diff options
author | Douglas Anderson <dianders@chromium.org> | 2019-04-16 17:53:49 -0400 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2019-05-03 02:13:47 -0400 |
commit | c40cf7705e13d288d900e044c0a2f756e9e4909a (patch) | |
tree | 31ab9133f03c69cda3587744766a8ce59a72eddb /drivers/usb/dwc2/core_intr.c | |
parent | cc389eaabd7082a14e46aaa5a02f87c9eef37d7f (diff) |
usb: dwc2: optionally assert phy reset when waking up
On the rk3288 USB host-only port (the one that's not the OTG-enabled
port) the PHY can get into a bad state when a wakeup is asserted (not
just a wakeup from full system suspend but also a wakeup from
autosuspend).
We can get the PHY out of its bad state by asserting its "port reset",
but unfortunately that seems to assert a reset onto the USB bus so it
could confuse things if we don't actually deenumerate / reenumerate the
device.
We can also get the PHY out of its bad state by fully resetting it using
the reset from the CRU (clock reset unit), which does a more full
reset. The CRU-based reset appears to actually cause devices on the bus
to be removed and reinserted, which fixes the problem (albeit in a hacky
way).
It's unfortunate that we need to do a full re-enumeration of devices at
wakeup time, but this is better than alternative of letting the bus get
wedged.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2/core_intr.c')
-rw-r--r-- | drivers/usb/dwc2/core_intr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..6af6add3d4c0 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c | |||
@@ -435,6 +435,18 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) | |||
435 | /* Restart the Phy Clock */ | 435 | /* Restart the Phy Clock */ |
436 | pcgcctl &= ~PCGCTL_STOPPCLK; | 436 | pcgcctl &= ~PCGCTL_STOPPCLK; |
437 | dwc2_writel(hsotg, pcgcctl, PCGCTL); | 437 | dwc2_writel(hsotg, pcgcctl, PCGCTL); |
438 | |||
439 | /* | ||
440 | * If we've got this quirk then the PHY is stuck upon | ||
441 | * wakeup. Assert reset. This will propagate out and | ||
442 | * eventually we'll re-enumerate the device. Not great | ||
443 | * but the best we can do. We can't call phy_reset() | ||
444 | * at interrupt time but there's no hurry, so we'll | ||
445 | * schedule it for later. | ||
446 | */ | ||
447 | if (hsotg->reset_phy_on_wake) | ||
448 | dwc2_host_schedule_phy_reset(hsotg); | ||
449 | |||
438 | mod_timer(&hsotg->wkp_timer, | 450 | mod_timer(&hsotg->wkp_timer, |
439 | jiffies + msecs_to_jiffies(71)); | 451 | jiffies + msecs_to_jiffies(71)); |
440 | } else { | 452 | } else { |