Skip to contentSkip to conversation

Enable DM USB support (host and gadget) and full RNDIS boot flow

PATCH New Jean-Jacques Hiblot 3 participants 13 messages Jan 22, 2019 – Feb 3, 2019

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

cover 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#Booting_U-Boot_from_the_network

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
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/4 usb: ether: call _usb_eth_halt() if initialization fails

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.

---

 drivers/usb/gadget/ether.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/gadget/ether.c +4 -1
index 3b3d9af681..57edaa3ac8 100644
@@ -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;
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/4 usb: ether: call _usb_eth_halt() if initialization fails

Hi Jean-Jacques,

Quoted 6 lines

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.

Quoted 29 lines

---

 drivers/usb/gadget/ether.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/gadget/ether.c +3 -0
index 3b3d9af681..57edaa3ac8 100644
@@ -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;
 }
 

drivers/usb/gadget/ether.c static int _usb_eth_recv(struct ether_priv · line 2494

Quoted 8 lines
drivers/usb/gadget/ether.c +1 -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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190122/db0191c0/attachment.sig>

#3 lore raw

PATCH 1/4 usb: ether: call _usb_eth_halt() if initialization fails

In reply to Jean-Jacques Hiblot
Quoted 9 lines · Jean-Jacques Hiblot

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190202/d7d2abde/attachment.sig>
#4 lore raw

PATCH 2/4 ARM: DTS: am335x-evm: Use USB0 in peripheral mode

In reply to Jean-Jacques Hiblot

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.

---

 arch/arm/dts/am335x-evm-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-evm-u-boot.dtsi +4 -0
index 0341600342..b6b97ed16d 100644
@@ -7,3 +7,7 @@
 &mmc3 {
 	status = "disabled";
 };
+
+&usb0 {
+	dr_mode = "peripheral";
+};
Signature · 1 line
2.17.1
#5 lore raw

PATCH 2/4 ARM: DTS: am335x-evm: Use USB0 in peripheral mode

Quoted 4 lines · Jean-Jacques Hiblot

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190122/1446e91b/attachment.sig>
#6 lore raw

PATCH 2/4 ARM: DTS: am335x-evm: Use USB0 in peripheral mode

In reply to Jean-Jacques Hiblot
Quoted 5 lines · Jean-Jacques Hiblot

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190202/3baaecc9/attachment.sig>
#7 lore raw

PATCH 3/4 configs: am335x_evm: enable DM_USB_GADGET and USB_ETHER in u-boot and SPL

In reply to Jean-Jacques Hiblot

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.

---

 configs/am335x_evm_defconfig | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
configs/am335x_evm_defconfig +7 -1
index 21c5bdb83e..4b22c19dfb 100644
@@ -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
Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/4 configs: am335x_evm: enable DM_USB_GADGET and USB_ETHER in u-boot and SPL

Quoted 7 lines · Jean-Jacques Hiblot

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.

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190122/1f660ab7/attachment.sig>
#9 lore raw

PATCH 3/4 configs: am335x_evm: enable DM_USB_GADGET and USB_ETHER in u-boot and SPL

In reply to Jean-Jacques Hiblot
Quoted 8 lines · Jean-Jacques Hiblot

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190202/d45e42d6/attachment.sig>
#10 lore raw

PATCH 4/4 configs: removing am335x_evm_usbspl_defconfig

In reply to Jean-Jacques Hiblot

This feature is now supported by the main config for am335x_evm:
am335x_evm_defconfig

---

 configs/am335x_evm_usbspl_defconfig | 55 -----------------------------
 1 file changed, 55 deletions(-)
 delete mode 100644 configs/am335x_evm_usbspl_defconfig
configs/am335x_evm_usbspl_defconfig deleted +0 -55
deleted file mode 100644
index bda1785e7e..0000000000
@@ -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
Signature · 1 line
2.17.1
#11 lore raw

PATCH 4/4 configs: removing am335x_evm_usbspl_defconfig

Quoted 5 lines · Jean-Jacques Hiblot

This feature is now supported by the main config for am335x_evm:
am335x_evm_defconfig

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190122/efeeaa5d/attachment.sig>
#12 lore raw

PATCH 4/4 configs: removing am335x_evm_usbspl_defconfig

In reply to Jean-Jacques Hiblot
Quoted 5 lines · Jean-Jacques Hiblot

This feature is now supported by the main config for am335x_evm:
am335x_evm_defconfig

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190202/0d814c8d/attachment.sig>