diff mbox series

[v2] usb: dwc3: turn off VBUS when leaving host mode

Message ID 20191211161003.14950-1-b-liu@ti.com (mailing list archive)
State Mainlined
Commit 09ed259fac621634d51cd986aa8d65f035662658
Headers show
Series [v2] usb: dwc3: turn off VBUS when leaving host mode | expand

Commit Message

Bin Liu Dec. 11, 2019, 4:10 p.m. UTC
VBUS should be turned off when leaving the host mode.
Set GCTL_PRTCAP to device mode in teardown to de-assert DRVVBUS pin to
turn off VBUS power.

Fixes: 5f94adfeed97 ("usb: dwc3: core: refactor mode initialization to its own function")
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
---
v2: cover dr_mode == OTG too.

 drivers/usb/dwc3/core.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index f561c6c9e8a9..1d85c42b9c67 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1246,6 +1246,9 @@  static void dwc3_core_exit_mode(struct dwc3 *dwc)
 		/* do nothing */
 		break;
 	}
+
+	/* de-assert DRVVBUS for HOST and OTG mode */
+	dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
 }
 
 static void dwc3_get_properties(struct dwc3 *dwc)