diff mbox

[U-Boot,v3,3/3] spl: add USB Gadget config option

Message ID 20161115210246.2245-4-stefan@agner.ch
State Accepted
Commit e94793c844a40606252f2e3f6428063e057b3fd2
Delegated to: Tom Rini
Headers show

Commit Message

Stefan Agner Nov. 15, 2016, 9:02 p.m. UTC
From: Stefan Agner <stefan.agner@toradex.com>

Introduce USB Gadget config option. This allows to combine Makefile
entries for SPL_USBETH_SUPPORT and SPL_DFU_SUPPORT.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

---

Changes in v3:
- Fix depends on SPL_USB_GADGET_SUPPORT and use if statement

Changes in v2: None

 common/spl/Kconfig                  | 33 +++++++++++++++++++++------------
 configs/am335x_evm_usbspl_defconfig |  1 +
 drivers/Makefile                    |  5 ++---
 drivers/usb/gadget/Makefile         |  3 ++-
 scripts/Makefile.spl                |  2 +-
 5 files changed, 27 insertions(+), 17 deletions(-)

Comments

Ɓukasz Majewski Nov. 16, 2016, 2:31 p.m. UTC | #1
Hi Stefan,

> From: Stefan Agner <stefan.agner@toradex.com>
> 
> Introduce USB Gadget config option. This allows to combine Makefile
> entries for SPL_USBETH_SUPPORT and SPL_DFU_SUPPORT.
> 
> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

Thanks for the patch.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> 
> ---
> 
> Changes in v3:
> - Fix depends on SPL_USB_GADGET_SUPPORT and use if statement
> 
> Changes in v2: None
> 
>  common/spl/Kconfig                  | 33
> +++++++++++++++++++++------------ configs/am335x_evm_usbspl_defconfig
> |  1 + drivers/Makefile                    |  5 ++---
>  drivers/usb/gadget/Makefile         |  3 ++-
>  scripts/Makefile.spl                |  2 +-
>  5 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 54bcba3..3305299 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -465,17 +465,6 @@ config SPL_SPI_SUPPORT
>  	  enable SPI drivers that are needed for other purposes
> also, such as a SPI PMIC.
>  
> -config SPL_USBETH_SUPPORT
> -	bool "Support USB Ethernet drivers"
> -	depends on SPL
> -	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_SUPPORT and SPL_ETH_SUPPORT.
> -
>  config SPL_USB_HOST_SUPPORT
>  	bool "Support USB host drivers"
>  	depends on SPL
> @@ -497,9 +486,27 @@ config SPL_USB_SUPPORT
>  	  config options. This enables loading from USB using a
> configured device.
>  
> +config SPL_USB_GADGET_SUPPORT
> +	bool "Suppport USB Gadget drivers"
> +	depends on SPL
> +	help
> +	  Enable USB Gadget API which allows to enable USB device
> functions
> +	  in SPL.
> +
> +if SPL_USB_GADGET_SUPPORT
> +
> +config SPL_USBETH_SUPPORT
> +	bool "Support USB Ethernet drivers"
> +	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_SUPPORT and SPL_ETH_SUPPORT.
> +
>  config SPL_DFU_SUPPORT
>  	bool "Support DFU (Device Firmware Upgarde)"
> -	depends on SPL
>  	select SPL_HASH_SUPPORT
>  	help
>  	  This feature enables the DFU (Device Firmware Upgarde) in
> SPL with @@ -523,6 +530,8 @@ config SPL_DFU_RAM
>  
>  endchoice
>  
> +endif
> +
>  config SPL_WATCHDOG_SUPPORT
>  	bool "Support watchdog drivers"
>  	depends on SPL
> diff --git a/configs/am335x_evm_usbspl_defconfig
> b/configs/am335x_evm_usbspl_defconfig index 8c28e28..fdb6f77 100644
> --- a/configs/am335x_evm_usbspl_defconfig
> +++ b/configs/am335x_evm_usbspl_defconfig
> @@ -12,6 +12,7 @@ CONFIG_SPL_MTD_SUPPORT=y
>  CONFIG_SPL_MUSB_NEW_SUPPORT=y
>  CONFIG_SPL_NET_SUPPORT=y
>  CONFIG_SPL_OS_BOOT=y
> +CONFIG_SPL_GADGET_SUPPORT=y
>  CONFIG_SPL_USBETH_SUPPORT=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_CMD_BOOTZ=y
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 40aba58..c19fa14 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -33,9 +33,8 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
>  obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
> -obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
> -obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
> -obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/
>  obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
>  obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
>  obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index 5b18e8c..0fbbb7c 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -9,6 +9,7 @@ obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o
> usbstring.o obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o
> usbstring.o 
>  ifdef CONFIG_SPL_BUILD
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += g_dnl.o
>  obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
>  endif
>  
> @@ -21,8 +22,8 @@ obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
>  obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
>  obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
>  obj-$(CONFIG_CI_UDC)	+= ci_udc.o
> -obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
>  ifndef CONFIG_SPL_BUILD
> +obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
>  obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
>  obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
>  obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 1e3b60a..0ca8430 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -66,7 +66,7 @@ endif
>  
>  libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
>  libs-y += drivers/
> -libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
> +libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
>  libs-y += dts/
>  libs-y += fs/
>  libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
diff mbox

Patch

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 54bcba3..3305299 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -465,17 +465,6 @@  config SPL_SPI_SUPPORT
 	  enable SPI drivers that are needed for other purposes also, such
 	  as a SPI PMIC.
 
-config SPL_USBETH_SUPPORT
-	bool "Support USB Ethernet drivers"
-	depends on SPL
-	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_SUPPORT and SPL_ETH_SUPPORT.
-
 config SPL_USB_HOST_SUPPORT
 	bool "Support USB host drivers"
 	depends on SPL
@@ -497,9 +486,27 @@  config SPL_USB_SUPPORT
 	  config options. This enables loading from USB using a configured
 	  device.
 
+config SPL_USB_GADGET_SUPPORT
+	bool "Suppport USB Gadget drivers"
+	depends on SPL
+	help
+	  Enable USB Gadget API which allows to enable USB device functions
+	  in SPL.
+
+if SPL_USB_GADGET_SUPPORT
+
+config SPL_USBETH_SUPPORT
+	bool "Support USB Ethernet drivers"
+	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_SUPPORT and SPL_ETH_SUPPORT.
+
 config SPL_DFU_SUPPORT
 	bool "Support DFU (Device Firmware Upgarde)"
-	depends on SPL
 	select SPL_HASH_SUPPORT
 	help
 	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
@@ -523,6 +530,8 @@  config SPL_DFU_RAM
 
 endchoice
 
+endif
+
 config SPL_WATCHDOG_SUPPORT
 	bool "Support watchdog drivers"
 	depends on SPL
diff --git a/configs/am335x_evm_usbspl_defconfig b/configs/am335x_evm_usbspl_defconfig
index 8c28e28..fdb6f77 100644
--- a/configs/am335x_evm_usbspl_defconfig
+++ b/configs/am335x_evm_usbspl_defconfig
@@ -12,6 +12,7 @@  CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_NET_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
+CONFIG_SPL_GADGET_SUPPORT=y
 CONFIG_SPL_USBETH_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
diff --git a/drivers/Makefile b/drivers/Makefile
index 40aba58..c19fa14 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -33,9 +33,8 @@  obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
-obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
-obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
-obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/
 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
 obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 5b18e8c..0fbbb7c 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -9,6 +9,7 @@  obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
 obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 
 ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += g_dnl.o
 obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
 endif
 
@@ -21,8 +22,8 @@  obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
 obj-$(CONFIG_CI_UDC)	+= ci_udc.o
-obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
 ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
 obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
 obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 1e3b60a..0ca8430 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -66,7 +66,7 @@  endif
 
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
+libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/