Commit 5c4ad318 authored by Felipe Balbi's avatar Felipe Balbi Committed by Felipe Balbi

usb: dwc3: core: fix PHY handling during suspend

we need to power off the PHY during suspend and
power it back on during resume.
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
[nsekhar@ti.com: fix call to usb_phy_set_suspend() in dwc3_suspend()]
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 45d49cb7
...@@ -1150,6 +1150,11 @@ static int dwc3_suspend(struct device *dev) ...@@ -1150,6 +1150,11 @@ static int dwc3_suspend(struct device *dev)
phy_exit(dwc->usb2_generic_phy); phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy); phy_exit(dwc->usb3_generic_phy);
usb_phy_set_suspend(dwc->usb2_phy, 1);
usb_phy_set_suspend(dwc->usb3_phy, 1);
WARN_ON(phy_power_off(dwc->usb2_generic_phy) < 0);
WARN_ON(phy_power_off(dwc->usb3_generic_phy) < 0);
pinctrl_pm_select_sleep_state(dev); pinctrl_pm_select_sleep_state(dev);
return 0; return 0;
...@@ -1163,11 +1168,21 @@ static int dwc3_resume(struct device *dev) ...@@ -1163,11 +1168,21 @@ static int dwc3_resume(struct device *dev)
pinctrl_pm_select_default_state(dev); pinctrl_pm_select_default_state(dev);
usb_phy_set_suspend(dwc->usb2_phy, 0);
usb_phy_set_suspend(dwc->usb3_phy, 0);
ret = phy_power_on(dwc->usb2_generic_phy);
if (ret < 0)
return ret;
ret = phy_power_on(dwc->usb3_generic_phy);
if (ret < 0)
goto err_usb2phy_power;
usb_phy_init(dwc->usb3_phy); usb_phy_init(dwc->usb3_phy);
usb_phy_init(dwc->usb2_phy); usb_phy_init(dwc->usb2_phy);
ret = phy_init(dwc->usb2_generic_phy); ret = phy_init(dwc->usb2_generic_phy);
if (ret < 0) if (ret < 0)
return ret; goto err_usb3phy_power;
ret = phy_init(dwc->usb3_generic_phy); ret = phy_init(dwc->usb3_generic_phy);
if (ret < 0) if (ret < 0)
...@@ -1200,6 +1215,12 @@ static int dwc3_resume(struct device *dev) ...@@ -1200,6 +1215,12 @@ static int dwc3_resume(struct device *dev)
err_usb2phy_init: err_usb2phy_init:
phy_exit(dwc->usb2_generic_phy); phy_exit(dwc->usb2_generic_phy);
err_usb3phy_power:
phy_power_off(dwc->usb3_generic_phy);
err_usb2phy_power:
phy_power_off(dwc->usb2_generic_phy);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment