aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/omap2430.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-09-11 05:09:40 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-11 05:13:23 -0400
commit00a0b1d58af873d842580dcac55f3b156c3a4077 (patch)
tree7c6bd4171effc156f204eb81e12bf4975596d0d0 /drivers/usb/musb/omap2430.c
parent5ec40590765b8571ae6218f1bc421ec63d3e91c2 (diff)
usb: musb: omap: Add device tree support for omap musb glue
Added device tree support for omap musb driver and updated 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/musb/omap2430.c')
-rw-r--r--drivers/usb/musb/omap2430.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f4d95037db5d..d96873ba97c7 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/of.h>
33#include <linux/platform_device.h> 34#include <linux/platform_device.h>
34#include <linux/dma-mapping.h> 35#include <linux/dma-mapping.h>
35#include <linux/pm_runtime.h> 36#include <linux/pm_runtime.h>
@@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
470static int __devinit omap2430_probe(struct platform_device *pdev) 471static int __devinit omap2430_probe(struct platform_device *pdev)
471{ 472{
472 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 473 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
474 struct omap_musb_board_data *data;
473 struct platform_device *musb; 475 struct platform_device *musb;
474 struct omap2430_glue *glue; 476 struct omap2430_glue *glue;
477 struct device_node *np = pdev->dev.of_node;
478 struct musb_hdrc_config *config;
475 struct resource *res; 479 struct resource *res;
476 int ret = -ENOMEM; 480 int ret = -ENOMEM;
477 481
@@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
501 if (glue->control_otghs == NULL) 505 if (glue->control_otghs == NULL)
502 dev_dbg(&pdev->dev, "Failed to obtain control memory\n"); 506 dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
503 507
508 if (np) {
509 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
510 if (!pdata) {
511 dev_err(&pdev->dev,
512 "failed to allocate musb platfrom data\n");
513 ret = -ENOMEM;
514 goto err1;
515 }
516
517 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
518 if (!data) {
519 dev_err(&pdev->dev,
520 "failed to allocate musb board data\n");
521 ret = -ENOMEM;
522 goto err1;
523 }
524
525 config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
526 if (!data) {
527 dev_err(&pdev->dev,
528 "failed to allocate musb hdrc config\n");
529 goto err1;
530 }
531
532 of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
533 of_property_read_u32(np, "interface_type",
534 (u32 *)&data->interface_type);
535 of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
536 of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
537 of_property_read_u32(np, "power", (u32 *)&pdata->power);
538 config->multipoint = of_property_read_bool(np, "multipoint");
539
540 pdata->board_data = data;
541 pdata->config = config;
542 }
543
504 pdata->platform_ops = &omap2430_ops; 544 pdata->platform_ops = &omap2430_ops;
505 545
506 platform_set_drvdata(pdev, glue); 546 platform_set_drvdata(pdev, glue);
@@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
597#define DEV_PM_OPS NULL 637#define DEV_PM_OPS NULL
598#endif 638#endif
599 639
640#ifdef CONFIG_OF
641static const struct of_device_id omap2430_id_table[] = {
642 {
643 .compatible = "ti,omap4-musb"
644 },
645 {
646 .compatible = "ti,omap3-musb"
647 },
648 {},
649};
650MODULE_DEVICE_TABLE(of, omap2430_id_table);
651#endif
652
600static struct platform_driver omap2430_driver = { 653static struct platform_driver omap2430_driver = {
601 .probe = omap2430_probe, 654 .probe = omap2430_probe,
602 .remove = __devexit_p(omap2430_remove), 655 .remove = __devexit_p(omap2430_remove),
603 .driver = { 656 .driver = {
604 .name = "musb-omap2430", 657 .name = "musb-omap2430",
605 .pm = DEV_PM_OPS, 658 .pm = DEV_PM_OPS,
659 .of_match_table = of_match_ptr(omap2430_id_table),
606 }, 660 },
607}; 661};
608 662