diff options
author | Felipe Balbi <balbi@ti.com> | 2010-12-01 08:01:11 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-12-10 03:21:11 -0500 |
commit | dc09886bfa781e2b442301116c18199519e36f0f (patch) | |
tree | f526992695aa32804dc7de012339cd1674737201 /drivers | |
parent | 05ac10dd6862a3fcce33d2203fbb2ef285e3ca87 (diff) |
usb: musb: split omap2430 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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/musb/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 84 |
2 files changed, 86 insertions, 1 deletions
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index 52d18dbefcfa..4792001a3d06 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -17,10 +17,11 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o | |||
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 | 19 | musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o |
20 | musb_hdrc-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o | ||
21 | musb_hdrc-$(CONFIG_USB_MUSB_AM35X) += am35x.o | 20 | musb_hdrc-$(CONFIG_USB_MUSB_AM35X) += am35x.o |
22 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o | 21 | musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o |
23 | 22 | ||
23 | obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o | ||
24 | |||
24 | # the kconfig must guarantee that only one of the | 25 | # the kconfig must guarantee that only one of the |
25 | # possible I/O schemes will be enabled at a time ... | 26 | # possible I/O schemes will be enabled at a time ... |
26 | # PIO only, or DMA (several potential schemes). | 27 | # PIO only, or DMA (several potential schemes). |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 5f0d0f105989..78bb1e5cb9f8 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/clk.h> | 32 | #include <linux/clk.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/dma-mapping.h> | ||
34 | 36 | ||
35 | #include "musb_core.h" | 37 | #include "musb_core.h" |
36 | #include "omap2430.h" | 38 | #include "omap2430.h" |
@@ -341,3 +343,85 @@ const struct musb_platform_ops musb_ops = { | |||
341 | 343 | ||
342 | .set_vbus = omap2430_musb_set_vbus, | 344 | .set_vbus = omap2430_musb_set_vbus, |
343 | }; | 345 | }; |
346 | |||
347 | static u64 omap2430_dmamask = DMA_BIT_MASK(32); | ||
348 | |||
349 | static int __init omap2430_probe(struct platform_device *pdev) | ||
350 | { | ||
351 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | ||
352 | struct platform_device *musb; | ||
353 | |||
354 | int ret = -ENOMEM; | ||
355 | |||
356 | musb = platform_device_alloc("musb-hdrc", -1); | ||
357 | if (!musb) { | ||
358 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
359 | goto err0; | ||
360 | } | ||
361 | |||
362 | musb->dev.parent = &pdev->dev; | ||
363 | musb->dev.dma_mask = &omap2430_dmamask; | ||
364 | musb->dev.coherent_dma_mask = omap2430_dmamask; | ||
365 | |||
366 | platform_set_drvdata(pdev, musb); | ||
367 | |||
368 | ret = platform_device_add_resources(musb, pdev->resource, | ||
369 | pdev->num_resources); | ||
370 | if (ret) { | ||
371 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
372 | goto err1; | ||
373 | } | ||
374 | |||
375 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
376 | if (ret) { | ||
377 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
378 | goto err1; | ||
379 | } | ||
380 | |||
381 | ret = platform_device_add(musb); | ||
382 | if (ret) { | ||
383 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
384 | goto err1; | ||
385 | } | ||
386 | |||
387 | return 0; | ||
388 | |||
389 | err1: | ||
390 | platform_device_put(musb); | ||
391 | |||
392 | err0: | ||
393 | return ret; | ||
394 | } | ||
395 | |||
396 | static int __exit omap2430_remove(struct platform_device *pdev) | ||
397 | { | ||
398 | struct platform_device *musb = platform_get_drvdata(pdev); | ||
399 | |||
400 | platform_device_del(musb); | ||
401 | platform_device_put(musb); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static struct platform_driver omap2430_driver = { | ||
407 | .remove = __exit_p(omap2430_remove), | ||
408 | .driver = { | ||
409 | .name = "musb-omap2430", | ||
410 | }, | ||
411 | }; | ||
412 | |||
413 | MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer"); | ||
414 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | ||
415 | MODULE_LICENSE("GPL v2"); | ||
416 | |||
417 | static int __init omap2430_init(void) | ||
418 | { | ||
419 | return platform_driver_probe(&omap2430_driver, omap2430_probe); | ||
420 | } | ||
421 | subsys_initcall(omap2430_init); | ||
422 | |||
423 | static void __exit omap2430_exit(void) | ||
424 | { | ||
425 | platform_driver_unregister(&omap2430_driver); | ||
426 | } | ||
427 | module_exit(omap2430_exit); | ||