From: Stefan Eichenberger <eichest@gmail.com>
To: francesco.dolcini@toradex.com, trini@konsulko.com,
ilias.apalodimas@linaro.org, sbabic@nabladev.com,
festevam@gmail.com, uboot-imx@nxp.com,
marek.vasut+usb@mailbox.org, alice.guo@nxp.com,
antoine.gouby@toradex.com, stefan.eichenberger@toradex.com,
emanuele.ghidoli@toradex.com, franz.schnyder@toradex.com,
balaji.selvanathan@oss.qualcomm.com,
gurumoorthy.santhakumar@oss.qualcomm.com,
mkorpershoek@kernel.org, xypron.glpk@gmx.de,
casey.connolly@linaro.org, hayashi.kunihiko@socionext.com,
sean.anderson@linux.dev, sjg@chromium.org,
ernest.vanhoecke@toradex.com
Cc: u-boot@lists.u-boot-project.org
Subject: [PATCH v1 2/6] usb: dwc3-generic: fix ref clock lookup indexing wrong clk_bulk array
Date: Mon, 24 Aug 2026 20:29:10 +0200 [thread overview]
Message-ID: <20260824183048.419198-3-eichest@gmail.com> (raw)
In-Reply-To: <20260824183048.419198-1-eichest@gmail.com>
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
On Verdin iMX95, with a USB hub permanently attached to the DWC3 host
port the hub itself enumerates fine but a USB stick plugged into it
fails intermittently:
Verdin iMX95 # usb start
starting USB...
USB XHCI 1.10
Device not responding to set address.
USB device not accepting new address (error=80000000)
Bus usb@4c100000: 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Verdin iMX95 # usb reset
resetting USB...
USB XHCI 1.10
WARN endpoint is halted
WARN endpoint is halted
unable to get device descriptor (error=-22)
Commit c6583354b7c1 ("usb: dwc3: Look up reference clock DT phandle in
both controller DT nodes") added a fallback that searches the DWC3
child node's "clock-names" for "ref"/"ref_clk" when it isn't found on
the parent glue node, but always resolves the found index against
glue->clks, a clk_bulk populated only from the parent glue node's own
clock-names list. This is wrong since the child node's clock-names list
is not guaranteed to be in the same order as the parent's, and indeed on
Verdin iMX95 the child node has a different order than the parent node.
Fix it by resolving the index against the child node's clk and ensure to
enable the clock before using it.
Fixes: c6583354b7c1 ("usb: dwc3: Look up reference clock DT phandle in both controller DT nodes")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
---
drivers/usb/dwc3/dwc3-generic.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 2356b3bc0aa..e16d236bd9d 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -31,6 +31,7 @@ struct dwc3_generic_priv {
struct dwc3 dwc3;
struct phy_bulk phys;
struct gpio_desc *ulpi_reset;
+ struct clk ref_clk;
};
struct dwc3_generic_host_priv {
@@ -76,9 +77,28 @@ static int dwc3_generic_probe(struct udevice *dev,
index = ofnode_stringlist_search(node, "clock-names", "ref");
if (index < 0)
index = ofnode_stringlist_search(node, "clock-names", "ref_clk");
- }
- if (index >= 0)
+ /*
+ * glue->clks was populated from the parent glue node's own
+ * clock-names list, which can differ in length/order from
+ * this child node's list (e.g. i.MX95: glue has "hsio",
+ * "suspend", the dwc3 child has "bus_early", "ref",
+ * "suspend"). Reusing this index against glue->clks would
+ * silently resolve to the wrong clock, so fetch it directly
+ * from this node instead.
+ */
+ if (index >= 0) {
+ if (!clk_get_by_index(dev, index, &priv->ref_clk)) {
+ clk_enable(&priv->ref_clk);
+ dwc3->ref_clk = &priv->ref_clk;
+ } else {
+ debug("%s: failed to get ref_clk from DT\n", dev->name);
+ }
+ } else {
+ debug("%s: no ref_clk found in DT\n", dev->name);
+ }
+ } else {
dwc3->ref_clk = &glue->clks.clks[index];
+ }
#endif
/*
--
2.55.0
next prev parent reply other threads:[~2026-08-24 19:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 18:29 [PATCH v1 0/6] usb: fix DWC3/gadget issues and enable USB on Toradex i.MX95 boards Stefan Eichenberger
2026-08-24 18:29 ` [PATCH v1 1/6] usb: dwc3: core: only provide legacy gadget IRQ handler when USB_DWC3_GADGET Stefan Eichenberger
2026-08-24 23:33 ` Marek Vasut
2026-08-26 7:15 ` Stefan Eichenberger
2026-08-26 12:27 ` Marek Vasut
2026-08-26 16:11 ` Tom Rini
2026-08-27 8:41 ` Stefan Eichenberger
2026-08-24 18:29 ` Stefan Eichenberger [this message]
2026-08-24 23:40 ` [PATCH v1 2/6] usb: dwc3-generic: fix ref clock lookup indexing wrong clk_bulk array Marek Vasut
2026-08-26 7:18 ` Stefan Eichenberger
2026-08-26 12:28 ` Marek Vasut
2026-08-24 18:29 ` [PATCH v1 3/6] usb: skip host-only devices when picking the ehci gadget controller Stefan Eichenberger
2026-08-24 23:45 ` Marek Vasut
2026-08-26 7:16 ` Stefan Eichenberger
2026-08-26 12:28 ` Marek Vasut
2026-08-24 18:29 ` [PATCH v1 4/6] configs: verdin-imx95: enable CI_UDC usb gadget driver Stefan Eichenberger
2026-08-24 18:29 ` [PATCH v1 5/6] toradex: verdin-imx95: enable DWC3 USB controller support Stefan Eichenberger
2026-08-24 18:29 ` [PATCH v1 6/6] toradex: smarc-imx95: " Stefan Eichenberger
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=20260824183048.419198-3-eichest@gmail.com \
--to=eichest@gmail.com \
--cc=alice.guo@nxp.com \
--cc=antoine.gouby@toradex.com \
--cc=balaji.selvanathan@oss.qualcomm.com \
--cc=casey.connolly@linaro.org \
--cc=emanuele.ghidoli@toradex.com \
--cc=ernest.vanhoecke@toradex.com \
--cc=festevam@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=franz.schnyder@toradex.com \
--cc=gurumoorthy.santhakumar@oss.qualcomm.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=ilias.apalodimas@linaro.org \
--cc=marek.vasut+usb@mailbox.org \
--cc=mkorpershoek@kernel.org \
--cc=sbabic@nabladev.com \
--cc=sean.anderson@linux.dev \
--cc=sjg@chromium.org \
--cc=stefan.eichenberger@toradex.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=uboot-imx@nxp.com \
--cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.