Skip to contentSkip to conversation

usb: Move SPL_USB_HOST Kconfig symbol to drivers/usb/

PATCH In review Marek Vasut 2 participants 8 messages May 6, 2023 – May 16, 2023 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 usb: Move SPL_USB_HOST Kconfig symbol to drivers/usb/

To avoid piling up all the various Kconfig symbols in one place, i.e. common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ . This commit moves SPL_USB_HOST and updates help text of both USB_HOST and SPL_USB_HOST .

---
Cc: Andrew Davis <[email protected]>
Cc: Chris Packham <[email protected]>
Cc: Jim Liu <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Weijie Gao <[email protected]>

---
 common/spl/Kconfig       | 10 ----------
 drivers/usb/host/Kconfig | 13 +++++++++++++
 2 files changed, 13 insertions(+), 10 deletions(-)
common/spl/Kconfig +0 -10
index 2c042ad3066..03d0fd90e09 100644
@@ -1345,16 +1345,6 @@ config SPL_THERMAL
 	  automatic power-off when the temperature gets too high or low. Other
 	  devices may be discrete but connected on a suitable bus.
 
-config SPL_USB_HOST
-	bool "Support USB host drivers"
-	help
-	  Enable access to USB (Universal Serial Bus) host devices so that
-	  SPL can load U-Boot from a connected USB peripheral, such as a USB
-	  flash stick. While USB takes a little longer to start up than most
-	  buses, it is very flexible since many different types of storage
-	  device can be attached. This option enables the drivers in
-	  drivers/usb/host as part of an SPL build.
-
 config SPL_USB_STORAGE
 	bool "Support loading from USB"
 	depends on SPL_USB_HOST
drivers/usb/host/Kconfig +13 -0
index 6213b3c95fa..1a883babf4c 100644
@@ -6,6 +6,19 @@ comment "USB Host Controller Drivers"
 config USB_HOST
 	bool
 	select DM_USB
+	help
+	  Enable access to USB (Universal Serial Bus) host devices so that
+	  SPL can load U-Boot from a connected USB peripheral, such as a USB
+	  flash stick. While USB takes a little longer to start up than most
+	  buses, it is very flexible since many different types of storage
+	  device can be attached.
+
+config SPL_USB_HOST
+	bool "Support USB host drivers"
+	depends on SPL
+	help
+	  For detailed help see USB_HOST Kconfig symbol. This option enables
+	  the drivers in drivers/usb/host as part of an SPL build.
 
 config USB_XHCI_HCD
 	bool "xHCI HCD (USB 3.0) support"
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/4 usb: Move SPL_USB_STORAGE Kconfig symbol to drivers/usb/

To avoid piling up all the various Kconfig symbols in one place, i.e. common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ . This commit moves SPL_USB_STORAGE and matching SYS_USB_FAT_BOOT_PARTITION .

---
Cc: Andrew Davis <[email protected]>
Cc: Chris Packham <[email protected]>
Cc: Jim Liu <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Weijie Gao <[email protected]>

---
 common/spl/Kconfig  | 17 -----------------
 drivers/usb/Kconfig | 22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 17 deletions(-)
common/spl/Kconfig +0 -17
index 03d0fd90e09..5ad29af21cb 100644
@@ -1345,23 +1345,6 @@ config SPL_THERMAL
 	  automatic power-off when the temperature gets too high or low. Other
 	  devices may be discrete but connected on a suitable bus.
 
-config SPL_USB_STORAGE
-	bool "Support loading from USB"
-	depends on SPL_USB_HOST
-	help
-	  Enable support for USB devices in SPL. This allows use of USB
-	  devices such as hard drives and flash drivers for loading U-Boot.
-	  The actual drivers are enabled separately using the normal U-Boot
-	  config options. This enables loading from USB using a configured
-	  device.
-
-config SYS_USB_FAT_BOOT_PARTITION
-	int "Partition on USB to use to load U-Boot from"
-	depends on SPL_USB_STORAGE
-	default 1
-	help
-	  Partition on the USB storage device to load U-Boot from
-
 config SPL_USB_GADGET
 	bool "Suppport USB Gadget drivers"
 	help
drivers/usb/Kconfig +22 -0
index 94fb32d107c..a972d87c7ad 100644
@@ -126,6 +126,28 @@ config USB_HUB_DEBOUNCE_TIMEOUT
 	  value = 1s because some usb device needs around 1.5s to be initialized
 	  and a 2s value should solve detection issue on problematic USB keys.
 
+if SPL_USB_HOST
+
+comment "USB peripherals in SPL"
+
+config SPL_USB_STORAGE
+	bool "Support loading from USB"
+	help
+	  Enable support for USB devices in SPL. This allows use of USB
+	  devices such as hard drives and flash drivers for loading U-Boot.
+	  The actual drivers are enabled separately using the normal U-Boot
+	  config options. This enables loading from USB using a configured
+	  device.
+
+config SYS_USB_FAT_BOOT_PARTITION
+	int "Partition on USB to use to load U-Boot from"
+	depends on SPL_USB_STORAGE
+	default 1
+	help
+	  Partition on the USB storage device to load U-Boot from.
+
+endif
+
 if USB_KEYBOARD
 
 config USB_KEYBOARD_FN_KEYS
Signature · 1 line
2.39.2
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] usb: Move SPL_USB_STORAGE Kconfig symbol to drivers/usb/

Quoted 5 lines · Marek Vasut

To avoid piling up all the various Kconfig symbols in one place, i.e. common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ . This commit moves SPL_USB_STORAGE and matching SYS_USB_FAT_BOOT_PARTITION .

Signature · 1 line
Tom
#3 lore raw

PATCH 3/4 usb: Move SPL_USB_GADGET and related Kconfig symbols to drivers/usb/

In reply to Marek Vasut

To avoid piling up all the various Kconfig symbols in one place, i.e. common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ . This commit moves SPL_USB_GADGET and related symbols. Fix typo and rename SPL_USB_GADGET to "USB Gadget Support in SPL" .

Update the gadget Makefile to match the symbol changes.

---
Cc: Andrew Davis <[email protected]>
Cc: Chris Packham <[email protected]>
Cc: Jim Liu <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Weijie Gao <[email protected]>

---
 common/spl/Kconfig          | 63 ------------------------------------
 drivers/usb/gadget/Kconfig  | 64 +++++++++++++++++++++++++++++++++++++
 drivers/usb/gadget/Makefile |  5 ++-
 3 files changed, 66 insertions(+), 66 deletions(-)
common/spl/Kconfig +0 -63
index 5ad29af21cb..6774ba5b42e 100644
@@ -1345,69 +1345,6 @@ config SPL_THERMAL
 	  automatic power-off when the temperature gets too high or low. Other
 	  devices may be discrete but connected on a suitable bus.
 
-config SPL_USB_GADGET
-	bool "Suppport USB Gadget drivers"
-	help
-	  Enable USB Gadget API which allows to enable USB device functions
-	  in SPL.
-
-if SPL_USB_GADGET
-
-config SPL_USB_ETHER
-	bool "Support USB Ethernet drivers"
-	depends on SPL_NET
-	help
-	  Enable access to the USB network subsystem and associated
-	  drivers in SPL. This permits SPL to load U-Boot over a
-	  USB-connected Ethernet link (such as a USB Ethernet dongle) rather
-	  than from an onboard peripheral. Environment support is required
-	  since the network stack uses a number of environment variables.
-	  See also SPL_NET and SPL_ETH.
-
-config SPL_DFU
-	bool "Support DFU (Device Firmware Upgrade)"
-	select SPL_HASH
-	select SPL_DFU_NO_RESET
-	depends on SPL_RAM_SUPPORT
-	help
-	  This feature enables the DFU (Device Firmware Upgrade) in SPL with
-	  RAM memory device support. The ROM code will load and execute
-	  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
-	  selected device partition from host-pc using dfu-utils.
-	  This feature is useful to flash the binaries to factory or bare-metal
-	  boards using USB interface.
-
-choice
-	bool "DFU device selection"
-	depends on SPL_DFU
-
-config SPL_DFU_RAM
-	bool "RAM device"
-	depends on SPL_DFU && SPL_RAM_SUPPORT
-	help
-	 select RAM/DDR memory device for loading binary images
-	 (u-boot/kernel) to the selected device partition using
-	 DFU and execute the u-boot/kernel from RAM.
-
-endchoice
-
-config SPL_USB_SDP_SUPPORT
-	bool "Support SDP (Serial Download Protocol)"
-	depends on SPL_SERIAL
-	help
-	  Enable Serial Download Protocol (SDP) device support in SPL. This
-	  allows to download images into memory and execute (jump to) them
-	  using the same protocol as implemented by the i.MX family's boot ROM.
-
-config SPL_SDP_USB_DEV
-	int "SDP USB controller index"
-	default 0
-	depends on SPL_USB_SDP_SUPPORT
-	help
-	  Some boards have USB controller other than 0. Define this option
-	  so it can be used in compiled environment.
-endif
-
 config SPL_WATCHDOG
 	bool "Support watchdog drivers"
 	imply SPL_WDT if !HW_WATCHDOG
drivers/usb/gadget/Kconfig +64 -0

73 lines not on this page · raw message

drivers/usb/gadget/Makefile +2 -3
index 6cfe0f3a041..a9edeb9f396 100644
@@ -3,8 +3,8 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, [email protected].
 
-obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
-obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
+obj-$(CONFIG_$(SPL_TPL_)USB_GADGET) += epautoconf.o config.o usbstring.o
+obj-$(CONFIG_$(SPL_TPL_)USB_ETHER) += epautoconf.o config.o usbstring.o ether.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_USB_GADGET) += g_dnl.o
@@ -34,7 +34,6 @@ endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
 
-obj-$(CONFIG_USB_ETHER) += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
 
 # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
Signature · 1 line
2.39.2
Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] usb: Move SPL_USB_GADGET and related Kconfig symbols to drivers/usb/

Quoted 8 lines · Marek Vasut

To avoid piling up all the various Kconfig symbols in one place, i.e. common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ . This commit moves SPL_USB_GADGET and related symbols. Fix typo and rename SPL_USB_GADGET to "USB Gadget Support in SPL" .

Update the gadget Makefile to match the symbol changes.

Signature · 1 line
Tom
#5 lore raw

PATCH 4/4 usb: gadget: Add and use matching SPL USB ethernet gadget Kconfig symbols

In reply to Marek Vasut

Define SPL_USB_ETH_RNDIS symbol to make it possible to select USB gadget ethernet support in SPL and U-Boot separately in Kconfig . Make use of the new symbols in gadget Makefile and move the rndis.o just below the now merged USB_ETHER symbol in Makefile.

---
Cc: Andrew Davis <[email protected]>
Cc: Chris Packham <[email protected]>
Cc: Jim Liu <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Weijie Gao <[email protected]>

---
 drivers/usb/gadget/Kconfig  | 24 ++++++++++++++++++++++++
 drivers/usb/gadget/Makefile |  3 +--
 2 files changed, 25 insertions(+), 2 deletions(-)
drivers/usb/gadget/Kconfig +24 -0
index 6f85089a9bf..1cfe6022842 100644
@@ -285,6 +285,30 @@ config SPL_USB_ETHER
 	  since the network stack uses a number of environment variables.
 	  See also SPL_NET and SPL_ETH.
 
+if SPL_USB_ETHER
+
+choice
+	prompt "USB Ethernet Gadget Model in SPL"
+	default SPL_USB_ETH_RNDIS
+	help
+	  There is several models (protocols) to implement Ethernet over USB
+	  devices. The main ones are Microsoft's RNDIS and USB's CDC-Ethernet
+	  (also called CDC-ECM). RNDIS is obviously compatible with Windows,
+	  while CDC-ECM is not. Most other operating systems support both, so
+	  if inter-operability is a concern, RNDIS is to be preferred.
+
+config SPL_USB_ETH_RNDIS
+	bool "RNDIS Protocol"
+	help
+	  The RNDIS (Remote Network Driver Interface Specification) is a
+	  Microsoft proprietary protocol to create an Ethernet device over USB.
+	  Windows obviously supports it, as well as all the major operating
+	  systems, so it's the best option for compatibility.
+
+endchoice
+
+endif # SPL_USB_ETHER
+
 config SPL_DFU
 	bool "Support DFU (Device Firmware Upgrade) in SPL"
 	select SPL_HASH
drivers/usb/gadget/Makefile +1 -2
index a9edeb9f396..6abcce0d9c7 100644
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_$(SPL_TPL_)USB_GADGET) += epautoconf.o config.o usbstring.o
 obj-$(CONFIG_$(SPL_TPL_)USB_ETHER) += epautoconf.o config.o usbstring.o ether.o
+obj-$(CONFIG_$(SPL_TPL_)USB_ETH_RNDIS) += rndis.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_USB_GADGET) += g_dnl.o
@@ -34,8 +35,6 @@ endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
 
-obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
-
 # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
 # This is really only N900 and USBTTY now.
 obj-$(CONFIG_USB_DEVICE) += core.o ep0.o
Signature · 1 line
2.39.2
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] usb: gadget: Add and use matching SPL USB ethernet gadget Kconfig symbols

Quoted 6 lines · Marek Vasut

Define SPL_USB_ETH_RNDIS symbol to make it possible to select USB gadget ethernet support in SPL and U-Boot separately in Kconfig . Make use of the new symbols in gadget Makefile and move the rndis.o just below the now merged USB_ETHER symbol in Makefile.

Signature · 1 line
Tom