diff options
Diffstat (limited to 'drivers/usb/musb/da8xx.c')
-rw-r--r-- | drivers/usb/musb/da8xx.c | 84 |
1 files changed, 84 insertions, 0 deletions
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 | |||
486 | static u64 da8xx_dmamask = DMA_BIT_MASK(32); | ||
487 | |||
488 | static 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 | |||
528 | err1: | ||
529 | platform_device_put(musb); | ||
530 | |||
531 | err0: | ||
532 | return ret; | ||
533 | } | ||
534 | |||
535 | static 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 | |||
545 | static struct platform_driver da8xx_driver = { | ||
546 | .remove = __exit_p(da8xx_remove), | ||
547 | .driver = { | ||
548 | .name = "musb-da8xx", | ||
549 | }, | ||
550 | }; | ||
551 | |||
552 | MODULE_DESCRIPTION("DA8xx/OMAP-L1x MUSB Glue Layer"); | ||
553 | MODULE_AUTHOR("Sergei Shtylyov <sshtylyov@ru.mvista.com>"); | ||
554 | MODULE_LICENSE("GPL v2"); | ||
555 | |||
556 | static int __init da8xx_init(void) | ||
557 | { | ||
558 | return platform_driver_probe(&da8xx_driver, da8xx_probe); | ||
559 | } | ||
560 | subsys_initcall(da8xx_init); | ||
561 | |||
562 | static void __exit da8xx_exit(void) | ||
563 | { | ||
564 | platform_driver_unregister(&da8xx_driver); | ||
565 | } | ||
566 | module_exit(da8xx_exit); | ||