aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2013-01-25 06:06:53 -0500
committerFelipe Balbi <balbi@ti.com>2013-01-25 06:17:54 -0500
commit5088b6f5bcf1747345ef9fe217fc80935b1b07df (patch)
tree58bb33d2660befeca679a363e4aca6e02f211afb /drivers/usb/dwc3
parent0c4c8bbbfdfc61c2ab2cc1026b5a05ae52396c93 (diff)
usb: dwc3: core: add dt support for dwc3 core
Added dt support for dwc3 core and update the documentation with device tree binding information. Getting a PHY is now done using devm_usb_get_phy_by_phandle() for dt boot. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 3a4004a620ad..804402510dea 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -420,13 +420,19 @@ 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;
@@ -450,8 +456,7 @@ static int dwc3_probe(struct platform_device *pdev)
450 else 456 else
451 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED; 457 dwc->maximum_speed = DWC3_DCFG_SUPERSPEED;
452 458
453 if (of_get_property(node, "tx-fifo-resize", NULL)) 459 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
454 dwc->needs_fifo_resize = true;
455 460
456 pm_runtime_enable(dev); 461 pm_runtime_enable(dev);
457 pm_runtime_get_sync(dev); 462 pm_runtime_get_sync(dev);
@@ -580,11 +585,22 @@ static int dwc3_remove(struct platform_device *pdev)
580 return 0; 585 return 0;
581} 586}
582 587
588#ifdef CONFIG_OF
589static const struct of_device_id of_dwc3_match[] = {
590 {
591 .compatible = "synopsys,dwc3"
592 },
593 { },
594};
595MODULE_DEVICE_TABLE(of, of_dwc3_match);
596#endif
597
583static struct platform_driver dwc3_driver = { 598static struct platform_driver dwc3_driver = {
584 .probe = dwc3_probe, 599 .probe = dwc3_probe,
585 .remove = dwc3_remove, 600 .remove = dwc3_remove,
586 .driver = { 601 .driver = {
587 .name = "dwc3", 602 .name = "dwc3",
603 .of_match_table = of_match_ptr(of_dwc3_match),
588 }, 604 },
589}; 605};
590 606