Skip to contentSkip to conversation

ARM: imx8m: Deduplicate CAAM init with arch_misc_init() call

PATCH In review Marek Vasut 9 participants 30 messages Sep 19, 2022 – Oct 21, 2022

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

PATCH 1/4 ARM: imx8m: Deduplicate CAAM init with arch_misc_init() call

Instead of duplicating code implemented by i.MX8M version of arch_misc_init() in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from spl_board_init(). This removes the duplication. No functional change.

---
Cc: Fabio Estevam <[email protected]>
Cc: Frieder Schrempf <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Teresa Remmet <[email protected]>

---
 board/freescale/imx8mm_evk/spl.c   | 10 +---------
 board/freescale/imx8mn_evk/spl.c   |  7 ++-----
 board/freescale/imx8mp_evk/spl.c   |  8 +-------
 board/kontron/sl-mx8mm/spl.c       |  6 +-----
 board/toradex/verdin-imx8mm/spl.c  |  9 +--------
 configs/imx8mm-mx8menlo_defconfig  |  1 +
 configs/imx8mm_evk_defconfig       |  1 +
 configs/imx8mm_evk_fspi_defconfig  |  1 +
 configs/imx8mp_evk_defconfig       |  1 +
 configs/kontron-sl-mx8mm_defconfig |  1 +
 configs/verdin-imx8mm_defconfig    |  1 +
 11 files changed, 12 insertions(+), 34 deletions(-)
board/freescale/imx8mm_evk/spl.c +1 -9
index e2eb1426c83..e0e97c7fd9a 100644
@@ -53,15 +53,7 @@ static void spl_dram_init(void)
 
 void spl_board_init(void)
 {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
-
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
-	puts("Normal Boot\n");
+	arch_misc_init();
 }
 
 #ifdef CONFIG_SPL_LOAD_FIT
board/freescale/imx8mn_evk/spl.c +2 -5
index c0bfb67199a..380abecd746 100644
@@ -49,11 +49,8 @@ void spl_board_init(void)
 	struct udevice *dev;
 	int ret;
 
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
+	arch_misc_init();
+
 	puts("Normal Boot\n");
 
 	ret = uclass_get_device_by_name(UCLASS_CLK,
board/freescale/imx8mp_evk/spl.c +1 -7
index 719b1f6d7da..f1b285417d0 100644
@@ -37,14 +37,8 @@ void spl_dram_init(void)
 
 void spl_board_init(void)
 {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
+	arch_misc_init();
 
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
 	/*
 	 * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does
 	 * not allow to change it. Should set the clock after PMIC
board/kontron/sl-mx8mm/spl.c +1 -5
index 09f81351dd4..b884c91aef9 100644
@@ -205,11 +205,7 @@ void spl_board_init(void)
 	struct udevice *dev;
 	int ret;
 
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize %s: %d\n", dev->name, ret);
-	}
+	arch_misc_init();
 
 	puts("Normal Boot\n");
 
board/toradex/verdin-imx8mm/spl.c +1 -8
index fb9aae6c9c8..59a3d9e0cae 100644
@@ -53,14 +53,7 @@ void spl_dram_init(void)
 
 void spl_board_init(void)
 {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
-
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize %s: %d\n", dev->name, ret);
-	}
+	arch_misc_init();
 
 	/* Serial download mode */
 	if (is_usb_boot()) {
configs/imx8mm-mx8menlo_defconfig +1 -0
index 702162f86de..929ff382f27 100644
@@ -34,6 +34,7 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-mx8menlo.dtb"
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
configs/imx8mm_evk_defconfig +1 -0
index 7bcedcd51f5..58b5e468a58 100644
@@ -23,6 +23,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
configs/imx8mm_evk_fspi_defconfig +1 -0
index 21fd7e08db1..73c96f634ce 100644
@@ -24,6 +24,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x25000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mp_evk_defconfig +1 -0
index 0be1951e740..406e89e428b 100644
@@ -28,6 +28,7 @@ CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x26000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/kontron-sl-mx8mm_defconfig +1 -0
index 5387f65926f..43731e4c280 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOARD_TYPES=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
configs/verdin-imx8mm_defconfig +1 -0
index f65b4a7f307..230fe55d068 100644
@@ -36,6 +36,7 @@ CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mm-verdin-${variant}-${
 CONFIG_LOG=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/4 ARM: imx8m: phycore_imx8mm: Drop bogus spl_board_init()

The current implementation of spl_board_init() is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

---
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Teresa Remmet <[email protected]>

---
 board/phytec/phycore_imx8mm/spl.c | 10 ----------
 configs/phycore-imx8mm_defconfig  |  1 -
 2 files changed, 11 deletions(-)
board/phytec/phycore_imx8mm/spl.c +0 -10
index d87ab6d4497..1bae9b1170d 100644
@@ -42,16 +42,6 @@ static void spl_dram_init(void)
 	ddr_init(&dram_timing);
 }
 
-void spl_board_init(void)
-{
-	/* Serial download mode */
-	if (is_usb_boot()) {
-		puts("Back to ROM, SDP\n");
-		restore_boot_params();
-	}
-	puts("Normal Boot\n");
-}
-
 int board_fit_config_name_match(const char *name)
 {
 	return 0;
configs/phycore-imx8mm_defconfig +0 -1
index 9b8c09a73ab..e8d7905bb4a 100644
@@ -30,7 +30,6 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
-CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK=0x920000
 CONFIG_SYS_SPL_MALLOC=y
Signature · 1 line
2.35.1
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] ARM: imx8m: phycore_imx8mm: Drop bogus spl_board_init()

Quoted 8 lines · Marek Vasut

The current implementation of spl_board_init() is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

Quoted 43 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Teresa Remmet <[email protected]>

---
  board/phytec/phycore_imx8mm/spl.c | 10 ----------
  configs/phycore-imx8mm_defconfig  |  1 -
  2 files changed, 11 deletions(-)
board/phytec/phycore_imx8mm/spl.c +0 -10
index d87ab6d4497..1bae9b1170d 100644
@@ -42,16 +42,6 @@ static void spl_dram_init(void)
  	ddr_init(&dram_timing);
  }
 
-void spl_board_init(void)
-{
-	/* Serial download mode */
-	if (is_usb_boot()) {
-		puts("Back to ROM, SDP\n");
-		restore_boot_params();
-	}
-	puts("Normal Boot\n");
-}
-
  int board_fit_config_name_match(const char *name)
  {
  	return 0;
configs/phycore-imx8mm_defconfig +0 -1
index 9b8c09a73ab..e8d7905bb4a 100644
@@ -30,7 +30,6 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
  CONFIG_SPL_BSS_MAX_SIZE=0x2000
-CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
  CONFIG_SPL_STACK=0x920000
  CONFIG_SYS_SPL_MALLOC=y
#3 lore raw

PATCH 2/4 ARM: imx8m: phycore_imx8mm: Drop bogus spl_board_init()

In reply to Marek Vasut
Quoted 8 lines

The current implementation of spl_board_init() is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#4 lore raw

PATCH 3/4 ARM: imx8m: verdin-imx8mm: Drop bogus content from spl_board_init()

In reply to Marek Vasut

The current implementation of spl_board_init() USB boot handling is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

---
Cc: Fabio Estevam <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
 board/toradex/verdin-imx8mm/spl.c | 7 -------
 1 file changed, 7 deletions(-)
board/toradex/verdin-imx8mm/spl.c +0 -7
index 59a3d9e0cae..210665bd6a9 100644
@@ -54,13 +54,6 @@ void spl_dram_init(void)
 void spl_board_init(void)
 {
 	arch_misc_init();
-
-	/* Serial download mode */
-	if (is_usb_boot()) {
-		puts("Back to ROM, SDP\n");
-		restore_boot_params();
-	}
-	puts("Normal Boot\n");
 }
 
 #ifdef CONFIG_SPL_LOAD_FIT
Signature · 1 line
2.35.1
Reviewed-by on v1 3/4
#5 lore raw

Re: [PATCH 3/4] ARM: imx8m: verdin-imx8mm: Drop bogus content from spl_board_init()

Quoted 7 lines · Marek Vasut

The current implementation of spl_board_init() USB boot handling is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

Quoted 29 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
  board/toradex/verdin-imx8mm/spl.c | 7 -------
  1 file changed, 7 deletions(-)
board/toradex/verdin-imx8mm/spl.c +0 -7
index 59a3d9e0cae..210665bd6a9 100644
@@ -54,13 +54,6 @@ void spl_dram_init(void)
  void spl_board_init(void)
  {
  	arch_misc_init();
-
-	/* Serial download mode */
-	if (is_usb_boot()) {
-		puts("Back to ROM, SDP\n");
-		restore_boot_params();
-	}
-	puts("Normal Boot\n");
  }
 
  #ifdef CONFIG_SPL_LOAD_FIT
#6 lore raw

PATCH 3/4 ARM: imx8m: verdin-imx8mm: Drop bogus content from spl_board_init()

In reply to Marek Vasut
Quoted 8 lines

The current implementation of spl_board_init() USB boot handling is not correct, the MX8MM BootROM v1 does not support SDP load when re-entered from U-Boot SPL, it is up to U-Boot to perform the next stage load using its own internal CI gadget driver and SDP protocol implementation. Drop the spl_board_init() to let SPL continue with normal load in case the SDP support is enabled.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#7 lore raw

PATCH 4/4 ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

---
Cc: Fabio Estevam <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
 arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi | 20 ++++++++++++++++++++
 configs/imx8mm-mx8menlo_defconfig        | 17 ++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi +20 -0
index 484d493e33c..7f5f8c384e8 100644
@@ -17,6 +17,26 @@
 	};
 };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
 &i2c4 {
 	/delete-node/ codec@1a;
 };
+
+&reg_usb_otg1_vbus {
+	u-boot,dm-spl;
+};
+
+&usbmisc1 {
+	u-boot,dm-spl;
+};
+
+&usbphynop1 {
+	u-boot,dm-spl;
+};
+
+&usbotg1 {
+	u-boot,dm-spl;
+};
configs/imx8mm-mx8menlo_defconfig +16 -1
index 929ff382f27..ad6885942d3 100644
@@ -50,6 +50,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
 CONFIG_SPL_POWER=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_CBSIZE=2048
@@ -65,6 +68,8 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_UUID=y
@@ -106,6 +111,8 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_NOP_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
@@ -125,7 +132,15 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
-# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
+# CONFIG_USB_STORAGE is not set
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Menlo"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_SDP_LOADADDR=0x40400000
+CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.35.1
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Hi Marek,

Quoted 8 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

Quoted 6 lines

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these same changes to imx8mm-evk and reducing the SPL size.

For the series:

#9 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 15 lines · Fabio Estevam

Hi Marek,

Quoted 11 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

Quoted 7 lines
Quoted 3 lines
$ uuu -brun spl flash.bin

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Fabio,

Can you tell me what you did to reduce the SPL size?

adam

Quoted 4 lines

For the series:

#10 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 21 lines · Adam Ford
Quoted 19 lines · Fabio Estevam

Hi Marek,

Quoted 14 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin
Quoted 8 lines
Quoted 3 lines

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Fabio,

Can you tell me what you did to reduce the SPL size?

CONFIG_LTO from the other patch

Michael

Quoted 5 lines

adam

Quoted 4 lines

For the series:

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#11 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 27 lines · Michael Nazzareno Trimarchi
Quoted 25 lines · Adam Ford
Quoted 22 lines · Fabio Estevam

Hi Marek,

Quoted 8 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

Quoted 6 lines

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Quoted 6 lines
Quoted 4 lines

Fabio,

Can you tell me what you did to reduce the SPL size?

CONFIG_LTO from the other patch

Bummer. I was hoping there was more. I already have LTO enabled. I was hoping there was more to it.

adam

Quoted 23 lines

Michael

Quoted 5 lines

adam

Quoted 4 lines

For the series:

--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

#12 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Il sab 24 set 2022, 20:54 Adam Ford <[email protected]> ha scritto:

Quoted 36 lines
Quoted 4 lines · Michael Nazzareno Trimarchi
Quoted 2 lines · Adam Ford

On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines

Hi Marek,

Quoted 2 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the

first

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

stage was loaded by BootROM SDP implementation. It is not possible

to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

jump back into BootROM v1 and let the BootROM implementation

continue

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which

fit

Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines

into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

Quoted 7 lines
Quoted 3 lines
$ uuu -brun spl flash.bin

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Fabio,

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Can you tell me what you did to reduce the SPL size?

CONFIG_LTO from the other patch

Bummer. I was hoping there was more. I already have LTO enabled. I was hoping there was more to it.

What version of U-Boot are you using?

Mainline or some older one. Are you compile under yocto?

Michael

Quoted 25 lines

adam

Quoted 23 lines

Michael

Quoted 5 lines

adam

Quoted 4 lines

For the series:

--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

#13 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 41 lines · Michael Nazzareno Trimarchi

Il sab 24 set 2022, 20:54 Adam Ford <[email protected]> ha scritto:

Quoted 37 lines
Quoted 33 lines · Michael Nazzareno Trimarchi
Quoted 21 lines · Adam Ford
Quoted 19 lines · Fabio Estevam

Hi Marek,

Quoted 14 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin
Quoted 8 lines
Quoted 3 lines

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Fabio,

Can you tell me what you did to reduce the SPL size?

CONFIG_LTO from the other patch

Quoted 7 lines
Quoted 2 lines

Bummer. I was hoping there was more. I already have LTO enabled. I was hoping there was more to it.

What version of U-Boot are you using?

Mainline or some older one. Are you compile under yocto?

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

adam

Quoted 29 lines

Michael

Quoted 25 lines

adam

Quoted 23 lines

Michael

Quoted 5 lines

adam

Quoted 4 lines

For the series:

--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

#14 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Hi

Il sab 24 set 2022, 21:10 Adam Ford <[email protected]> ha scritto:

Quoted 55 lines
Quoted 11 lines · Michael Nazzareno Trimarchi

Il sab 24 set 2022, 20:54 Adam Ford <[email protected]> ha scritto:

Quoted 7 lines
Quoted 4 lines · Michael Nazzareno Trimarchi
Quoted 2 lines · Adam Ford

On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hi Marek,

Quoted 1 line · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo

SPL

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to let the board continue SDP loading of second stage after the

first

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

stage was loaded by BootROM SDP implementation. It is not

possible to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

jump back into BootROM v1 and let the BootROM implementation

continue

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the SDP loading, all this has to be performed by the U-Boot CI

HDRC

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

controller driver and SDP protocol implementation, both of

which fit

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and

U-Boot

Quoted 21 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

This is great, I was able to test SPL SDP on an imx8mm-evk after applying these
same changes to imx8mm-evk and reducing the SPL size.

Quoted 6 lines
Quoted 4 lines

Fabio,

Can you tell me what you did to reduce the SPL size?

CONFIG_LTO from the other patch

Bummer. I was hoping there was more. I already have LTO enabled. I was hoping there was more to it.

Quoted 8 lines
Quoted 3 lines

What version of U-Boot are you using?

Mainline or some older one. Are you compile under yocto?

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

I was thinking about an issue was solved by patching U-Boot on increase size of 3% in yocto toolchain.

Michael

Quoted 32 lines

adam

Quoted 29 lines

Michael

Quoted 25 lines

adam

Quoted 23 lines

Michael

Quoted 5 lines

adam

Quoted 4 lines

For the series:

--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

#15 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Adam Ford

On 9/24/22 21:10, Adam Ford wrote:

Hi,

[...]

Quoted 3 lines

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

Try

$ aarch64...readelf -s spl/u-boot-spl | sort -nk 3

That should give you a list of large symbols you might want to inspect.

#16 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 11 lines · Marek Vasut

On 9/24/22 21:10, Adam Ford wrote:

Hi,

[...]

Quoted 3 lines

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

Quoted 5 lines

Try

$ aarch64...readelf -s spl/u-boot-spl | sort -nk 3

That should give you a list of large symbols you might want to inspect.

Thank you!

adam

#17 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 13 lines · Adam Ford
Quoted 11 lines · Marek Vasut

On 9/24/22 21:10, Adam Ford wrote:

Hi,

[...]

Quoted 3 lines

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

Quoted 8 lines
Quoted 5 lines

Try

$ aarch64...readelf -s spl/u-boot-spl | sort -nk 3

That should give you a list of large symbols you might want to inspect.

Thank you!

Adam,

I'm curious what you find as my SPL for imx8mm_venice_defconfig also overflows by about 3K when enabling what's needed here for SDP as well. I have 4 different dram configs which are chewing up about 1K each.

Best Regards,

Tim

#18 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 24 lines · Tim Harvey
Quoted 13 lines · Adam Ford
Quoted 11 lines · Marek Vasut

On 9/24/22 21:10, Adam Ford wrote:

Hi,

[...]

Quoted 3 lines

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

Quoted 8 lines
Quoted 5 lines

Try

$ aarch64...readelf -s spl/u-boot-spl | sort -nk 3

That should give you a list of large symbols you might want to inspect.

Thank you!

Quoted 6 lines

Adam,

I'm curious what you find as my SPL for imx8mm_venice_defconfig also overflows by about 3K when enabling what's needed here for SDP as well. I have 4 different dram configs which are chewing up about 1K each.

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

adam

Quoted 4 lines

Best Regards,

Tim

reviewer
#19 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Hi Adam,

Quoted 11 lines · Adam Ford

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

Ok, great.

Does "ums 0 mmc 0" work for you if you run it, stop it via CTRL+C and rerun it?

On an imx8mm_evk, I get USB errors after the CTRL+C and ums fails to mount after that.

#20 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 12 lines · Fabio Estevam

Hi Adam,

Quoted 7 lines · Adam Ford

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

Quoted 9 lines
Quoted 4 lines

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

Ok, great.

Does "ums 0 mmc 0" work for you if you run it, stop it via CTRL+C and rerun it?

I didn't try UMS. I was going to investigate Fastboot, but I'll give it try this week.

Quoted 2 lines

On an imx8mm_evk, I get USB errors after the CTRL+C and ums fails to mount after that.

Do you need to do a USB reset or anything?

adam

#21 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Quoted 18 lines · Adam Ford
Quoted 17 lines · Fabio Estevam

Hi Adam,

Quoted 11 lines · Adam Ford

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

Quoted 7 lines
Quoted 4 lines

Ok, great.

Does "ums 0 mmc 0" work for you if you run it, stop it via CTRL+C and rerun it?

I didn't try UMS. I was going to investigate Fastboot, but I'll give it try this week.

IMO UMS is the most convenient for development. It does require access to the console to hit ctrl-c, whereas you can control booting/rebooting with fastboot (making it nicer for production or for in-field repair).

I have found that both fastboot and UMS are far nice to use than SDP.

--Sean

Quoted 7 lines
Quoted 2 lines

On an imx8mm_evk, I get USB errors after the CTRL+C and ums fails to mount after that.

Do you need to do a USB reset or anything?

adam

#22 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Fabio Estevam
Quoted 17 lines · Fabio Estevam

Hi Adam,

Quoted 11 lines · Adam Ford

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

Quoted 6 lines

Ok, great.

Does "ums 0 mmc 0" work for you if you run it, stop it via CTRL+C and rerun it?

On an imx8mm_evk, I get USB errors after the CTRL+C and ums fails to mount after that.

Fabio,

I see this failure as well. If I CTRL+C and repeat the ums the attached Linux host shows:

[6307703.733810] usb 3-2: new high-speed USB device number 10 using xhci_hcd
[6307708.933752] usb 3-2: device descriptor read/64, error -110
[6307714.313724] usb 3-2: device descriptor read/64, error -71
[6307714.549708] usb 3-2: new high-speed USB device number 11 using xhci_hcd
[6307719.689650] usb 3-2: device descriptor read/64, error -110
[6307725.061625] usb 3-2: device descriptor read/64, error -71
[6307725.169657] usb usb3-port2: attempt power cycle
[6307725.581584] usb 3-2: new high-speed USB device number 12 using xhci_hcd
[6307730.825577] xhci_hcd 0000:00:14.0: Timeout while waiting for
setup device command
[6307731.033614] usb 3-2: Device not responding to setup address.
[6307731.241528] usb 3-2: device not accepting address 12, error -71
[6307731.373537] usb 3-2: new high-speed USB device number 13 using xhci_hcd
[6307736.453499] xhci_hcd 0000:00:14.0: Timeout while waiting for
setup device command
[6307736.665545] usb 3-2: Device not responding to setup address.
[6307736.873482] usb 3-2: device not accepting address 13, error -71
[6307736.873589] usb usb3-port2: unable to enumerate USB device

Best Regards,

Tim

#23 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Adam Ford
Quoted 40 lines · Adam Ford
Quoted 24 lines · Tim Harvey
Quoted 13 lines · Adam Ford
Quoted 11 lines · Marek Vasut

On 9/24/22 21:10, Adam Ford wrote:

Hi,

[...]

Quoted 3 lines

I am using the Mainline with the aarch64 gcc from Ubuntu 22.04. I am over by ~1100 bytes with LTO enabled, but I'm going through my SPL drivers to see what I can either remove or reduce functionality.

Quoted 8 lines
Quoted 5 lines

Try

$ aarch64...readelf -s spl/u-boot-spl | sort -nk 3

That should give you a list of large symbols you might want to inspect.

Thank you!

Quoted 6 lines

Adam,

I'm curious what you find as my SPL for imx8mm_venice_defconfig also overflows by about 3K when enabling what's needed here for SDP as well. I have 4 different dram configs which are chewing up about 1K each.

Tim,

I have it building successfully now, and it loads over USB. I had to disable BD718x7 PMIC children binding which required a small change to the PMIC driver [1]. I then removed HS400, HS200 and UHS support in SPL. Once I did all that, the code size fit into SPL space.

Quoted 5 lines

[1] - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I'll try to push my patch today or tomorrow. I was doing some other clean-up, but I might just push that as a small series in itself.

Adam,

Yes, I have already done those same things for imx8mm_venice but am still 3K over due to my 4x dram configs. Each dram config must be about 3K as I only have to remove one of them to successfully build.

Thanks,

Tim

Reviewed-by on v1 4/4
#24 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Marek Vasut
Quoted 61 lines · Marek Vasut

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

---
Cc: Fabio Estevam <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
  arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi | 20 ++++++++++++++++++++
  configs/imx8mm-mx8menlo_defconfig        | 17 ++++++++++++++++-
  2 files changed, 36 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi +20 -0
index 484d493e33c..7f5f8c384e8 100644
@@ -17,6 +17,26 @@
  	};
  };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
  &i2c4 {
  	/delete-node/ codec@1a;
  };
+
+&reg_usb_otg1_vbus {
+	u-boot,dm-spl;
+};
+
+&usbmisc1 {
+	u-boot,dm-spl;
+};
+
+&usbphynop1 {
+	u-boot,dm-spl;
+};
+
+&usbotg1 {
+	u-boot,dm-spl;
+};
configs/imx8mm-mx8menlo_defconfig +0 -0
index 929ff382f27..ad6885942d3 100644

configs/imx8mm-mx8menlo_defconfig CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y · line 53

Quoted 4 lines
configs/imx8mm-mx8menlo_defconfig +1 -0
@@ -50,6 +50,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
  CONFIG_SPL_POWER=y
+CONFIG_SPL_USB_HOST=y

Nitpick, would this option required?

Otherwise looks good to me,

Quoted 40 lines
configs/imx8mm-mx8menlo_defconfig +15 -1
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
  CONFIG_SPL_WATCHDOG=y
  CONFIG_SYS_MAXARGS=64
  CONFIG_SYS_CBSIZE=2048
@@ -65,6 +68,8 @@ CONFIG_CMD_GPIO=y
  CONFIG_CMD_I2C=y
  CONFIG_CMD_MMC=y
  CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
  CONFIG_CMD_BOOTCOUNT=y
  CONFIG_CMD_CACHE=y
  CONFIG_CMD_UUID=y
@@ -106,6 +111,8 @@ CONFIG_PHY_MICREL=y
  CONFIG_PHY_MICREL_KSZ90X1=y
  CONFIG_FEC_MXC=y
  CONFIG_MII=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_NOP_PHY=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_PINCTRL_IMX8M=y
@@ -125,7 +132,15 @@ CONFIG_SYSRESET_PSCI=y
  CONFIG_SYSRESET_WATCHDOG=y
  CONFIG_DM_THERMAL=y
  CONFIG_USB=y
-# CONFIG_SPL_DM_USB is not set
  CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
+# CONFIG_USB_STORAGE is not set
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Menlo"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_SDP_LOADADDR=0x40400000
+CONFIG_USB_GADGET_DOWNLOAD=y
  CONFIG_IMX_WATCHDOG=y
  CONFIG_OF_LIBFDT_OVERLAY=y
#25 lore raw

Re: [PATCH 4/4] ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

On 9/21/22 07:30, Peng Fan wrote:

[...]

Quoted 7 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -50,6 +50,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y

  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
  CONFIG_SPL_POWER=y
+CONFIG_SPL_USB_HOST=y

Nitpick, would this option required?

Sadly, yes, that's all the common EHCI bits also needed by the UDC.

Quoted 3 lines

Otherwise looks good to me,

[...]

#26 lore raw

PATCH 4/4 ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

In reply to Marek Vasut
Quoted 9 lines

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL to let the board continue SDP loading of second stage after the first stage was loaded by BootROM SDP implementation. It is not possible to jump back into BootROM v1 and let the BootROM implementation continue the SDP loading, all this has to be performed by the U-Boot CI HDRC controller driver and SDP protocol implementation, both of which fit into the SPL just barely.
With this patch, it is possible to start both U-Boot SPL and U-Boot using e.g. uuu on this board as follows:

Quoted 4 lines
$ uuu -brun spl flash.bin
Signed-off-by: Marek Vasut <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
Reviewed-by: Peng Fan <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
Reviewed-by on v1 1/4
#27 lore raw
In reply to Marek Vasut
Quoted 5 lines · Marek Vasut

Instead of duplicating code implemented by i.MX8M version of arch_misc_init() in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from spl_board_init(). This removes the duplication. No functional change.

Quoted 8 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Frieder Schrempf <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Teresa Remmet <[email protected]>

Quoted 182 lines
---
  board/freescale/imx8mm_evk/spl.c   | 10 +---------
  board/freescale/imx8mn_evk/spl.c   |  7 ++-----
  board/freescale/imx8mp_evk/spl.c   |  8 +-------
  board/kontron/sl-mx8mm/spl.c       |  6 +-----
  board/toradex/verdin-imx8mm/spl.c  |  9 +--------
  configs/imx8mm-mx8menlo_defconfig  |  1 +
  configs/imx8mm_evk_defconfig       |  1 +
  configs/imx8mm_evk_fspi_defconfig  |  1 +
  configs/imx8mp_evk_defconfig       |  1 +
  configs/kontron-sl-mx8mm_defconfig |  1 +
  configs/verdin-imx8mm_defconfig    |  1 +
  11 files changed, 12 insertions(+), 34 deletions(-)
board/freescale/imx8mm_evk/spl.c +1 -9
index e2eb1426c83..e0e97c7fd9a 100644
@@ -53,15 +53,7 @@ static void spl_dram_init(void)
 
  void spl_board_init(void)
  {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
-
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
-	puts("Normal Boot\n");
+	arch_misc_init();
  }
 
  #ifdef CONFIG_SPL_LOAD_FIT
board/freescale/imx8mn_evk/spl.c +2 -5
index c0bfb67199a..380abecd746 100644
@@ -49,11 +49,8 @@ void spl_board_init(void)
  	struct udevice *dev;
  	int ret;
 
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
+	arch_misc_init();
+
  	puts("Normal Boot\n");
 
  	ret = uclass_get_device_by_name(UCLASS_CLK,
board/freescale/imx8mp_evk/spl.c +1 -7
index 719b1f6d7da..f1b285417d0 100644
@@ -37,14 +37,8 @@ void spl_dram_init(void)
 
  void spl_board_init(void)
  {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
+	arch_misc_init();
 
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize caam_jr: %d\n", ret);
-	}
  	/*
  	 * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does
  	 * not allow to change it. Should set the clock after PMIC
board/kontron/sl-mx8mm/spl.c +1 -5
index 09f81351dd4..b884c91aef9 100644
@@ -205,11 +205,7 @@ void spl_board_init(void)
  	struct udevice *dev;
  	int ret;
 
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize %s: %d\n", dev->name, ret);
-	}
+	arch_misc_init();
 
  	puts("Normal Boot\n");
 
board/toradex/verdin-imx8mm/spl.c +1 -8
index fb9aae6c9c8..59a3d9e0cae 100644
@@ -53,14 +53,7 @@ void spl_dram_init(void)
 
  void spl_board_init(void)
  {
-	if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-		struct udevice *dev;
-		int ret;
-
-		ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
-		if (ret)
-			printf("Failed to initialize %s: %d\n", dev->name, ret);
-	}
+	arch_misc_init();
 
  	/* Serial download mode */
  	if (is_usb_boot()) {
configs/imx8mm-mx8menlo_defconfig +1 -0
index 702162f86de..929ff382f27 100644
@@ -34,6 +34,7 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-mx8menlo.dtb"
  CONFIG_LOG=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
configs/imx8mm_evk_defconfig +1 -0
index 7bcedcd51f5..58b5e468a58 100644
@@ -23,6 +23,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
  CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
configs/imx8mm_evk_fspi_defconfig +1 -0
index 21fd7e08db1..73c96f634ce 100644
@@ -24,6 +24,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
  CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x25000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mp_evk_defconfig +1 -0
index 0be1951e740..406e89e428b 100644
@@ -28,6 +28,7 @@ CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_SYSTEM_SETUP=y
  CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x26000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/kontron-sl-mx8mm_defconfig +1 -0
index 5387f65926f..43731e4c280 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_BOARD_SETUP=y
  CONFIG_BOARD_TYPES=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
  CONFIG_SPL_BSS_MAX_SIZE=0x2000
configs/verdin-imx8mm_defconfig +1 -0
index f65b4a7f307..230fe55d068 100644
@@ -36,6 +36,7 @@ CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mm-verdin-${variant}-${
  CONFIG_LOG=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
#28 lore raw

Hi Marek,

just for tracking. ARCH_MISC_INIT was missing for imx8mn_ddr4_evk, I added myself to have a clean build and applied.

Stefano

Quoted 195 lines · Peng Fan
Quoted 5 lines · Marek Vasut

Instead of duplicating code implemented by i.MX8M version of arch_misc_init() in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from spl_board_init(). This removes the duplication. No functional change.

Quoted 8 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Frieder Schrempf <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Teresa Remmet <[email protected]>

Quoted 177 lines

---

  board/freescale/imx8mm_evk/spl.c   | 10 +---------
  board/freescale/imx8mn_evk/spl.c   |  7 ++-----
  board/freescale/imx8mp_evk/spl.c   |  8 +-------

  board/kontron/sl-mx8mm/spl.c       |  6 +----- board/toradex/verdin-imx8mm/spl.c  |  9 +-------- configs/imx8mm-mx8menlo_defconfig  |  1 + configs/imx8mm_evk_defconfig       |  1 + configs/imx8mm_evk_fspi_defconfig  |  1 + configs/imx8mp_evk_defconfig       |  1 + configs/kontron-sl-mx8mm_defconfig |  1 + configs/verdin-imx8mm_defconfig    |  1 +

  11 files changed, 12 insertions(+), 34 deletions(-)
board/freescale/imx8mm_evk/spl.c +1 -9
index e2eb1426c83..e0e97c7fd9a 100644
@@ -53,15 +53,7 @@ static void spl_dram_init(void)
   void spl_board_init(void)
   {
-    if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-        struct udevice *dev;
-        int ret;
-
-        ret = uclass_get_device_by_driver(UCLASS_MISC, 
 DM_DRIVER_GET(caam_jr), &dev);
-        if (ret)
-            printf("Failed to initialize caam_jr: %d\n", ret);
-    }
-    puts("Normal Boot\n");
+    arch_misc_init();
   }
   #ifdef CONFIG_SPL_LOAD_FIT
board/freescale/imx8mn_evk/spl.c +2 -5
index c0bfb67199a..380abecd746 100644
@@ -49,11 +49,8 @@ void spl_board_init(void)
       struct udevice *dev;
       int ret;
-    if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-        ret = uclass_get_device_by_driver(UCLASS_MISC, 
 DM_DRIVER_GET(caam_jr), &dev);
-        if (ret)
-            printf("Failed to initialize caam_jr: %d\n", ret);
-    }
+    arch_misc_init();
+
       puts("Normal Boot\n");
       ret = uclass_get_device_by_name(UCLASS_CLK,
board/freescale/imx8mp_evk/spl.c +1 -7
index 719b1f6d7da..f1b285417d0 100644
@@ -37,14 +37,8 @@ void spl_dram_init(void)
   void spl_board_init(void)
   {
-    if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-        struct udevice *dev;
-        int ret;
+    arch_misc_init();
-        ret = uclass_get_device_by_driver(UCLASS_MISC, 
 DM_DRIVER_GET(caam_jr), &dev);
-        if (ret)
-            printf("Failed to initialize caam_jr: %d\n", ret);
-    }
       /*
        * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does
        * not allow to change it. Should set the clock after PMIC
board/kontron/sl-mx8mm/spl.c +1 -5
index 09f81351dd4..b884c91aef9 100644
@@ -205,11 +205,7 @@ void spl_board_init(void)
       struct udevice *dev;
       int ret;
-    if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-        ret = uclass_get_device_by_driver(UCLASS_MISC, 
 DM_DRIVER_GET(caam_jr), &dev);
-        if (ret)
-            printf("Failed to initialize %s: %d\n", dev->name, ret);
-    }
+    arch_misc_init();
       puts("Normal Boot\n");
board/toradex/verdin-imx8mm/spl.c +1 -8
index fb9aae6c9c8..59a3d9e0cae 100644
@@ -53,14 +53,7 @@ void spl_dram_init(void)
   void spl_board_init(void)
   {
-    if (IS_ENABLED(CONFIG_FSL_CAAM)) {
-        struct udevice *dev;
-        int ret;
-
-        ret = uclass_get_device_by_driver(UCLASS_MISC, 
 DM_DRIVER_GET(caam_jr), &dev);
-        if (ret)
-            printf("Failed to initialize %s: %d\n", dev->name, ret);
-    }
+    arch_misc_init();
       /* Serial download mode */
       if (is_usb_boot()) {
configs/imx8mm-mx8menlo_defconfig +0 -0
index 702162f86de..929ff382f27 100644
@@ -34,6 +34,7 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-mx8menlo.dtb"

  CONFIG_LOG=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000

configs/imx8mm_evk_defconfig +0 -0
index 7bcedcd51f5..58b5e468a58 100644
@@ -23,6 +23,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000

  CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000

configs/imx8mm_evk_fspi_defconfig +0 -0
index 21fd7e08db1..73c96f634ce 100644
@@ -24,6 +24,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000

  CONFIG_SPL_LOAD_FIT=y
  # CONFIG_USE_SPL_FIT_GENERATOR is not set
  CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x25000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

configs/imx8mp_evk_defconfig +0 -0
index 0be1951e740..406e89e428b 100644
@@ -28,6 +28,7 @@ CONFIG_SPL_LOAD_FIT=y
   # CONFIG_USE_SPL_FIT_GENERATOR is not set

  CONFIG_OF_SYSTEM_SETUP=y
  CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x26000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

configs/kontron-sl-mx8mm_defconfig +0 -0
index 5387f65926f..43731e4c280 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_LOAD_FIT=y
   # CONFIG_USE_SPL_FIT_GENERATOR is not set

  CONFIG_OF_BOARD_SETUP=y
  CONFIG_BOARD_TYPES=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000
  CONFIG_SPL_BSS_MAX_SIZE=0x2000

configs/verdin-imx8mm_defconfig +0 -0
index f65b4a7f307..230fe55d068 100644
@@ -36,6 +36,7 @@ CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
 imx8mm-verdin-${variant}-${

  CONFIG_LOG=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ARCH_MISC_INIT=y
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x910000

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#29 lore raw

PATCH 1/4 ARM: imx8m: Deduplicate CAAM init with arch_misc_init() call

In reply to Marek Vasut
Quoted 5 lines

Instead of duplicating code implemented by i.MX8M version of arch_misc_init() in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from spl_board_init(). This removes the duplication. No functional change.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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