Linux USB
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle
@ 2026-11-12  8:35 Arun Iyengar via B4 Relay
  2026-11-12  8:35 ` [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended " Arun Iyengar via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-12  8:35 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Heiko Stuebner
  Cc: linux-usb, linux-kernel, linux-arm-kernel, linux-rockchip,
	Sebastian Reichel, Joonhoe Kim, Vladyslav Tymoshchuk,
	Arun Iyengar

In host mode, dwc3 tears the core down for system suspend unless the
controller is a wakeup source. On RK3588 that ends the power session of
every suspended USB device in suspend-to-idle: on an Orange Pi 5 a
SanDisk Extreme drive on the Type-A USB3 port and a card reader behind a
USB3 hub are disconnected and enumerated again after every resume, which
kills a filesystem mounted on them. With the bus kept suspended they
resume from U3 in milliseconds.

Patch 2 of v1 [1] kept the host core in suspend-to-idle for every dwc3
host. Sashiko found three ways in which that breaks other platforms, and
all three hold on usb-next:
- legacy glue drivers still act in their own suspend callbacks in
  suspend-to-idle (dwc3-of-simple asserts its resets on rk3399,
  dwc3-meson-g12a powers the PHYs off, dwc3-exynos switches its supplies
  off), so the core would skip the re-init on a reset controller;
- dwc3-google asserts its resets unless wakeup is enabled;
- genpd keeps a domain on for a device on the awake path only with
  GENPD_FLAG_ACTIVE_WAKEUP, which e.g. RK3568 PD_PIPE does not set.
  Vladyslav Tymoshchuk has since seen this one on hardware [2]: on
  SM8750 the USB GDSCs lack the flag, genpd powers them off in
  suspend-to-idle and the xHCI dies on resume, already on the existing
  wakeup path.
Commit c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs on
system_suspend in host mode") also made the teardown deliberate, so
that the PHYs can be powered off. Thanks to Sashiko for the review and
to Vladyslav for the test on SM8750.

This version makes it an opt-in instead: patch 1 adds
keep_host_bus_in_s2idle to dwc3_properties for the glue to set, and
patch 2 sets it in the Rockchip glue for RK3588 only, whose PD_USB has
GENPD_FLAG_ACTIVE_WAKEUP. Nothing changes for any other platform, nor
for suspend-to-RAM and hibernation.

It is an RFC because it depends on two postings that are not merged:
- Sebastian Reichel's Rockchip dwc3 glue driver, v18 [3]; patch 2 is on
  top of it.
- Joonhoe Kim's "usb: dwc3: tell xHCI that it lost its state when the
  core is powered off" [4]; patch 1 uses its xhci_power_lost flag to
  re-initialise the core on resume exactly when suspend tore it down.
  In host mode it does the same as patch 1 of v1 [1], which I withdrew
  in its favour.
The base is usb-next (v7.4-rc1) with [3] and [4] applied.

Tested on an Orange Pi 5 (RK3588S, no wakeup source) with the code of
this series on top of [3] and [4] in a v7.3-based kernel, 50
suspend-to-idle cycles through rtcwake. Both dwc3 controllers of the
board run on the Rockchip glue: USB3OTG2 (no power domain) with a
SanDisk Extreme drive on the Type-A port, and USB3OTG0 (in PD_USB) with
the USB 2.0 billboard device behind the Type-C port.
- Bus kept (this series), 40 of 40 cycles: the same USB bus and device
  numbers before and after resume; no "root hub lost power", no "xHC
  error in resume", no disconnect, re-enumeration or "reset
  SuperSpeed", no WARNING/BUG/Oops; the drive was readable after every
  resume (64 MiB direct read).
- Core torn down as without the opt-in (forced with a test-only module
  parameter that is not part of this series), 10 of 10 cycles: all
  root hubs reported "root hub lost power or was reset" (80 lines), no
  "xHC error in resume" thanks to [4], no WARNING/BUG/Oops; the drive
  was disconnected and enumerated again on every resume, which is what
  this series avoids.
Not tested: RK3576 (left unchanged), USB3OTG1 (not on the RK3588S),
suspend-to-RAM (not run with this series; the opt-in does not apply
there).

[1] https://lore.kernel.org/r/20261110-dwc3-s2idle-v1-0-2ef4cc3f8130@gmail.com
[2] https://lore.kernel.org/r/20261111121556.1871-1-tvlad744@gmail.com
[3] https://lore.kernel.org/r/20261021-b4-rockchip-dwc3-rockchip-glue-v18-0-60000d03fca2@collabora.com
[4] https://lore.kernel.org/r/20260929130252.869-1-26rote@gmail.com

This series was developed with Claude (Anthropic) as a coding assistant:
it wrote the code and the commit messages, and I reviewed and tested it
as described above.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Arun Iyengar (2):
      usb: dwc3: Let the glue keep the host bus suspended across suspend-to-idle
      usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588

 drivers/usb/dwc3/core.c          | 41 ++++++++++++++++++++++++++++++++++++----
 drivers/usb/dwc3/core.h          |  3 +++
 drivers/usb/dwc3/dwc3-rockchip.c | 10 ++++++++++
 drivers/usb/dwc3/glue.h          |  7 +++++++
 4 files changed, 57 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261110-dwc3-s2idle-optin-1e3021adb650
prerequisite-message-id: <20261021-b4-rockchip-dwc3-rockchip-glue-v18-0-60000d03fca2@collabora.com>
prerequisite-patch-id: 4fa3aae8ccfa5383522070179c8777302411082c
prerequisite-patch-id: db09b4f5b0cffc1d5bf098fbdebb06b8be448fb7
prerequisite-patch-id: c2e1c453454a7589a691fe391dc79e86f09ca7b7
prerequisite-patch-id: dadeaf9e369e04d8b3329493a1a0756ddd6140f0
prerequisite-patch-id: aa0125edb604ecf704a69250cc0d693013a977c9
prerequisite-patch-id: 62b492b7b6e9957282f1029a02aaf258b63e990f
prerequisite-patch-id: fcc7dd5dcd583913f91bf9986b0137c2930d2200
prerequisite-message-id: <20260929130252.869-1-26rote@gmail.com>
prerequisite-patch-id: 34a5a2c638a729bde49c06a330bf0847bf17e5e9

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended across suspend-to-idle
  2026-11-12  8:35 [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar via B4 Relay
@ 2026-11-12  8:35 ` Arun Iyengar via B4 Relay
  2026-11-12  8:49   ` sashiko-bot
  2026-11-12  8:35 ` [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588 Arun Iyengar via B4 Relay
  2026-11-12  8:39 ` [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar
  2 siblings, 1 reply; 6+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-12  8:35 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Heiko Stuebner
  Cc: linux-usb, linux-kernel, linux-arm-kernel, linux-rockchip,
	Sebastian Reichel, Joonhoe Kim, Vladyslav Tymoshchuk,
	Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

In host mode, dwc3_suspend_common() tears the core down for system
suspend (dwc3_core_exit(): PHYs off, core reset) unless the controller
is a wakeup source. By then xhci-plat has already suspended the bus:
the root ports and every device behind them are in U3/suspend and
expect to keep their power session (Documentation/driver-api/usb/
persist.rst). Resetting the core ends all of them. On resume xhci-plat
finds a reset controller ("root hub lost power or was reset") and the
USB core has to reset-resume every device, which only works for devices
that come back within the 2 s that usb_port_resume() waits for a
connection.

Devices that are cut off in U3 do not necessarily come back that fast.
On an Orange Pi 5 (RK3588S) a SanDisk Extreme drive on the Type-A USB3
port only connects again ~3 s after resume, and a card reader behind a
USB3 hub loses VBUS when the hub is reset and needs ~2.35 s. Both are
disconnected and enumerated again on every resume, which kills a
filesystem mounted on them. With the bus kept suspended they resume
from U3 in milliseconds.

Whether the bus can be kept is a property of the platform, not of the
dwc3 core: in suspend-to-idle some glue drivers still assert resets or
switch off PHY supplies in their own suspend callbacks, some power
domains are switched off, and some platforms rely on the PHYs being
powered off to reach their low-power state (c4a5153e87fd ("usb: dwc3:
core: Power-off core/PHYs on system_suspend in host mode")). So make it
an opt-in: a glue driver whose platform keeps the controller, its PHYs
and its power domain powered across suspend-to-idle sets
keep_host_bus_in_s2idle in dwc3_properties, and only then does the core
keep the suspended bus in suspend-to-idle, as it does for wakeup. It
also marks the device as being on the awake path so that a power domain
with GENPD_FLAG_ACTIVE_WAKEUP stays on. Resume re-initialises the core
exactly when suspend tore it down, which xhci_power_lost now records.
Nothing changes for platforms that do not set the flag, nor for
suspend-to-RAM, hibernation and needs_full_reinit controllers.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/usb/dwc3/core.c | 41 +++++++++++++++++++++++++++++++++++++----
 drivers/usb/dwc3/core.h |  3 +++
 drivers/usb/dwc3/glue.h |  7 +++++++
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index bc9ce8dce0c6..21746fc8624a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -16,6 +16,7 @@
 #include <linux/spinlock.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/suspend.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
@@ -1694,6 +1695,9 @@ static void dwc3_get_software_properties(struct dwc3 *dwc,
 	if (properties->needs_full_reinit)
 		dwc->needs_full_reinit = true;
 
+	if (properties->keep_host_bus_in_s2idle)
+		dwc->keep_host_bus_in_s2idle = true;
+
 	dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
 
 	if (properties->gsbuscfg0_reqinfo !=
@@ -2554,6 +2558,30 @@ static int dwc3_core_init_for_resume(struct dwc3 *dwc)
 	return ret;
 }
 
+/*
+ * In host mode, system suspend suspends the bus: xhci-plat puts the root ports
+ * and with them every attached device into U3/suspend, and the USB core
+ * expects them to keep that power session (see
+ * Documentation/driver-api/usb/persist.rst). Tearing the core down ends all of
+ * them: the devices then have to go through a reset-resume, and one that takes
+ * longer to come back than the USB core waits for is disconnected, e.g. with a
+ * mounted filesystem.
+ *
+ * The core is kept when it is a wakeup source, and in suspend-to-idle on
+ * platforms whose glue says that the controller, its PHYs and its power domain
+ * stay powered then (keep_host_bus_in_s2idle). Everywhere else it is torn down
+ * so the PHYs can be powered off.
+ */
+static bool dwc3_host_keep_core(struct dwc3 *dwc)
+{
+	if (dwc->needs_full_reinit)
+		return false;
+	if (device_may_wakeup(dwc->dev))
+		return true;
+	return dwc->keep_host_bus_in_s2idle &&
+	       pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
+}
+
 static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
 {
 	u32 reg;
@@ -2584,14 +2612,20 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
 		dwc3_core_exit(dwc);
 		break;
 	case DWC3_GCTL_PRTCAP_HOST:
-		if (!PMSG_IS_AUTO(msg) &&
-		    (!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)) {
+		if (!PMSG_IS_AUTO(msg) && !dwc3_host_keep_core(dwc)) {
 			dwc3_core_exit(dwc);
 			dwc->xhci_power_lost = 1;
 			break;
 		}
 		dwc->xhci_power_lost = 0;
 
+		/*
+		 * The core and its PHYs stay powered to keep the suspended bus:
+		 * keep the power domain on as well.
+		 */
+		if (!PMSG_IS_AUTO(msg))
+			device_set_awake_path(dwc->dev);
+
 		/* Let controller to suspend HSPHY before PHY driver suspends */
 		if (dwc->dis_u2_susphy_quirk ||
 		    dwc->dis_enblslpm_quirk) {
@@ -2650,8 +2684,7 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)
 		dwc3_gadget_resume(dwc);
 		break;
 	case DWC3_GCTL_PRTCAP_HOST:
-		if (!PMSG_IS_AUTO(msg) &&
-		    (!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)) {
+		if (!PMSG_IS_AUTO(msg) && dwc->xhci_power_lost) {
 			ret = dwc3_core_init_for_resume(dwc);
 			if (ret)
 				return ret;
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 94408958e9a1..ee1afa0d106a 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1137,6 +1137,8 @@ struct dwc3_glue_ops {
  * @usb2_gadget_lpm_disable: set to disable usb2 lpm for gadget
  * @needs_full_reinit: set to indicate the core may lose power and need full
  *			initialization during system pm
+ * @keep_host_bus_in_s2idle: set if the platform keeps the controller powered
+ *			across suspend-to-idle, so the host bus stays suspended
  * @disable_scramble_quirk: set if we enable the disable scramble quirk
  * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk
  * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk
@@ -1407,6 +1409,7 @@ struct dwc3 {
 	unsigned		usb2_lpm_disable:1;
 	unsigned		usb2_gadget_lpm_disable:1;
 	unsigned		needs_full_reinit:1;
+	unsigned		keep_host_bus_in_s2idle:1;
 
 	unsigned		disable_scramble_quirk:1;
 	unsigned		u2exit_lfps_quirk:1;
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index d738e1739ae0..130c455d9c4e 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -14,10 +14,17 @@
  * @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
  * @needs_full_reinit: indicate the controller may not remain power during system
  *			pm and need full initialization
+ * @keep_host_bus_in_s2idle: indicate the controller, its PHYs and its power
+ *			domain stay powered across suspend-to-idle when the core
+ *			keeps them on, so a suspended host bus can be kept
+ *			instead of being torn down. Set it only if the USB power
+ *			domain, if there is one, stays on in suspend-to-idle for
+ *			a device on the awake path (GENPD_FLAG_ACTIVE_WAKEUP)
  */
 struct dwc3_properties {
 	u32 gsbuscfg0_reqinfo;
 	unsigned needs_full_reinit:1;
+	unsigned keep_host_bus_in_s2idle:1;
 };
 
 #define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){		\

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588
  2026-11-12  8:35 [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar via B4 Relay
  2026-11-12  8:35 ` [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended " Arun Iyengar via B4 Relay
@ 2026-11-12  8:35 ` Arun Iyengar via B4 Relay
  2026-11-12  8:56   ` sashiko-bot
  2026-11-12  8:39 ` [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar
  2 siblings, 1 reply; 6+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-12  8:35 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Heiko Stuebner
  Cc: linux-usb, linux-kernel, linux-arm-kernel, linux-rockchip,
	Sebastian Reichel, Joonhoe Kim, Vladyslav Tymoshchuk,
	Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

On RK3588 nothing powers the USB3 controllers down in suspend-to-idle:
this glue has no system sleep work of its own, the controllers are
either in PD_USB, which has GENPD_FLAG_ACTIVE_WAKEUP and so stays on for
a device on the awake path, or (USB3OTG2) in no power domain at all.
Tearing the core down there only ends the power sessions of the
suspended devices: on an Orange Pi 5 a SanDisk Extreme drive and a card
reader behind a USB3 hub are disconnected and enumerated again after
every resume, which kills a filesystem mounted on them.

Set keep_host_bus_in_s2idle for RK3588, so the core keeps the suspended
bus in suspend-to-idle. RK3576 is left as it is: its second controller
is in PD_PHP, which is switched off in suspend-to-idle.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/usb/dwc3/dwc3-rockchip.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-rockchip.c b/drivers/usb/dwc3/dwc3-rockchip.c
index 65d17536af14..c96b2ac1a62d 100644
--- a/drivers/usb/dwc3/dwc3-rockchip.c
+++ b/drivers/usb/dwc3/dwc3-rockchip.c
@@ -4,6 +4,7 @@
 #include <linux/platform_device.h>
 #include <linux/phy/rockchip-usbdp.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include "glue.h"
 #include "io.h"
 
@@ -153,6 +154,15 @@ static int dwc3_rockchip_probe(struct platform_device *pdev)
 	probe_data.res = res;
 	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
 
+	/*
+	 * On RK3588 nothing powers the controllers down in suspend-to-idle:
+	 * this glue does not touch them, and they are either in PD_USB, which
+	 * stays on for a device on the awake path, or in no power domain.
+	 * (On RK3576 the second controller is in PD_PHP, which does not.)
+	 */
+	if (device_is_compatible(&pdev->dev, "rockchip,rk3588-dwc3"))
+		probe_data.properties.keep_host_bus_in_s2idle = true;
+
 	return dwc3_core_probe(&probe_data);
 }
 

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle
  2026-11-12  8:35 [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar via B4 Relay
  2026-11-12  8:35 ` [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended " Arun Iyengar via B4 Relay
  2026-11-12  8:35 ` [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588 Arun Iyengar via B4 Relay
@ 2026-11-12  8:39 ` Arun Iyengar
  2 siblings, 0 replies; 6+ messages in thread
From: Arun Iyengar @ 2026-11-12  8:39 UTC (permalink / raw)
  To: aiyengar1990
  Cc: Thinh Nguyen, Greg Kroah-Hartman, Heiko Stuebner, linux-usb,
	linux-kernel, linux-arm-kernel, linux-rockchip, Sebastian Reichel,
	Joonhoe Kim, Vladyslav Tymoshchuk

Please drop this series.

In host mode, patch 1 duplicates Joonhoe Kim's earlier "usb: dwc3:
tell xHCI that it lost its state when the core is powered off" [1],
which I only found after sending. I have tested it on an Orange Pi 5
(RK3588S), with the core teardown forced so that it takes the same
path as that patch alone: 10 of 10 suspend-to-idle cycles with the
core powered off recover without "xHC error in resume". Please take
it instead.

Patch 2 is not safe as a default for every dwc3 host (Sashiko's review
of it holds). I have reworked it as an opt-in that a glue driver sets,
used by the Rockchip glue for RK3588 only, and posted it as an RFC on
top of Sebastian Reichel's Rockchip glue series and Joonhoe's patch:
https://lore.kernel.org/r/20261112-dwc3-s2idle-optin-v1-0-842e3f8413d0@gmail.com

[1] https://lore.kernel.org/r/20260929130252.869-1-26rote@gmail.com

Arun

On Thu, Nov 12, 2026 at 12:35 AM Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org> wrote:
>
> In host mode, dwc3 tears the core down for system suspend unless the
> controller is a wakeup source. On RK3588 that ends the power session of
> every suspended USB device in suspend-to-idle: on an Orange Pi 5 a
> SanDisk Extreme drive on the Type-A USB3 port and a card reader behind a
> USB3 hub are disconnected and enumerated again after every resume, which
> kills a filesystem mounted on them. With the bus kept suspended they
> resume from U3 in milliseconds.
>
> Patch 2 of v1 [1] kept the host core in suspend-to-idle for every dwc3
> host. Sashiko found three ways in which that breaks other platforms, and
> all three hold on usb-next:
> - legacy glue drivers still act in their own suspend callbacks in
>   suspend-to-idle (dwc3-of-simple asserts its resets on rk3399,
>   dwc3-meson-g12a powers the PHYs off, dwc3-exynos switches its supplies
>   off), so the core would skip the re-init on a reset controller;
> - dwc3-google asserts its resets unless wakeup is enabled;
> - genpd keeps a domain on for a device on the awake path only with
>   GENPD_FLAG_ACTIVE_WAKEUP, which e.g. RK3568 PD_PIPE does not set.
>   Vladyslav Tymoshchuk has since seen this one on hardware [2]: on
>   SM8750 the USB GDSCs lack the flag, genpd powers them off in
>   suspend-to-idle and the xHCI dies on resume, already on the existing
>   wakeup path.
> Commit c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs on
> system_suspend in host mode") also made the teardown deliberate, so
> that the PHYs can be powered off. Thanks to Sashiko for the review and
> to Vladyslav for the test on SM8750.
>
> This version makes it an opt-in instead: patch 1 adds
> keep_host_bus_in_s2idle to dwc3_properties for the glue to set, and
> patch 2 sets it in the Rockchip glue for RK3588 only, whose PD_USB has
> GENPD_FLAG_ACTIVE_WAKEUP. Nothing changes for any other platform, nor
> for suspend-to-RAM and hibernation.
>
> It is an RFC because it depends on two postings that are not merged:
> - Sebastian Reichel's Rockchip dwc3 glue driver, v18 [3]; patch 2 is on
>   top of it.
> - Joonhoe Kim's "usb: dwc3: tell xHCI that it lost its state when the
>   core is powered off" [4]; patch 1 uses its xhci_power_lost flag to
>   re-initialise the core on resume exactly when suspend tore it down.
>   In host mode it does the same as patch 1 of v1 [1], which I withdrew
>   in its favour.
> The base is usb-next (v7.4-rc1) with [3] and [4] applied.
>
> Tested on an Orange Pi 5 (RK3588S, no wakeup source) with the code of
> this series on top of [3] and [4] in a v7.3-based kernel, 50
> suspend-to-idle cycles through rtcwake. Both dwc3 controllers of the
> board run on the Rockchip glue: USB3OTG2 (no power domain) with a
> SanDisk Extreme drive on the Type-A port, and USB3OTG0 (in PD_USB) with
> the USB 2.0 billboard device behind the Type-C port.
> - Bus kept (this series), 40 of 40 cycles: the same USB bus and device
>   numbers before and after resume; no "root hub lost power", no "xHC
>   error in resume", no disconnect, re-enumeration or "reset
>   SuperSpeed", no WARNING/BUG/Oops; the drive was readable after every
>   resume (64 MiB direct read).
> - Core torn down as without the opt-in (forced with a test-only module
>   parameter that is not part of this series), 10 of 10 cycles: all
>   root hubs reported "root hub lost power or was reset" (80 lines), no
>   "xHC error in resume" thanks to [4], no WARNING/BUG/Oops; the drive
>   was disconnected and enumerated again on every resume, which is what
>   this series avoids.
> Not tested: RK3576 (left unchanged), USB3OTG1 (not on the RK3588S),
> suspend-to-RAM (not run with this series; the opt-in does not apply
> there).
>
> [1] https://lore.kernel.org/r/20261110-dwc3-s2idle-v1-0-2ef4cc3f8130@gmail.com
> [2] https://lore.kernel.org/r/20261111121556.1871-1-tvlad744@gmail.com
> [3] https://lore.kernel.org/r/20261021-b4-rockchip-dwc3-rockchip-glue-v18-0-60000d03fca2@collabora.com
> [4] https://lore.kernel.org/r/20260929130252.869-1-26rote@gmail.com
>
> This series was developed with Claude (Anthropic) as a coding assistant:
> it wrote the code and the commit messages, and I reviewed and tested it
> as described above.
>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Arun Iyengar (2):
>       usb: dwc3: Let the glue keep the host bus suspended across suspend-to-idle
>       usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588
>
>  drivers/usb/dwc3/core.c          | 41 ++++++++++++++++++++++++++++++++++++----
>  drivers/usb/dwc3/core.h          |  3 +++
>  drivers/usb/dwc3/dwc3-rockchip.c | 10 ++++++++++
>  drivers/usb/dwc3/glue.h          |  7 +++++++
>  4 files changed, 57 insertions(+), 4 deletions(-)
> ---
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
> change-id: 20261110-dwc3-s2idle-optin-1e3021adb650
> prerequisite-message-id: <20261021-b4-rockchip-dwc3-rockchip-glue-v18-0-60000d03fca2@collabora.com>
> prerequisite-patch-id: 4fa3aae8ccfa5383522070179c8777302411082c
> prerequisite-patch-id: db09b4f5b0cffc1d5bf098fbdebb06b8be448fb7
> prerequisite-patch-id: c2e1c453454a7589a691fe391dc79e86f09ca7b7
> prerequisite-patch-id: dadeaf9e369e04d8b3329493a1a0756ddd6140f0
> prerequisite-patch-id: aa0125edb604ecf704a69250cc0d693013a977c9
> prerequisite-patch-id: 62b492b7b6e9957282f1029a02aaf258b63e990f
> prerequisite-patch-id: fcc7dd5dcd583913f91bf9986b0137c2930d2200
> prerequisite-message-id: <20260929130252.869-1-26rote@gmail.com>
> prerequisite-patch-id: 34a5a2c638a729bde49c06a330bf0847bf17e5e9
>
> Best regards,
> --
> Arun Iyengar <aiyengar1990@gmail.com>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended across suspend-to-idle
  2026-11-12  8:35 ` [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended " Arun Iyengar via B4 Relay
@ 2026-11-12  8:49   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-12  8:49 UTC (permalink / raw)
  To: Arun Iyengar; +Cc: linux-usb

> From: Arun Iyengar <aiyengar1990@gmail.com>
> 
> In host mode, dwc3_suspend_common() tears the core down for system
> suspend (dwc3_core_exit(): PHYs off, core reset) unless the controller
> is a wakeup source. By then xhci-plat has already suspended the bus:
> the root ports and every device behind them are in U3/suspend and
> expect to keep their power session (Documentation/driver-api/usb/
> persist.rst). Resetting the core ends all of them. On resume xhci-plat
> finds a reset controller ("root hub lost power or was reset") and the
> USB core has to reset-resume every device, which only works for devices
> that come back within the 2 s that usb_port_resume() waits for a
> connection.
> 
> Devices that are cut off in U3 do not necessarily come back that fast.
> On an Orange Pi 5 (RK3588S) a SanDisk Extreme drive on the Type-A USB3
> [ ... ]
> exactly when suspend tore it down, which xhci_power_lost now records.
> Nothing changes for platforms that do not set the flag, nor for
> suspend-to-RAM, hibernation and needs_full_reinit controllers.
> 
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-dwc3-s2idle-optin-v1-0-842e3f8413d0@gmail.com?part=1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588
  2026-11-12  8:35 ` [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588 Arun Iyengar via B4 Relay
@ 2026-11-12  8:56   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-12  8:56 UTC (permalink / raw)
  To: Arun Iyengar; +Cc: linux-usb

> From: Arun Iyengar <aiyengar1990@gmail.com>
> 
> On RK3588 nothing powers the USB3 controllers down in suspend-to-idle:
> this glue has no system sleep work of its own, the controllers are
> either in PD_USB, which has GENPD_FLAG_ACTIVE_WAKEUP and so stays on for
> a device on the awake path, or (USB3OTG2) in no power domain at all.
> Tearing the core down there only ends the power sessions of the
> suspended devices: on an Orange Pi 5 a SanDisk Extreme drive and a card
> reader behind a USB3 hub are disconnected and enumerated again after
> every resume, which kills a filesystem mounted on them.
> 
> Set keep_host_bus_in_s2idle for RK3588, so the core keeps the suspended
> bus in suspend-to-idle. RK3576 is left as it is: its second controller
> is in PD_PHP, which is switched off in suspend-to-idle.
> 
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-dwc3-s2idle-optin-v1-0-842e3f8413d0@gmail.com?part=2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-12  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  8:35 [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar via B4 Relay
2026-11-12  8:35 ` [PATCH RFC 1/2] usb: dwc3: Let the glue keep the host bus suspended " Arun Iyengar via B4 Relay
2026-11-12  8:49   ` sashiko-bot
2026-11-12  8:35 ` [PATCH RFC 2/2] usb: dwc3: rockchip: Keep the host bus across suspend-to-idle on RK3588 Arun Iyengar via B4 Relay
2026-11-12  8:56   ` sashiko-bot
2026-11-12  8:39 ` [PATCH RFC 0/2] usb: dwc3: Let the Rockchip glue keep the host bus across suspend-to-idle Arun Iyengar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox