aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2010-12-02 02:19:35 -0500
committerFelipe Balbi <balbi@ti.com>2010-12-10 03:21:16 -0500
commit8ceae51ed5d1739d4ed5c4b947d12ff1d7df0e89 (patch)
treee804ca6410e24a239ee826fc44e200dfbf502ca1 /drivers
parent73b089b052a69020b953312a624a6e1eb5b81fab (diff)
usb: musb: split da8xx 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/Makefile2
-rw-r--r--drivers/usb/musb/da8xx.c84
2 files changed, 85 insertions, 1 deletions
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 2692eeb2085f..d2a012917887 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
17musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
18musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o 17musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o
19 18
20obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o 19obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
21obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o 20obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o
22obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o 21obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o
23obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o 22obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o
23obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.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/da8xx.c b/drivers/usb/musb/da8xx.c
index 6161fc50d049..b80b7da44727 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.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 <mach/da8xx.h> 35#include <mach/da8xx.h>
34#include <mach/usb.h> 36#include <mach/usb.h>
@@ -480,3 +482,85 @@ const struct musb_platform_ops musb_ops = {
480 482
481 .set_vbus = da8xx_musb_set_vbus, 483 .set_vbus = da8xx_musb_set_vbus,
482}; 484};
485
486static u64 da8xx_dmamask = DMA_BIT_MASK(32);
487
488static int __init da8xx_probe(struct platform_device *pdev)
489{
490 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
491 struct platform_device *musb;
492
493 int ret = -ENOMEM;
494
495 musb = platform_device_alloc("musb-hdrc", -1);
496 if (!musb) {
497 dev_err(&pdev->dev, "failed to allocate musb device\n");
498 goto err0;
499 }
500
501 musb->dev.parent = &pdev->dev;
502 musb->dev.dma_mask = &da8xx_dmamask;
503 musb->dev.coherent_dma_mask = da8xx_dmamask;
504
505 platform_set_drvdata(pdev, musb);
506
507 ret = platform_device_add_resources(musb, pdev->resource,
508 pdev->num_resources);
509 if (ret) {
510 dev_err(&pdev->dev, "failed to add resources\n");
511 goto err1;
512 }
513
514 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
515 if (ret) {
516 dev_err(&pdev->dev, "failed to add platform_data\n");
517 goto err1;
518 }
519
520 ret = platform_device_add(musb);
521 if (ret) {
522 dev_err(&pdev->dev, "failed to register musb device\n");
523 goto err1;
524 }
525
526 return 0;
527
528err1:
529 platform_device_put(musb);
530
531err0:
532 return ret;
533}
534
535static int __exit da8xx_remove(struct platform_device *pdev)
536{
537 struct platform_device *musb = platform_get_drvdata(pdev);
538
539 platform_device_del(musb);
540 platform_device_put(musb);
541
542 return 0;
543}
544
545static struct platform_driver da8xx_driver = {
546 .remove = __exit_p(da8xx_remove),
547 .driver = {
548 .name = "musb-da8xx",
549 },
550};
551
552MODULE_DESCRIPTION("DA8xx/OMAP-L1x MUSB Glue Layer");
553MODULE_AUTHOR("Sergei Shtylyov <sshtylyov@ru.mvista.com>");
554MODULE_LICENSE("GPL v2");
555
556static int __init da8xx_init(void)
557{
558 return platform_driver_probe(&da8xx_driver, da8xx_probe);
559}
560subsys_initcall(da8xx_init);
561
562static void __exit da8xx_exit(void)
563{
564 platform_driver_unregister(&da8xx_driver);
565}
566module_exit(da8xx_exit);