Skip to content

Commit 3578b1c

Browse files
claudiubezneagregkh
authored andcommitted
usb: renesas_usbhs: Assert/de-assert reset signals on suspend/resume
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>
1 parent e4d9da3 commit 3578b1c

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

drivers/usb/renesas_usbhs/common.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,26 @@ static void usbhs_remove(struct platform_device *pdev)
827827
usbhs_pipe_remove(priv);
828828
}
829829

830+
static void usbhsc_restore(struct device *dev)
831+
{
832+
struct usbhs_priv *priv = dev_get_drvdata(dev);
833+
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
834+
835+
if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
836+
usbhsc_power_ctrl(priv, 1);
837+
usbhs_mod_autonomy_mode(priv);
838+
}
839+
840+
usbhs_platform_call(priv, phy_reset, pdev);
841+
842+
usbhsc_schedule_notify_hotplug(pdev);
843+
}
844+
830845
static int usbhsc_suspend(struct device *dev)
831846
{
832847
struct usbhs_priv *priv = dev_get_drvdata(dev);
833848
struct usbhs_mod *mod = usbhs_mod_get_current(priv);
849+
int ret;
834850

835851
if (mod) {
836852
usbhs_mod_call(priv, stop, priv);
@@ -840,22 +856,23 @@ static int usbhsc_suspend(struct device *dev)
840856
if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
841857
usbhsc_power_ctrl(priv, 0);
842858

843-
return 0;
859+
ret = reset_control_assert(priv->rsts);
860+
if (ret)
861+
usbhsc_restore(dev);
862+
863+
return ret;
844864
}
845865

846866
static int usbhsc_resume(struct device *dev)
847867
{
848868
struct usbhs_priv *priv = dev_get_drvdata(dev);
849-
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
850-
851-
if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
852-
usbhsc_power_ctrl(priv, 1);
853-
usbhs_mod_autonomy_mode(priv);
854-
}
869+
int ret;
855870

856-
usbhs_platform_call(priv, phy_reset, pdev);
871+
ret = reset_control_deassert(priv->rsts);
872+
if (ret)
873+
return ret;
857874

858-
usbhsc_schedule_notify_hotplug(pdev);
875+
usbhsc_restore(dev);
859876

860877
return 0;
861878
}

0 commit comments

Comments
 (0)