Re: [PATCH v5 1/7] usb: dwc2: fix recovery after PM domain off

From: Stefan Wahren

Date: Tue Nov 24 2026 - 16:31:56 EST


Hi Fabrice,

Am 24.11.26 um 11:52 schrieb Fabrice Gasnier:
On 11/21/26 21:38, Stefan Wahren wrote:
Hi Fabrice,

Am 17.11.26 um 18:06 schrieb Fabrice Gasnier:
When the power domain containing the DWC2 controller is disabled during
suspend, its registers are lost. Reading registers to back them up from
dwc2_suspend() after clock gating can hang STM32MP1 in both host and
device mode. Host suspend enters clock gating directly; in device mode,
this can happen if the host suspended the USB bus before system suspend.
Hi Stefan,

sorry for breaking this platform, but I only had the Raspberry Pi for testing and I didn't get much
feedback last year.
I saw your series, sorry about that, but unfortunately I haven't tested in time...
no worries

I'm not familiar with STM32MP1, could you please clarify based on the compatible which is affected?
Yes, "st,stm32mp15-hsotg"
I think it would be helpful to have at least "stm32mp15" in the commit message

Could you please explain, why backing up the registers before clock gating isn't an option?
Well, that can probably be an option, thanks on your suggestion!

That's not the way I had in mind (power gating and clock gating are two things).
This means: prepare for register loss each time the controller is put into clock gating mode (but
drop the backup values when exiting clock gating without PM-wide platform suspend, as these are
normally not lost).

I can rework this in V6:
- Add the registers backup call when entering clock gating. This will backup the registers when the
bus gets suspended (either as device or host), then a later PM suspend request can skip the backup,
if they are already backed-up.
- Remains some stale states, as raised by Sashiko: when doing this, most of state flags have to be
re-initialized. I'll try to split into separate patch to ease review.

Is it basically what you're thinking of ?
Yes, I'm not an expert here and mostly followed Doug's suggestions. I consider my suggestion as a possible fix for my original approach.
There is a reference manual [1] for the EZR32WG ARM MCU, which also have a DWC2 IP. Even if it's not your SoC, the chapter 15.4.8.2 Suspend seems to have helpful information.

I hope this helps.

Best regards

[1] - https://www.silabs.com/documents/public/reference-manuals/EZR32WG-RM.pdf

Best Regards,
Fabrice

Best regards