Skip to contentSkip to conversation

arm: xea: Modify board code to generate single binary u-boot

PATCH In review Lukasz Majewski 2 participants 6 messages Dec 22, 2021 – Dec 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm: xea: Modify board code to generate single binary u-boot

This change provides the possibility to build XEA (imx287 based) board U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used, which requires the lowlevel_init() function.

---

 board/liebherr/xea/spl_xea.c | 8 ++++++++
 board/liebherr/xea/xea.c     | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)
board/liebherr/xea/spl_xea.c +8 -0
index 192f68fca5f..5ee561b8b78 100644
@@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
 	0x00000000, 0xffffffff
 };
 
+/* #ifndef CONFIG_SPL_FRAMEWORK */
+#if !CONFIG_IS_ENABLED(FRAMEWORK)
+void board_init_ll(const u32 arg, const uint32_t *resptr)
+{
+	mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
+}
+#else
 void lowlevel_init(void)
 {
 	struct mxs_pinctrl_regs *pinctrl_regs =
@@ -301,3 +308,4 @@ void lowlevel_init(void)
 
 	mxs_common_spl_init(0, NULL, iomux_setup, ARRAY_SIZE(iomux_setup));
 }
+#endif
board/liebherr/xea/xea.c +2 -1
index cd11b0ada77..685e2e26a18 100644
@@ -58,7 +58,8 @@ static void init_clocks(void)
 	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
 }
 
-#ifdef CONFIG_SPL_BUILD
+/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
+#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
 void board_init_f(ulong arg)
 {
 	init_clocks();
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/3 arm: xea: config: Provide special defconfig for a single binary u-boot

The new configs/imx28_xea_sb_defconfig is introduced to facilitate building the single binary u-boot.sb fox XEA board.

The biggest distinction from "normal" XEA imx28_xea_sb_defconfig is support for USB mass storage devices (pen drives).

To achieve that, the CONFIG_DM_USB is enabled and supported.

---

 configs/imx28_xea_sb_defconfig | 112 +++++++++++++++++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 configs/imx28_xea_sb_defconfig
configs/imx28_xea_sb_defconfig new file +112 -0
new file mode 100644
index 00000000000..9513c5c695a
@@ -0,0 +1,112 @@
+CONFIG_ARM=y
+CONFIG_SPL_SYS_THUMB_BUILD=y
+CONFIG_ARCH_MX28=y
+CONFIG_SYS_TEXT_BASE=0x40002000
+CONFIG_SYS_MALLOC_F_LEN=0x800
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DM_GPIO=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_DEFAULT_DEVICE_TREE="imx28-xea"
+CONFIG_SPL_TEXT_BASE=0x1000
+CONFIG_TARGET_XEA=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
+CONFIG_SPL=y
+CONFIG_ENV_OFFSET_REDUND=0x90000
+CONFIG_SPL_PAYLOAD="u-boot.img"
+CONFIG_SYS_LOAD_ADDR=0x42000000
+CONFIG_FIT=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyAMA0,115200n8"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="run prebootcmd"
+CONFIG_BOARD_EARLY_INIT_F=y
+# CONFIG_SPL_FRAMEWORK is not set
+CONFIG_SPL_BOARD_INIT=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0
+CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
+CONFIG_SPL_DMA=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_GREPENV=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+# CONFIG_CMD_PINMUX is not set
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi3.0"
+CONFIG_MTDPARTS_DEFAULT="spi3.0:64k(SPL),448k(uboot),128k(envs),384k(unused1),4096k(kernel),8192k(swupdate),-(unused2)"
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent interrupts"
+CONFIG_SPL_OF_PLATDATA=y
+# CONFIG_SPL_OF_PLATDATA_PARENT is not set
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_USE_ENV_SPI_BUS=y
+CONFIG_ENV_SPI_BUS=3
+CONFIG_USE_ENV_SPI_CS=y
+CONFIG_ENV_SPI_CS=0
+CONFIG_USE_ENV_SPI_MAX_HZ=y
+CONFIG_ENV_SPI_MAX_HZ=40000000
+CONFIG_USE_ENV_SPI_MODE=y
+CONFIG_ENV_SPI_MODE=0x0
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM=y
+CONFIG_SPL_DM=y
+CONFIG_DEVRES=y
+# CONFIG_SPL_BLK is not set
+CONFIG_MXS_GPIO=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_MXS=y
+CONFIG_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_BUS=3
+CONFIG_SF_DEFAULT_MODE=0x0
+CONFIG_SF_DEFAULT_SPEED=40000000
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_ISSI=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHYLIB=y
+CONFIG_PHY_ADDR_ENABLE=y
+CONFIG_PHY_ADDR=1
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
+CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MXS=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_CONS_INDEX=0
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MXS_SPI=y
+CONFIG_USB=y
+# CONFIG_SPL_DM_USB is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_FS_FAT=y
+# CONFIG_SPL_OF_LIBFDT is not set
Signature · 1 line
2.20.1
#2 lore raw

PATCH 3/3 arm: dts: Enable support for USB on XEA (imx28) board

In reply to Lukasz Majewski

This change enables the support for USB with DM on the XEA (imx28) board.

---

 arch/arm/dts/imx28-xea.dts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/dts/imx28-xea.dts +18 -0
index de049042f83..c97869e5225 100644
@@ -41,6 +41,15 @@
 		enable-active-high;
 		regulator-boot-on;
 	};
+
+	reg_usb_5v: regulator-usb-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
 &mac0 {
@@ -110,3 +119,12 @@
 		};
 	};
 };
+
+&usb0 {
+	vbus-supply = <&reg_usb_5v>;
+	status = "okay";
+};
+
+&usbphy0 {
+	status = "okay";
+};
Signature · 1 line
2.20.1
#3 lore raw
In reply to Lukasz Majewski
Quoted 50 lines · Lukasz Majewski

This change provides the possibility to build XEA (imx287 based) board U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used, which requires the lowlevel_init() function.

---

 board/liebherr/xea/spl_xea.c | 8 ++++++++
 board/liebherr/xea/xea.c     | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)
board/liebherr/xea/spl_xea.c +8 -0
index 192f68fca5f..5ee561b8b78 100644
@@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
 	0x00000000, 0xffffffff
 };
 
+/* #ifndef CONFIG_SPL_FRAMEWORK */
+#if !CONFIG_IS_ENABLED(FRAMEWORK)
+void board_init_ll(const u32 arg, const uint32_t *resptr)
+{
+	mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
+}
+#else
 void lowlevel_init(void)
 {
 	struct mxs_pinctrl_regs *pinctrl_regs =
@@ -301,3 +308,4 @@ void lowlevel_init(void)
 
 	mxs_common_spl_init(0, NULL, iomux_setup, ARRAY_SIZE(iomux_setup));
 }
+#endif
board/liebherr/xea/xea.c +0 -0
index cd11b0ada77..685e2e26a18 100644

board/liebherr/xea/xea.c static void init_clocks(void) · line 65

Quoted 9 lines
board/liebherr/xea/xea.c +2 -1
@@ -58,7 +58,8 @@ static void init_clocks(void)
 	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
 }
 
-#ifdef CONFIG_SPL_BUILD
+/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
+#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
 void board_init_f(ulong arg)
 {
 	init_clocks();

I know checkpatch.pl has a warning, but maybe the text needs to be tweaked there slightly? Using CONFIG_IS_ENABLED here is less readable / clear than CONFIG_SPL_BUILD (which is special) and CONFIG_SPL_FRAMEWORK (there's no CONFIG_FRAMEWORK and this board isn't going to use TPL).

Signature · 1 line
Tom
#4 lore raw

Hi Tom,

Quoted 56 lines · Lukasz Majewski
Quoted 55 lines

This change provides the possibility to build XEA (imx287 based) board U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used, which requires the lowlevel_init() function.

---

 board/liebherr/xea/spl_xea.c | 8 ++++++++
 board/liebherr/xea/xea.c     | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/board/liebherr/xea/spl_xea.c index 192f68fca5f..5ee561b8b78 100644

board/liebherr/xea/spl_xea.c +7 -0
@@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
 	0x00000000, 0xffffffff
 };
 
+/* #ifndef CONFIG_SPL_FRAMEWORK */
+#if !CONFIG_IS_ENABLED(FRAMEWORK)
+void board_init_ll(const u32 arg, const uint32_t *resptr)
+{
+	mxs_common_spl_init(arg, resptr, iomux_setup,
 ARRAY_SIZE(iomux_setup)); +}
+#else
 void lowlevel_init(void)
 {
 	struct mxs_pinctrl_regs *pinctrl_regs =
@@ -301,3 +308,4 @@ void lowlevel_init(void)
 
 	mxs_common_spl_init(0, NULL, iomux_setup,
 ARRAY_SIZE(iomux_setup)); }
+#endif
board/liebherr/xea/xea.c +0 -0
index cd11b0ada77..685e2e26a18 100644
@@ -58,7 +58,8 @@ static void init_clocks(void)
 	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
 }
 
Quoted 9 lines

board/liebherr/xea/xea.c static void init_clocks(void) · line 65

Quoted 6 lines
board/liebherr/xea/xea.c +2 -1
-#ifdef CONFIG_SPL_BUILD
+/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
+#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
 void board_init_f(ulong arg)
 {
 	init_clocks();  

I know checkpatch.pl has a warning, but maybe the text needs to be tweaked there slightly?

Yes, exactly - this was done to silence the checkpatch.pl error.

Quoted 5 lines

Using CONFIG_IS_ENABLED here is less
readable / clear than CONFIG_SPL_BUILD (which is special) and CONFIG_SPL_FRAMEWORK (there's no CONFIG_FRAMEWORK and this board isn't going to use TPL).

If you prefer I can just add the preprocessor code from the above comment.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#5 lore raw
Quoted 70 lines · Lukasz Majewski

Hi Tom,

Quoted 56 lines · Lukasz Majewski
Quoted 55 lines

This change provides the possibility to build XEA (imx287 based) board U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used, which requires the lowlevel_init() function.

---

 board/liebherr/xea/spl_xea.c | 8 ++++++++
 board/liebherr/xea/xea.c     | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/board/liebherr/xea/spl_xea.c index 192f68fca5f..5ee561b8b78 100644

board/liebherr/xea/spl_xea.c +7 -0
@@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
 	0x00000000, 0xffffffff
 };
 
+/* #ifndef CONFIG_SPL_FRAMEWORK */
+#if !CONFIG_IS_ENABLED(FRAMEWORK)
+void board_init_ll(const u32 arg, const uint32_t *resptr)
+{
+	mxs_common_spl_init(arg, resptr, iomux_setup,
 ARRAY_SIZE(iomux_setup)); +}
+#else
 void lowlevel_init(void)
 {
 	struct mxs_pinctrl_regs *pinctrl_regs =
@@ -301,3 +308,4 @@ void lowlevel_init(void)
 
 	mxs_common_spl_init(0, NULL, iomux_setup,
 ARRAY_SIZE(iomux_setup)); }
+#endif
board/liebherr/xea/xea.c +0 -0
index cd11b0ada77..685e2e26a18 100644
@@ -58,7 +58,8 @@ static void init_clocks(void)
 	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
 }
 
Quoted 9 lines

board/liebherr/xea/xea.c static void init_clocks(void) · line 65

Quoted 6 lines
board/liebherr/xea/xea.c +2 -1
-#ifdef CONFIG_SPL_BUILD
+/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
+#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
 void board_init_f(ulong arg)
 {
 	init_clocks();  

I know checkpatch.pl has a warning, but maybe the text needs to be tweaked there slightly?

Yes, exactly - this was done to silence the checkpatch.pl error.

Quoted 8 lines
Quoted 5 lines

Using CONFIG_IS_ENABLED here is less
readable / clear than CONFIG_SPL_BUILD (which is special) and CONFIG_SPL_FRAMEWORK (there's no CONFIG_FRAMEWORK and this board isn't going to use TPL).

If you prefer I can just add the preprocessor code from the above comment.

It's a warning not an error, please just use #ifdef here instead, thanks.

Signature · 1 line
Tom