Skip to contentSkip to conversation

imx8mm_evk: Add an entry for USB boot

PATCH In review Fabio Estevam 6 participants 13 messages Sep 20, 2022 – Oct 21, 2022

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

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.

---
 board/freescale/imx8mm_evk/spl.c | 2 ++
 1 file changed, 2 insertions(+)
board/freescale/imx8mm_evk/spl.c +2 -0
index e2eb1426c8..c827ed5546 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 imx8mm_evk: Add Serial Download Protocol support

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.

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
 configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
index 36fbf56bc5..d82428f8fe 100644
@@ -20,6 +20,10 @@
 	};
 };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
 &reg_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;
 };
configs/imx8mm_evk_defconfig +21 -0
index 7bcedcd51f..2dff26b3eb 100644
@@ -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
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hi

Quoted 59 lines · Fabio Estevam

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.

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
 configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
index 36fbf56bc5..d82428f8fe 100644
@@ -20,6 +20,10 @@
        };
 };
 
+&aips4 {
+       u-boot,dm-spl;
+};
+
 &reg_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;
 };
configs/imx8mm_evk_defconfig +0 -0
index 7bcedcd51f..2dff26b3eb 100644

configs/imx8mm_evk_defconfig CONFIG_SPL_SERIAL=y · line 20

Quoted 4 lines
configs/imx8mm_evk_defconfig +1 -0
@@ -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

Quoted 55 lines
configs/imx8mm_evk_defconfig +20 -1
 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

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
#3 lore raw

RE: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hello Michael,

Quoted 70 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Nazzareno Trimarchi
Sent: Tuesday, September 20, 2022 7:46 AM
To: Fabio Estevam <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hi

arch/arm/dts/imx8mm-evk-u-

Quoted 21 lines · Fabio Estevam

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.

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
 configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u- renamed from arch/arm/dts/imx8mm-evk-u-boot.dtsi +0 -0

boot.dtsi

Quoted 37 lines

index 36fbf56bc5..d82428f8fe 100644

arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
@@ -20,6 +20,10 @@
        };
 };
 
+&aips4 {
+       u-boot,dm-spl;
+};
+
 &reg_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;
 };
configs/imx8mm_evk_defconfig +0 -0
index 7bcedcd51f..2dff26b3eb 100644
Quoted 8 lines

configs/imx8mm_evk_defconfig CONFIG_SPL_SERIAL=y · line 20

Quoted 5 lines
configs/imx8mm_evk_defconfig +1 -0
@@ -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

Quoted 72 lines

Michael

Quoted 53 lines
configs/imx8mm_evk_defconfig +20 -1
 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
--
Quoted 2 lines

2.25.1

--
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

#4 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

HI

Quoted 82 lines · ZHIZHIKIN Andrey

Hello Michael,

Quoted 70 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Nazzareno Trimarchi
Sent: Tuesday, September 20, 2022 7:46 AM
To: Fabio Estevam <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hi

arch/arm/dts/imx8mm-evk-u-

Quoted 21 lines · Fabio Estevam

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.

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
 configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u- renamed from arch/arm/dts/imx8mm-evk-u-boot.dtsi +0 -0

boot.dtsi

Quoted 37 lines

index 36fbf56bc5..d82428f8fe 100644

arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
@@ -20,6 +20,10 @@
        };
 };
 
+&aips4 {
+       u-boot,dm-spl;
+};
+
 &reg_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;
 };
configs/imx8mm_evk_defconfig +0 -0
index 7bcedcd51f..2dff26b3eb 100644
Quoted 8 lines

configs/imx8mm_evk_defconfig CONFIG_SPL_SERIAL=y · line 20

Quoted 5 lines
configs/imx8mm_evk_defconfig +1 -0
@@ -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?

Quoted 4 lines

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

Quoted 74 lines

-- andrey

Quoted 72 lines

Michael

Quoted 53 lines
configs/imx8mm_evk_defconfig +20 -1
 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
--
Quoted 2 lines

2.25.1

--
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

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
#5 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

In reply to Fabio Estevam

Hi Fabio,

Just have a question, the tcpci driver is not supported, so how do you manage to make SDP work?

Regards,
Peng.

Quoted 114 lines · Fabio Estevam

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.

---
  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
  configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
  2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
index 36fbf56bc5..d82428f8fe 100644
@@ -20,6 +20,10 @@
  	};
  };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
  &reg_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;
  };
configs/imx8mm_evk_defconfig +21 -0
index 7bcedcd51f..2dff26b3eb 100644
@@ -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
reviewer
#6 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hi Peng,

Quoted 5 lines · Peng Fan

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

#7 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Quoted 4 lines · Fabio Estevam

Hi Peng,

Quoted 1 line · Peng Fan
Quoted 8 lines
Quoted 4 lines

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.

Quoted 46 lines

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.

Quoted 6 lines

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.

Quoted 4 lines

Thanks,

Fabio Estevam

reviewer
#8 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

Hi Peng,

Quoted 2 lines · Peng Fan

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-PxadkMFSEnqvNmg@mail.gmail.com/T/#t

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

Reviewed-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] imx8mm_evk: Add Serial Download Protocol support

In reply to Fabio Estevam
Quoted 6 lines · Fabio Estevam

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:

Quoted 8 lines
$ 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.

Quoted 100 lines
---
  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 16 ++++++++++++++++
  configs/imx8mm_evk_defconfig        | 21 +++++++++++++++++++++
  2 files changed, 37 insertions(+)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -0
index 36fbf56bc5..d82428f8fe 100644
@@ -20,6 +20,10 @@
  	};
  };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
  &reg_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;
  };
configs/imx8mm_evk_defconfig +21 -0
index 7bcedcd51f..2dff26b3eb 100644
@@ -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
#10 lore raw

PATCH 2/2 imx8mm_evk: Add Serial Download Protocol support

In reply to Fabio Estevam
Quoted 10 lines

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 <[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/2
#11 lore raw
In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

Add an entry for USB boot so that U-Boot could be loaded via the Serial Download Protocol.

Quoted 17 lines
---
  board/freescale/imx8mm_evk/spl.c | 2 ++
  1 file changed, 2 insertions(+)
board/freescale/imx8mm_evk/spl.c +2 -0
index e2eb1426c8..c827ed5546 100644
@@ -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;
#12 lore raw

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

In reply to Fabio Estevam
Quoted 4 lines

Add an entry for USB boot so that U-Boot could be loaded via the Serial Download Protocol.

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]
=====================================================================