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>
This commit is contained in:
Claudiu Beznea 2025-11-06 16:36:25 +02:00 committed by Greg Kroah-Hartman
parent e4d9da32bf
commit 3578b1cde5

View File

@ -827,23 +827,7 @@ static void usbhs_remove(struct platform_device *pdev)
usbhs_pipe_remove(priv);
}
static int usbhsc_suspend(struct device *dev)
{
struct usbhs_priv *priv = dev_get_drvdata(dev);
struct usbhs_mod *mod = usbhs_mod_get_current(priv);
if (mod) {
usbhs_mod_call(priv, stop, priv);
usbhs_mod_change(priv, -1);
}
if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
usbhsc_power_ctrl(priv, 0);
return 0;
}
static int usbhsc_resume(struct device *dev)
static void usbhsc_restore(struct device *dev)
{
struct usbhs_priv *priv = dev_get_drvdata(dev);
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
@ -856,6 +840,39 @@ static int usbhsc_resume(struct device *dev)
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);
usbhs_mod_change(priv, -1);
}
if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
usbhsc_power_ctrl(priv, 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);
int ret;
ret = reset_control_deassert(priv->rsts);
if (ret)
return ret;
usbhsc_restore(dev);
return 0;
}