Re: [PATCH] bus: ti-sysc: Fix am335x resume hang for usb otg module
From: Tony Lindgren
Date: Tue May 18 2021 - 02:50:29 EST
* Tony Lindgren <tony@xxxxxxxxxxx> [210429 10:45]:
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -1308,7 +1314,23 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev)
> (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
> return 0;
>
> - return pm_runtime_force_resume(dev);
> + /* Only enable module if it was on, or needs to be reinitialized */
> + if (ddata->needs_resume ||
> + ddata->cfg.quirks & SYSC_QUIRK_REINIT_ON_RESUME) {
> + error = sysc_runtime_resume(dev);
> + if (error)
> + dev_warn(dev, "noirq_resume failed: %i\n", error);
> + }
> +
> + /* Idle quirky module again if it was not on before suspend */
> + if (ddata->cfg.quirks & SYSC_QUIRK_REINIT_ON_RESUME &&
> + !ddata->needs_resume) {
> + error = sysc_runtime_suspend(dev);
> + }
> +
> + ddata->needs_resume = 0;
> +
> + return error;
> }
Best to set this up as a separate function, otherwise cpu_pm won't
be able to use it eventually. I'll send out v2.
Regards,
Tony