diff options
author | Jean-Jacques Hiblot <jjhiblot@ti.com> | 2019-09-11 11:33:45 +0200 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2019-10-24 11:28:16 +0200 |
commit | bbe3d4a6c14e17d251029e4dde07f184244e9a4a (patch) | |
tree | 8c241a3c9ee2f31b7f171f60b371c9826abe9a20 /drivers/usb | |
parent | a8973731a452323e8767e8f9775c7d06921ebed5 (diff) | |
download | u-boot-bbe3d4a6c14e17d251029e4dde07f184244e9a4a.tar.gz u-boot-bbe3d4a6c14e17d251029e4dde07f184244e9a4a.tar.bz2 u-boot-bbe3d4a6c14e17d251029e4dde07f184244e9a4a.zip |
usb: dwc3: switch to peripheral mode when exiting
This allow the phy to enter idle and then suspend.
the K2 platforms require the PHY to be suspended before the USB domain
clock can be turned off.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc3/core.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2498f0efb1..1bd41f8bc7 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -581,6 +581,12 @@ static int dwc3_core_init_mode(struct dwc3 *dwc) return 0; } +static void dwc3_gadget_run(struct dwc3 *dwc) +{ + dwc3_writel(dwc->regs, DWC3_DCTL, DWC3_DCTL_RUN_STOP); + mdelay(100); +} + static void dwc3_core_exit_mode(struct dwc3 *dwc) { switch (dwc->dr_mode) { @@ -598,6 +604,13 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) /* do nothing */ break; } + + /* + * switch back to peripheral mode + * This enables the phy to enter idle and then, if enabled, suspend. + */ + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); + dwc3_gadget_run(dwc); } #define DWC3_ALIGN_MASK (16 - 1) |