aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/blackfin.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb/blackfin.c')
-rw-r--r--drivers/usb/musb/blackfin.c84
1 files changed, 84 insertions, 0 deletions
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
448static u64 bfin_dmamask = DMA_BIT_MASK(32);
449
450static 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
490err1:
491 platform_device_put(musb);
492
493err0:
494 return ret;
495}
496
497static 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
507static struct platform_driver bfin_driver = {
508 .remove = __exit_p(bfin_remove),
509 .driver = {
510 .name = "musb-bfin",
511 },
512};
513
514MODULE_DESCRIPTION("Blackfin MUSB Glue Layer");
515MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>");
516MODULE_LICENSE("GPL v2");
517
518static int __init bfin_init(void)
519{
520 return platform_driver_probe(&bfin_driver, bfin_probe);
521}
522subsys_initcall(bfin_init);
523
524static void __exit bfin_exit(void)
525{
526 platform_driver_unregister(&bfin_driver);
527}
528module_exit(bfin_exit);