Commit 0534d401 authored by Thierry Reding's avatar Thierry Reding Committed by Felipe Balbi
Browse files

usb: gadget: tegra-xudc: Fix idle suspend/resume



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: 49db4272 ("usb: gadget: Add UDC driver for tegra XUSB device mode controller")
Acked-by: default avatarJon Hunter <jonathanh@nvidia.com>
Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent ccaef7e6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3840,11 +3840,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev)

	flush_work(&xudc->usb_role_sw_work);

	if (!pm_runtime_status_suspended(dev)) {
		/* Forcibly disconnect before powergating. */
		tegra_xudc_device_mode_off(xudc);

	if (!pm_runtime_status_suspended(dev))
		tegra_xudc_powergate(xudc);
	}

	pm_runtime_disable(dev);