diff options
author | Felipe Balbi <balbi@ti.com> | 2010-12-02 02:21:05 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-12-10 03:21:16 -0500 |
commit | 9cb0308eec7a965136fe9fc6d1be3548c01a4a1e (patch) | |
tree | 7aa08956e8396c0e4fa77c94d0af62bbca5cf022 /drivers/usb/musb | |
parent | 8ceae51ed5d1739d4ed5c4b947d12ff1d7df0e89 (diff) |
usb: musb: split blackfin to its own platform_driver
Just adding its own platform_driver, not really
using it yet.
Later 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')
-rw-r--r-- | drivers/usb/musb/Makefile | 4 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 84 |
2 files changed, 85 insertions, 3 deletions
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index d2a012917887..61f46affcf7a 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -13,14 +13,12 @@ musb_hdrc-$(CONFIG_USB_MUSB_HDRC_HCD) += musb_virthub.o musb_host.o | |||
13 | musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o | 13 | musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o |
14 | 14 | ||
15 | # Hardware Glue Layer | 15 | # Hardware Glue Layer |
16 | |||
17 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o | ||
18 | |||
19 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o | 16 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o |
20 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o | 17 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o |
21 | obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o | 18 | obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o |
22 | obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o | 19 | obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o |
23 | obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o | 20 | obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o |
21 | obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o | ||
24 | 22 | ||
25 | # the kconfig must guarantee that only one of the | 23 | # the kconfig must guarantee that only one of the |
26 | # possible I/O schemes will be enabled at a time ... | 24 | # possible I/O schemes will be enabled at a time ... |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 9874501d6429..b0968201d849 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/dma-mapping.h> | ||
18 | 20 | ||
19 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
20 | 22 | ||
@@ -442,3 +444,85 @@ const struct musb_platform_ops musb_ops = { | |||
442 | .vbus_status = bfin_musb_vbus_status, | 444 | .vbus_status = bfin_musb_vbus_status, |
443 | .set_vbus = bfin_musb_set_vbus, | 445 | .set_vbus = bfin_musb_set_vbus, |
444 | }; | 446 | }; |
447 | |||
448 | static u64 bfin_dmamask = DMA_BIT_MASK(32); | ||
449 | |||
450 | static int __init bfin_probe(struct platform_device *pdev) | ||
451 | { | ||
452 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | ||
453 | struct platform_device *musb; | ||
454 | |||
455 | int ret = -ENOMEM; | ||
456 | |||
457 | musb = platform_device_alloc("musb-hdrc", -1); | ||
458 | if (!musb) { | ||
459 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
460 | goto err0; | ||
461 | } | ||
462 | |||
463 | musb->dev.parent = &pdev->dev; | ||
464 | musb->dev.dma_mask = &bfin_dmamask; | ||
465 | musb->dev.coherent_dma_mask = bfin_dmamask; | ||
466 | |||
467 | platform_set_drvdata(pdev, musb); | ||
468 | |||
469 | ret = platform_device_add_resources(musb, pdev->resource, | ||
470 | pdev->num_resources); | ||
471 | if (ret) { | ||
472 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
473 | goto err1; | ||
474 | } | ||
475 | |||
476 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
477 | if (ret) { | ||
478 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
479 | goto err1; | ||
480 | } | ||
481 | |||
482 | ret = platform_device_add(musb); | ||
483 | if (ret) { | ||
484 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
485 | goto err1; | ||
486 | } | ||
487 | |||
488 | return 0; | ||
489 | |||
490 | err1: | ||
491 | platform_device_put(musb); | ||
492 | |||
493 | err0: | ||
494 | return ret; | ||
495 | } | ||
496 | |||
497 | static int __exit bfin_remove(struct platform_device *pdev) | ||
498 | { | ||
499 | struct platform_device *musb = platform_get_drvdata(pdev); | ||
500 | |||
501 | platform_device_del(musb); | ||
502 | platform_device_put(musb); | ||
503 | |||
504 | return 0; | ||
505 | } | ||
506 | |||
507 | static struct platform_driver bfin_driver = { | ||
508 | .remove = __exit_p(bfin_remove), | ||
509 | .driver = { | ||
510 | .name = "musb-bfin", | ||
511 | }, | ||
512 | }; | ||
513 | |||
514 | MODULE_DESCRIPTION("Blackfin MUSB Glue Layer"); | ||
515 | MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>"); | ||
516 | MODULE_LICENSE("GPL v2"); | ||
517 | |||
518 | static int __init bfin_init(void) | ||
519 | { | ||
520 | return platform_driver_probe(&bfin_driver, bfin_probe); | ||
521 | } | ||
522 | subsys_initcall(bfin_init); | ||
523 | |||
524 | static void __exit bfin_exit(void) | ||
525 | { | ||
526 | platform_driver_unregister(&bfin_driver); | ||
527 | } | ||
528 | module_exit(bfin_exit); | ||