[U-Boot] [PATCH v1 0/4] Enable DM USB support (host and gadget) and full RNDIS boot flow

The AM335x is able to get its SPL using a RNDIS connection. The goal of this series is to make this feature available out of the box for the am335x-evm There is already a defconfig to handle this use case, but with DM USB it becomes easy to activate the feature in the main defconfig. So the last patch of the series actually removes the defconfig specially crafted for the RNDIS boot flow.
Details on host setup are available there: http://processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User%27s_Guide#Boo...
Jean-Jacques Hiblot (4): usb: ether: call _usb_eth_halt() if initialization fails ARM: DTS: am335x-evm: Use USB0 in peripheral mode configs: am335x_evm: enable DM_USB_GADGET and USB_ETHER in u-boot and SPL configs: removing am335x_evm_usbspl_defconfig
arch/arm/dts/am335x-evm-u-boot.dtsi | 4 +++ configs/am335x_evm_defconfig | 8 ++++- configs/am335x_evm_usbspl_defconfig | 55 ----------------------------- drivers/usb/gadget/ether.c | 5 ++- 4 files changed, 15 insertions(+), 57 deletions(-) delete mode 100644 configs/am335x_evm_usbspl_defconfig

If the host does not respond in time, the initialization fails. However the usb ether driver will still be registered. This will make usb_gadget_probe_driver() fail the next time the initialization is attempted because it cannot find an available UDC.
Fixing this by calling _usb_eth_halt() when the init fails.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
drivers/usb/gadget/ether.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 3b3d9af681..57edaa3ac8 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -2333,6 +2333,8 @@ fail: }
/*-------------------------------------------------------------------------*/ +static void _usb_eth_halt(struct ether_priv *priv); + static int _usb_eth_init(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev; @@ -2406,6 +2408,7 @@ static int _usb_eth_init(struct ether_priv *priv) rx_submit(dev, dev->rx_req, 0); return 0; fail: + _usb_eth_halt(priv); return -1; }
@@ -2485,7 +2488,7 @@ static int _usb_eth_recv(struct ether_priv *priv) return 0; }
-void _usb_eth_halt(struct ether_priv *priv) +static void _usb_eth_halt(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev;

Hi Jean-Jacques,
If the host does not respond in time, the initialization fails. However the usb ether driver will still be registered. This will make usb_gadget_probe_driver() fail the next time the initialization is attempted because it cannot find an available UDC.
Fixing this by calling _usb_eth_halt() when the init fails.
Acked-by: Lukasz Majewski lukma@denx.de
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
drivers/usb/gadget/ether.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 3b3d9af681..57edaa3ac8 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -2333,6 +2333,8 @@ fail: }
/*-------------------------------------------------------------------------*/ +static void _usb_eth_halt(struct ether_priv *priv);
static int _usb_eth_init(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev; @@ -2406,6 +2408,7 @@ static int _usb_eth_init(struct ether_priv *priv) rx_submit(dev, dev->rx_req, 0); return 0; fail:
- _usb_eth_halt(priv); return -1;
}
@@ -2485,7 +2488,7 @@ static int _usb_eth_recv(struct ether_priv *priv) return 0; }
-void _usb_eth_halt(struct ether_priv *priv) +static void _usb_eth_halt(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev;
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

On Tue, Jan 22, 2019 at 04:48:16PM +0100, Jean-Jacques Hiblot wrote:
If the host does not respond in time, the initialization fails. However the usb ether driver will still be registered. This will make usb_gadget_probe_driver() fail the next time the initialization is attempted because it cannot find an available UDC.
Fixing this by calling _usb_eth_halt() when the init fails.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Acked-by: Lukasz Majewski lukma@denx.de
Applied to u-boot/master, thanks!

This USB port is mainly used for RNDIS and DFU. To be able to use it with DM_USB and DM_USB_GADGET, we need to provide a dr_mode value in the DTS.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
arch/arm/dts/am335x-evm-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi index 0341600342..b6b97ed16d 100644 --- a/arch/arm/dts/am335x-evm-u-boot.dtsi +++ b/arch/arm/dts/am335x-evm-u-boot.dtsi @@ -7,3 +7,7 @@ &mmc3 { status = "disabled"; }; + +&usb0 { + dr_mode = "peripheral"; +};

On Tue, Jan 22, 2019 at 04:48:17PM +0100, Jean-Jacques Hiblot wrote:
This USB port is mainly used for RNDIS and DFU. To be able to use it with DM_USB and DM_USB_GADGET, we need to provide a dr_mode value in the DTS.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

On Tue, Jan 22, 2019 at 04:48:17PM +0100, Jean-Jacques Hiblot wrote:
This USB port is mainly used for RNDIS and DFU. To be able to use it with DM_USB and DM_USB_GADGET, we need to provide a dr_mode value in the DTS.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

The AM335x ROM boot is able to download the SPL from a RNDIS connection on USB0. To enable a full RNDIS boot flow (romboot -> SPL -> u-boot -> ..), we can use USB_ETHER in SPL and u-boot. However this increase the size of the SPL past its limit. So removing the unused SPL_EXT_SUPPORT.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
configs/am335x_evm_defconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index 21c5bdb83e..4b22c19dfb 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -10,9 +10,14 @@ CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run f CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_ARCH_MISC_INIT=y +# CONFIG_SPL_EXT_SUPPORT is not set CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_MUSB_NEW_SUPPORT=y +CONFIG_SPL_NET_SUPPORT=y +CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_USB_ETHER=y CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x00080000 # CONFIG_CMD_FLASH is not set @@ -51,7 +56,8 @@ CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y -# CONFIG_SPL_DM_USB is not set +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y CONFIG_USB_MUSB_HOST=y CONFIG_USB_MUSB_GADGET=y CONFIG_USB_MUSB_TI=y

On Tue, Jan 22, 2019 at 04:48:18PM +0100, Jean-Jacques Hiblot wrote:
The AM335x ROM boot is able to download the SPL from a RNDIS connection on USB0. To enable a full RNDIS boot flow (romboot -> SPL -> u-boot -> ..), we can use USB_ETHER in SPL and u-boot. However this increase the size of the SPL past its limit. So removing the unused SPL_EXT_SUPPORT.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Since I don't _think_ anyone ever ended up making use of extN support in SPL (even for Falcon mode) I guess this is an OK choice for the "kitchen sink" config.
Reviewed-by: Tom Rini trini@konsulko.com

On Tue, Jan 22, 2019 at 04:48:18PM +0100, Jean-Jacques Hiblot wrote:
The AM335x ROM boot is able to download the SPL from a RNDIS connection on USB0. To enable a full RNDIS boot flow (romboot -> SPL -> u-boot -> ..), we can use USB_ETHER in SPL and u-boot. However this increase the size of the SPL past its limit. So removing the unused SPL_EXT_SUPPORT.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

This feature is now supported by the main config for am335x_evm: am335x_evm_defconfig
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
---
configs/am335x_evm_usbspl_defconfig | 55 ----------------------------- 1 file changed, 55 deletions(-) delete mode 100644 configs/am335x_evm_usbspl_defconfig
diff --git a/configs/am335x_evm_usbspl_defconfig b/configs/am335x_evm_usbspl_defconfig deleted file mode 100644 index bda1785e7e..0000000000 --- a/configs/am335x_evm_usbspl_defconfig +++ /dev/null @@ -1,55 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_OMAP2PLUS=y -CONFIG_TI_COMMON_CMD_OPTIONS=y -CONFIG_AM33XX=y -CONFIG_SPL=y -CONFIG_DISTRO_DEFAULTS=y -# CONFIG_ANDROID_BOOT_IMAGE is not set -CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" -CONFIG_CONSOLE_MUX=y -CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y -CONFIG_SYS_CONSOLE_INFO_QUIET=y -CONFIG_VERSION_VARIABLE=y -CONFIG_ARCH_MISC_INIT=y -CONFIG_SPL_MUSB_NEW_SUPPORT=y -# CONFIG_SPL_NAND_SUPPORT is not set -CONFIG_SPL_NET_SUPPORT=y -CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" -CONFIG_SPL_OS_BOOT=y -CONFIG_SPL_USB_GADGET=y -CONFIG_SPL_USB_ETHER=y -# CONFIG_SPL_YMODEM_SUPPORT is not set -CONFIG_CMD_SPL=y -CONFIG_CMD_SPL_NAND_OFS=0x00080000 -# CONFIG_CMD_FLASH is not set -CONFIG_CMD_NAND=y -# CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_MTDPARTS=y -CONFIG_MTDIDS_DEFAULT="nand0=nand.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)" -CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -CONFIG_NETCONSOLE=y -CONFIG_BOOTCOUNT_LIMIT=y -CONFIG_DFU_MMC=y -CONFIG_DFU_NAND=y -CONFIG_DFU_RAM=y -CONFIG_USB_FUNCTION_FASTBOOT=y -CONFIG_MMC_OMAP_HS=y -CONFIG_NAND=y -CONFIG_SPI_FLASH=y -CONFIG_SPI_FLASH_WINBOND=y -CONFIG_MII=y -CONFIG_DRIVER_TI_CPSW=y -CONFIG_SPI=y -CONFIG_OMAP3_SPI=y -CONFIG_USB=y -CONFIG_USB_MUSB_HOST=y -CONFIG_USB_MUSB_GADGET=y -CONFIG_USB_MUSB_DSPS=y -CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" -CONFIG_USB_GADGET_VENDOR_NUM=0x0451 -CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 -CONFIG_USB_ETHER=y -CONFIG_LZO=y -CONFIG_OF_LIBFDT=y

On Tue, Jan 22, 2019 at 04:48:19PM +0100, Jean-Jacques Hiblot wrote:
This feature is now supported by the main config for am335x_evm: am335x_evm_defconfig
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

On Tue, Jan 22, 2019 at 04:48:19PM +0100, Jean-Jacques Hiblot wrote:
This feature is now supported by the main config for am335x_evm: am335x_evm_defconfig
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!
participants (3)
-
Jean-Jacques Hiblot
-
Lukasz Majewski
-
Tom Rini