diff options
-rw-r--r-- | arch/arm/mach-davinci/usb.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 84 |
3 files changed, 86 insertions, 2 deletions
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c index 0c7735bc0d19..803dbacfa5cd 100644 --- a/arch/arm/mach-davinci/usb.c +++ b/arch/arm/mach-davinci/usb.c | |||
@@ -76,7 +76,7 @@ static struct resource usb_resources[] = { | |||
76 | static u64 usb_dmamask = DMA_BIT_MASK(32); | 76 | static u64 usb_dmamask = DMA_BIT_MASK(32); |
77 | 77 | ||
78 | static struct platform_device usb_dev = { | 78 | static struct platform_device usb_dev = { |
79 | .name = "musb-hdrc", | 79 | .name = "musb-davinci", |
80 | .id = -1, | 80 | .id = -1, |
81 | .dev = { | 81 | .dev = { |
82 | .platform_data = &usb_data, | 82 | .platform_data = &usb_data, |
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index 8e0c9ad85531..2692eeb2085f 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -14,13 +14,13 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o | |||
14 | 14 | ||
15 | # Hardware Glue Layer | 15 | # Hardware Glue Layer |
16 | 16 | ||
17 | musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o | ||
18 | musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o | 17 | musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o |
19 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o | 18 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o |
20 | 19 | ||
21 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o | 20 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o |
22 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o | 21 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o |
23 | obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o | 22 | obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o |
23 | obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o | ||
24 | 24 | ||
25 | # the kconfig must guarantee that only one of the | 25 | # the kconfig must guarantee that only one of the |
26 | # possible I/O schemes will be enabled at a time ... | 26 | # possible I/O schemes will be enabled at a time ... |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index e283b5af8de0..bdf1940d6fee 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/platform_device.h> | ||
34 | #include <linux/dma-mapping.h> | ||
33 | 35 | ||
34 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
35 | #include <mach/memory.h> | 37 | #include <mach/memory.h> |
@@ -514,3 +516,85 @@ const struct musb_platform_ops musb_ops = { | |||
514 | 516 | ||
515 | .set_vbus = davinci_musb_set_vbus, | 517 | .set_vbus = davinci_musb_set_vbus, |
516 | }; | 518 | }; |
519 | |||
520 | static u64 davinci_dmamask = DMA_BIT_MASK(32); | ||
521 | |||
522 | static int __init davinci_probe(struct platform_device *pdev) | ||
523 | { | ||
524 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | ||
525 | struct platform_device *musb; | ||
526 | |||
527 | int ret = -ENOMEM; | ||
528 | |||
529 | musb = platform_device_alloc("musb-hdrc", -1); | ||
530 | if (!musb) { | ||
531 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
532 | goto err0; | ||
533 | } | ||
534 | |||
535 | musb->dev.parent = &pdev->dev; | ||
536 | musb->dev.dma_mask = &davinci_dmamask; | ||
537 | musb->dev.coherent_dma_mask = davinci_dmamask; | ||
538 | |||
539 | platform_set_drvdata(pdev, musb); | ||
540 | |||
541 | ret = platform_device_add_resources(musb, pdev->resource, | ||
542 | pdev->num_resources); | ||
543 | if (ret) { | ||
544 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
545 | goto err1; | ||
546 | } | ||
547 | |||
548 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
549 | if (ret) { | ||
550 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
551 | goto err1; | ||
552 | } | ||
553 | |||
554 | ret = platform_device_add(musb); | ||
555 | if (ret) { | ||
556 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
557 | goto err1; | ||
558 | } | ||
559 | |||
560 | return 0; | ||
561 | |||
562 | err1: | ||
563 | platform_device_put(musb); | ||
564 | |||
565 | err0: | ||
566 | return ret; | ||
567 | } | ||
568 | |||
569 | static int __exit davinci_remove(struct platform_device *pdev) | ||
570 | { | ||
571 | struct platform_device *musb = platform_get_drvdata(pdev); | ||
572 | |||
573 | platform_device_del(musb); | ||
574 | platform_device_put(musb); | ||
575 | |||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | static struct platform_driver davinci_driver = { | ||
580 | .remove = __exit_p(davinci_remove), | ||
581 | .driver = { | ||
582 | .name = "musb-davinci", | ||
583 | }, | ||
584 | }; | ||
585 | |||
586 | MODULE_DESCRIPTION("DaVinci MUSB Glue Layer"); | ||
587 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | ||
588 | MODULE_LICENSE("GPL v2"); | ||
589 | |||
590 | static int __init davinci_init(void) | ||
591 | { | ||
592 | return platform_driver_probe(&davinci_driver, davinci_probe); | ||
593 | } | ||
594 | subsys_initcall(davinci_init); | ||
595 | |||
596 | static void __exit davinci_exit(void) | ||
597 | { | ||
598 | platform_driver_unregister(&davinci_driver); | ||
599 | } | ||
600 | module_exit(davinci_exit); | ||