aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/usb/twlxxxx-usb.txt19
-rw-r--r--drivers/usb/otg/twl4030-usb.c26
2 files changed, 39 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt b/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
index 930f9ff2952a..36b9aede3f40 100644
--- a/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
@@ -19,3 +19,22 @@ Board specific device node entry
19&twl6030-usb { 19&twl6030-usb {
20 usb-supply = <&vusb>; 20 usb-supply = <&vusb>;
21}; 21};
22
23TWL4030 USB PHY AND COMPARATOR
24 - compatible : Should be "ti,twl4030-usb"
25 - interrupts : The interrupt numbers to the cpu should be specified. First
26 interrupt number is the otg interrupt number that raises ID interrupts
27 and VBUS interrupts. The second interrupt number is optional.
28 - <supply-name>-supply : phandle to the regulator device tree node.
29 <supply-name> should be vusb1v5, vusb1v8 and vusb3v1
30 - usb_mode : The mode used by the phy to connect to the controller. "1"
31 specifies "ULPI" mode and "2" specifies "CEA2011_3PIN" mode.
32
33twl4030-usb {
34 compatible = "ti,twl4030-usb";
35 interrupts = < 10 4 >;
36 usb1v5-supply = <&vusb1v5>;
37 usb1v8-supply = <&vusb1v8>;
38 usb3v1-supply = <&vusb3v1>;
39 usb_mode = <1>;
40};
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 523cad5bfea9..f0d2e7530cfe 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -585,23 +585,28 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
585 struct twl4030_usb *twl; 585 struct twl4030_usb *twl;
586 int status, err; 586 int status, err;
587 struct usb_otg *otg; 587 struct usb_otg *otg;
588 588 struct device_node *np = pdev->dev.of_node;
589 if (!pdata) {
590 dev_dbg(&pdev->dev, "platform_data not available\n");
591 return -EINVAL;
592 }
593 589
594 twl = devm_kzalloc(&pdev->dev, sizeof *twl, GFP_KERNEL); 590 twl = devm_kzalloc(&pdev->dev, sizeof *twl, GFP_KERNEL);
595 if (!twl) 591 if (!twl)
596 return -ENOMEM; 592 return -ENOMEM;
597 593
594 if (np)
595 of_property_read_u32(np, "usb_mode",
596 (enum twl4030_usb_mode *)&twl->usb_mode);
597 else if (pdata)
598 twl->usb_mode = pdata->usb_mode;
599 else {
600 dev_err(&pdev->dev, "twl4030 initialized without pdata\n");
601 return -EINVAL;
602 }
603
598 otg = devm_kzalloc(&pdev->dev, sizeof *otg, GFP_KERNEL); 604 otg = devm_kzalloc(&pdev->dev, sizeof *otg, GFP_KERNEL);
599 if (!otg) 605 if (!otg)
600 return -ENOMEM; 606 return -ENOMEM;
601 607
602 twl->dev = &pdev->dev; 608 twl->dev = &pdev->dev;
603 twl->irq = platform_get_irq(pdev, 0); 609 twl->irq = platform_get_irq(pdev, 0);
604 twl->usb_mode = pdata->usb_mode;
605 twl->vbus_supplied = false; 610 twl->vbus_supplied = false;
606 twl->asleep = 1; 611 twl->asleep = 1;
607 twl->linkstat = OMAP_MUSB_UNKNOWN; 612 twl->linkstat = OMAP_MUSB_UNKNOWN;
@@ -690,12 +695,21 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
690 return 0; 695 return 0;
691} 696}
692 697
698#ifdef CONFIG_OF
699static const struct of_device_id twl4030_usb_id_table[] = {
700 { .compatible = "ti,twl4030-usb" },
701 {}
702};
703MODULE_DEVICE_TABLE(of, twl4030_usb_id_table);
704#endif
705
693static struct platform_driver twl4030_usb_driver = { 706static struct platform_driver twl4030_usb_driver = {
694 .probe = twl4030_usb_probe, 707 .probe = twl4030_usb_probe,
695 .remove = __exit_p(twl4030_usb_remove), 708 .remove = __exit_p(twl4030_usb_remove),
696 .driver = { 709 .driver = {
697 .name = "twl4030_usb", 710 .name = "twl4030_usb",
698 .owner = THIS_MODULE, 711 .owner = THIS_MODULE,
712 .of_match_table = of_match_ptr(twl4030_usb_id_table),
699 }, 713 },
700}; 714};
701 715