aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc2/platform.c')
-rw-r--r--drivers/usb/dwc2/platform.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 6a795aa2ff05..ae095f009b4f 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
155 struct dwc2_core_params defparams; 155 struct dwc2_core_params defparams;
156 struct dwc2_hsotg *hsotg; 156 struct dwc2_hsotg *hsotg;
157 struct resource *res; 157 struct resource *res;
158 struct phy *phy;
159 struct usb_phy *uphy;
158 int retval; 160 int retval;
159 int irq; 161 int irq;
160 162
@@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev)
212 214
213 hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); 215 hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
214 216
217 /*
218 * Attempt to find a generic PHY, then look for an old style
219 * USB PHY
220 */
221 phy = devm_phy_get(&dev->dev, "usb2-phy");
222 if (IS_ERR(phy)) {
223 hsotg->phy = NULL;
224 uphy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
225 if (IS_ERR(uphy))
226 hsotg->uphy = NULL;
227 else
228 hsotg->uphy = uphy;
229 } else {
230 hsotg->phy = phy;
231 phy_power_on(hsotg->phy);
232 phy_init(hsotg->phy);
233 }
234
215 spin_lock_init(&hsotg->lock); 235 spin_lock_init(&hsotg->lock);
216 mutex_init(&hsotg->init_mutex); 236 mutex_init(&hsotg->init_mutex);
217 retval = dwc2_gadget_init(hsotg, irq); 237 retval = dwc2_gadget_init(hsotg, irq);
@@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev)
231 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); 251 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
232 int ret = 0; 252 int ret = 0;
233 253
234 if (dwc2_is_device_mode(dwc2)) 254 if (dwc2_is_device_mode(dwc2)) {
235 ret = s3c_hsotg_suspend(dwc2); 255 ret = s3c_hsotg_suspend(dwc2);
256 } else {
257 if (dwc2->lx_state == DWC2_L0)
258 return 0;
259 phy_exit(dwc2->phy);
260 phy_power_off(dwc2->phy);
261
262 }
236 return ret; 263 return ret;
237} 264}
238 265
@@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev)
241 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); 268 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
242 int ret = 0; 269 int ret = 0;
243 270
244 if (dwc2_is_device_mode(dwc2)) 271 if (dwc2_is_device_mode(dwc2)) {
245 ret = s3c_hsotg_resume(dwc2); 272 ret = s3c_hsotg_resume(dwc2);
273 } else {
274 phy_power_on(dwc2->phy);
275 phy_init(dwc2->phy);
276
277 }
246 return ret; 278 return ret;
247} 279}
248 280