aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2010-12-02 02:06:51 -0500
committerFelipe Balbi <balbi@ti.com>2010-12-10 03:21:13 -0500
commitce40c5767a0ea1e77ca5d0b73269cb86301a35cf (patch)
treea57a74a1a12596f50df2e3ecbe70f5d5253a03cf
parentdc09886bfa781e2b442301116c18199519e36f0f (diff)
usb: musb: split am35x to its own platform_driver
Just adding its own platform_driver, not really using it yet. When all HW glue layers are converted, more patches will come to split power management code from musb_core and move it completely to HW glue layer. Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--arch/arm/mach-omap2/usb-musb.c1
-rw-r--r--drivers/usb/musb/Makefile2
-rw-r--r--drivers/usb/musb/am35x.c84
3 files changed, 86 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 542387a598ed..9107883287f6 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -93,6 +93,7 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
93 if (cpu_is_omap243x()) { 93 if (cpu_is_omap243x()) {
94 musb_resources[0].start = OMAP243X_HS_BASE; 94 musb_resources[0].start = OMAP243X_HS_BASE;
95 } else if (cpu_is_omap3517() || cpu_is_omap3505()) { 95 } else if (cpu_is_omap3517() || cpu_is_omap3505()) {
96 musb_device.name = "musb-am35x";
96 musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE; 97 musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE;
97 musb_resources[1].start = INT_35XX_USBOTG_IRQ; 98 musb_resources[1].start = INT_35XX_USBOTG_IRQ;
98 } else if (cpu_is_omap34xx()) { 99 } else if (cpu_is_omap34xx()) {
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 4792001a3d06..a48c86d9b4d0 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -17,10 +17,10 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o
17musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o 17musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o
18musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o 18musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
19musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o 19musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o
20musb_hdrc-$(CONFIG_USB_MUSB_AM35X) += am35x.o
21musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o 20musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o
22 21
23obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o 22obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
23obj-$(CONFIG_USB_MUSB_AM35X) += am35x.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/am35x.c b/drivers/usb/musb/am35x.c
index be17610d7fc2..0ae01f57b3df 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -29,6 +29,8 @@
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/platform_device.h>
33#include <linux/dma-mapping.h>
32 34
33#include <plat/control.h> 35#include <plat/control.h>
34#include <plat/usb.h> 36#include <plat/usb.h>
@@ -535,3 +537,85 @@ const struct musb_platform_ops musb_ops = {
535 537
536 .set_vbus = am35x_musb_set_vbus, 538 .set_vbus = am35x_musb_set_vbus,
537}; 539};
540
541static u64 am35x_dmamask = DMA_BIT_MASK(32);
542
543static int __init am35x_probe(struct platform_device *pdev)
544{
545 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
546 struct platform_device *musb;
547
548 int ret = -ENOMEM;
549
550 musb = platform_device_alloc("musb-hdrc", -1);
551 if (!musb) {
552 dev_err(&pdev->dev, "failed to allocate musb device\n");
553 goto err0;
554 }
555
556 musb->dev.parent = &pdev->dev;
557 musb->dev.dma_mask = &am35x_dmamask;
558 musb->dev.coherent_dma_mask = am35x_dmamask;
559
560 platform_set_drvdata(pdev, musb);
561
562 ret = platform_device_add_resources(musb, pdev->resource,
563 pdev->num_resources);
564 if (ret) {
565 dev_err(&pdev->dev, "failed to add resources\n");
566 goto err1;
567 }
568
569 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
570 if (ret) {
571 dev_err(&pdev->dev, "failed to add platform_data\n");
572 goto err1;
573 }
574
575 ret = platform_device_add(musb);
576 if (ret) {
577 dev_err(&pdev->dev, "failed to register musb device\n");
578 goto err1;
579 }
580
581 return 0;
582
583err1:
584 platform_device_put(musb);
585
586err0:
587 return ret;
588}
589
590static int __exit am35x_remove(struct platform_device *pdev)
591{
592 struct platform_device *musb = platform_get_drvdata(pdev);
593
594 platform_device_del(musb);
595 platform_device_put(musb);
596
597 return 0;
598}
599
600static struct platform_driver am35x_driver = {
601 .remove = __exit_p(am35x_remove),
602 .driver = {
603 .name = "musb-am35x",
604 },
605};
606
607MODULE_DESCRIPTION("AM35x MUSB Glue Layer");
608MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>");
609MODULE_LICENSE("GPL v2");
610
611static int __init am35x_init(void)
612{
613 return platform_driver_probe(&am35x_driver, am35x_probe);
614}
615subsys_initcall(am35x_init);
616
617static void __exit am35x_exit(void)
618{
619 platform_driver_unregister(&am35x_driver);
620}
621module_exit(am35x_exit);