Fixes commit 013116243950 ("dm: usb: create a new UCLASS ID for USB gadget
devices")

The UCLASS_DRIVER for id UCLASS_USB_GADGET_GENERIC needs to be declared
even for platforms that do not enable DM_USB_GADGET. Otherwise the driver
for their usb peripheral controller fails to bind.

Reported-by: Priit Laes <pl...@plaes.org>
Reported-by: Jagan Teki <ja...@amarulasolutions.com>
Signed-off-by: Jean-Jacques Hiblot <jjhib...@ti.com>
Tested-by: Priit Laes <pl...@plaes.org>

---

build status available here: 
https://travis-ci.org/jjhiblot/u-boot/builds/470396811


 drivers/usb/gadget/udc/Makefile     | 3 ++-
 drivers/usb/gadget/udc/udc-uclass.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
index 38ac2dd..95dbf0c 100644
--- a/drivers/usb/gadget/udc/Makefile
+++ b/drivers/usb/gadget/udc/Makefile
@@ -6,4 +6,5 @@ ifndef CONFIG_$(SPL_)DM_USB_GADGET
 obj-$(CONFIG_USB_DWC3_GADGET)  += udc-core.o
 endif
 
-obj-$(CONFIG_$(SPL_)DM_USB_GADGET)     += udc-uclass.o udc-core.o
+obj-$(CONFIG_$(SPL_)DM_USB_GADGET)     += udc-core.o
+obj-$(CONFIG_$(SPL_)DM) += udc-uclass.o
diff --git a/drivers/usb/gadget/udc/udc-uclass.c 
b/drivers/usb/gadget/udc/udc-uclass.c
index e9f8f5f..8d78647 100644
--- a/drivers/usb/gadget/udc/udc-uclass.c
+++ b/drivers/usb/gadget/udc/udc-uclass.c
@@ -9,6 +9,7 @@
 #include <dm/device-internal.h>
 #include <linux/usb/gadget.h>
 
+#if CONFIG_IS_ENABLED(DM_USB_GADGET)
 #define MAX_UDC_DEVICES 4
 static struct udevice *dev_array[MAX_UDC_DEVICES];
 int usb_gadget_initialize(int index)
@@ -51,6 +52,7 @@ int usb_gadget_handle_interrupts(int index)
                return -EINVAL;
        return dm_usb_gadget_handle_interrupts(dev_array[index]);
 }
+#endif
 
 UCLASS_DRIVER(usb_gadget_generic) = {
        .id             = UCLASS_USB_GADGET_GENERIC,
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to