summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeng Dongyang <daniel.meng@rock-chips.com>2018-03-08 19:00:02 +0800
committerTao Huang <huangtao@rock-chips.com>2018-03-16 17:51:16 +0800
commit079b3c7cdb59a69620b0d9ad289fa0ff464e53e2 (patch)
tree26e49ae544c2d5b750c0f565ae04a0ec988bd7f0
parentab4a44bf83351eeaded85db8969266455a98346c (diff)
usb: dwc2: make hcd into L3 power off state when suspend
The controller will reset and run into error state if turn off power when suspend in host mode. This patch stop hcd to make the controller into L3 state to make sure that the controller and driver state will reset when resume. Change-Id: If66bc1a249e919f440ecde0c66f18dabde0b2e62 Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
-rw-r--r--drivers/usb/dwc2/platform.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 47a1b6dd3a18..5d569792a6ec 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -699,6 +699,12 @@ static int __maybe_unused dwc2_resume(struct device *dev)
return ret;
}
+ /* Stop hcd if dr_mode is host and PD is power off when suspend */
+ if (dwc2->op_state == OTG_STATE_A_HOST && dwc2_is_device_mode(dwc2)) {
+ dwc2_hcd_disconnect(dwc2, true);
+ dwc2->lx_state = DWC2_L3;
+ }
+
if (dwc2_is_device_mode(dwc2))
ret = dwc2_hsotg_resume(dwc2);