[U-Boot] [PATCH 1/9] usb: Fix bug when both DFU & ETHER are defined

Pantelis Antoniou panto at antoniou-consulting.com
Fri Nov 30 17:51:25 CET 2012


When both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined
the makefile links objects twice.

The cleanest way to fix is to use a new define, CONFIG_USB_UTIL
which must be defined when either CONFIG_USB_ETHER or
CONFIG_USB_GADGET are defined.

All affected boards have been modified as well.

Signed-off-by: Pantelis Antoniou <panto at antoniou-consulting.com>
---
 drivers/usb/gadget/Makefile         | 8 ++++++--
 include/configs/am335x_evm.h        | 1 +
 include/configs/am3517_evm.h        | 1 +
 include/configs/h2200.h             | 1 +
 include/configs/omap3_beagle.h      | 1 +
 include/configs/s5p_goni.h          | 1 +
 include/configs/s5pc210_universal.h | 1 +
 include/configs/trats.h             | 1 +
 8 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 040eaba..167f24f 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -25,15 +25,19 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libusb_gadget.o
 
+# required for both USB_GADGET & USB_ETHER
+ifdef CONFIG_USB_UTIL
+COBJS-y += epautoconf.o config.o usbstring.o
+endif
+
 # new USB gadget layer dependencies
 ifdef CONFIG_USB_GADGET
-COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
 endif
 ifdef CONFIG_USB_ETHER
-COBJS-y += ether.o epautoconf.o config.o usbstring.o
+COBJS-y += ether.o
 COBJS-$(CONFIG_USB_ETH_RNDIS) += rndis.o
 COBJS-$(CONFIG_MV_UDC)	+= mv_udc.o
 COBJS-$(CONFIG_CPU_PXA25X) += pxa25x_udc.o
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ab9549b..ee19e54 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -278,6 +278,7 @@
 
 #ifdef CONFIG_MUSB_GADGET
 #define CONFIG_USB_ETHER
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_ETH_RNDIS
 #endif /* CONFIG_MUSB_GADGET */
 
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index ba15325..3aedff3 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -123,6 +123,7 @@
 #ifdef CONFIG_MUSB_GADGET
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_ETHER
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_ETH_RNDIS
 #endif /* CONFIG_MUSB_GADGET */
 
diff --git a/include/configs/h2200.h b/include/configs/h2200.h
index 516a26e..fc27bf0 100644
--- a/include/configs/h2200.h
+++ b/include/configs/h2200.h
@@ -170,6 +170,7 @@
 
 #define CONFIG_USB_GADGET_PXA2XX
 #define CONFIG_USB_ETHER
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_ETH_SUBSET
 
 #define CONFIG_USBNET_DEV_ADDR		"de:ad:be:ef:00:01"
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 12d65f2..04fbb5d 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -123,6 +123,7 @@
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_TWL4030_USB		1
 #define CONFIG_USB_ETHER
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_ETHER_RNDIS
 
 /* USB EHCI */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 56e8347..1e180ade 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -231,6 +231,7 @@
 #define CONFIG_I2C_MULTI_BUS
 #define CONFIG_SYS_MAX_I2C_BUS	7
 #define CONFIG_USB_GADGET
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 894f38b..07ab884 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -258,6 +258,7 @@
 #define CONFIG_POWER_MAX8998
 
 #define CONFIG_USB_GADGET
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 355029e..7c2c875 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -245,6 +245,7 @@
 #define CONFIG_POWER_BATTERY
 #define CONFIG_POWER_BATTERY_TRATS
 #define CONFIG_USB_GADGET
+#define CONFIG_USB_UTIL
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
-- 
1.7.12



More information about the U-Boot mailing list