[PATCH] usb: dwc3-generic: Fix build errors when USB_DWC3_GADGET is disabled

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue Jan 7 13:48:02 CET 2025


Hi Marek,

On dim., janv. 05, 2025 at 20:29, Marek Vasut <marex at denx.de> wrote:

> On 6/18/24 9:15 AM, Mattijs Korpershoek wrote:
>> Hi Jonas,
>
> Hello all,
>
>> On sam., mars 02, 2024 at 14:00, Jonas Karlman <jonas at kwiboo.se> wrote:
>> 
>> [...]
>> 
>>>>
>>>> I will keep you posted.
>>>
>>> Thanks, much appreciated!
>>>
>>> Please also keep in mind that changing the interrupt handling probably
>>> only fixes the second of the two build errors reported and fixed by this
>>> patch.
>>>
>>> Trying to build with following will trigger the first build error, and
>>> should not change because use of dm_usb_gadget_handle_interrupts() is
>>> reworked.
>>>
>>> CONFIG_DM_USB_GADGET=y
>>> CONFIG_USB_DWC3=y
>>> # CONFIG_USB_DWC3_GADGET is not set
>>> CONFIG_USB_DWC3_GENERIC=y
>>> CONFIG_USB_GADGET=y
>>>
>>> E.g to only include host part of dwc3 and gadget from another driver,
>>> to i.e. save on binary size, produce following build error:
>>>
>>> aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dm_usb_gadget_handle_interrupts':
>>> drivers/usb/dwc3/dwc3-generic.c:201:(.text.dm_usb_gadget_handle_interrupts+0x10):
>>>    undefined reference to `dwc3_gadget_uboot_handle_interrupt'
>>>
>>> I guess force select USB_DWC3_GADGET for USB_DWC3_GENERIC would make
>>> that build error disappear, and increase binary size as a result.
>>>
>>> For my RK3328 series [1] I will just revert to use USB_XHCI_DWC3 instead
>>> of using USB_DWC3_GENERIC on boards that enable peripheral use of otg
>>> port.
>>>
>>> [1] https://patchwork.ozlabs.org/patch/1904779/
>> 
>> Marek ended up doing this rework.
>> It's available for review here, if you want to have a look:
>> https://lore.kernel.org/all/20240614005309.34433-1-marek.vasut+renesas@mailbox.org/
> This should be upstream in some form now, is this thread still an open 
> topic or is this solved now ?

The thread reported 2 problems:

Using khadas-vim3_android_defconfig, I tried:
1. DM_USB_GADGET is enabled and USB_DWC3_GADGET is disabled
$ grep -e DM_USB_GADGET -e USB_DWC3_GADGET .config
CONFIG_DM_USB_GADGET=y
# CONFIG_USB_DWC3_GADGET is not set

2. USB_GADGET_DWC2_OTG + DM_USB_GADGET is enabled and USB_DWC3_GADGET is disabled.
$ grep -e USB_GADGET_DWC2_OTG -e DM_USB_GADGET -e USB_DWC3_GADGET .config
CONFIG_DM_USB_GADGET=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_GADGET_DWC2_OTG=y
# CONFIG_USB_GADGET_DWC2_OTG_PHY is not set
CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y

In both case, I could build succesfully on master with commit 6d41f0a39d64 ("Prepare v2025.01")

So I think this is solved now. I'll let Jonas confirm.


More information about the U-Boot mailing list