Re: [PATCH v1 1/6] usb: dwc3: core: only provide legacy gadget IRQ handler when USB_DWC3_GADGET

Marek Vasut <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
On 8/24/26 8:29 PM, Stefan Eichenberger wrote:
> From: Stefan Eichenberger <[email protected]>
> 
> Building a board with USB_DWC3=y (DWC3 used purely as an XHCI host
> controller), USB_DWC3_GADGET unset, and DM_USB_GADGET disabled (e.g.
> to use CONFIG_CI_UDC for a separate ChipIdea gadget/OTG controller)
> fails to link:
> 
> drivers/usb/gadget/ci_udc.o: in function `dm_usb_gadget_handle_interrupts':
> drivers/usb/gadget/ci_udc.c:983: multiple definition of `dm_usb_gadget_handle_interrupts';
> drivers/usb/dwc3/core.o:drivers/usb/dwc3/core.c:1034: first defined here
> drivers/usb/dwc3/core.o: in function `dm_usb_gadget_handle_interrupts':
> drivers/usb/dwc3/core.c:1044: undefined reference to `dwc3_gadget_uboot_handle_interrupt'
> 
> Add "&& CONFIG_IS_ENABLED(USB_DWC3_GADGET)" to the guard so this code
> is only compiled when the DWC3 gadget driver it depends on is actually
> present, matching the Makefile dependency. Boards that combine DWC3
> (host) with a separate legacy gadget driver like CI_UDC, with
> DM_USB_GADGET disabled, now link correctly. Boards that already use
> DWC3 in gadget mode without DM_USB_GADGET are unaffected since
> USB_DWC3_GADGET is set for them.
> 
> Fixes: 4d1589808970 ("usb: udc: dwc3: Fold board dm_usb_gadget_handle_interrupts() into DWC3 gadget")
> Signed-off-by: Stefan Eichenberger <[email protected]>
> ---
>   drivers/usb/dwc3/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index be198041f08..9bff5149c5f 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1016,7 +1016,7 @@ MODULE_AUTHOR("Felipe Balbi <[email protected]>");
>   MODULE_LICENSE("GPL v2");
>   MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");
>   
> -#if !CONFIG_IS_ENABLED(DM_USB_GADGET)
> +#if !CONFIG_IS_ENABLED(DM_USB_GADGET) && CONFIG_IS_ENABLED(USB_DWC3_GADGET)
>   __weak int dwc3_uboot_interrupt_status(struct udevice *dev)
Simply enable DM_USB_GADGET , then the 
drivers/usb/gadget/udc/udc-uclass.c dm_usb_gadget_handle_interrupts() is 
used which correctly invokes the per-controller IRQ handler. DWC3_GADGET 
should likely depend on DM_USB_GADGET.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.