UPSTREAM: 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. Change-Id: Id674a95ff3cacb9e614cdc583f4a755e8301b7d7 Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Signed-off-by: Frank Wang <frank.wang@rock-chips.com> (cherry picked from commit bbe3d4a6c14e17d251029e4dde07f184244e9a4a)
This commit is contained in:
parent
5d262e9885
commit
2f6edaae3c
|
|
@ -590,6 +590,12 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||||
return 0;
|
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)
|
static void dwc3_core_exit_mode(struct dwc3 *dwc)
|
||||||
{
|
{
|
||||||
switch (dwc->dr_mode) {
|
switch (dwc->dr_mode) {
|
||||||
|
|
@ -607,6 +613,13 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
break;
|
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)
|
#define DWC3_ALIGN_MASK (16 - 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue