* [PATCH 0/2] usb: dwc3: recover USB3 link after controller power loss
@ 2026-11-06 11:19 Xu Yang
2026-11-06 11:19 ` [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset Xu Yang
2026-11-06 11:19 ` [PATCH 2/2] usb: dwc3: imx8mp: set needs_full_reinit as true Xu Yang
0 siblings, 2 replies; 4+ messages in thread
From: Xu Yang @ 2026-11-06 11:19 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh
Cc: Frank.Li, s.hauer, kernel, festevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, jun.li
From: Xu Yang <xu.yang_2@nxp.com>
This series fixes a USB3 link recovery failure observed on an i.MX SoC
when the DWC3 host controller loses power during system suspend.
After power is restored, the USB3 port starts in the Disconnected
(RxDetect) state instead of retaining its previous Enabled (U3) state.
Testing on the i.MX SoC shows that the port takes about 2 ms after host
mode is restored to leave RxDetect and enter Polling.
If xHCI is reset while the port is still in RxDetect, the port does not
issue a Warm Reset. Since the USB3 device may still be in U3, the
subsequent LFPS.Polling attempts time out and the controller eventually
reports the device as disconnected.
The first patch adds a DWC3 xHCI resume quirk that waits for the port to
leave RxDetect before xHCI is reset. The second patch enables this quirk
for the affected i.MX8MP platform by setting needs_full_reinit.
With this delay, xHCI is reset after the port can enter Polling, allowing
a Warm Reset to be issued and the USB3 link to recover normally.
Xu Yang (2):
usb: dwc3: wait for the port to leave RxDetect before xHCI reset
usb: dwc3: imx8mp: set needs_full_reinit as true
drivers/usb/dwc3/dwc3-imx8mp.c | 1 +
drivers/usb/dwc3/host.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset
2026-11-06 11:19 [PATCH 0/2] usb: dwc3: recover USB3 link after controller power loss Xu Yang
@ 2026-11-06 11:19 ` Xu Yang
2026-11-25 1:03 ` Thinh Nguyen
2026-11-06 11:19 ` [PATCH 2/2] usb: dwc3: imx8mp: set needs_full_reinit as true Xu Yang
1 sibling, 1 reply; 4+ messages in thread
From: Xu Yang @ 2026-11-06 11:19 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh
Cc: Frank.Li, s.hauer, kernel, festevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, jun.li
From: Xu Yang <xu.yang_2@nxp.com>
When the host controller loses power during system suspend, the port
state is not retained. After power is restored, the port starts in the
Disconnected (RxDetect) state instead of its previous Enabled (U3)
state.
After the controller is switched back to host mode, testing on an i.MX8/9
SoC shows that it takes about 2 ms for the port to leave RxDetect and
enter Polling. If xHCI is reset while the port is still in RxDetect, the
port does not issue a Warm Reset.
This prevents the link from recovering because the USB3 device may
still be in U3. Once the port enters Polling, it sends LFPS.Polling, but
the device does not respond as expected. After three Polling attempts,
each taking about 360 ms (tPollingLFPSTimeout), the controller reports
the device as disconnected.
If xHCI is reset after the port has entered Polling, the port issues a
Warm Reset and the link recovers quickly after the device responds.
Add a 2 ms delay through the xHCI resume quirk before resetting xHCI.
This allows the port to leave RxDetect so that a Warm Reset can be
issued, avoiding an unnecessary device disconnect during system
resume.
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/usb/dwc3/host.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c5674161b2b0..465c170df12c 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -78,8 +78,29 @@ static void dwc3_xhci_plat_start(struct usb_hcd *hcd)
dwc3_enable_susphy(dwc, true);
}
+static int dwc3_xhci_resume_quirk(struct usb_hcd *hcd)
+{
+ struct platform_device *pdev;
+ struct dwc3 *dwc;
+
+ pdev = to_platform_device(hcd->self.controller);
+ dwc = dev_get_drvdata(pdev->dev.parent);
+
+ if (dwc->needs_full_reinit) {
+ /*
+ * The port needs some time to leave RxDetect after host mode
+ * is restored. Delay the xHCI reset until the port can enter
+ * Polling, allowing a Warm Reset to recover the USB3 link.
+ */
+ usleep_range(2000, 2500);
+ }
+
+ return 0;
+}
+
static const struct xhci_plat_priv dwc3_xhci_plat_quirk = {
.plat_start = dwc3_xhci_plat_start,
+ .resume_quirk = dwc3_xhci_resume_quirk,
};
static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] usb: dwc3: imx8mp: set needs_full_reinit as true
2026-11-06 11:19 [PATCH 0/2] usb: dwc3: recover USB3 link after controller power loss Xu Yang
2026-11-06 11:19 ` [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset Xu Yang
@ 2026-11-06 11:19 ` Xu Yang
1 sibling, 0 replies; 4+ messages in thread
From: Xu Yang @ 2026-11-06 11:19 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh
Cc: Frank.Li, s.hauer, kernel, festevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, jun.li
From: Xu Yang <xu.yang_2@nxp.com>
On i.MX8MP Soc, the USB3 Controller power will not be maintained in system
suspened state. Setting dwc3->needs_full_reinit as true to indicate the
controller should be re-initialized after system PM operations.
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/usb/dwc3/dwc3-imx8mp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index ee92a5efaa6e..78cb79fefba2 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -267,6 +267,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
}
dwc3->glue_ops = &dwc3_imx_glue_ops;
+ dwc3->needs_full_reinit = true;
if (dwc3->dr_mode == USB_DR_MODE_HOST)
pm_runtime_dont_use_autosuspend(dwc3->dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset
2026-11-06 11:19 ` [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset Xu Yang
@ 2026-11-25 1:03 ` Thinh Nguyen
0 siblings, 0 replies; 4+ messages in thread
From: Thinh Nguyen @ 2026-11-25 1:03 UTC (permalink / raw)
To: Xu Yang
Cc: Thinh Nguyen, gregkh@linuxfoundation.org, Frank.Li@nxp.com,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
linux-usb@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, jun.li@nxp.com
On Fri, Nov 06, 2026, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
>
> When the host controller loses power during system suspend, the port
> state is not retained. After power is restored, the port starts in the
> Disconnected (RxDetect) state instead of its previous Enabled (U3)
> state.
>
> After the controller is switched back to host mode, testing on an i.MX8/9
> SoC shows that it takes about 2 ms for the port to leave RxDetect and
> enter Polling. If xHCI is reset while the port is still in RxDetect, the
> port does not issue a Warm Reset.
>
> This prevents the link from recovering because the USB3 device may
> still be in U3. Once the port enters Polling, it sends LFPS.Polling, but
> the device does not respond as expected. After three Polling attempts,
> each taking about 360 ms (tPollingLFPSTimeout), the controller reports
> the device as disconnected.
>
> If xHCI is reset after the port has entered Polling, the port issues a
> Warm Reset and the link recovers quickly after the device responds.
>
> Add a 2 ms delay through the xHCI resume quirk before resetting xHCI.
> This allows the port to leave RxDetect so that a Warm Reset can be
> issued, avoiding an unnecessary device disconnect during system
> resume.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
> drivers/usb/dwc3/host.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index c5674161b2b0..465c170df12c 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -78,8 +78,29 @@ static void dwc3_xhci_plat_start(struct usb_hcd *hcd)
> dwc3_enable_susphy(dwc, true);
> }
>
> +static int dwc3_xhci_resume_quirk(struct usb_hcd *hcd)
> +{
> + struct platform_device *pdev;
> + struct dwc3 *dwc;
> +
> + pdev = to_platform_device(hcd->self.controller);
> + dwc = dev_get_drvdata(pdev->dev.parent);
> +
> + if (dwc->needs_full_reinit) {
The core is also re-initialized on system resume when wakeup is disabled
(see dwc3_resume_common()). Shouldn't this be like below:
if (!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)
> + /*
> + * The port needs some time to leave RxDetect after host mode
> + * is restored. Delay the xHCI reset until the port can enter
> + * Polling, allowing a Warm Reset to recover the USB3 link.
> + */
> + usleep_range(2000, 2500);
Can we add a comment that this value is tested with i.MX8/9 rather than
a common value for all platforms?
Thanks,
Thinh
> + }
> +
> + return 0;
> +}
> +
> static const struct xhci_plat_priv dwc3_xhci_plat_quirk = {
> .plat_start = dwc3_xhci_plat_start,
> + .resume_quirk = dwc3_xhci_resume_quirk,
> };
>
> static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc,
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-25 1:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 11:19 [PATCH 0/2] usb: dwc3: recover USB3 link after controller power loss Xu Yang
2026-11-06 11:19 ` [PATCH 1/2] usb: dwc3: wait for the port to leave RxDetect before xHCI reset Xu Yang
2026-11-25 1:03 ` Thinh Nguyen
2026-11-06 11:19 ` [PATCH 2/2] usb: dwc3: imx8mp: set needs_full_reinit as true Xu Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox