aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@kernel.org>2016-04-11 10:12:34 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-04-18 05:35:17 -0400
commit5c4ad318de3b8e8680d654c82a254c4b65243739 (patch)
tree7208078b192a98cd8a4ace8b016f51d44fc92748
parent45d49cb706e5d8f0ca5e868118b5d453afbb938f (diff)
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: Felipe Balbi <balbi@kernel.org> [nsekhar@ti.com: fix call to usb_phy_set_suspend() in dwc3_suspend()] Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/dwc3/core.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index fa20f5a99d12..34277ced26bd 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1150,6 +1150,11 @@ static int dwc3_suspend(struct device *dev)
1150 phy_exit(dwc->usb2_generic_phy); 1150 phy_exit(dwc->usb2_generic_phy);
1151 phy_exit(dwc->usb3_generic_phy); 1151 phy_exit(dwc->usb3_generic_phy);
1152 1152
1153 usb_phy_set_suspend(dwc->usb2_phy, 1);
1154 usb_phy_set_suspend(dwc->usb3_phy, 1);
1155 WARN_ON(phy_power_off(dwc->usb2_generic_phy) < 0);
1156 WARN_ON(phy_power_off(dwc->usb3_generic_phy) < 0);
1157
1153 pinctrl_pm_select_sleep_state(dev); 1158 pinctrl_pm_select_sleep_state(dev);
1154 1159
1155 return 0; 1160 return 0;
@@ -1163,11 +1168,21 @@ static int dwc3_resume(struct device *dev)
1163 1168
1164 pinctrl_pm_select_default_state(dev); 1169 pinctrl_pm_select_default_state(dev);
1165 1170
1171 usb_phy_set_suspend(dwc->usb2_phy, 0);
1172 usb_phy_set_suspend(dwc->usb3_phy, 0);
1173 ret = phy_power_on(dwc->usb2_generic_phy);
1174 if (ret < 0)
1175 return ret;
1176
1177 ret = phy_power_on(dwc->usb3_generic_phy);
1178 if (ret < 0)
1179 goto err_usb2phy_power;
1180
1166 usb_phy_init(dwc->usb3_phy); 1181 usb_phy_init(dwc->usb3_phy);
1167 usb_phy_init(dwc->usb2_phy); 1182 usb_phy_init(dwc->usb2_phy);
1168 ret = phy_init(dwc->usb2_generic_phy); 1183 ret = phy_init(dwc->usb2_generic_phy);
1169 if (ret < 0) 1184 if (ret < 0)
1170 return ret; 1185 goto err_usb3phy_power;
1171 1186
1172 ret = phy_init(dwc->usb3_generic_phy); 1187 ret = phy_init(dwc->usb3_generic_phy);
1173 if (ret < 0) 1188 if (ret < 0)
@@ -1200,6 +1215,12 @@ static int dwc3_resume(struct device *dev)
1200err_usb2phy_init: 1215err_usb2phy_init:
1201 phy_exit(dwc->usb2_generic_phy); 1216 phy_exit(dwc->usb2_generic_phy);
1202 1217
1218err_usb3phy_power:
1219 phy_power_off(dwc->usb3_generic_phy);
1220
1221err_usb2phy_power:
1222 phy_power_off(dwc->usb2_generic_phy);
1223
1203 return ret; 1224 return ret;
1204} 1225}
1205 1226