aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r--drivers/usb/dwc3/core.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 3a4004a620ad..999909451e37 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -420,18 +420,27 @@ static int dwc3_probe(struct platform_device *pdev)
420 return -ENOMEM; 420 return -ENOMEM;
421 } 421 }
422 422
423 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); 423 if (node) {
424 dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
425 dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
426 } else {
427 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
428 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
429 }
430
424 if (IS_ERR_OR_NULL(dwc->usb2_phy)) { 431 if (IS_ERR_OR_NULL(dwc->usb2_phy)) {
425 dev_err(dev, "no usb2 phy configured\n"); 432 dev_err(dev, "no usb2 phy configured\n");
426 return -EPROBE_DEFER; 433 return -EPROBE_DEFER;
427 } 434 }
428 435
429 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
430 if (IS_ERR_OR_NULL(dwc->usb3_phy)) { 436 if (IS_ERR_OR_NULL(dwc->usb3_phy)) {
431 dev_err(dev, "no usb3 phy configured\n"); 437 dev_err(dev, "no usb3 phy configured\n");
432 return -EPROBE_DEFER; 438 return -EPROBE_DEFER;
433 } 439 }
434 440
441 usb_phy_set_suspend(dwc->usb2_phy, 0);
442 usb_phy_set_suspend(dwc->usb3_phy, 0);
443
435 spin_lock_init(&dwc->lock); 444 spin_lock_init(&dwc->lock);
436 platform_set_drvdata(pdev, dwc); 445 platform_set_drvdata(pdev, dwc);
437 446
@@ -450,8 +459,7 @@ static int dwc3_probe(struct platform_device *pdev)
450 else 459 else
451 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED; 460 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
452 461
453 if (of_get_property(node, "tx-fifo-resize", NULL)) 462 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
454 dwc->needs_fifo_resize = true;
455 463
456 pm_runtime_enable(dev); 464 pm_runtime_enable(dev);
457 pm_runtime_get_sync(dev); 465 pm_runtime_get_sync(dev);
@@ -550,9 +558,9 @@ err0:
550static int dwc3_remove(struct platform_device *pdev) 558static int dwc3_remove(struct platform_device *pdev)
551{ 559{
552 struct dwc3 *dwc = platform_get_drvdata(pdev); 560 struct dwc3 *dwc = platform_get_drvdata(pdev);
553 struct resource *res;
554 561
555 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 562 usb_phy_set_suspend(dwc->usb2_phy, 1);
563 usb_phy_set_suspend(dwc->usb3_phy, 1);
556 564
557 pm_runtime_put(&pdev->dev); 565 pm_runtime_put(&pdev->dev);
558 pm_runtime_disable(&pdev->dev); 566 pm_runtime_disable(&pdev->dev);
@@ -580,11 +588,22 @@ static int dwc3_remove(struct platform_device *pdev)
580 return 0; 588 return 0;
581} 589}
582 590
591#ifdef CONFIG_OF
592static const struct of_device_id of_dwc3_match[] = {
593 {
594 .compatible = "synopsys,dwc3"
595 },
596 { },
597};
598MODULE_DEVICE_TABLE(of, of_dwc3_match);
599#endif
600
583static struct platform_driver dwc3_driver = { 601static struct platform_driver dwc3_driver = {
584 .probe = dwc3_probe, 602 .probe = dwc3_probe,
585 .remove = dwc3_remove, 603 .remove = dwc3_remove,
586 .driver = { 604 .driver = {
587 .name = "dwc3", 605 .name = "dwc3",
606 .of_match_table = of_match_ptr(of_dwc3_match),
588 }, 607 },
589}; 608};
590 609