[U-Boot] [PATCH 4/7] arm: mvebu: helios4: Enable mvebu GPIO and IO Expander

Make use of U-Boot's GPIO DM and device tree to control the I2C IO expander. While at it, also enable the native GPIO.
Signed-off-by: Aditya Prayoga aditya@kobol.io --- board/kobol/helios4/helios4.c | 32 -------------------------------- configs/helios4_defconfig | 4 ++++ 2 files changed, 4 insertions(+), 32 deletions(-)
diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c index 3416783..37c46a5 100644 --- a/board/kobol/helios4/helios4.c +++ b/board/kobol/helios4/helios4.c @@ -33,18 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; #define BOARD_GPP_POL_LOW 0x0 #define BOARD_GPP_POL_MID 0x0
-/* IO expander on Marvell GP board includes e.g. fan enabling */ -struct marvell_io_exp { - u8 addr; - u8 val; -}; - -static struct marvell_io_exp io_exp[] = { - {6, 0xf9}, - {2, 0x46}, /* Assert reset signals and enable USB3 current limiter */ - {6, 0xb9} -}; - static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_6_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {USB3_HOST0, SERDES_SPEED_5_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -123,29 +111,9 @@ int board_early_init_f(void)
int board_init(void) { - int i; - /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
- /* Init I2C IO expanders */ - for (i = 0; i < ARRAY_SIZE(io_exp); i++) { - struct udevice *dev; - int ret; - - ret = i2c_get_chip_for_busnum(0, io_exp[i].addr, 1, &dev); - if (ret) { - printf("Cannot find I2C: %d\n", ret); - return 0; - } - - ret = dm_i2c_write(dev, io_exp[i].val, &io_exp[i].val, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - } - return 0; }
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 8ac8978..69dd774 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -22,6 +22,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x141 CONFIG_SPL_I2C_SUPPORT=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y @@ -38,6 +39,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_SCSI_AHCI=y +CONFIG_DM_GPIO=y +CONFIG_MVEBU_GPIO=y +CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_I2C_SET_DEFAULT_BUS_NUM=y

Remove unused I2C support in SPL and use simple_malloc functions to reduce SPL image size. Since Helios4 does not have any PCIe allocated on SerDes, remove PCI support. MTD layer on top of SPI flash is not needed, remove it also.
Signed-off-by: Aditya Prayoga aditya@kobol.io --- configs/helios4_defconfig | 5 +---- include/configs/helios4.h | 6 ------ 2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 69dd774..53995fe 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -8,6 +8,7 @@ CONFIG_TARGET_HELIOS4=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL=y CONFIG_DEBUG_UART_BASE=0xd0012000 CONFIG_DEBUG_UART_CLOCK=250000000 @@ -20,12 +21,10 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x141 -CONFIG_SPL_I2C_SUPPORT=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y -CONFIG_CMD_PCI=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -52,11 +51,9 @@ CONFIG_MMC_SDHCI_MV=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_WINBOND=y -CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y -CONFIG_PCI=y CONFIG_SCSI=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y diff --git a/include/configs/helios4.h b/include/configs/helios4.h index 1401a12..bd59ecf 100644 --- a/include/configs/helios4.h +++ b/include/configs/helios4.h @@ -54,12 +54,6 @@ #define CONFIG_PHY_MARVELL /* there is a marvell phy */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */
-/* PCIe support */ -#ifndef CONFIG_SPL_BUILD -#define CONFIG_PCI_MVEBU -#define CONFIG_PCI_SCAN_SHOW -#endif - /* Keep device tree and initrd in lower memory so the kernel can access them */ #define RELOCATION_LIMITS_ENV_SETTINGS \ "fdt_high=0x10000000\0" \

Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace * CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI * CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga aditya@kobol.io --- arch/arm/dts/armada-388-helios4.dts | 7 +++++++ configs/helios4_defconfig | 1 - include/configs/helios4.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/armada-388-helios4.dts b/arch/arm/dts/armada-388-helios4.dts index 711fc22..cd3fcae 100644 --- a/arch/arm/dts/armada-388-helios4.dts +++ b/arch/arm/dts/armada-388-helios4.dts @@ -26,6 +26,7 @@ ethernet1 = ð0; i2c0 = &i2c0; i2c1 = &i2c1; + spi1 = &spi1; };
chosen { @@ -244,6 +245,7 @@ µsom_spi1_cs_pins>; pinctrl-names = "default"; status = "okay"; + u-boot,dm-spl; };
sdhci@d8000 { @@ -308,3 +310,8 @@ }; }; }; + +&w25q32 { + status = "okay"; + u-boot,dm-spl; +}; diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 53995fe..3bb4622 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_HELIOS4=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL=y diff --git a/include/configs/helios4.h b/include/configs/helios4.h index bd59ecf..6943378 100644 --- a/include/configs/helios4.h +++ b/include/configs/helios4.h @@ -6,6 +6,8 @@ #ifndef _CONFIG_HELIOS4_H #define _CONFIG_HELIOS4_H
+#include <linux/sizes.h> + /* * High Level Configuration Options (easy to change) */ @@ -23,6 +25,9 @@
/* SPI NOR flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_BUS 1 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 104000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3
/* * SDIO/MMC Card Configuration @@ -43,6 +48,21 @@ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN)
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +/* + * SPI Flash configuration for the environment access + */ +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED + +/* Environment in SPI NOR flash */ +#define CONFIG_ENV_SECT_SIZE SZ_64K +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_OFFSET SZ_1M +#endif + +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC /* Environment in MMC */ #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_ENV_SECT_SIZE 0x200 @@ -50,6 +70,7 @@ /* stay within first 1M */ #define CONFIG_ENV_OFFSET (SZ_1M - CONFIG_ENV_SIZE) #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET +#endif
#define CONFIG_PHY_MARVELL /* there is a marvell phy */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ @@ -69,7 +90,13 @@ */ #define SPL_BOOT_SPI_NOR_FLASH 1 #define SPL_BOOT_SDIO_MMC_CARD 2 + +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH +#endif +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC #define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SDIO_MMC_CARD +#endif
/* Defines for SPL */ #define CONFIG_SPL_SIZE (140 << 10) @@ -88,12 +115,16 @@
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH /* SPL related SPI defines */ +#define CONFIG_SPL_SPI_FLASH_SUPPORT +#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_OFFS #endif
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD /* SPL related MMC defines */ +#define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10) #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_U_BOOT_OFFS #ifdef CONFIG_SPL_BUILD

On Wed, 2018-11-28 at 17:00 +0800, Aditya Prayoga wrote:
Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace
- CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
- CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga aditya@kobol.io
arch/arm/dts/armada-388-helios4.dts | 7 +++++++ configs/helios4_defconfig | 1 - include/configs/helios4.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/armada-388-helios4.dts b/arch/arm/dts/armada-388-helios4.dts index 711fc22..cd3fcae 100644 --- a/arch/arm/dts/armada-388-helios4.dts +++ b/arch/arm/dts/armada-388-helios4.dts @@ -26,6 +26,7 @@ ethernet1 = ð0; i2c0 = &i2c0; i2c1 = &i2c1;
spi1 = &spi1;
has this gone upstream to the kernel?
};
chosen { @@ -244,6 +245,7 @@ µsom_spi1_cs_pins>; pinctrl-names = "default"; status = "okay";
u-boot,dm-spl;
there is a method in u-boot that needs to be used where u-boot specific snippets go into a <dtb file nane>-u-boot.dts file, I am struggling to find the documentation on it, perhaps someone else can point us both at it.
}; sdhci@d8000 {
@@ -308,3 +310,8 @@ }; }; };
+&w25q32 {
- status = "okay";
- u-boot,dm-spl;
+};
same as above the u-boot bit should go in a armada-388-helios4-u- boot.dts file and the generic bits in the upstream kernel dts file.
Dennis
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 53995fe..3bb4622 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_HELIOS4=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL=y diff --git a/include/configs/helios4.h b/include/configs/helios4.h index bd59ecf..6943378 100644 --- a/include/configs/helios4.h +++ b/include/configs/helios4.h @@ -6,6 +6,8 @@ #ifndef _CONFIG_HELIOS4_H #define _CONFIG_HELIOS4_H
+#include <linux/sizes.h>
/*
- High Level Configuration Options (easy to change)
*/ @@ -23,6 +25,9 @@
/* SPI NOR flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_BUS 1 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 104000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3
/*
- SDIO/MMC Card Configuration
@@ -43,6 +48,21 @@ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID
- \ CONFIG_SYS_SCSI_MAX_LUN)
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +/*
- SPI Flash configuration for the environment access
- */
+#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
+/* Environment in SPI NOR flash */ +#define CONFIG_ENV_SECT_SIZE SZ_64K +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_OFFSET SZ_1M +#endif
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC /* Environment in MMC */ #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_ENV_SECT_SIZE 0x200 @@ -50,6 +70,7 @@ /* stay within first 1M */ #define CONFIG_ENV_OFFSET (SZ_1M - CONFIG_ENV_SIZE) #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET +#endif
#define CONFIG_PHY_MARVELL /* there is a marvell phy */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ @@ -69,7 +90,13 @@ */ #define SPL_BOOT_SPI_NOR_FLASH 1 #define SPL_BOOT_SDIO_MMC_CARD 2
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH +#endif +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC #define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SDIO_MMC_CARD +#endif
/* Defines for SPL */ #define CONFIG_SPL_SIZE (140 << 10) @@ -88,12 +115,16 @@
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH /* SPL related SPI defines */ +#define CONFIG_SPL_SPI_FLASH_SUPPORT +#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_O FFS #endif
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD /* SPL related MMC defines */ +#define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10) #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_ U_BOOT_OFFS #ifdef CONFIG_SPL_BUILD

Hi Dennis,
On Wed, Nov 28, 2018 at 07:53:44AM -0600, Dennis Gilmore wrote:
On Wed, 2018-11-28 at 17:00 +0800, Aditya Prayoga wrote:
Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace
- CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
- CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga aditya@kobol.io
arch/arm/dts/armada-388-helios4.dts | 7 +++++++ configs/helios4_defconfig | 1 - include/configs/helios4.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/armada-388-helios4.dts b/arch/arm/dts/armada-388-helios4.dts index 711fc22..cd3fcae 100644 --- a/arch/arm/dts/armada-388-helios4.dts +++ b/arch/arm/dts/armada-388-helios4.dts @@ -26,6 +26,7 @@ ethernet1 = ð0; i2c0 = &i2c0; i2c1 = &i2c1;
spi1 = &spi1;
has this gone upstream to the kernel?
};
chosen { @@ -244,6 +245,7 @@ µsom_spi1_cs_pins>; pinctrl-names = "default"; status = "okay";
u-boot,dm-spl;
there is a method in u-boot that needs to be used where u-boot specific snippets go into a <dtb file nane>-u-boot.dts file, I am struggling to find the documentation on it, perhaps someone else can point us both at it.
See tools/binman/README under "Automatic .dtsi inclusion".
Would have been nice to be able to add u-boot.dtsi onto another .dtsi. That would have saved us from copying the content of armada-388-clearfog-u-boot.dtsi over and over for each board that carries the same SOM. Maybe we can use a symlink for that? It's a little less ugly than copy.
baruch
}; sdhci@d8000 {
@@ -308,3 +310,8 @@ }; }; };
+&w25q32 {
- status = "okay";
- u-boot,dm-spl;
+};
same as above the u-boot bit should go in a armada-388-helios4-u- boot.dts file and the generic bits in the upstream kernel dts file.
Dennis

On Wed, Nov 28, 2018 at 9:10 PM Baruch Siach baruch@tkos.co.il wrote:
Hi Dennis,
On Wed, Nov 28, 2018 at 07:53:44AM -0600, Dennis Gilmore wrote:
On Wed, 2018-11-28 at 17:00 +0800, Aditya Prayoga wrote:
Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace
- CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
- CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga aditya@kobol.io
arch/arm/dts/armada-388-helios4.dts | 7 +++++++ configs/helios4_defconfig | 1 - include/configs/helios4.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/armada-388-helios4.dts b/arch/arm/dts/armada-388-helios4.dts index 711fc22..cd3fcae 100644 --- a/arch/arm/dts/armada-388-helios4.dts +++ b/arch/arm/dts/armada-388-helios4.dts @@ -26,6 +26,7 @@ ethernet1 = ð0; i2c0 = &i2c0; i2c1 = &i2c1;
spi1 = &spi1;
has this gone upstream to the kernel?
}; chosen {
@@ -244,6 +245,7 @@ µsom_spi1_cs_pins>; pinctrl-names = "default"; status = "okay";
u-boot,dm-spl;
there is a method in u-boot that needs to be used where u-boot specific snippets go into a <dtb file nane>-u-boot.dts file, I am struggling to find the documentation on it, perhaps someone else can point us both at it.
See tools/binman/README under "Automatic .dtsi inclusion".
Thanks for the pointer
Aditya
Would have been nice to be able to add u-boot.dtsi onto another .dtsi. That would have saved us from copying the content of armada-388-clearfog-u-boot.dtsi over and over for each board that carries the same SOM. Maybe we can use a symlink for that? It's a little less ugly than copy.
baruch
}; sdhci@d8000 {
@@ -308,3 +310,8 @@ }; }; };
+&w25q32 {
- status = "okay";
- u-boot,dm-spl;
+};
same as above the u-boot bit should go in a armada-388-helios4-u- boot.dts file and the generic bits in the upstream kernel dts file.
Dennis
-- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

On Wed, Nov 28, 2018 at 8:53 PM Dennis Gilmore dgilmore@redhat.com wrote:
On Wed, 2018-11-28 at 17:00 +0800, Aditya Prayoga wrote:
Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace
- CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
- CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga aditya@kobol.io
arch/arm/dts/armada-388-helios4.dts | 7 +++++++ configs/helios4_defconfig | 1 - include/configs/helios4.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/armada-388-helios4.dts b/arch/arm/dts/armada-388-helios4.dts index 711fc22..cd3fcae 100644 --- a/arch/arm/dts/armada-388-helios4.dts +++ b/arch/arm/dts/armada-388-helios4.dts @@ -26,6 +26,7 @@ ethernet1 = ð0; i2c0 = &i2c0; i2c1 = &i2c1;
spi1 = &spi1;
has this gone upstream to the kernel?
No. Should I also send it to kernel?
}; chosen {
@@ -244,6 +245,7 @@ µsom_spi1_cs_pins>; pinctrl-names = "default"; status = "okay";
u-boot,dm-spl;
there is a method in u-boot that needs to be used where u-boot specific snippets go into a <dtb file nane>-u-boot.dts file, I am struggling to find the documentation on it, perhaps someone else can point us both at it.
Yes, i saw that kind of dtsi, for example armada-388-clearfog-u-boot.dtsi but i could not find the documentation or figuring out how it works. I was expecting something like #include "armada-388-clearfog-u-boot.dtsi" I will move it to armada-388-helios4-u-boot.dtsi on next version.
Aditya
}; sdhci@d8000 {
@@ -308,3 +310,8 @@ }; }; };
+&w25q32 {
status = "okay";
u-boot,dm-spl;
+};
same as above the u-boot bit should go in a armada-388-helios4-u- boot.dts file and the generic bits in the upstream kernel dts file.
Dennis
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 53995fe..3bb4622 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_HELIOS4=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL=y diff --git a/include/configs/helios4.h b/include/configs/helios4.h index bd59ecf..6943378 100644 --- a/include/configs/helios4.h +++ b/include/configs/helios4.h @@ -6,6 +6,8 @@ #ifndef _CONFIG_HELIOS4_H #define _CONFIG_HELIOS4_H
+#include <linux/sizes.h>
/*
- High Level Configuration Options (easy to change)
*/ @@ -23,6 +25,9 @@
/* SPI NOR flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_BUS 1 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 104000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3
/*
- SDIO/MMC Card Configuration
@@ -43,6 +48,21 @@ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID
- \ CONFIG_SYS_SCSI_MAX_LUN)
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +/*
- SPI Flash configuration for the environment access
- */
+#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
+/* Environment in SPI NOR flash */ +#define CONFIG_ENV_SECT_SIZE SZ_64K +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_OFFSET SZ_1M +#endif
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC /* Environment in MMC */ #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_ENV_SECT_SIZE 0x200 @@ -50,6 +70,7 @@ /* stay within first 1M */ #define CONFIG_ENV_OFFSET (SZ_1M - CONFIG_ENV_SIZE) #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET +#endif
#define CONFIG_PHY_MARVELL /* there is a marvell phy */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ @@ -69,7 +90,13 @@ */ #define SPL_BOOT_SPI_NOR_FLASH 1 #define SPL_BOOT_SDIO_MMC_CARD 2
+#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH +#endif +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC #define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SDIO_MMC_CARD +#endif
/* Defines for SPL */ #define CONFIG_SPL_SIZE (140 << 10) @@ -88,12 +115,16 @@
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH /* SPL related SPI defines */ +#define CONFIG_SPL_SPI_FLASH_SUPPORT +#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_O FFS #endif
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD /* SPL related MMC defines */ +#define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10) #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_ U_BOOT_OFFS #ifdef CONFIG_SPL_BUILD

Similar to Clearfog rev 2.1, GPIO 19 also used to reset onboard ethernet PHY.
Signed-off-by: Aditya Prayoga aditya@kobol.io --- board/kobol/helios4/helios4.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c index 37c46a5..7c1a7a8 100644 --- a/board/kobol/helios4/helios4.c +++ b/board/kobol/helios4/helios4.c @@ -114,6 +114,13 @@ int board_init(void) /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
+ /* GPIO 19 controls the uSOM onboard phy reset */ + clrbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); + clrbits_le32(MVEBU_GPIO0_BASE + 0x4, BIT(19)); + mdelay(1); + setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); + mdelay(10); + return 0; }

Hi Aditya,
On Wed, Nov 28, 2018 at 05:00:39PM +0800, Aditya Prayoga wrote:
Similar to Clearfog rev 2.1, GPIO 19 also used to reset onboard ethernet PHY.
Signed-off-by: Aditya Prayoga aditya@kobol.io
board/kobol/helios4/helios4.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c index 37c46a5..7c1a7a8 100644 --- a/board/kobol/helios4/helios4.c +++ b/board/kobol/helios4/helios4.c @@ -114,6 +114,13 @@ int board_init(void) /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
- /* GPIO 19 controls the uSOM onboard phy reset */
- clrbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19));
- clrbits_le32(MVEBU_GPIO0_BASE + 0x4, BIT(19));
- mdelay(1);
- setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19));
- mdelay(10);
This copied from board/solidrun/clearfog/clearfog.c. Can't you use the generic gpio_* API for that in these days?
baruch

Hi Baruch,
On Wed, Nov 28, 2018 at 8:56 PM Baruch Siach baruch@tkos.co.il wrote:
Hi Aditya,
On Wed, Nov 28, 2018 at 05:00:39PM +0800, Aditya Prayoga wrote:
Similar to Clearfog rev 2.1, GPIO 19 also used to reset onboard ethernet PHY.
Signed-off-by: Aditya Prayoga aditya@kobol.io
board/kobol/helios4/helios4.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c index 37c46a5..7c1a7a8 100644 --- a/board/kobol/helios4/helios4.c +++ b/board/kobol/helios4/helios4.c @@ -114,6 +114,13 @@ int board_init(void) /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
/* GPIO 19 controls the uSOM onboard phy reset */
clrbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19));
clrbits_le32(MVEBU_GPIO0_BASE + 0x4, BIT(19));
mdelay(1);
setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19));
mdelay(10);
This copied from board/solidrun/clearfog/clearfog.c. Can't you use the generic gpio_* API for that in these days?
Yes, it was copied from clearfog. You are right, I should be able to use gpio_* API after enabling the GPIO DM. I will change it on next version. Thanks
Aditya
baruch
-- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
participants (3)
-
Aditya Prayoga
-
Baruch Siach
-
Dennis Gilmore