Thread (20 messages) 20 messages, 5 authors, 2024-09-01

Re: [PATCH V3 RFC 8/9] usb: dwc2: Implement recovery after PM domain off

From: Doug Anderson <dianders@chromium.org>
Date: 2024-08-29 19:35:01
Also in: dri-devel, linux-pm, linux-usb

Hi,

On Wed, Aug 21, 2024 at 2:41 PM Stefan Wahren [off-list ref] wrote:
According to the dt-bindings there are some platforms, which have a
dedicated USB power domain for DWC2 IP core supply. If the power domain
is switched off during system suspend then all USB register will lose
their settings.

Use GUSBCFG_TOUTCAL as a canary to detect that the power domain has
been powered off during suspend. Since the GOTGCTL_CURMODE_HOST doesn't
match on all platform with the current mode, additionally backup
GINTSTS. This works reliable to decide which registers should be
restored.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/usb/dwc2/core.c     |  1 +
 drivers/usb/dwc2/core.h     |  2 ++
 drivers/usb/dwc2/platform.c | 38 +++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
+static int dwc2_restore_critical_registers(struct dwc2_hsotg *hsotg)
+{
+       struct dwc2_gregs_backup *gr;
+
+       gr = &hsotg->gr_backup;
+
+       if (!gr->valid) {
+               dev_err(hsotg->dev, "%s: no registers to restore\n",
+                       __func__);
nit: IMO "__func__" should not be in dev_err() messages. The message
plus the device should be enough. If __func__ should have been in
dev_err() messages then the Linux kernel would have automatically put
it there.

Aside from that, this looks reasonable to me and discussed previously.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help