diff options
author | Felipe Balbi <balbi@ti.com> | 2010-12-02 02:13:54 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-12-10 03:21:14 -0500 |
commit | 18688fbeb09665725c842291bbadd88295a359e1 (patch) | |
tree | cf0b0af2dfe431a4895dba8198af1c4e49ad55b6 | |
parent | ce40c5767a0ea1e77ca5d0b73269cb86301a35cf (diff) |
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[] = { | |||
223 | static u64 tusb_dmamask = ~(u32)0; | 223 | static u64 tusb_dmamask = ~(u32)0; |
224 | 224 | ||
225 | static struct platform_device tusb_device = { | 225 | static struct platform_device tusb_device = { |
226 | .name = "musb-hdrc", | 226 | .name = "musb-tusb", |
227 | .id = -1, | 227 | .id = -1, |
228 | .dev = { | 228 | .dev = { |
229 | .dma_mask = &tusb_dmamask, | 229 | .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 | |||
16 | 16 | ||
17 | musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o | 17 | musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o |
18 | musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o | 18 | musb_hdrc-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o |
19 | musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o | ||
20 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o | 19 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o |
21 | 20 | ||
22 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o | 21 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o |
23 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o | 22 | obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o |
23 | obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o | ||
24 | 24 | ||
25 | # the kconfig must guarantee that only one of the | 25 | # the kconfig must guarantee that only one of the |
26 | # possible I/O schemes will be enabled at a time ... | 26 | # 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 @@ | |||
21 | #include <linux/usb.h> | 21 | #include <linux/usb.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/dma-mapping.h> | ||
24 | 25 | ||
25 | #include "musb_core.h" | 26 | #include "musb_core.h" |
26 | 27 | ||
@@ -1185,3 +1186,85 @@ const struct musb_platform_ops musb_ops = { | |||
1185 | .vbus_status = tusb_musb_vbus_status, | 1186 | .vbus_status = tusb_musb_vbus_status, |
1186 | .set_vbus = tusb_musb_set_vbus, | 1187 | .set_vbus = tusb_musb_set_vbus, |
1187 | }; | 1188 | }; |
1189 | |||
1190 | static u64 tusb_dmamask = DMA_BIT_MASK(32); | ||
1191 | |||
1192 | static int __init tusb_probe(struct platform_device *pdev) | ||
1193 | { | ||
1194 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | ||
1195 | struct platform_device *musb; | ||
1196 | |||
1197 | int ret = -ENOMEM; | ||
1198 | |||
1199 | musb = platform_device_alloc("musb-hdrc", -1); | ||
1200 | if (!musb) { | ||
1201 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
1202 | goto err0; | ||
1203 | } | ||
1204 | |||
1205 | musb->dev.parent = &pdev->dev; | ||
1206 | musb->dev.dma_mask = &tusb_dmamask; | ||
1207 | musb->dev.coherent_dma_mask = tusb_dmamask; | ||
1208 | |||
1209 | platform_set_drvdata(pdev, musb); | ||
1210 | |||
1211 | ret = platform_device_add_resources(musb, pdev->resource, | ||
1212 | pdev->num_resources); | ||
1213 | if (ret) { | ||
1214 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
1215 | goto err1; | ||
1216 | } | ||
1217 | |||
1218 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
1219 | if (ret) { | ||
1220 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
1221 | goto err1; | ||
1222 | } | ||
1223 | |||
1224 | ret = platform_device_add(musb); | ||
1225 | if (ret) { | ||
1226 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
1227 | goto err1; | ||
1228 | } | ||
1229 | |||
1230 | return 0; | ||
1231 | |||
1232 | err1: | ||
1233 | platform_device_put(musb); | ||
1234 | |||
1235 | err0: | ||
1236 | return ret; | ||
1237 | } | ||
1238 | |||
1239 | static int __exit tusb_remove(struct platform_device *pdev) | ||
1240 | { | ||
1241 | struct platform_device *musb = platform_get_drvdata(pdev); | ||
1242 | |||
1243 | platform_device_del(musb); | ||
1244 | platform_device_put(musb); | ||
1245 | |||
1246 | return 0; | ||
1247 | } | ||
1248 | |||
1249 | static struct platform_driver tusb_driver = { | ||
1250 | .remove = __exit_p(tusb_remove), | ||
1251 | .driver = { | ||
1252 | .name = "musb-tusb", | ||
1253 | }, | ||
1254 | }; | ||
1255 | |||
1256 | MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer"); | ||
1257 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | ||
1258 | MODULE_LICENSE("GPL v2"); | ||
1259 | |||
1260 | static int __init tusb_init(void) | ||
1261 | { | ||
1262 | return platform_driver_probe(&tusb_driver, tusb_probe); | ||
1263 | } | ||
1264 | subsys_initcall(tusb_init); | ||
1265 | |||
1266 | static void __exit tusb_exit(void) | ||
1267 | { | ||
1268 | platform_driver_unregister(&tusb_driver); | ||
1269 | } | ||
1270 | module_exit(tusb_exit); | ||