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 | |
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>
-rw-r--r-- | arch/blackfin/mach-bf527/boards/ad7160eval.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf527/boards/cm_bf527.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf527/boards/ezbrd.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf527/boards/ezkit.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf527/boards/tll6527m.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf548/boards/cm_bf548.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-bf548/boards/ezkit.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 4 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 84 |
9 files changed, 92 insertions, 10 deletions
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c index ec9f2612be1..52295fff557 100644 --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c | |||
@@ -83,7 +83,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
83 | static u64 musb_dmamask = ~(u32)0; | 83 | static u64 musb_dmamask = ~(u32)0; |
84 | 84 | ||
85 | static struct platform_device musb_device = { | 85 | static struct platform_device musb_device = { |
86 | .name = "musb-hdrc", | 86 | .name = "musb-blackfin", |
87 | .id = 0, | 87 | .id = 0, |
88 | .dev = { | 88 | .dev = { |
89 | .dma_mask = &musb_dmamask, | 89 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c index a7627dee688..50533edc399 100644 --- a/arch/blackfin/mach-bf527/boards/cm_bf527.c +++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c | |||
@@ -120,7 +120,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
120 | static u64 musb_dmamask = ~(u32)0; | 120 | static u64 musb_dmamask = ~(u32)0; |
121 | 121 | ||
122 | static struct platform_device musb_device = { | 122 | static struct platform_device musb_device = { |
123 | .name = "musb-hdrc", | 123 | .name = "musb-blackfin", |
124 | .id = 0, | 124 | .id = 0, |
125 | .dev = { | 125 | .dev = { |
126 | .dma_mask = &musb_dmamask, | 126 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c index d1df634e24c..d06177b5fe2 100644 --- a/arch/blackfin/mach-bf527/boards/ezbrd.c +++ b/arch/blackfin/mach-bf527/boards/ezbrd.c | |||
@@ -84,7 +84,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
84 | static u64 musb_dmamask = ~(u32)0; | 84 | static u64 musb_dmamask = ~(u32)0; |
85 | 85 | ||
86 | static struct platform_device musb_device = { | 86 | static struct platform_device musb_device = { |
87 | .name = "musb-hdrc", | 87 | .name = "musb-blackfin", |
88 | .id = 0, | 88 | .id = 0, |
89 | .dev = { | 89 | .dev = { |
90 | .dma_mask = &musb_dmamask, | 90 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 5983abd8a7e..35a88a5a501 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c | |||
@@ -124,7 +124,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
124 | static u64 musb_dmamask = ~(u32)0; | 124 | static u64 musb_dmamask = ~(u32)0; |
125 | 125 | ||
126 | static struct platform_device musb_device = { | 126 | static struct platform_device musb_device = { |
127 | .name = "musb-hdrc", | 127 | .name = "musb-blackfin", |
128 | .id = 0, | 128 | .id = 0, |
129 | .dev = { | 129 | .dev = { |
130 | .dma_mask = &musb_dmamask, | 130 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf527/boards/tll6527m.c b/arch/blackfin/mach-bf527/boards/tll6527m.c index 284ec1f4413..130861bd258 100644 --- a/arch/blackfin/mach-bf527/boards/tll6527m.c +++ b/arch/blackfin/mach-bf527/boards/tll6527m.c | |||
@@ -91,7 +91,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
91 | static u64 musb_dmamask = ~(u32)0; | 91 | static u64 musb_dmamask = ~(u32)0; |
92 | 92 | ||
93 | static struct platform_device musb_device = { | 93 | static struct platform_device musb_device = { |
94 | .name = "musb-hdrc", | 94 | .name = "musb-blackfin", |
95 | .id = 0, | 95 | .id = 0, |
96 | .dev = { | 96 | .dev = { |
97 | .dma_mask = &musb_dmamask, | 97 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c index f52334519a2..4c2ee678909 100644 --- a/arch/blackfin/mach-bf548/boards/cm_bf548.c +++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c | |||
@@ -520,7 +520,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
520 | static u64 musb_dmamask = ~(u32)0; | 520 | static u64 musb_dmamask = ~(u32)0; |
521 | 521 | ||
522 | static struct platform_device musb_device = { | 522 | static struct platform_device musb_device = { |
523 | .name = "musb-hdrc", | 523 | .name = "musb-blackfin", |
524 | .id = 0, | 524 | .id = 0, |
525 | .dev = { | 525 | .dev = { |
526 | .dma_mask = &musb_dmamask, | 526 | .dma_mask = &musb_dmamask, |
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index e2c851bef99..4f03fbc4c9b 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
@@ -625,7 +625,7 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
625 | static u64 musb_dmamask = ~(u32)0; | 625 | static u64 musb_dmamask = ~(u32)0; |
626 | 626 | ||
627 | static struct platform_device musb_device = { | 627 | static struct platform_device musb_device = { |
628 | .name = "musb-hdrc", | 628 | .name = "musb-blackfin", |
629 | .id = 0, | 629 | .id = 0, |
630 | .dev = { | 630 | .dev = { |
631 | .dma_mask = &musb_dmamask, | 631 | .dma_mask = &musb_dmamask, |
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index d2a01291788..61f46affcf7 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 9874501d642..b0968201d84 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); | ||