aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/am35x.c
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 /drivers/usb/musb/am35x.c
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>
Diffstat (limited to 'drivers/usb/musb/am35x.c')
-rw-r--r--drivers/usb/musb/am35x.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index be17610d7fc..0ae01f57b3d 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);