From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Lukasz Majewski <lukma@denx.de>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH] usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool
Date: Wed, 19 Mar 2025 23:07:52 +0100 [thread overview]
Message-ID: <20250319220805.219001-1-marex@denx.de> (raw)
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@denx.de>
---
Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@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,
+ * 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;
}
--
2.47.2
next reply other threads:[~2025-03-19 22:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 22:07 Marek Vasut [this message]
2025-03-20 9:47 ` [PATCH] usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool Mattijs Korpershoek
2025-03-24 8:03 ` Francesco Dolcini
2025-03-24 8:26 ` Mattijs Korpershoek
2025-03-24 12:30 ` Francesco Dolcini
2025-03-24 13:53 ` Marek Vasut
2025-03-24 14:16 ` Francesco Dolcini
2025-03-24 14:36 ` Marek Vasut
2025-04-08 9:06 ` Francesco Dolcini
2025-04-08 14:51 ` Marek Vasut
2025-04-11 14:21 ` Francesco Dolcini
2025-04-13 9:14 ` Marek Vasut
2025-04-14 8:52 ` Francesco Dolcini
2025-03-24 9:20 ` Neil Armstrong
2025-03-24 13:36 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319220805.219001-1-marex@denx.de \
--to=marex@denx.de \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alexander.sverdlin@siemens.com \
--cc=felipe.balbi@linux.intel.com \
--cc=lukma@denx.de \
--cc=mkorpershoek@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox