]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: renesas_usbhs: Assert/de-assert reset signals on suspend/resume
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Thu, 6 Nov 2025 14:36:25 +0000 (16:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 14:11:35 +0000 (15:11 +0100)
The Renesas RZ/G3S SoC supports a power-saving mode in which power to most
SoC components is turned off, including the USB subsystem.

To properly restore from such a state, the reset signal needs to be
asserted/de-asserted during suspend/resume. Add reset assert/de-assert on
suspend/resume.

The resume code has been moved into a separate function to allow reusing
it in case reset_control_assert() from suspend fails.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20251106143625.3050119-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/common.c

index 8f536f2c500f7b8da6ac44adaa5200fe8f92d609..8df68261a320fde72f2ba625b81fb77aa20289ab 100644 (file)
@@ -827,10 +827,26 @@ static void usbhs_remove(struct platform_device *pdev)
        usbhs_pipe_remove(priv);
 }
 
+static void usbhsc_restore(struct device *dev)
+{
+       struct usbhs_priv *priv = dev_get_drvdata(dev);
+       struct platform_device *pdev = usbhs_priv_to_pdev(priv);
+
+       if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
+               usbhsc_power_ctrl(priv, 1);
+               usbhs_mod_autonomy_mode(priv);
+       }
+
+       usbhs_platform_call(priv, phy_reset, pdev);
+
+       usbhsc_schedule_notify_hotplug(pdev);
+}
+
 static int usbhsc_suspend(struct device *dev)
 {
        struct usbhs_priv *priv = dev_get_drvdata(dev);
        struct usbhs_mod *mod = usbhs_mod_get_current(priv);
+       int ret;
 
        if (mod) {
                usbhs_mod_call(priv, stop, priv);
@@ -840,22 +856,23 @@ static int usbhsc_suspend(struct device *dev)
        if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
                usbhsc_power_ctrl(priv, 0);
 
-       return 0;
+       ret = reset_control_assert(priv->rsts);
+       if (ret)
+               usbhsc_restore(dev);
+
+       return ret;
 }
 
 static int usbhsc_resume(struct device *dev)
 {
        struct usbhs_priv *priv = dev_get_drvdata(dev);
-       struct platform_device *pdev = usbhs_priv_to_pdev(priv);
-
-       if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
-               usbhsc_power_ctrl(priv, 1);
-               usbhs_mod_autonomy_mode(priv);
-       }
+       int ret;
 
-       usbhs_platform_call(priv, phy_reset, pdev);
+       ret = reset_control_deassert(priv->rsts);
+       if (ret)
+               return ret;
 
-       usbhsc_schedule_notify_hotplug(pdev);
+       usbhsc_restore(dev);
 
        return 0;
 }