[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.
Signed-off-by: Marek Vasut marex@denx.de --- Cc: Fabio Estevam festevam@denx.de Cc: Frieder Schrempf frieder.schrempf@kontron.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Teresa Remmet t.remmet@phytec.de --- 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(-)
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index e2eb1426c83..e0e97c7fd9a 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -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 diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index c0bfb67199a..380abecd746 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -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, diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 719b1f6d7da..f1b285417d0 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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 diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c index 09f81351dd4..b884c91aef9 100644 --- a/board/kontron/sl-mx8mm/spl.c +++ b/board/kontron/sl-mx8mm/spl.c @@ -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");
diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index fb9aae6c9c8..59a3d9e0cae 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -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()) { diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig index 702162f86de..929ff382f27 100644 --- a/configs/imx8mm-mx8menlo_defconfig +++ b/configs/imx8mm-mx8menlo_defconfig @@ -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 diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f5..58b5e468a58 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -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 diff --git a/configs/imx8mm_evk_fspi_defconfig b/configs/imx8mm_evk_fspi_defconfig index 21fd7e08db1..73c96f634ce 100644 --- a/configs/imx8mm_evk_fspi_defconfig +++ b/configs/imx8mm_evk_fspi_defconfig @@ -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 diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig index 0be1951e740..406e89e428b 100644 --- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -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 diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig index 5387f65926f..43731e4c280 100644 --- a/configs/kontron-sl-mx8mm_defconfig +++ b/configs/kontron-sl-mx8mm_defconfig @@ -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 diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index f65b4a7f307..230fe55d068 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -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

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.
Signed-off-by: Marek Vasut marex@denx.de --- Cc: Fabio Estevam festevam@denx.de Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Teresa Remmet t.remmet@phytec.de --- board/phytec/phycore_imx8mm/spl.c | 10 ---------- configs/phycore-imx8mm_defconfig | 1 - 2 files changed, 11 deletions(-)
diff --git a/board/phytec/phycore_imx8mm/spl.c b/board/phytec/phycore_imx8mm/spl.c index d87ab6d4497..1bae9b1170d 100644 --- a/board/phytec/phycore_imx8mm/spl.c +++ b/board/phytec/phycore_imx8mm/spl.c @@ -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; diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig index 9b8c09a73ab..e8d7905bb4a 100644 --- a/configs/phycore-imx8mm_defconfig +++ b/configs/phycore-imx8mm_defconfig @@ -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

On 9/20/2022 3:41 AM, Marek Vasut wrote:
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.
Signed-off-by: Marek Vasut marex@denx.de
Reviewed-by: Peng Fan peng.fan@nxp.com
Cc: Fabio Estevam festevam@denx.de Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Teresa Remmet t.remmet@phytec.de
board/phytec/phycore_imx8mm/spl.c | 10 ---------- configs/phycore-imx8mm_defconfig | 1 - 2 files changed, 11 deletions(-)
diff --git a/board/phytec/phycore_imx8mm/spl.c b/board/phytec/phycore_imx8mm/spl.c index d87ab6d4497..1bae9b1170d 100644 --- a/board/phytec/phycore_imx8mm/spl.c +++ b/board/phytec/phycore_imx8mm/spl.c @@ -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;
diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig index 9b8c09a73ab..e8d7905bb4a 100644 --- a/configs/phycore-imx8mm_defconfig +++ b/configs/phycore-imx8mm_defconfig @@ -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

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. Signed-off-by: Marek Vasut marex@denx.de Reviewed-by: Peng Fan peng.fan@nxp.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

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.
Signed-off-by: Marek Vasut marex@denx.de --- Cc: Fabio Estevam festevam@denx.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- board/toradex/verdin-imx8mm/spl.c | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index 59a3d9e0cae..210665bd6a9 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -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

On 9/20/2022 3:41 AM, Marek Vasut wrote:
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.
Reviewed-by: Peng Fan peng.fan@nxp.com
Signed-off-by: Marek Vasut marex@denx.de
Cc: Fabio Estevam festevam@denx.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
board/toradex/verdin-imx8mm/spl.c | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index 59a3d9e0cae..210665bd6a9 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -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

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. Signed-off-by: Marek Vasut marex@denx.de Reviewed-by: Peng Fan peng.fan@nxp.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

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
Signed-off-by: Marek Vasut marex@denx.de --- Cc: Fabio Estevam festevam@denx.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi | 20 ++++++++++++++++++++ configs/imx8mm-mx8menlo_defconfig | 17 ++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi b/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi index 484d493e33c..7f5f8c384e8 100644 --- a/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi @@ -17,6 +17,26 @@ }; };
+&aips4 { + u-boot,dm-spl; +}; + &i2c4 { /delete-node/ codec@1a; }; + +®_usb_otg1_vbus { + u-boot,dm-spl; +}; + +&usbmisc1 { + u-boot,dm-spl; +}; + +&usbphynop1 { + u-boot,dm-spl; +}; + +&usbotg1 { + u-boot,dm-spl; +}; diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig index 929ff382f27..ad6885942d3 100644 --- a/configs/imx8mm-mx8menlo_defconfig +++ b/configs/imx8mm-mx8menlo_defconfig @@ -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

Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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:
Reviewed-by: Fabio Estevam festevam@denx.de

On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de

On Sat, Sep 24, 2022 at 8:38 PM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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
adam
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de

On Sat, Sep 24, 2022 at 1:52 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
On Sat, Sep 24, 2022 at 8:38 PM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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
Bummer. I was hoping there was more. I already have LTO enabled. I was hoping there was more to it.
adam
Michael
adam
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com

Il sab 24 set 2022, 20:54 Adam Ford aford173@gmail.com ha scritto:
On Sat, Sep 24, 2022 at 1:52 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
On Sat, Sep 24, 2022 at 8:38 PM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de
wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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
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
adam
Michael
adam
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com

On Sat, Sep 24, 2022 at 2:00 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Il sab 24 set 2022, 20:54 Adam Ford aford173@gmail.com ha scritto:
On Sat, Sep 24, 2022 at 1:52 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
On Sat, Sep 24, 2022 at 8:38 PM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
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
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
Michael
adam
Michael
adam
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com

Hi
Il sab 24 set 2022, 21:10 Adam Ford aford173@gmail.com ha scritto:
On Sat, Sep 24, 2022 at 2:00 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Il sab 24 set 2022, 20:54 Adam Ford aford173@gmail.com ha scritto:
On Sat, Sep 24, 2022 at 1:52 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
On Sat, Sep 24, 2022 at 8:38 PM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 19, 2022 at 5:02 PM Fabio Estevam festevam@denx.de
wrote:
Hi Marek,
On 19/09/2022 16:41, Marek Vasut wrote: > 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 > > Signed-off-by: Marek Vasut marex@denx.de
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
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.
I was thinking about an issue was solved by patching U-Boot on increase size of 3% in yocto toolchain.
Michael
adam
Michael
adam
Michael
adam
For the series:
Reviewed-by: Fabio Estevam festevam@denx.de
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com

On 9/24/22 21:10, Adam Ford wrote:
Hi,
[...]
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.

On Sat, Sep 24, 2022 at 4:47 PM Marek Vasut marex@denx.de wrote:
On 9/24/22 21:10, Adam Ford wrote:
Hi,
[...]
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.
Thank you!
adam

On Sat, Sep 24, 2022, 2:54 PM Adam Ford aford173@gmail.com wrote:
On Sat, Sep 24, 2022 at 4:47 PM Marek Vasut marex@denx.de wrote:
On 9/24/22 21:10, Adam Ford wrote:
Hi,
[...]
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.
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

On Mon, Sep 26, 2022 at 11:59 AM Tim Harvey tharvey@gateworks.com wrote:
On Sat, Sep 24, 2022, 2:54 PM Adam Ford aford173@gmail.com wrote:
On Sat, Sep 24, 2022 at 4:47 PM Marek Vasut marex@denx.de wrote:
On 9/24/22 21:10, Adam Ford wrote:
Hi,
[...]
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.
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.
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/20220817112403.68144-2-afor...
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
Best Regards,
Tim

Hi Adam,
On Mon, Sep 26, 2022 at 2:07 PM Adam Ford aford173@gmail.com wrote:
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/20220817112403.68144-2-afor...
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.

On Mon, Sep 26, 2022 at 12:12 PM Fabio Estevam festevam@gmail.com wrote:
Hi Adam,
On Mon, Sep 26, 2022 at 2:07 PM Adam Ford aford173@gmail.com wrote:
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/20220817112403.68144-2-afor...
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.
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

On 9/26/22 1:28 PM, Adam Ford wrote:
On Mon, Sep 26, 2022 at 12:12 PM Fabio Estevam festevam@gmail.com wrote:
Hi Adam,
On Mon, Sep 26, 2022 at 2:07 PM Adam Ford aford173@gmail.com wrote:
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/20220817112403.68144-2-afor...
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.
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
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

On Mon, Sep 26, 2022 at 10:12 AM Fabio Estevam festevam@gmail.com wrote:
Hi Adam,
On Mon, Sep 26, 2022 at 2:07 PM Adam Ford aford173@gmail.com wrote:
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/20220817112403.68144-2-afor...
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.
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

On Mon, Sep 26, 2022 at 10:06 AM Adam Ford aford173@gmail.com wrote:
On Mon, Sep 26, 2022 at 11:59 AM Tim Harvey tharvey@gateworks.com wrote:
On Sat, Sep 24, 2022, 2:54 PM Adam Ford aford173@gmail.com wrote:
On Sat, Sep 24, 2022 at 4:47 PM Marek Vasut marex@denx.de wrote:
On 9/24/22 21:10, Adam Ford wrote:
Hi,
[...]
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.
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.
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/20220817112403.68144-2-afor...
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

On 9/20/2022 3:41 AM, Marek Vasut wrote:
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
Signed-off-by: Marek Vasut marex@denx.de
Cc: Fabio Estevam festevam@denx.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi | 20 ++++++++++++++++++++ configs/imx8mm-mx8menlo_defconfig | 17 ++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi b/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi index 484d493e33c..7f5f8c384e8 100644 --- a/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-mx8menlo-u-boot.dtsi @@ -17,6 +17,26 @@ }; };
+&aips4 {
- u-boot,dm-spl;
+};
- &i2c4 { /delete-node/ codec@1a; };
+®_usb_otg1_vbus {
- u-boot,dm-spl;
+};
+&usbmisc1 {
- u-boot,dm-spl;
+};
+&usbphynop1 {
- u-boot,dm-spl;
+};
+&usbotg1 {
- u-boot,dm-spl;
+}; diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig index 929ff382f27..ad6885942d3 100644 --- a/configs/imx8mm-mx8menlo_defconfig +++ b/configs/imx8mm-mx8menlo_defconfig @@ -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,
Reviewed-by: Peng Fan peng.fan@nxp.com
+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

On 9/21/22 07:30, Peng Fan wrote:
[...]
@@ -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.
Otherwise looks good to me,
Reviewed-by: Peng Fan peng.fan@nxp.com
[...]

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 Signed-off-by: Marek Vasut marex@denx.de Reviewed-by: Fabio Estevam festevam@denx.de Reviewed-by: Peng Fan peng.fan@nxp.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

On 9/20/2022 3:41 AM, Marek Vasut wrote:
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.
Signed-off-by: Marek Vasut marex@denx.de
Cc: Fabio Estevam festevam@denx.de Cc: Frieder Schrempf frieder.schrempf@kontron.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Teresa Remmet t.remmet@phytec.de
Reviewed-by: Peng Fan peng.fan@nxp.com
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(-)
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index e2eb1426c83..e0e97c7fd9a 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -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
diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index c0bfb67199a..380abecd746 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -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,
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 719b1f6d7da..f1b285417d0 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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
diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c index 09f81351dd4..b884c91aef9 100644 --- a/board/kontron/sl-mx8mm/spl.c +++ b/board/kontron/sl-mx8mm/spl.c @@ -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");
diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index fb9aae6c9c8..59a3d9e0cae 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -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()) {
diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig index 702162f86de..929ff382f27 100644 --- a/configs/imx8mm-mx8menlo_defconfig +++ b/configs/imx8mm-mx8menlo_defconfig @@ -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 diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f5..58b5e468a58 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -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 diff --git a/configs/imx8mm_evk_fspi_defconfig b/configs/imx8mm_evk_fspi_defconfig index 21fd7e08db1..73c96f634ce 100644 --- a/configs/imx8mm_evk_fspi_defconfig +++ b/configs/imx8mm_evk_fspi_defconfig @@ -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 diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig index 0be1951e740..406e89e428b 100644 --- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -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 diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig index 5387f65926f..43731e4c280 100644 --- a/configs/kontron-sl-mx8mm_defconfig +++ b/configs/kontron-sl-mx8mm_defconfig @@ -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 diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index f65b4a7f307..230fe55d068 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -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

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
On 21.09.22 07:31, Peng Fan wrote:
On 9/20/2022 3:41 AM, Marek Vasut wrote:
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.
Signed-off-by: Marek Vasut marex@denx.de
Cc: Fabio Estevam festevam@denx.de Cc: Frieder Schrempf frieder.schrempf@kontron.de Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Max Krummenacher max.krummenacher@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Teresa Remmet t.remmet@phytec.de
Reviewed-by: Peng Fan peng.fan@nxp.com
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(-)
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index e2eb1426c83..e0e97c7fd9a 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -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 diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index c0bfb67199a..380abecd746 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -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, diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 719b1f6d7da..f1b285417d0 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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 diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c index 09f81351dd4..b884c91aef9 100644 --- a/board/kontron/sl-mx8mm/spl.c +++ b/board/kontron/sl-mx8mm/spl.c @@ -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"); diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index fb9aae6c9c8..59a3d9e0cae 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -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()) { diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig index 702162f86de..929ff382f27 100644 --- a/configs/imx8mm-mx8menlo_defconfig +++ b/configs/imx8mm-mx8menlo_defconfig @@ -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 diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f5..58b5e468a58 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -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 diff --git a/configs/imx8mm_evk_fspi_defconfig b/configs/imx8mm_evk_fspi_defconfig index 21fd7e08db1..73c96f634ce 100644 --- a/configs/imx8mm_evk_fspi_defconfig +++ b/configs/imx8mm_evk_fspi_defconfig @@ -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 diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig index 0be1951e740..406e89e428b 100644 --- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -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 diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig index 5387f65926f..43731e4c280 100644 --- a/configs/kontron-sl-mx8mm_defconfig +++ b/configs/kontron-sl-mx8mm_defconfig @@ -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 diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index f65b4a7f307..230fe55d068 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -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

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. Signed-off-by: Marek Vasut marex@denx.de Reviewed-by: Peng Fan peng.fan@nxp.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic
participants (10)
-
Adam Ford
-
Fabio Estevam
-
Fabio Estevam
-
Marek Vasut
-
Michael Nazzareno Trimarchi
-
Peng Fan
-
sbabic@denx.de
-
Sean Anderson
-
Stefano Babic
-
Tim Harvey