From: Chris Morgan <macroalpha82@gmail.com>
To: u-boot@lists.denx.de
Cc: thinhn@synopsys.com, neil.armstrong@linaro.org,
quic_varada@quicinc.com, felipe.balbi@linux.intel.com,
mkorpershoek@kernel.org, lukma@denx.de, trini@konsulko.com,
marex@denx.de, macromorgan@hotmail.com,
Wesley Cheng <quic_wcheng@quicinc.com>
Subject: [PATCH V2 2/4] usb: dwc3: Increase DWC3 controller halt timeout
Date: Thu, 15 Jan 2026 17:01:33 -0600 [thread overview]
Message-ID: <20260115230135.183158-3-macroalpha82@gmail.com> (raw)
In-Reply-To: <20260115230135.183158-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
Since EP0 transactions need to be completed before the controller halt
sequence is finished, this may take some time depending on the host and the
enabled functions. Increase the controller halt timeout, so that we give
the controller sufficient time to handle EP0 transfers.
This patch was originally submitted to Linux in 2022, but is required to
use USB gadget mode on my device in U-Boot.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=461ee467507cb98a348fa91ff8460908bb0ea423
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
drivers/usb/dwc3/gadget.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 2b01113d54c..d2ae892d554 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1396,7 +1396,7 @@ static int dwc3_gadget_set_selfpowered(struct usb_gadget *g,
static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
{
u32 reg;
- u32 timeout = 500;
+ u32 timeout = 2000;
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
if (is_on) {
@@ -1425,6 +1425,7 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
do {
+ udelay(2000);
reg = dwc3_readl(dwc->regs, DWC3_DSTS);
if (is_on) {
if (!(reg & DWC3_DSTS_DEVCTRLHLT))
@@ -1436,7 +1437,6 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
timeout--;
if (!timeout)
return -ETIMEDOUT;
- udelay(1);
} while (1);
dev_vdbg(dwc->dev, "gadget %s data soft-%s\n",
--
2.43.0
next prev parent reply other threads:[~2026-01-15 23:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 23:01 [PATCH V2 0/4] USB Fixes for Gadget Mode on DWC3 Chris Morgan
2026-01-15 23:01 ` [PATCH V2 1/4] usb: dwc3: core: Add ip and version_type support from Linux Chris Morgan
2026-01-29 8:49 ` Mattijs Korpershoek
2026-01-15 23:01 ` Chris Morgan [this message]
2026-01-29 8:51 ` [PATCH V2 2/4] usb: dwc3: Increase DWC3 controller halt timeout Mattijs Korpershoek
2026-01-15 23:01 ` [PATCH V2 3/4] usb: dwc3: gadget: Don't send unintended link state change Chris Morgan
2026-01-29 9:06 ` Mattijs Korpershoek
2026-01-15 23:01 ` [PATCH V2 4/4] usb: dwc3: core: improve reset sequence Chris Morgan
2026-01-22 12:15 ` Ernest Van Hoecke
2026-01-22 12:34 ` Marek Vasut
2026-01-23 7:24 ` 回复: " Alice Guo (OSS)
2026-01-23 14:12 ` Ernest Van Hoecke
2026-01-27 1:58 ` 回复: " Alice Guo (OSS)
2026-02-05 17:32 ` Ernest Van Hoecke
2026-02-25 11:04 ` 回复: " Alice Guo (OSS)
2026-01-29 9:38 ` Mattijs Korpershoek
2026-01-30 8:00 ` [PATCH V2 0/4] USB Fixes for Gadget Mode on DWC3 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=20260115230135.183158-3-macroalpha82@gmail.com \
--to=macroalpha82@gmail.com \
--cc=felipe.balbi@linux.intel.com \
--cc=lukma@denx.de \
--cc=macromorgan@hotmail.com \
--cc=marex@denx.de \
--cc=mkorpershoek@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_varada@quicinc.com \
--cc=quic_wcheng@quicinc.com \
--cc=thinhn@synopsys.com \
--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