[PATCH] usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool
Mattijs Korpershoek
mkorpershoek at baylibre.com
Mon Mar 24 14:36:41 CET 2025
Hi Neil,
On lun., mars 24, 2025 at 10:20, Neil Armstrong <neil.armstrong at linaro.org> wrote:
> On 19/03/2025 23:07, Marek Vasut wrote:
>> The UUU tool excepts the interrupt-in endpoint to be ep1in, otherwise
>> it crashes. This is a result of the previous hard-coded EP setup in
>> drivers/usb/gadget/epautoconf.c which did special-case EP allocation
>> for SPL builds, and which was since converted to this callback, but
>> without the special-case EP allocation in SPL part.
>>
>> This reinstates the SPL part in an isolated manner, only for NXP iMX
>> SoCs, only for SPL builds, and only for the ep1in interrupt-in endpoint.
>>
>> Fixes: 1918b8010c32 ("usb: dwc3: gadget: Convert epautoconf workaround to match_ep callback")
>> Signed-off-by: Marek Vasut <marex at denx.de>
>> ---
>> Cc: Alexander Sverdlin <alexander.sverdlin at siemens.com>
>> Cc: Felipe Balbi <felipe.balbi at linux.intel.com>
>> Cc: Lukasz Majewski <lukma at denx.de>
>> Cc: Marek Vasut <marex at denx.de>
>> Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
>> Cc: Neil Armstrong <neil.armstrong at linaro.org>
>> Cc: Thinh Nguyen <Thinh.Nguyen at synopsys.com>
>> Cc: Tom Rini <trini at konsulko.com>
>> Cc: u-boot at lists.denx.de
>> ---
>> NOTE: This should go into master as a bugfix.
>> ---
>> drivers/usb/dwc3/gadget.c | 19 ++++++++++++++++++-
>> 1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>> index e5a383407a2..477ecd02098 100644
>> --- a/drivers/usb/dwc3/gadget.c
>> +++ b/drivers/usb/dwc3/gadget.c
>> @@ -1631,8 +1631,25 @@ usb_ep *dwc3_gadget_match_ep(struct usb_gadget *gadget,
>> return dwc3_find_ep(gadget, "ep1in");
>> if (usb_endpoint_is_bulk_out(desc))
>> return dwc3_find_ep(gadget, "ep2out");
>> - if (usb_endpoint_is_int_in(desc))
>> + if (usb_endpoint_is_int_in(desc)) {
>> + /*
>> + * Special workaround for NXP UUU tool in SPL.
>> + *
>> + * The tool excepts the interrupt-in endpoint to be ep1in,
>
> Small nit: expects
Argh, I missed this :( The code already landed in master:
https://source.denx.de/u-boot/u-boot/-/commit/0916053ebc566245b06d0a179533f6622b6ad392
If we have to modify this again we can fixup the comment typo at the
same time.
Thanks for catching it!
>
>> + * otherwise it crashes. This is a result of the previous
>> + * hard-coded EP setup in drivers/usb/gadget/epautoconf.c
>> + * which did special-case EP allocation for SPL builds,
>> + * and which was since converted to this callback, but
>> + * without the special-case EP allocation in SPL part.
>> + *
>> + * This reinstates the SPL part in an isolated manner,
>> + * only for NXP iMX SoCs, only for SPL builds, and only
>> + * for the ep1in interrupt-in endpoint.
>> + */
>> + if (IS_ENABLED(CONFIG_MACH_IMX) && IS_ENABLED(CONFIG_XPL_BUILD))
>> + return dwc3_find_ep(gadget, "ep1in");
>> return dwc3_find_ep(gadget, "ep3in");
>> + }
>>
>> return NULL;
>> }
More information about the U-Boot
mailing list