aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-09-06 10:57:09 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-06 13:16:07 -0400
commitf8515f0639c337b6fac2f24073368ae834053a96 (patch)
tree8386ffb5be8916ce2fa033306f0aec961ad62c87 /drivers/usb
parentff0a1f39400a8d2c02343bd22d295517d72e58ec (diff)
usb: twl4030: Add device tree support for twl4030 usb
Add device tree support for twl4030 usb driver. Update the Documentation with device tree binding information. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/otg/twl4030-usb.c26
1 files changed, 20 insertions, 6 deletions
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