* [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume
@ 2020-04-17 17:05 Thierry Reding
2020-04-20 14:32 ` Jon Hunter
2020-05-06 17:13 ` Thierry Reding
0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2020-04-17 17:05 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman
Cc: Jon Hunter, Nagarjuna Kristam, linux-usb, linux-tegra, linux-kernel
From: Thierry Reding <treding@nvidia.com>
When the XUDC device is idle (i.e. powergated), care must be taken not
to access any registers because that would lead to a crash.
Move the call to tegra_xudc_device_mode_off() into the same conditional
as the tegra_xudc_powergate() call to make sure we only force device
mode off if the XUDC is actually powered up.
Fixes: 49db427232fe ("usb: gadget: Add UDC driver for tegra XUSB device mode controller")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 52a6add961f4..dfabc54cdc27 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -3840,11 +3840,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev)
flush_work(&xudc->usb_role_sw_work);
- /* Forcibly disconnect before powergating. */
- tegra_xudc_device_mode_off(xudc);
-
- if (!pm_runtime_status_suspended(dev))
+ if (!pm_runtime_status_suspended(dev)) {
+ /* Forcibly disconnect before powergating. */
+ tegra_xudc_device_mode_off(xudc);
tegra_xudc_powergate(xudc);
+ }
pm_runtime_disable(dev);
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume
2020-04-17 17:05 [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume Thierry Reding
@ 2020-04-20 14:32 ` Jon Hunter
2020-05-06 17:13 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2020-04-20 14:32 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman
Cc: Nagarjuna Kristam, linux-usb, linux-tegra, linux-kernel
On 17/04/2020 18:05, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> When the XUDC device is idle (i.e. powergated), care must be taken not
> to access any registers because that would lead to a crash.
>
> Move the call to tegra_xudc_device_mode_off() into the same conditional
> as the tegra_xudc_powergate() call to make sure we only force device
> mode off if the XUDC is actually powered up.
>
> Fixes: 49db427232fe ("usb: gadget: Add UDC driver for tegra XUSB device mode controller")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
> index 52a6add961f4..dfabc54cdc27 100644
> --- a/drivers/usb/gadget/udc/tegra-xudc.c
> +++ b/drivers/usb/gadget/udc/tegra-xudc.c
> @@ -3840,11 +3840,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev)
>
> flush_work(&xudc->usb_role_sw_work);
>
> - /* Forcibly disconnect before powergating. */
> - tegra_xudc_device_mode_off(xudc);
> -
> - if (!pm_runtime_status_suspended(dev))
> + if (!pm_runtime_status_suspended(dev)) {
> + /* Forcibly disconnect before powergating. */
> + tegra_xudc_device_mode_off(xudc);
> tegra_xudc_powergate(xudc);
> + }
>
> pm_runtime_disable(dev);
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume
2020-04-17 17:05 [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume Thierry Reding
2020-04-20 14:32 ` Jon Hunter
@ 2020-05-06 17:13 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2020-05-06 17:13 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman
Cc: Jon Hunter, Nagarjuna Kristam, linux-usb, linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
On Fri, Apr 17, 2020 at 07:05:37PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> When the XUDC device is idle (i.e. powergated), care must be taken not
> to access any registers because that would lead to a crash.
>
> Move the call to tegra_xudc_device_mode_off() into the same conditional
> as the tegra_xudc_powergate() call to make sure we only force device
> mode off if the XUDC is actually powered up.
>
> Fixes: 49db427232fe ("usb: gadget: Add UDC driver for tegra XUSB device mode controller")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Hi Felipe, Greg,
can you guys pick this up for v5.7, please?
Thanks,
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-06 17:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 17:05 [PATCH] usb: gadget: tegra-xudc: Fix idle suspend/resume Thierry Reding
2020-04-20 14:32 ` Jon Hunter
2020-05-06 17:13 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).