usb: musb: split blackfin to its own platform_driver
authorFelipe Balbi <balbi@ti.com>
Thu, 2 Dec 2010 07:21:05 +0000 (09:21 +0200)
committerFelipe Balbi <balbi@ti.com>
Fri, 10 Dec 2010 08:21:16 +0000 (10:21 +0200)
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>
arch/blackfin/mach-bf527/boards/ad7160eval.c
arch/blackfin/mach-bf527/boards/cm_bf527.c
arch/blackfin/mach-bf527/boards/ezbrd.c
arch/blackfin/mach-bf527/boards/ezkit.c
arch/blackfin/mach-bf527/boards/tll6527m.c
arch/blackfin/mach-bf548/boards/cm_bf548.c
arch/blackfin/mach-bf548/boards/ezkit.c
drivers/usb/musb/Makefile
drivers/usb/musb/blackfin.c

index ec9f2612be1d2d7c0e5d206e7c5a164c859110aa..52295fff5577b407bb6c4d1d59d9f1ca900882f5 100644 (file)
@@ -83,7 +83,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index a7627dee688e0eac489fdc074a736f95780a10df..50533edc399408e6eec10b8d36f69691a7f17bd5 100644 (file)
@@ -120,7 +120,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index d1df634e24c39a4b16582fda1d8a125a6db3dccf..d06177b5fe221f54f991322b9cc833043bc46c24 100644 (file)
@@ -84,7 +84,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index 5983abd8a7e3d633446fbfd4c76c81a61f6ffb23..35a88a5a501341f140283a5bfa12b11ce5822999 100644 (file)
@@ -124,7 +124,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index 284ec1f4413111125d4de2e38bbfbeaaa8fcc116..130861bd25892a6e85291ef220efc8033d1630fc 100644 (file)
@@ -91,7 +91,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index f52334519a20ca8cc53e8dce7bbca8608d2100cb..4c2ee678909900ebca62de9da749b374f9a8e136 100644 (file)
@@ -520,7 +520,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index e2c851bef99ad42b1deb5eaa2bff90838f0bedaf..4f03fbc4c9bec5c37009637632a9225666becf4b 100644 (file)
@@ -625,7 +625,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 static u64 musb_dmamask = ~(u32)0;
 
 static struct platform_device musb_device = {
-       .name           = "musb-hdrc",
+       .name           = "musb-blackfin",
        .id             = 0,
        .dev = {
                .dma_mask               = &musb_dmamask,
index d2a012917887fba81f6c40c90a8a2d525d15f0a7..61f46affcf7a64a2648c781896901fc3b70c91c8 100644 (file)
@@ -13,14 +13,12 @@ musb_hdrc-$(CONFIG_USB_MUSB_HDRC_HCD)               += musb_virthub.o musb_host.o
 musb_hdrc-$(CONFIG_DEBUG_FS)                   += musb_debugfs.o
 
 # Hardware Glue Layer
-
-musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN)          += blackfin.o
-
 obj-$(CONFIG_USB_MUSB_OMAP2PLUS)               += omap2430.o
 obj-$(CONFIG_USB_MUSB_AM35X)                   += am35x.o
 obj-$(CONFIG_USB_MUSB_TUSB6010)                        += tusb6010.o
 obj-$(CONFIG_USB_MUSB_DAVINCI)                 += davinci.o
 obj-$(CONFIG_USB_MUSB_DA8XX)                   += da8xx.o
+obj-$(CONFIG_USB_MUSB_BLACKFIN)                        += blackfin.o
 
 # the kconfig must guarantee that only one of the
 # possible I/O schemes will be enabled at a time ...
index 9874501d642959af752a4d4e2708c563c61b57cb..b0968201d849bc201106edd3f1c3a4907e6d0ed5 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/list.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/cacheflush.h>
 
@@ -442,3 +444,85 @@ const struct musb_platform_ops musb_ops = {
        .vbus_status    = bfin_musb_vbus_status,
        .set_vbus       = bfin_musb_set_vbus,
 };
+
+static u64 bfin_dmamask = DMA_BIT_MASK(32);
+
+static int __init bfin_probe(struct platform_device *pdev)
+{
+       struct musb_hdrc_platform_data  *pdata = pdev->dev.platform_data;
+       struct platform_device          *musb;
+
+       int                             ret = -ENOMEM;
+
+       musb = platform_device_alloc("musb-hdrc", -1);
+       if (!musb) {
+               dev_err(&pdev->dev, "failed to allocate musb device\n");
+               goto err0;
+       }
+
+       musb->dev.parent                = &pdev->dev;
+       musb->dev.dma_mask              = &bfin_dmamask;
+       musb->dev.coherent_dma_mask     = bfin_dmamask;
+
+       platform_set_drvdata(pdev, musb);
+
+       ret = platform_device_add_resources(musb, pdev->resource,
+                       pdev->num_resources);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to add resources\n");
+               goto err1;
+       }
+
+       ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
+       if (ret) {
+               dev_err(&pdev->dev, "failed to add platform_data\n");
+               goto err1;
+       }
+
+       ret = platform_device_add(musb);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to register musb device\n");
+               goto err1;
+       }
+
+       return 0;
+
+err1:
+       platform_device_put(musb);
+
+err0:
+       return ret;
+}
+
+static int __exit bfin_remove(struct platform_device *pdev)
+{
+       struct platform_device          *musb = platform_get_drvdata(pdev);
+
+       platform_device_del(musb);
+       platform_device_put(musb);
+
+       return 0;
+}
+
+static struct platform_driver bfin_driver = {
+       .remove         = __exit_p(bfin_remove),
+       .driver         = {
+               .name   = "musb-bfin",
+       },
+};
+
+MODULE_DESCRIPTION("Blackfin MUSB Glue Layer");
+MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>");
+MODULE_LICENSE("GPL v2");
+
+static int __init bfin_init(void)
+{
+       return platform_driver_probe(&bfin_driver, bfin_probe);
+}
+subsys_initcall(bfin_init);
+
+static void __exit bfin_exit(void)
+{
+       platform_driver_unregister(&bfin_driver);
+}
+module_exit(bfin_exit);