[PATCH] usb: dwc3-generic: Fix build errors when USB_DWC3_GADGET is disabled
Jonas Karlman
jonas at kwiboo.se
Sun Feb 25 16:27:13 CET 2024
Build fail with the following error when DM_USB_GADGET is enabled and
USB_DWC3_GADGET is disabled:
dwc3/dwc3-generic.o: in function `dm_usb_gadget_handle_interrupts':
dwc3/dwc3-generic.c:201:(.text.dm_usb_gadget_handle_interrupts+0x10):
undefined reference to `dwc3_gadget_uboot_handle_interrupt'
Build also fail with the following error when USB_GADGET_DWC2_OTG +
DM_USB_GADGET is enabled and USB_DWC3_GADGET is disabled:
gadget/dwc2_udc_otg.o: in function `dm_usb_gadget_handle_interrupts':
gadget/dwc2_udc_otg.c:947: multiple definition of `dm_usb_gadget_handle_interrupts';
dwc3/dwc3-generic.o:dwc3/dwc3-generic.c:197: first defined here
Fix this by checking for USB_DWC3_GADGET in addition to DM_USB_GADGET.
Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
---
drivers/usb/dwc3/dwc3-generic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 6fb2de8a5ace..891d01957619 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -192,7 +192,7 @@ static int dwc3_generic_of_to_plat(struct udevice *dev)
return 0;
}
-#if CONFIG_IS_ENABLED(DM_USB_GADGET)
+#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) && CONFIG_IS_ENABLED(DM_USB_GADGET)
int dm_usb_gadget_handle_interrupts(struct udevice *dev)
{
struct dwc3_generic_priv *priv = dev_get_priv(dev);
@@ -435,7 +435,7 @@ static int dwc3_glue_bind_common(struct udevice *parent, ofnode node)
if (!dr_mode)
dr_mode = usb_get_dr_mode(node);
- if (CONFIG_IS_ENABLED(DM_USB_GADGET) &&
+ if (IS_ENABLED(CONFIG_USB_DWC3_GADGET) && CONFIG_IS_ENABLED(DM_USB_GADGET) &&
(dr_mode == USB_DR_MODE_PERIPHERAL || dr_mode == USB_DR_MODE_OTG)) {
debug("%s: dr_mode: OTG or Peripheral\n", __func__);
driver = "dwc3-generic-peripheral";
--
2.43.0
More information about the U-Boot
mailing list