diff options
author | Felipe Balbi <balbi@ti.com> | 2010-12-02 10:13:54 +0300 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-12-10 11:21:14 +0300 |
commit | 18688fbeb09665725c842291bbadd88295a359e1 (patch) | |
tree | cf0b0af2dfe431a4895dba8198af1c4e49ad55b6 | |
parent | ce40c5767a0ea1e77ca5d0b73269cb86301a35cf (diff) | |
download | linux-18688fbeb09665725c842291bbadd88295a359e1.tar.xz |
usb: musb: split tusb6010 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>
-rw-r--r-- | arch/arm/mach-omap2/usb-tusb6010.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 83 |
3 files changed, 85 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 42389213b470..7cb3c18a5e20 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c @@ -223,7 +223,7 @@ static struct resource tusb_resources[] = { static u64 tusb_dmamask = ~(u32)0; static struct platform_device tusb_device = { - .name = "musb-hdrc", + .name = "musb-tusb", .id = -1, .dev = { .dma_mask = &tusb_dmamask, diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index a48c86d9b4d0..8e0c9ad85531 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile @@ -16,11 +16,11 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o -musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o 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 # the kconfig must guarantee that only one of the # possible I/O schemes will be enabled at a time ... diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 60abd52b2c51..a8e26a0f2ad4 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -21,6 +21,7 @@ #include <linux/usb.h> #include <linux/irq.h> #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include "musb_core.h" @@ -1185,3 +1186,85 @@ const struct musb_platform_ops musb_ops = { .vbus_status = tusb_musb_vbus_status, .set_vbus = tusb_musb_set_vbus, }; + +static u64 tusb_dmamask = DMA_BIT_MASK(32); + +static int __init tusb_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 = &tusb_dmamask; + musb->dev.coherent_dma_mask = tusb_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 tusb_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 tusb_driver = { + .remove = __exit_p(tusb_remove), + .driver = { + .name = "musb-tusb", + }, +}; + +MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer"); +MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); +MODULE_LICENSE("GPL v2"); + +static int __init tusb_init(void) +{ + return platform_driver_probe(&tusb_driver, tusb_probe); +} +subsys_initcall(tusb_init); + +static void __exit tusb_exit(void) +{ + platform_driver_unregister(&tusb_driver); +} +module_exit(tusb_exit); |