Skip to content
Snippets Groups Projects
Commit 138c941a authored by Li Jun's avatar Li Jun Committed by Jason Liu
Browse files

MA-19419 usb: dwc3: core: balance usb phy init for core soft reset


After we start to do core soft reset while switch to device
mode, the phy init will be done at every switch, but its counter
part de-init is missing, this cause the phy init and exit is not
balanced, then when we really need do phy init like system resume,
it will not be done by phy driver because the maintained counter
is not 0. Considering actually phy init is redundant while mode
switch, so move out the phy init to dwc3 core init where is the
only place required.

Reviewed-by: default avatarHaibo Chen <haibo.chen@nxp.com>
Tested-by: default avatarfaqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
Acked-by: default avatarJason Liu <jason.hui.liu@nxp.com>
parent 3b9c1f7d
No related branches found
No related tags found
No related merge requests found
...@@ -272,19 +272,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) ...@@ -272,19 +272,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
{ {
u32 reg; u32 reg;
int retries = 1000; int retries = 1000;
int ret;
usb_phy_init(dwc->usb2_phy);
usb_phy_init(dwc->usb3_phy);
ret = phy_init(dwc->usb2_generic_phy);
if (ret < 0)
return ret;
ret = phy_init(dwc->usb3_generic_phy);
if (ret < 0) {
phy_exit(dwc->usb2_generic_phy);
return ret;
}
/* /*
* We're resetting only the device side because, if we're in host mode, * We're resetting only the device side because, if we're in host mode,
...@@ -318,9 +305,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) ...@@ -318,9 +305,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
udelay(1); udelay(1);
} while (--retries); } while (--retries);
phy_exit(dwc->usb3_generic_phy);
phy_exit(dwc->usb2_generic_phy);
return -ETIMEDOUT; return -ETIMEDOUT;
done: done:
...@@ -1111,9 +1095,21 @@ static int dwc3_core_init(struct dwc3 *dwc) ...@@ -1111,9 +1095,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
dwc->phys_ready = true; dwc->phys_ready = true;
} }
usb_phy_init(dwc->usb2_phy);
usb_phy_init(dwc->usb3_phy);
ret = phy_init(dwc->usb2_generic_phy);
if (ret < 0)
goto err0a;
ret = phy_init(dwc->usb3_generic_phy);
if (ret < 0) {
phy_exit(dwc->usb2_generic_phy);
goto err0a;
}
ret = dwc3_core_soft_reset(dwc); ret = dwc3_core_soft_reset(dwc);
if (ret) if (ret)
goto err0a; goto err1;
if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD &&
!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment