[PATCH 1/2] imx8mm_evk: Add an entry for USB boot

Add an entry for USB boot so that U-Boot could be loaded via the Serial Download Protocol.
Signed-off-by: Fabio Estevam festevam@denx.de --- board/freescale/imx8mm_evk/spl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index e2eb1426c8..c827ed5546 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -33,6 +33,8 @@ DECLARE_GLOBAL_DATA_PTR; int spl_board_boot_device(enum boot_device boot_dev_spl) { switch (boot_dev_spl) { + case USB_BOOT: + return BOOT_DEVICE_BOARD; case SD2_BOOT: case MMC2_BOOT: return BOOT_DEVICE_MMC1;

Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de --- arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 { + u-boot,dm-spl; +}; + ®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; }; @@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 { + u-boot,dm-spl; +}; + +&usbphynop1 { + u-boot,dm-spl; +}; + +&usbotg1 { + u-boot,dm-spl; +}; + &usdhc1 { u-boot,dm-spl; }; diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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

Hi
On Tue, Sep 20, 2022 at 2:21 AM Fabio Estevam festevam@denx.de wrote:
Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 {
u-boot,dm-spl;
+};
®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; }; @@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 {
u-boot,dm-spl;
+};
+&usbphynop1 {
u-boot,dm-spl;
+};
+&usbotg1 {
u-boot,dm-spl;
+};
&usdhc1 { u-boot,dm-spl; }; diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y
Is the entry required? or part of the series. If so could you explain in the commit message?
Michael
CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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 -- 2.25.1

Hello Michael,
-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Michael Nazzareno Trimarchi Sent: Tuesday, September 20, 2022 7:46 AM To: Fabio Estevam festevam@denx.de Cc: sbabic@denx.de; peng.fan@nxp.com; marex@denx.de; u-boot@lists.denx.de Subject: Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support
Hi
On Tue, Sep 20, 2022 at 2:21 AM Fabio Estevam festevam@denx.de wrote:
Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-
boot.dtsi
index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 {
u-boot,dm-spl;
+};
®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; }; @@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 {
u-boot,dm-spl;
+};
+&usbphynop1 {
u-boot,dm-spl;
+};
+&usbotg1 {
u-boot,dm-spl;
+};
&usdhc1 { u-boot,dm-spl; }; diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y
Is the entry required? or part of the series. If so could you explain in the commit message?
While not being strictly part of the series, Fabio did explained the LTO enablement in the commit message above. This reduces the size of SPL, which in turn allows it to fit into IRAM.
-- andrey
Michael
CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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 -- 2.25.1
-- 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
On Tue, Sep 20, 2022 at 8:31 AM ZHIZHIKIN Andrey andrey.zhizhikin@leica-geosystems.com wrote:
Hello Michael,
-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Michael Nazzareno Trimarchi Sent: Tuesday, September 20, 2022 7:46 AM To: Fabio Estevam festevam@denx.de Cc: sbabic@denx.de; peng.fan@nxp.com; marex@denx.de; u-boot@lists.denx.de Subject: Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support
Hi
On Tue, Sep 20, 2022 at 2:21 AM Fabio Estevam festevam@denx.de wrote:
Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-
boot.dtsi
index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 {
u-boot,dm-spl;
+};
®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; }; @@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 {
u-boot,dm-spl;
+};
+&usbphynop1 {
u-boot,dm-spl;
+};
+&usbotg1 {
u-boot,dm-spl;
+};
&usdhc1 { u-boot,dm-spl; }; diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y
Is the entry required? or part of the series. If so could you explain in the commit message?
While not being strictly part of the series, Fabio did explained the LTO enablement in the commit message above. This reduces the size of SPL, which in turn allows it to fit into IRAM.
Sorry too early. I was thinking that I was read this comment in marek review for other patch but was reported even here
Michael
-- andrey
Michael
CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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 -- 2.25.1
-- 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 Fabio,
Just have a question, the tcpci driver is not supported, so how do you manage to make SDP work?
Regards, Peng.
On 9/20/2022 8:20 AM, Fabio Estevam wrote:
Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 {
- u-boot,dm-spl;
+};
- ®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; };
@@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 {
- u-boot,dm-spl;
+};
+&usbphynop1 {
- u-boot,dm-spl;
+};
+&usbotg1 {
- u-boot,dm-spl;
+};
- &usdhc1 { u-boot,dm-spl; };
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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

Hi Peng,
On Tue, Sep 20, 2022 at 3:56 AM Peng Fan peng.fan@oss.nxp.com wrote:
Hi Fabio,
Just have a question, the tcpci driver is not supported, so how do you manage to make SDP work?
I understand that the tcpci driver is required when a USB role switch is needed.
I am only using the usbotg1 as a peripheral.
Here are the logs:
On the host PC:
$ sudo uuu -brun spl flash.bin
On the console:
U-Boot SPL 2022.10-rc5-00003-g9e02955991-dirty (Sep 19 2022 - 21:49:01 -0300) No pmic SEC0: RNG instantiated Normal Boot WDT: Started watchdog@30280000 with servicing (60s timeout) Trying to boot from USB SDP SDP: initialize... SDP: handle requests... Downloading file of size 885712 to 0x40400000... done Jumping to header at 0x40400000 Header Tag is not an IMX image Found header at 0x40420400 NOTICE: BL31: v2.2(release):rel_imx_5.4.47_2.2.0-0-gc949a888e NOTICE: BL31: Built : 17:18:02, Sep 19 2022
U-Boot 2022.10-rc5-00003-g9e02955991-dirty (Sep 19 2022 - 21:49:01 -0300)
CPU: Freescale i.MX8MMQ rev1.0 at 1200 MHz Reset cause: POR Model: FSL i.MX8MM EVK board DRAM: 2 GiB Core: 176 devices, 23 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial@30890000 Out: serial@30890000 Err: serial@30890000 SEC0: RNG instantiated Net: eth0: ethernet@30be0000 Hit any key to stop autoboot: 0 u-boot=>
One issue that I observed and haven't had a chance to debug yet is that running 'ums 0 mmc 1' works only when issued for the first time.
If I interrupt with CRLC+C and then launch 'ums 0 mmc 1' again, it does not work.
This is unrelated to SDP and happens when I boot from SD card as well.
If you have any ideas, please let me know.
Thanks,
Fabio Estevam

On 9/20/2022 7:13 PM, Fabio Estevam wrote:
Hi Peng,
On Tue, Sep 20, 2022 at 3:56 AM Peng Fan peng.fan@oss.nxp.com wrote:
Hi Fabio,
Just have a question, the tcpci driver is not supported, so how do you manage to make SDP work?
I understand that the tcpci driver is required when a USB role switch is needed.
I am only using the usbotg1 as a peripheral.
ok, got it.
Here are the logs:
On the host PC:
$ sudo uuu -brun spl flash.bin
On the console:
U-Boot SPL 2022.10-rc5-00003-g9e02955991-dirty (Sep 19 2022 - 21:49:01 -0300) No pmic SEC0: RNG instantiated Normal Boot WDT: Started watchdog@30280000 with servicing (60s timeout) Trying to boot from USB SDP SDP: initialize... SDP: handle requests... Downloading file of size 885712 to 0x40400000... done Jumping to header at 0x40400000 Header Tag is not an IMX image Found header at 0x40420400 NOTICE: BL31: v2.2(release):rel_imx_5.4.47_2.2.0-0-gc949a888e NOTICE: BL31: Built : 17:18:02, Sep 19 2022
U-Boot 2022.10-rc5-00003-g9e02955991-dirty (Sep 19 2022 - 21:49:01 -0300)
CPU: Freescale i.MX8MMQ rev1.0 at 1200 MHz Reset cause: POR Model: FSL i.MX8MM EVK board DRAM: 2 GiB Core: 176 devices, 23 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial@30890000 Out: serial@30890000 Err: serial@30890000 SEC0: RNG instantiated Net: eth0: ethernet@30be0000 Hit any key to stop autoboot: 0 u-boot=>
One issue that I observed and haven't had a chance to debug yet is that running 'ums 0 mmc 1' works only when issued for the first time.
If I interrupt with CRLC+C and then launch 'ums 0 mmc 1' again, it does not work.
This is unrelated to SDP and happens when I boot from SD card as well.
If you have any ideas, please let me know.
I am not sure, the master branch has this issue? Any specific config option required?
Thanks, Peng.
Thanks,
Fabio Estevam

Hi Peng,
On Wed, Sep 21, 2022 at 2:25 AM Peng Fan peng.fan@oss.nxp.com wrote:
I am not sure, the master branch has this issue? Any specific config option required?
Yes, to reproduce this issue on U-Boot master, just need to apply this series plus Marek's fix: https://lore.kernel.org/u-boot/CAOMZO5Cid5eck=ahiowbAKOjaQNzOORNLU-PxadkMFSE...
It looks like some clock-related issue:
u-boot=> ums 0 mmc 1 UMS: LUN 0, dev mmc 1, hwpart 0, sector 0x0, count 0x3b72400 CTRL+C - Operation aborted clk usb_bus already disabled
After issuing CTRL+C, dmesg on the host PC shows lots of USB failures.
If you have any suggestions, please let me know.
Thanks

On 9/20/2022 8:20 AM, Fabio Estevam wrote:
Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'.
With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command:
$ uuu -brun spl flash.bin
Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.
Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size.
Signed-off-by: Fabio Estevam festevam@denx.de
Reviewed-by: Peng Fan peng.fan@nxp.com
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++ configs/imx8mm_evk_defconfig | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi index 36fbf56bc5..d82428f8fe 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -20,6 +20,10 @@ }; };
+&aips4 {
- u-boot,dm-spl;
+};
- ®_usdhc2_vmmc { u-boot,off-on-delay-us = <20000>; };
@@ -84,6 +88,18 @@ u-boot,dm-spl; };
+&usbmisc1 {
- u-boot,dm-spl;
+};
+&usbphynop1 {
- u-boot,dm-spl;
+};
+&usbotg1 {
- u-boot,dm-spl;
+};
- &usdhc1 { u-boot,dm-spl; };
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 7bcedcd51f..2dff26b3eb 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -17,6 +17,7 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL=y CONFIG_SYS_LOAD_ADDR=0x40480000 +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 @@ -38,6 +39,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 @@ -50,6 +54,8 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y @@ -80,9 +86,13 @@ CONFIG_PHY_ATHEROS=y CONFIG_PHY_GIGE=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 +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_SPL_DM_PMIC_PCA9450=y CONFIG_DM_REGULATOR=y @@ -97,4 +107,15 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_USB=y +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="FSL" +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

Add Serial Download Protocol support as it is a useful method to load flash.bin to RAM and run it via 'uuu'. With this patch, it is possible to start both U-Boot SPL and U-Boot proper using the following 'uuu'command: $ uuu -brun spl flash.bin Based on a patch from Marek Vasut for the imx8mm-mx8menlo board. Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO to reduce its size. Signed-off-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 8:20 AM, Fabio Estevam wrote:
Add an entry for USB boot so that U-Boot could be loaded via the Serial Download Protocol.
Signed-off-by: Fabio Estevam festevam@denx.de
Reviewed-by: Peng Fan peng.fan@nxp.com
board/freescale/imx8mm_evk/spl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index e2eb1426c8..c827ed5546 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -33,6 +33,8 @@ DECLARE_GLOBAL_DATA_PTR; int spl_board_boot_device(enum boot_device boot_dev_spl) { switch (boot_dev_spl) {
- case USB_BOOT:
case SD2_BOOT: case MMC2_BOOT: return BOOT_DEVICE_MMC1;return BOOT_DEVICE_BOARD;

Add an entry for USB boot so that U-Boot could be loaded via the Serial Download Protocol. Signed-off-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
participants (6)
-
Fabio Estevam
-
Fabio Estevam
-
Michael Nazzareno Trimarchi
-
Peng Fan
-
sbabic@denx.de
-
ZHIZHIKIN Andrey