aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/am35x.c40
-rw-r--r--drivers/usb/musb/blackfin.c38
-rw-r--r--drivers/usb/musb/cppi_dma.c4
-rw-r--r--drivers/usb/musb/da8xx.c40
-rw-r--r--drivers/usb/musb/davinci.c40
-rw-r--r--drivers/usb/musb/musb_core.c137
-rw-r--r--drivers/usb/musb/musb_core.h5
-rw-r--r--drivers/usb/musb/musb_debugfs.c2
-rw-r--r--drivers/usb/musb/musb_dma.h3
-rw-r--r--drivers/usb/musb/musb_dsps.c141
-rw-r--r--drivers/usb/musb/musb_gadget.c36
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c6
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/musbhsdma.c3
-rw-r--r--drivers/usb/musb/musbhsdma.h4
-rw-r--r--drivers/usb/musb/omap2430.c52
-rw-r--r--drivers/usb/musb/tusb6010.c40
-rw-r--r--drivers/usb/musb/tusb6010_omap.c3
-rw-r--r--drivers/usb/musb/ux500.c62
-rw-r--r--drivers/usb/musb/ux500_dma.c3
20 files changed, 245 insertions, 416 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index a87cdd2387cf..c107d7cdfa69 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -454,7 +454,7 @@ static const struct musb_platform_ops am35x_ops = {
454 454
455static u64 am35x_dmamask = DMA_BIT_MASK(32); 455static u64 am35x_dmamask = DMA_BIT_MASK(32);
456 456
457static int __devinit am35x_probe(struct platform_device *pdev) 457static int am35x_probe(struct platform_device *pdev)
458{ 458{
459 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 459 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
460 struct platform_device *musb; 460 struct platform_device *musb;
@@ -464,7 +464,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
464 struct clk *clk; 464 struct clk *clk;
465 465
466 int ret = -ENOMEM; 466 int ret = -ENOMEM;
467 int musbid;
468 467
469 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 468 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
470 if (!glue) { 469 if (!glue) {
@@ -472,18 +471,10 @@ static int __devinit am35x_probe(struct platform_device *pdev)
472 goto err0; 471 goto err0;
473 } 472 }
474 473
475 /* get the musb id */ 474 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
476 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
477 if (musbid < 0) {
478 dev_err(&pdev->dev, "failed to allocate musb id\n");
479 ret = -ENOMEM;
480 goto err1;
481 }
482
483 musb = platform_device_alloc("musb-hdrc", musbid);
484 if (!musb) { 475 if (!musb) {
485 dev_err(&pdev->dev, "failed to allocate musb device\n"); 476 dev_err(&pdev->dev, "failed to allocate musb device\n");
486 goto err2; 477 goto err1;
487 } 478 }
488 479
489 phy_clk = clk_get(&pdev->dev, "fck"); 480 phy_clk = clk_get(&pdev->dev, "fck");
@@ -512,7 +503,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
512 goto err6; 503 goto err6;
513 } 504 }
514 505
515 musb->id = musbid;
516 musb->dev.parent = &pdev->dev; 506 musb->dev.parent = &pdev->dev;
517 musb->dev.dma_mask = &am35x_dmamask; 507 musb->dev.dma_mask = &am35x_dmamask;
518 musb->dev.coherent_dma_mask = am35x_dmamask; 508 musb->dev.coherent_dma_mask = am35x_dmamask;
@@ -562,9 +552,6 @@ err4:
562err3: 552err3:
563 platform_device_put(musb); 553 platform_device_put(musb);
564 554
565err2:
566 musb_put_id(&pdev->dev, musbid);
567
568err1: 555err1:
569 kfree(glue); 556 kfree(glue);
570 557
@@ -572,13 +559,11 @@ err0:
572 return ret; 559 return ret;
573} 560}
574 561
575static int __devexit am35x_remove(struct platform_device *pdev) 562static int am35x_remove(struct platform_device *pdev)
576{ 563{
577 struct am35x_glue *glue = platform_get_drvdata(pdev); 564 struct am35x_glue *glue = platform_get_drvdata(pdev);
578 565
579 musb_put_id(&pdev->dev, glue->musb->id); 566 platform_device_unregister(glue->musb);
580 platform_device_del(glue->musb);
581 platform_device_put(glue->musb);
582 clk_disable(glue->clk); 567 clk_disable(glue->clk);
583 clk_disable(glue->phy_clk); 568 clk_disable(glue->phy_clk);
584 clk_put(glue->clk); 569 clk_put(glue->clk);
@@ -643,7 +628,7 @@ static struct dev_pm_ops am35x_pm_ops = {
643 628
644static struct platform_driver am35x_driver = { 629static struct platform_driver am35x_driver = {
645 .probe = am35x_probe, 630 .probe = am35x_probe,
646 .remove = __devexit_p(am35x_remove), 631 .remove = am35x_remove,
647 .driver = { 632 .driver = {
648 .name = "musb-am35x", 633 .name = "musb-am35x",
649 .pm = DEV_PM_OPS, 634 .pm = DEV_PM_OPS,
@@ -653,15 +638,4 @@ static struct platform_driver am35x_driver = {
653MODULE_DESCRIPTION("AM35x MUSB Glue Layer"); 638MODULE_DESCRIPTION("AM35x MUSB Glue Layer");
654MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>"); 639MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>");
655MODULE_LICENSE("GPL v2"); 640MODULE_LICENSE("GPL v2");
656 641module_platform_driver(am35x_driver);
657static int __init am35x_init(void)
658{
659 return platform_driver_register(&am35x_driver);
660}
661module_init(am35x_init);
662
663static void __exit am35x_exit(void)
664{
665 platform_driver_unregister(&am35x_driver);
666}
667module_exit(am35x_exit);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index e8cff9bb9d23..14dab9f9b3d0 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -448,14 +448,13 @@ static const struct musb_platform_ops bfin_ops = {
448 448
449static u64 bfin_dmamask = DMA_BIT_MASK(32); 449static u64 bfin_dmamask = DMA_BIT_MASK(32);
450 450
451static int __devinit bfin_probe(struct platform_device *pdev) 451static int bfin_probe(struct platform_device *pdev)
452{ 452{
453 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 453 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
454 struct platform_device *musb; 454 struct platform_device *musb;
455 struct bfin_glue *glue; 455 struct bfin_glue *glue;
456 456
457 int ret = -ENOMEM; 457 int ret = -ENOMEM;
458 int musbid;
459 458
460 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 459 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
461 if (!glue) { 460 if (!glue) {
@@ -463,21 +462,12 @@ static int __devinit bfin_probe(struct platform_device *pdev)
463 goto err0; 462 goto err0;
464 } 463 }
465 464
466 /* get the musb id */ 465 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
467 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
468 if (musbid < 0) {
469 dev_err(&pdev->dev, "failed to allocate musb id\n");
470 ret = -ENOMEM;
471 goto err1;
472 }
473
474 musb = platform_device_alloc("musb-hdrc", musbid);
475 if (!musb) { 466 if (!musb) {
476 dev_err(&pdev->dev, "failed to allocate musb device\n"); 467 dev_err(&pdev->dev, "failed to allocate musb device\n");
477 goto err2; 468 goto err1;
478 } 469 }
479 470
480 musb->id = musbid;
481 musb->dev.parent = &pdev->dev; 471 musb->dev.parent = &pdev->dev;
482 musb->dev.dma_mask = &bfin_dmamask; 472 musb->dev.dma_mask = &bfin_dmamask;
483 musb->dev.coherent_dma_mask = bfin_dmamask; 473 musb->dev.coherent_dma_mask = bfin_dmamask;
@@ -513,9 +503,6 @@ static int __devinit bfin_probe(struct platform_device *pdev)
513err3: 503err3:
514 platform_device_put(musb); 504 platform_device_put(musb);
515 505
516err2:
517 musb_put_id(&pdev->dev, musbid);
518
519err1: 506err1:
520 kfree(glue); 507 kfree(glue);
521 508
@@ -523,13 +510,11 @@ err0:
523 return ret; 510 return ret;
524} 511}
525 512
526static int __devexit bfin_remove(struct platform_device *pdev) 513static int bfin_remove(struct platform_device *pdev)
527{ 514{
528 struct bfin_glue *glue = platform_get_drvdata(pdev); 515 struct bfin_glue *glue = platform_get_drvdata(pdev);
529 516
530 musb_put_id(&pdev->dev, glue->musb->id); 517 platform_device_unregister(glue->musb);
531 platform_device_del(glue->musb);
532 platform_device_put(glue->musb);
533 kfree(glue); 518 kfree(glue);
534 519
535 return 0; 520 return 0;
@@ -585,15 +570,4 @@ static struct platform_driver bfin_driver = {
585MODULE_DESCRIPTION("Blackfin MUSB Glue Layer"); 570MODULE_DESCRIPTION("Blackfin MUSB Glue Layer");
586MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>"); 571MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>");
587MODULE_LICENSE("GPL v2"); 572MODULE_LICENSE("GPL v2");
588 573module_platform_driver(bfin_driver);
589static int __init bfin_init(void)
590{
591 return platform_driver_register(&bfin_driver);
592}
593module_init(bfin_init);
594
595static void __exit bfin_exit(void)
596{
597 platform_driver_unregister(&bfin_driver);
598}
599module_exit(bfin_exit);
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index e19da82b4782..0968dd7a859d 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -1314,10 +1314,10 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
1314 1314
1315 return IRQ_HANDLED; 1315 return IRQ_HANDLED;
1316} 1316}
1317EXPORT_SYMBOL_GPL(cppi_interrupt);
1317 1318
1318/* Instantiate a software object representing a DMA controller. */ 1319/* Instantiate a software object representing a DMA controller. */
1319struct dma_controller *__devinit 1320struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *mregs)
1320dma_controller_create(struct musb *musb, void __iomem *mregs)
1321{ 1321{
1322 struct cppi *controller; 1322 struct cppi *controller;
1323 struct device *dev = musb->controller; 1323 struct device *dev = musb->controller;
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 8bc44b76eec2..97996af2646e 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -471,7 +471,7 @@ static const struct musb_platform_ops da8xx_ops = {
471 471
472static u64 da8xx_dmamask = DMA_BIT_MASK(32); 472static u64 da8xx_dmamask = DMA_BIT_MASK(32);
473 473
474static int __devinit da8xx_probe(struct platform_device *pdev) 474static int da8xx_probe(struct platform_device *pdev)
475{ 475{
476 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 476 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
477 struct platform_device *musb; 477 struct platform_device *musb;
@@ -480,7 +480,6 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
480 struct clk *clk; 480 struct clk *clk;
481 481
482 int ret = -ENOMEM; 482 int ret = -ENOMEM;
483 int musbid;
484 483
485 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 484 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
486 if (!glue) { 485 if (!glue) {
@@ -488,18 +487,10 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
488 goto err0; 487 goto err0;
489 } 488 }
490 489
491 /* get the musb id */ 490 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
492 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
493 if (musbid < 0) {
494 dev_err(&pdev->dev, "failed to allocate musb id\n");
495 ret = -ENOMEM;
496 goto err1;
497 }
498
499 musb = platform_device_alloc("musb-hdrc", musbid);
500 if (!musb) { 491 if (!musb) {
501 dev_err(&pdev->dev, "failed to allocate musb device\n"); 492 dev_err(&pdev->dev, "failed to allocate musb device\n");
502 goto err2; 493 goto err1;
503 } 494 }
504 495
505 clk = clk_get(&pdev->dev, "usb20"); 496 clk = clk_get(&pdev->dev, "usb20");
@@ -515,7 +506,6 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
515 goto err4; 506 goto err4;
516 } 507 }
517 508
518 musb->id = musbid;
519 musb->dev.parent = &pdev->dev; 509 musb->dev.parent = &pdev->dev;
520 musb->dev.dma_mask = &da8xx_dmamask; 510 musb->dev.dma_mask = &da8xx_dmamask;
521 musb->dev.coherent_dma_mask = da8xx_dmamask; 511 musb->dev.coherent_dma_mask = da8xx_dmamask;
@@ -558,9 +548,6 @@ err4:
558err3: 548err3:
559 platform_device_put(musb); 549 platform_device_put(musb);
560 550
561err2:
562 musb_put_id(&pdev->dev, musbid);
563
564err1: 551err1:
565 kfree(glue); 552 kfree(glue);
566 553
@@ -568,13 +555,11 @@ err0:
568 return ret; 555 return ret;
569} 556}
570 557
571static int __devexit da8xx_remove(struct platform_device *pdev) 558static int da8xx_remove(struct platform_device *pdev)
572{ 559{
573 struct da8xx_glue *glue = platform_get_drvdata(pdev); 560 struct da8xx_glue *glue = platform_get_drvdata(pdev);
574 561
575 musb_put_id(&pdev->dev, glue->musb->id); 562 platform_device_unregister(glue->musb);
576 platform_device_del(glue->musb);
577 platform_device_put(glue->musb);
578 clk_disable(glue->clk); 563 clk_disable(glue->clk);
579 clk_put(glue->clk); 564 clk_put(glue->clk);
580 kfree(glue); 565 kfree(glue);
@@ -584,7 +569,7 @@ static int __devexit da8xx_remove(struct platform_device *pdev)
584 569
585static struct platform_driver da8xx_driver = { 570static struct platform_driver da8xx_driver = {
586 .probe = da8xx_probe, 571 .probe = da8xx_probe,
587 .remove = __devexit_p(da8xx_remove), 572 .remove = da8xx_remove,
588 .driver = { 573 .driver = {
589 .name = "musb-da8xx", 574 .name = "musb-da8xx",
590 }, 575 },
@@ -593,15 +578,4 @@ static struct platform_driver da8xx_driver = {
593MODULE_DESCRIPTION("DA8xx/OMAP-L1x MUSB Glue Layer"); 578MODULE_DESCRIPTION("DA8xx/OMAP-L1x MUSB Glue Layer");
594MODULE_AUTHOR("Sergei Shtylyov <sshtylyov@ru.mvista.com>"); 579MODULE_AUTHOR("Sergei Shtylyov <sshtylyov@ru.mvista.com>");
595MODULE_LICENSE("GPL v2"); 580MODULE_LICENSE("GPL v2");
596 581module_platform_driver(da8xx_driver);
597static int __init da8xx_init(void)
598{
599 return platform_driver_register(&da8xx_driver);
600}
601module_init(da8xx_init);
602
603static void __exit da8xx_exit(void)
604{
605 platform_driver_unregister(&da8xx_driver);
606}
607module_exit(da8xx_exit);
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 606bfd00cde6..b1c01cad28b2 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -504,7 +504,7 @@ static const struct musb_platform_ops davinci_ops = {
504 504
505static u64 davinci_dmamask = DMA_BIT_MASK(32); 505static u64 davinci_dmamask = DMA_BIT_MASK(32);
506 506
507static int __devinit davinci_probe(struct platform_device *pdev) 507static int davinci_probe(struct platform_device *pdev)
508{ 508{
509 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 509 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
510 struct platform_device *musb; 510 struct platform_device *musb;
@@ -512,7 +512,6 @@ static int __devinit davinci_probe(struct platform_device *pdev)
512 struct clk *clk; 512 struct clk *clk;
513 513
514 int ret = -ENOMEM; 514 int ret = -ENOMEM;
515 int musbid;
516 515
517 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 516 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
518 if (!glue) { 517 if (!glue) {
@@ -520,18 +519,10 @@ static int __devinit davinci_probe(struct platform_device *pdev)
520 goto err0; 519 goto err0;
521 } 520 }
522 521
523 /* get the musb id */ 522 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
524 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
525 if (musbid < 0) {
526 dev_err(&pdev->dev, "failed to allocate musb id\n");
527 ret = -ENOMEM;
528 goto err1;
529 }
530
531 musb = platform_device_alloc("musb-hdrc", musbid);
532 if (!musb) { 523 if (!musb) {
533 dev_err(&pdev->dev, "failed to allocate musb device\n"); 524 dev_err(&pdev->dev, "failed to allocate musb device\n");
534 goto err2; 525 goto err1;
535 } 526 }
536 527
537 clk = clk_get(&pdev->dev, "usb"); 528 clk = clk_get(&pdev->dev, "usb");
@@ -547,7 +538,6 @@ static int __devinit davinci_probe(struct platform_device *pdev)
547 goto err4; 538 goto err4;
548 } 539 }
549 540
550 musb->id = musbid;
551 musb->dev.parent = &pdev->dev; 541 musb->dev.parent = &pdev->dev;
552 musb->dev.dma_mask = &davinci_dmamask; 542 musb->dev.dma_mask = &davinci_dmamask;
553 musb->dev.coherent_dma_mask = davinci_dmamask; 543 musb->dev.coherent_dma_mask = davinci_dmamask;
@@ -590,9 +580,6 @@ err4:
590err3: 580err3:
591 platform_device_put(musb); 581 platform_device_put(musb);
592 582
593err2:
594 musb_put_id(&pdev->dev, musbid);
595
596err1: 583err1:
597 kfree(glue); 584 kfree(glue);
598 585
@@ -600,13 +587,11 @@ err0:
600 return ret; 587 return ret;
601} 588}
602 589
603static int __devexit davinci_remove(struct platform_device *pdev) 590static int davinci_remove(struct platform_device *pdev)
604{ 591{
605 struct davinci_glue *glue = platform_get_drvdata(pdev); 592 struct davinci_glue *glue = platform_get_drvdata(pdev);
606 593
607 musb_put_id(&pdev->dev, glue->musb->id); 594 platform_device_unregister(glue->musb);
608 platform_device_del(glue->musb);
609 platform_device_put(glue->musb);
610 clk_disable(glue->clk); 595 clk_disable(glue->clk);
611 clk_put(glue->clk); 596 clk_put(glue->clk);
612 kfree(glue); 597 kfree(glue);
@@ -616,7 +601,7 @@ static int __devexit davinci_remove(struct platform_device *pdev)
616 601
617static struct platform_driver davinci_driver = { 602static struct platform_driver davinci_driver = {
618 .probe = davinci_probe, 603 .probe = davinci_probe,
619 .remove = __devexit_p(davinci_remove), 604 .remove = davinci_remove,
620 .driver = { 605 .driver = {
621 .name = "musb-davinci", 606 .name = "musb-davinci",
622 }, 607 },
@@ -625,15 +610,4 @@ static struct platform_driver davinci_driver = {
625MODULE_DESCRIPTION("DaVinci MUSB Glue Layer"); 610MODULE_DESCRIPTION("DaVinci MUSB Glue Layer");
626MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); 611MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
627MODULE_LICENSE("GPL v2"); 612MODULE_LICENSE("GPL v2");
628 613module_platform_driver(davinci_driver);
629static int __init davinci_init(void)
630{
631 return platform_driver_register(&davinci_driver);
632}
633module_init(davinci_init);
634
635static void __exit davinci_exit(void)
636{
637 platform_driver_unregister(&davinci_driver);
638}
639module_exit(davinci_exit);
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index bb56a0e8b23b..57cc9c6eaa9f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -116,7 +116,6 @@
116 116
117#define MUSB_DRIVER_NAME "musb-hdrc" 117#define MUSB_DRIVER_NAME "musb-hdrc"
118const char musb_driver_name[] = MUSB_DRIVER_NAME; 118const char musb_driver_name[] = MUSB_DRIVER_NAME;
119static DEFINE_IDA(musb_ida);
120 119
121MODULE_DESCRIPTION(DRIVER_INFO); 120MODULE_DESCRIPTION(DRIVER_INFO);
122MODULE_AUTHOR(DRIVER_AUTHOR); 121MODULE_AUTHOR(DRIVER_AUTHOR);
@@ -133,35 +132,6 @@ static inline struct musb *dev_to_musb(struct device *dev)
133 132
134/*-------------------------------------------------------------------------*/ 133/*-------------------------------------------------------------------------*/
135 134
136int musb_get_id(struct device *dev, gfp_t gfp_mask)
137{
138 int ret;
139 int id;
140
141 ret = ida_pre_get(&musb_ida, gfp_mask);
142 if (!ret) {
143 dev_err(dev, "failed to reserve resource for id\n");
144 return -ENOMEM;
145 }
146
147 ret = ida_get_new(&musb_ida, &id);
148 if (ret < 0) {
149 dev_err(dev, "failed to allocate a new id\n");
150 return ret;
151 }
152
153 return id;
154}
155EXPORT_SYMBOL_GPL(musb_get_id);
156
157void musb_put_id(struct device *dev, int id)
158{
159
160 dev_dbg(dev, "removing id %d\n", id);
161 ida_remove(&musb_ida, id);
162}
163EXPORT_SYMBOL_GPL(musb_put_id);
164
165#ifndef CONFIG_BLACKFIN 135#ifndef CONFIG_BLACKFIN
166static int musb_ulpi_read(struct usb_phy *phy, u32 offset) 136static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
167{ 137{
@@ -467,12 +437,12 @@ void musb_hnp_stop(struct musb *musb)
467 */ 437 */
468 438
469static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, 439static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
470 u8 devctl, u8 power) 440 u8 devctl)
471{ 441{
472 struct usb_otg *otg = musb->xceiv->otg; 442 struct usb_otg *otg = musb->xceiv->otg;
473 irqreturn_t handled = IRQ_NONE; 443 irqreturn_t handled = IRQ_NONE;
474 444
475 dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, 445 dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl,
476 int_usb); 446 int_usb);
477 447
478 /* in host mode, the peripheral may issue remote wakeup. 448 /* in host mode, the peripheral may issue remote wakeup.
@@ -485,6 +455,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
485 455
486 if (devctl & MUSB_DEVCTL_HM) { 456 if (devctl & MUSB_DEVCTL_HM) {
487 void __iomem *mbase = musb->mregs; 457 void __iomem *mbase = musb->mregs;
458 u8 power;
488 459
489 switch (musb->xceiv->state) { 460 switch (musb->xceiv->state) {
490 case OTG_STATE_A_SUSPEND: 461 case OTG_STATE_A_SUSPEND:
@@ -492,6 +463,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
492 * will stop RESUME signaling 463 * will stop RESUME signaling
493 */ 464 */
494 465
466 power = musb_readb(musb->mregs, MUSB_POWER);
495 if (power & MUSB_POWER_SUSPENDM) { 467 if (power & MUSB_POWER_SUSPENDM) {
496 /* spurious */ 468 /* spurious */
497 musb->int_usb &= ~MUSB_INTR_SUSPEND; 469 musb->int_usb &= ~MUSB_INTR_SUSPEND;
@@ -655,8 +627,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
655 } 627 }
656 628
657 if (int_usb & MUSB_INTR_SUSPEND) { 629 if (int_usb & MUSB_INTR_SUSPEND) {
658 dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x power %02x\n", 630 dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x\n",
659 otg_state_string(musb->xceiv->state), devctl, power); 631 otg_state_string(musb->xceiv->state), devctl);
660 handled = IRQ_HANDLED; 632 handled = IRQ_HANDLED;
661 633
662 switch (musb->xceiv->state) { 634 switch (musb->xceiv->state) {
@@ -722,8 +694,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
722 if (is_peripheral_active(musb)) { 694 if (is_peripheral_active(musb)) {
723 /* REVISIT HNP; just force disconnect */ 695 /* REVISIT HNP; just force disconnect */
724 } 696 }
725 musb_writew(musb->mregs, MUSB_INTRTXE, musb->epmask); 697 musb->intrtxe = musb->epmask;
726 musb_writew(musb->mregs, MUSB_INTRRXE, musb->epmask & 0xfffe); 698 musb_writew(musb->mregs, MUSB_INTRTXE, musb->intrtxe);
699 musb->intrrxe = musb->epmask & 0xfffe;
700 musb_writew(musb->mregs, MUSB_INTRRXE, musb->intrrxe);
727 musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7); 701 musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7);
728 musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED 702 musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED
729 |USB_PORT_STAT_HIGH_SPEED 703 |USB_PORT_STAT_HIGH_SPEED
@@ -944,8 +918,10 @@ void musb_start(struct musb *musb)
944 dev_dbg(musb->controller, "<== devctl %02x\n", devctl); 918 dev_dbg(musb->controller, "<== devctl %02x\n", devctl);
945 919
946 /* Set INT enable registers, enable interrupts */ 920 /* Set INT enable registers, enable interrupts */
947 musb_writew(regs, MUSB_INTRTXE, musb->epmask); 921 musb->intrtxe = musb->epmask;
948 musb_writew(regs, MUSB_INTRRXE, musb->epmask & 0xfffe); 922 musb_writew(regs, MUSB_INTRTXE, musb->intrtxe);
923 musb->intrrxe = musb->epmask & 0xfffe;
924 musb_writew(regs, MUSB_INTRRXE, musb->intrrxe);
949 musb_writeb(regs, MUSB_INTRUSBE, 0xf7); 925 musb_writeb(regs, MUSB_INTRUSBE, 0xf7);
950 926
951 musb_writeb(regs, MUSB_TESTMODE, 0); 927 musb_writeb(regs, MUSB_TESTMODE, 0);
@@ -983,7 +959,9 @@ static void musb_generic_disable(struct musb *musb)
983 959
984 /* disable interrupts */ 960 /* disable interrupts */
985 musb_writeb(mbase, MUSB_INTRUSBE, 0); 961 musb_writeb(mbase, MUSB_INTRUSBE, 0);
962 musb->intrtxe = 0;
986 musb_writew(mbase, MUSB_INTRTXE, 0); 963 musb_writew(mbase, MUSB_INTRTXE, 0);
964 musb->intrrxe = 0;
987 musb_writew(mbase, MUSB_INTRRXE, 0); 965 musb_writew(mbase, MUSB_INTRRXE, 0);
988 966
989 /* off */ 967 /* off */
@@ -1062,12 +1040,12 @@ static void musb_shutdown(struct platform_device *pdev)
1062 || defined(CONFIG_USB_MUSB_AM35X_MODULE) \ 1040 || defined(CONFIG_USB_MUSB_AM35X_MODULE) \
1063 || defined(CONFIG_USB_MUSB_DSPS) \ 1041 || defined(CONFIG_USB_MUSB_DSPS) \
1064 || defined(CONFIG_USB_MUSB_DSPS_MODULE) 1042 || defined(CONFIG_USB_MUSB_DSPS_MODULE)
1065static ushort __devinitdata fifo_mode = 4; 1043static ushort fifo_mode = 4;
1066#elif defined(CONFIG_USB_MUSB_UX500) \ 1044#elif defined(CONFIG_USB_MUSB_UX500) \
1067 || defined(CONFIG_USB_MUSB_UX500_MODULE) 1045 || defined(CONFIG_USB_MUSB_UX500_MODULE)
1068static ushort __devinitdata fifo_mode = 5; 1046static ushort fifo_mode = 5;
1069#else 1047#else
1070static ushort __devinitdata fifo_mode = 2; 1048static ushort fifo_mode = 2;
1071#endif 1049#endif
1072 1050
1073/* "modprobe ... fifo_mode=1" etc */ 1051/* "modprobe ... fifo_mode=1" etc */
@@ -1080,7 +1058,7 @@ MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration");
1080 */ 1058 */
1081 1059
1082/* mode 0 - fits in 2KB */ 1060/* mode 0 - fits in 2KB */
1083static struct musb_fifo_cfg __devinitdata mode_0_cfg[] = { 1061static struct musb_fifo_cfg mode_0_cfg[] = {
1084{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1062{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1085{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1063{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1086{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, }, 1064{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, },
@@ -1089,7 +1067,7 @@ static struct musb_fifo_cfg __devinitdata mode_0_cfg[] = {
1089}; 1067};
1090 1068
1091/* mode 1 - fits in 4KB */ 1069/* mode 1 - fits in 4KB */
1092static struct musb_fifo_cfg __devinitdata mode_1_cfg[] = { 1070static struct musb_fifo_cfg mode_1_cfg[] = {
1093{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1071{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1094{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1072{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1095{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1073{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, },
@@ -1098,7 +1076,7 @@ static struct musb_fifo_cfg __devinitdata mode_1_cfg[] = {
1098}; 1076};
1099 1077
1100/* mode 2 - fits in 4KB */ 1078/* mode 2 - fits in 4KB */
1101static struct musb_fifo_cfg __devinitdata mode_2_cfg[] = { 1079static struct musb_fifo_cfg mode_2_cfg[] = {
1102{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1080{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1103{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1081{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1104{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1082{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1108,7 +1086,7 @@ static struct musb_fifo_cfg __devinitdata mode_2_cfg[] = {
1108}; 1086};
1109 1087
1110/* mode 3 - fits in 4KB */ 1088/* mode 3 - fits in 4KB */
1111static struct musb_fifo_cfg __devinitdata mode_3_cfg[] = { 1089static struct musb_fifo_cfg mode_3_cfg[] = {
1112{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1090{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1113{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1091{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1114{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1092{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1118,7 +1096,7 @@ static struct musb_fifo_cfg __devinitdata mode_3_cfg[] = {
1118}; 1096};
1119 1097
1120/* mode 4 - fits in 16KB */ 1098/* mode 4 - fits in 16KB */
1121static struct musb_fifo_cfg __devinitdata mode_4_cfg[] = { 1099static struct musb_fifo_cfg mode_4_cfg[] = {
1122{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1100{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1123{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1101{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1124{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1102{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1149,7 +1127,7 @@ static struct musb_fifo_cfg __devinitdata mode_4_cfg[] = {
1149}; 1127};
1150 1128
1151/* mode 5 - fits in 8KB */ 1129/* mode 5 - fits in 8KB */
1152static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { 1130static struct musb_fifo_cfg mode_5_cfg[] = {
1153{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1131{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1154{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1132{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1155{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1133{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1185,7 +1163,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = {
1185 * 1163 *
1186 * returns negative errno or offset for next fifo. 1164 * returns negative errno or offset for next fifo.
1187 */ 1165 */
1188static int __devinit 1166static int
1189fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, 1167fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
1190 const struct musb_fifo_cfg *cfg, u16 offset) 1168 const struct musb_fifo_cfg *cfg, u16 offset)
1191{ 1169{
@@ -1256,11 +1234,11 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
1256 return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0)); 1234 return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0));
1257} 1235}
1258 1236
1259static struct musb_fifo_cfg __devinitdata ep0_cfg = { 1237static struct musb_fifo_cfg ep0_cfg = {
1260 .style = FIFO_RXTX, .maxpacket = 64, 1238 .style = FIFO_RXTX, .maxpacket = 64,
1261}; 1239};
1262 1240
1263static int __devinit ep_config_from_table(struct musb *musb) 1241static int ep_config_from_table(struct musb *musb)
1264{ 1242{
1265 const struct musb_fifo_cfg *cfg; 1243 const struct musb_fifo_cfg *cfg;
1266 unsigned i, n; 1244 unsigned i, n;
@@ -1351,7 +1329,7 @@ done:
1351 * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false 1329 * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false
1352 * @param musb the controller 1330 * @param musb the controller
1353 */ 1331 */
1354static int __devinit ep_config_from_hw(struct musb *musb) 1332static int ep_config_from_hw(struct musb *musb)
1355{ 1333{
1356 u8 epnum = 0; 1334 u8 epnum = 0;
1357 struct musb_hw_ep *hw_ep; 1335 struct musb_hw_ep *hw_ep;
@@ -1398,7 +1376,7 @@ enum { MUSB_CONTROLLER_MHDRC, MUSB_CONTROLLER_HDRC, };
1398/* Initialize MUSB (M)HDRC part of the USB hardware subsystem; 1376/* Initialize MUSB (M)HDRC part of the USB hardware subsystem;
1399 * configure endpoints, or take their config from silicon 1377 * configure endpoints, or take their config from silicon
1400 */ 1378 */
1401static int __devinit musb_core_init(u16 musb_type, struct musb *musb) 1379static int musb_core_init(u16 musb_type, struct musb *musb)
1402{ 1380{
1403 u8 reg; 1381 u8 reg;
1404 char *type; 1382 char *type;
@@ -1523,33 +1501,6 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb)
1523 1501
1524/*-------------------------------------------------------------------------*/ 1502/*-------------------------------------------------------------------------*/
1525 1503
1526#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \
1527 defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500)
1528
1529static irqreturn_t generic_interrupt(int irq, void *__hci)
1530{
1531 unsigned long flags;
1532 irqreturn_t retval = IRQ_NONE;
1533 struct musb *musb = __hci;
1534
1535 spin_lock_irqsave(&musb->lock, flags);
1536
1537 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
1538 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
1539 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
1540
1541 if (musb->int_usb || musb->int_tx || musb->int_rx)
1542 retval = musb_interrupt(musb);
1543
1544 spin_unlock_irqrestore(&musb->lock, flags);
1545
1546 return retval;
1547}
1548
1549#else
1550#define generic_interrupt NULL
1551#endif
1552
1553/* 1504/*
1554 * handle all the irqs defined by the HDRC core. for now we expect: other 1505 * handle all the irqs defined by the HDRC core. for now we expect: other
1555 * irq sources (phy, dma, etc) will be handled first, musb->int_* values 1506 * irq sources (phy, dma, etc) will be handled first, musb->int_* values
@@ -1560,12 +1511,11 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
1560irqreturn_t musb_interrupt(struct musb *musb) 1511irqreturn_t musb_interrupt(struct musb *musb)
1561{ 1512{
1562 irqreturn_t retval = IRQ_NONE; 1513 irqreturn_t retval = IRQ_NONE;
1563 u8 devctl, power; 1514 u8 devctl;
1564 int ep_num; 1515 int ep_num;
1565 u32 reg; 1516 u32 reg;
1566 1517
1567 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 1518 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
1568 power = musb_readb(musb->mregs, MUSB_POWER);
1569 1519
1570 dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n", 1520 dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n",
1571 (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", 1521 (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral",
@@ -1576,7 +1526,7 @@ irqreturn_t musb_interrupt(struct musb *musb)
1576 */ 1526 */
1577 if (musb->int_usb) 1527 if (musb->int_usb)
1578 retval |= musb_stage0_irq(musb, musb->int_usb, 1528 retval |= musb_stage0_irq(musb, musb->int_usb,
1579 devctl, power); 1529 devctl);
1580 1530
1581 /* "stage 1" is handling endpoint irqs */ 1531 /* "stage 1" is handling endpoint irqs */
1582 1532
@@ -1628,7 +1578,7 @@ irqreturn_t musb_interrupt(struct musb *musb)
1628EXPORT_SYMBOL_GPL(musb_interrupt); 1578EXPORT_SYMBOL_GPL(musb_interrupt);
1629 1579
1630#ifndef CONFIG_MUSB_PIO_ONLY 1580#ifndef CONFIG_MUSB_PIO_ONLY
1631static bool __devinitdata use_dma = 1; 1581static bool use_dma = 1;
1632 1582
1633/* "modprobe ... use_dma=0" etc */ 1583/* "modprobe ... use_dma=0" etc */
1634module_param(use_dma, bool, 0); 1584module_param(use_dma, bool, 0);
@@ -1809,8 +1759,7 @@ static void musb_irq_work(struct work_struct *data)
1809 * Init support 1759 * Init support
1810 */ 1760 */
1811 1761
1812static struct musb *__devinit 1762static struct musb *allocate_instance(struct device *dev,
1813allocate_instance(struct device *dev,
1814 struct musb_hdrc_config *config, void __iomem *mbase) 1763 struct musb_hdrc_config *config, void __iomem *mbase)
1815{ 1764{
1816 struct musb *musb; 1765 struct musb *musb;
@@ -1885,7 +1834,7 @@ static void musb_free(struct musb *musb)
1885 * @ctrl: virtual address of controller registers, 1834 * @ctrl: virtual address of controller registers,
1886 * not yet corrected for platform-specific offsets 1835 * not yet corrected for platform-specific offsets
1887 */ 1836 */
1888static int __devinit 1837static int
1889musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) 1838musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1890{ 1839{
1891 int status; 1840 int status;
@@ -1919,7 +1868,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1919 musb->ops = plat->platform_ops; 1868 musb->ops = plat->platform_ops;
1920 1869
1921 /* The musb_platform_init() call: 1870 /* The musb_platform_init() call:
1922 * - adjusts musb->mregs and musb->isr if needed, 1871 * - adjusts musb->mregs
1872 * - sets the musb->isr
1923 * - may initialize an integrated tranceiver 1873 * - may initialize an integrated tranceiver
1924 * - initializes musb->xceiv, usually by otg_get_phy() 1874 * - initializes musb->xceiv, usually by otg_get_phy()
1925 * - stops powering VBUS 1875 * - stops powering VBUS
@@ -1929,7 +1879,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1929 * external/discrete ones in various flavors (twl4030 family, 1879 * external/discrete ones in various flavors (twl4030 family,
1930 * isp1504, non-OTG, etc) mostly hooking up through ULPI. 1880 * isp1504, non-OTG, etc) mostly hooking up through ULPI.
1931 */ 1881 */
1932 musb->isr = generic_interrupt;
1933 status = musb_platform_init(musb); 1882 status = musb_platform_init(musb);
1934 if (status < 0) 1883 if (status < 0)
1935 goto fail1; 1884 goto fail1;
@@ -2060,7 +2009,7 @@ fail0:
2060/* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just 2009/* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
2061 * bridge to a platform device; this driver then suffices. 2010 * bridge to a platform device; this driver then suffices.
2062 */ 2011 */
2063static int __devinit musb_probe(struct platform_device *pdev) 2012static int musb_probe(struct platform_device *pdev)
2064{ 2013{
2065 struct device *dev = &pdev->dev; 2014 struct device *dev = &pdev->dev;
2066 int irq = platform_get_irq_byname(pdev, "mc"); 2015 int irq = platform_get_irq_byname(pdev, "mc");
@@ -2085,7 +2034,7 @@ static int __devinit musb_probe(struct platform_device *pdev)
2085 return status; 2034 return status;
2086} 2035}
2087 2036
2088static int __devexit musb_remove(struct platform_device *pdev) 2037static int musb_remove(struct platform_device *pdev)
2089{ 2038{
2090 struct device *dev = &pdev->dev; 2039 struct device *dev = &pdev->dev;
2091 struct musb *musb = dev_to_musb(dev); 2040 struct musb *musb = dev_to_musb(dev);
@@ -2120,8 +2069,6 @@ static void musb_save_context(struct musb *musb)
2120 musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE); 2069 musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE);
2121 musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs); 2070 musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs);
2122 musb->context.power = musb_readb(musb_base, MUSB_POWER); 2071 musb->context.power = musb_readb(musb_base, MUSB_POWER);
2123 musb->context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE);
2124 musb->context.intrrxe = musb_readw(musb_base, MUSB_INTRRXE);
2125 musb->context.intrusbe = musb_readb(musb_base, MUSB_INTRUSBE); 2072 musb->context.intrusbe = musb_readb(musb_base, MUSB_INTRUSBE);
2126 musb->context.index = musb_readb(musb_base, MUSB_INDEX); 2073 musb->context.index = musb_readb(musb_base, MUSB_INDEX);
2127 musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); 2074 musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL);
@@ -2194,8 +2141,8 @@ static void musb_restore_context(struct musb *musb)
2194 musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); 2141 musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode);
2195 musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); 2142 musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl);
2196 musb_writeb(musb_base, MUSB_POWER, musb->context.power); 2143 musb_writeb(musb_base, MUSB_POWER, musb->context.power);
2197 musb_writew(musb_base, MUSB_INTRTXE, musb->context.intrtxe); 2144 musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
2198 musb_writew(musb_base, MUSB_INTRRXE, musb->context.intrrxe); 2145 musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
2199 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); 2146 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);
2200 musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); 2147 musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
2201 2148
@@ -2340,7 +2287,7 @@ static struct platform_driver musb_driver = {
2340 .pm = MUSB_DEV_PM_OPS, 2287 .pm = MUSB_DEV_PM_OPS,
2341 }, 2288 },
2342 .probe = musb_probe, 2289 .probe = musb_probe,
2343 .remove = __devexit_p(musb_remove), 2290 .remove = musb_remove,
2344 .shutdown = musb_shutdown, 2291 .shutdown = musb_shutdown,
2345}; 2292};
2346 2293
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index c158aacd6de8..7fb4819a6f11 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -288,7 +288,6 @@ struct musb_csr_regs {
288struct musb_context_registers { 288struct musb_context_registers {
289 289
290 u8 power; 290 u8 power;
291 u16 intrtxe, intrrxe;
292 u8 intrusbe; 291 u8 intrusbe;
293 u16 frame; 292 u16 frame;
294 u8 index, testmode; 293 u8 index, testmode;
@@ -313,6 +312,8 @@ struct musb {
313 struct work_struct irq_work; 312 struct work_struct irq_work;
314 u16 hwvers; 313 u16 hwvers;
315 314
315 u16 intrrxe;
316 u16 intrtxe;
316/* this hub status bit is reserved by USB 2.0 and not seen by usbcore */ 317/* this hub status bit is reserved by USB 2.0 and not seen by usbcore */
317#define MUSB_PORT_STAT_RESUME (1 << 31) 318#define MUSB_PORT_STAT_RESUME (1 << 31)
318 319
@@ -521,8 +522,6 @@ extern const char musb_driver_name[];
521 522
522extern void musb_start(struct musb *musb); 523extern void musb_start(struct musb *musb);
523extern void musb_stop(struct musb *musb); 524extern void musb_stop(struct musb *musb);
524extern int musb_get_id(struct device *dev, gfp_t gfp_mask);
525extern void musb_put_id(struct device *dev, int id);
526 525
527extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src); 526extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src);
528extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst); 527extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst);
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 1d6e8af94c06..4c216790e86b 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -233,7 +233,7 @@ static const struct file_operations musb_test_mode_fops = {
233 .release = single_release, 233 .release = single_release,
234}; 234};
235 235
236int __devinit musb_init_debugfs(struct musb *musb) 236int musb_init_debugfs(struct musb *musb)
237{ 237{
238 struct dentry *root; 238 struct dentry *root;
239 struct dentry *file; 239 struct dentry *file;
diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h
index 24d39210d4ab..1b6b827b769f 100644
--- a/drivers/usb/musb/musb_dma.h
+++ b/drivers/usb/musb/musb_dma.h
@@ -178,8 +178,7 @@ struct dma_controller {
178extern void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit); 178extern void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit);
179 179
180 180
181extern struct dma_controller *__devinit 181extern struct dma_controller *dma_controller_create(struct musb *, void __iomem *);
182dma_controller_create(struct musb *, void __iomem *);
183 182
184extern void dma_controller_destroy(struct dma_controller *); 183extern void dma_controller_destroy(struct dma_controller *);
185 184
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index aa34f22181c1..e6f2ae8368bb 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -123,8 +123,44 @@ struct dsps_glue {
123 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ 123 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
124 struct timer_list timer[2]; /* otg_workaround timer */ 124 struct timer_list timer[2]; /* otg_workaround timer */
125 unsigned long last_timer[2]; /* last timer data for each instance */ 125 unsigned long last_timer[2]; /* last timer data for each instance */
126 u32 __iomem *usb_ctrl[2];
126}; 127};
127 128
129#define DSPS_AM33XX_CONTROL_MODULE_PHYS_0 0x44e10620
130#define DSPS_AM33XX_CONTROL_MODULE_PHYS_1 0x44e10628
131
132static const resource_size_t dsps_control_module_phys[] = {
133 DSPS_AM33XX_CONTROL_MODULE_PHYS_0,
134 DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
135};
136
137/**
138 * musb_dsps_phy_control - phy on/off
139 * @glue: struct dsps_glue *
140 * @id: musb instance
141 * @on: flag for phy to be switched on or off
142 *
143 * This is to enable the PHY using usb_ctrl register in system control
144 * module space.
145 *
146 * XXX: This function will be removed once we have a seperate driver for
147 * control module
148 */
149static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
150{
151 u32 usbphycfg;
152
153 usbphycfg = readl(glue->usb_ctrl[id]);
154
155 if (on) {
156 usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
157 usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
158 } else {
159 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
160 }
161
162 writel(usbphycfg, glue->usb_ctrl[id]);
163}
128/** 164/**
129 * dsps_musb_enable - enable interrupts 165 * dsps_musb_enable - enable interrupts
130 */ 166 */
@@ -295,7 +331,7 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
295 * Also, DRVVBUS pulses for SRP (but not at 5V) ... 331 * Also, DRVVBUS pulses for SRP (but not at 5V) ...
296 */ 332 */
297 if (usbintr & MUSB_INTR_BABBLE) 333 if (usbintr & MUSB_INTR_BABBLE)
298 pr_info("CAUTION: musb: Babble Interrupt Occured\n"); 334 pr_info("CAUTION: musb: Babble Interrupt Occurred\n");
299 335
300 if (usbintr & ((1 << wrp->drvvbus) << wrp->usb_shift)) { 336 if (usbintr & ((1 << wrp->drvvbus) << wrp->usb_shift)) {
301 int drvvbus = dsps_readl(reg_base, wrp->status); 337 int drvvbus = dsps_readl(reg_base, wrp->status);
@@ -364,11 +400,9 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
364static int dsps_musb_init(struct musb *musb) 400static int dsps_musb_init(struct musb *musb)
365{ 401{
366 struct device *dev = musb->controller; 402 struct device *dev = musb->controller;
367 struct musb_hdrc_platform_data *plat = dev->platform_data;
368 struct platform_device *pdev = to_platform_device(dev); 403 struct platform_device *pdev = to_platform_device(dev);
369 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 404 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
370 const struct dsps_musb_wrapper *wrp = glue->wrp; 405 const struct dsps_musb_wrapper *wrp = glue->wrp;
371 struct omap_musb_board_data *data = plat->board_data;
372 void __iomem *reg_base = musb->ctrl_base; 406 void __iomem *reg_base = musb->ctrl_base;
373 u32 rev, val; 407 u32 rev, val;
374 int status; 408 int status;
@@ -376,7 +410,8 @@ static int dsps_musb_init(struct musb *musb)
376 /* mentor core register starts at offset of 0x400 from musb base */ 410 /* mentor core register starts at offset of 0x400 from musb base */
377 musb->mregs += wrp->musb_core_offset; 411 musb->mregs += wrp->musb_core_offset;
378 412
379 /* Get the NOP PHY */ 413 /* NOP driver needs change if supporting dual instance */
414 usb_nop_xceiv_register();
380 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 415 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
381 if (IS_ERR_OR_NULL(musb->xceiv)) 416 if (IS_ERR_OR_NULL(musb->xceiv))
382 return -ENODEV; 417 return -ENODEV;
@@ -394,8 +429,7 @@ static int dsps_musb_init(struct musb *musb)
394 dsps_writel(reg_base, wrp->control, (1 << wrp->reset)); 429 dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
395 430
396 /* Start the on-chip PHY and its PLL. */ 431 /* Start the on-chip PHY and its PLL. */
397 if (data->set_phy_power) 432 musb_dsps_phy_control(glue, pdev->id, 1);
398 data->set_phy_power(1);
399 433
400 musb->isr = dsps_interrupt; 434 musb->isr = dsps_interrupt;
401 435
@@ -417,16 +451,13 @@ err0:
417static int dsps_musb_exit(struct musb *musb) 451static int dsps_musb_exit(struct musb *musb)
418{ 452{
419 struct device *dev = musb->controller; 453 struct device *dev = musb->controller;
420 struct musb_hdrc_platform_data *plat = dev->platform_data;
421 struct omap_musb_board_data *data = plat->board_data;
422 struct platform_device *pdev = to_platform_device(dev); 454 struct platform_device *pdev = to_platform_device(dev);
423 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 455 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
424 456
425 del_timer_sync(&glue->timer[pdev->id]); 457 del_timer_sync(&glue->timer[pdev->id]);
426 458
427 /* Shutdown the on-chip PHY and its PLL. */ 459 /* Shutdown the on-chip PHY and its PLL. */
428 if (data->set_phy_power) 460 musb_dsps_phy_control(glue, pdev->id, 0);
429 data->set_phy_power(0);
430 461
431 /* NOP driver needs change if supporting dual instance */ 462 /* NOP driver needs change if supporting dual instance */
432 usb_put_phy(musb->xceiv); 463 usb_put_phy(musb->xceiv);
@@ -447,7 +478,7 @@ static struct musb_platform_ops dsps_ops = {
447 478
448static u64 musb_dmamask = DMA_BIT_MASK(32); 479static u64 musb_dmamask = DMA_BIT_MASK(32);
449 480
450static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) 481static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
451{ 482{
452 struct device *dev = glue->dev; 483 struct device *dev = glue->dev;
453 struct platform_device *pdev = to_platform_device(dev); 484 struct platform_device *pdev = to_platform_device(dev);
@@ -458,24 +489,33 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
458 struct resource *res; 489 struct resource *res;
459 struct resource resources[2]; 490 struct resource resources[2];
460 char res_name[11]; 491 char res_name[11];
461 int ret, musbid; 492 int ret;
462 493
463 /* get memory resource */ 494 resources[0].start = dsps_control_module_phys[id];
464 snprintf(res_name, sizeof(res_name), "musb%d", id); 495 resources[0].end = resources[0].start + SZ_4 - 1;
465 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); 496 resources[0].flags = IORESOURCE_MEM;
497
498 glue->usb_ctrl[id] = devm_request_and_ioremap(&pdev->dev, resources);
499 if (glue->usb_ctrl[id] == NULL) {
500 dev_err(dev, "Failed to obtain usb_ctrl%d memory\n", id);
501 ret = -ENODEV;
502 goto err0;
503 }
504
505 /* first resource is for usbss, so start index from 1 */
506 res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1);
466 if (!res) { 507 if (!res) {
467 dev_err(dev, "%s get mem resource failed\n", res_name); 508 dev_err(dev, "failed to get memory for instance %d\n", id);
468 ret = -ENODEV; 509 ret = -ENODEV;
469 goto err0; 510 goto err0;
470 } 511 }
471 res->parent = NULL; 512 res->parent = NULL;
472 resources[0] = *res; 513 resources[0] = *res;
473 514
474 /* get irq resource */ 515 /* first resource is for usbss, so start index from 1 */
475 snprintf(res_name, sizeof(res_name), "musb%d-irq", id); 516 res = platform_get_resource(pdev, IORESOURCE_IRQ, id + 1);
476 res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
477 if (!res) { 517 if (!res) {
478 dev_err(dev, "%s get irq resource failed\n", res_name); 518 dev_err(dev, "failed to get irq for instance %d\n", id);
479 ret = -ENODEV; 519 ret = -ENODEV;
480 goto err0; 520 goto err0;
481 } 521 }
@@ -483,22 +523,14 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
483 resources[1] = *res; 523 resources[1] = *res;
484 resources[1].name = "mc"; 524 resources[1].name = "mc";
485 525
486 /* get the musb id */
487 musbid = musb_get_id(dev, GFP_KERNEL);
488 if (musbid < 0) {
489 dev_err(dev, "failed to allocate musb id\n");
490 ret = -ENOMEM;
491 goto err0;
492 }
493 /* allocate the child platform device */ 526 /* allocate the child platform device */
494 musb = platform_device_alloc("musb-hdrc", musbid); 527 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
495 if (!musb) { 528 if (!musb) {
496 dev_err(dev, "failed to allocate musb device\n"); 529 dev_err(dev, "failed to allocate musb device\n");
497 ret = -ENOMEM; 530 ret = -ENOMEM;
498 goto err1; 531 goto err0;
499 } 532 }
500 533
501 musb->id = musbid;
502 musb->dev.parent = dev; 534 musb->dev.parent = dev;
503 musb->dev.dma_mask = &musb_dmamask; 535 musb->dev.dma_mask = &musb_dmamask;
504 musb->dev.coherent_dma_mask = musb_dmamask; 536 musb->dev.coherent_dma_mask = musb_dmamask;
@@ -555,20 +587,11 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
555 587
556err2: 588err2:
557 platform_device_put(musb); 589 platform_device_put(musb);
558err1:
559 musb_put_id(dev, musbid);
560err0: 590err0:
561 return ret; 591 return ret;
562} 592}
563 593
564static void dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id) 594static int dsps_probe(struct platform_device *pdev)
565{
566 musb_put_id(glue->dev, glue->musb[id]->id);
567 platform_device_del(glue->musb[id]);
568 platform_device_put(glue->musb[id]);
569}
570
571static int __devinit dsps_probe(struct platform_device *pdev)
572{ 595{
573 struct device_node *np = pdev->dev.of_node; 596 struct device_node *np = pdev->dev.of_node;
574 const struct of_device_id *match; 597 const struct of_device_id *match;
@@ -627,7 +650,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
627 dev_err(&pdev->dev, "failed to create child pdev\n"); 650 dev_err(&pdev->dev, "failed to create child pdev\n");
628 /* release resources of previously created instances */ 651 /* release resources of previously created instances */
629 for (i--; i >= 0 ; i--) 652 for (i--; i >= 0 ; i--)
630 dsps_delete_musb_pdev(glue, i); 653 platform_device_unregister(glue->musb[i]);
631 goto err3; 654 goto err3;
632 } 655 }
633 } 656 }
@@ -644,7 +667,7 @@ err1:
644err0: 667err0:
645 return ret; 668 return ret;
646} 669}
647static int __devexit dsps_remove(struct platform_device *pdev) 670static int dsps_remove(struct platform_device *pdev)
648{ 671{
649 struct dsps_glue *glue = platform_get_drvdata(pdev); 672 struct dsps_glue *glue = platform_get_drvdata(pdev);
650 const struct dsps_musb_wrapper *wrp = glue->wrp; 673 const struct dsps_musb_wrapper *wrp = glue->wrp;
@@ -652,7 +675,7 @@ static int __devexit dsps_remove(struct platform_device *pdev)
652 675
653 /* delete the child platform device */ 676 /* delete the child platform device */
654 for (i = 0; i < wrp->instances ; i++) 677 for (i = 0; i < wrp->instances ; i++)
655 dsps_delete_musb_pdev(glue, i); 678 platform_device_unregister(glue->musb[i]);
656 679
657 /* disable usbss clocks */ 680 /* disable usbss clocks */
658 pm_runtime_put(&pdev->dev); 681 pm_runtime_put(&pdev->dev);
@@ -665,24 +688,26 @@ static int __devexit dsps_remove(struct platform_device *pdev)
665#ifdef CONFIG_PM_SLEEP 688#ifdef CONFIG_PM_SLEEP
666static int dsps_suspend(struct device *dev) 689static int dsps_suspend(struct device *dev)
667{ 690{
668 struct musb_hdrc_platform_data *plat = dev->platform_data; 691 struct platform_device *pdev = to_platform_device(dev->parent);
669 struct omap_musb_board_data *data = plat->board_data; 692 struct dsps_glue *glue = platform_get_drvdata(pdev);
693 const struct dsps_musb_wrapper *wrp = glue->wrp;
694 int i;
670 695
671 /* Shutdown the on-chip PHY and its PLL. */ 696 for (i = 0; i < wrp->instances; i++)
672 if (data->set_phy_power) 697 musb_dsps_phy_control(glue, i, 0);
673 data->set_phy_power(0);
674 698
675 return 0; 699 return 0;
676} 700}
677 701
678static int dsps_resume(struct device *dev) 702static int dsps_resume(struct device *dev)
679{ 703{
680 struct musb_hdrc_platform_data *plat = dev->platform_data; 704 struct platform_device *pdev = to_platform_device(dev->parent);
681 struct omap_musb_board_data *data = plat->board_data; 705 struct dsps_glue *glue = platform_get_drvdata(pdev);
706 const struct dsps_musb_wrapper *wrp = glue->wrp;
707 int i;
682 708
683 /* Start the on-chip PHY and its PLL. */ 709 for (i = 0; i < wrp->instances; i++)
684 if (data->set_phy_power) 710 musb_dsps_phy_control(glue, i, 1);
685 data->set_phy_power(1);
686 711
687 return 0; 712 return 0;
688} 713}
@@ -690,7 +715,7 @@ static int dsps_resume(struct device *dev)
690 715
691static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume); 716static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
692 717
693static const struct dsps_musb_wrapper ti81xx_driver_data __devinitconst = { 718static const struct dsps_musb_wrapper ti81xx_driver_data = {
694 .revision = 0x00, 719 .revision = 0x00,
695 .control = 0x14, 720 .control = 0x14,
696 .status = 0x18, 721 .status = 0x18,
@@ -718,10 +743,10 @@ static const struct dsps_musb_wrapper ti81xx_driver_data __devinitconst = {
718 .rxep_bitmap = (0xfffe << 16), 743 .rxep_bitmap = (0xfffe << 16),
719 .musb_core_offset = 0x400, 744 .musb_core_offset = 0x400,
720 .poll_seconds = 2, 745 .poll_seconds = 2,
721 .instances = 2, 746 .instances = 1,
722}; 747};
723 748
724static const struct platform_device_id musb_dsps_id_table[] __devinitconst = { 749static const struct platform_device_id musb_dsps_id_table[] = {
725 { 750 {
726 .name = "musb-ti81xx", 751 .name = "musb-ti81xx",
727 .driver_data = (kernel_ulong_t) &ti81xx_driver_data, 752 .driver_data = (kernel_ulong_t) &ti81xx_driver_data,
@@ -731,7 +756,7 @@ static const struct platform_device_id musb_dsps_id_table[] __devinitconst = {
731MODULE_DEVICE_TABLE(platform, musb_dsps_id_table); 756MODULE_DEVICE_TABLE(platform, musb_dsps_id_table);
732 757
733#ifdef CONFIG_OF 758#ifdef CONFIG_OF
734static const struct of_device_id musb_dsps_of_match[] __devinitconst = { 759static const struct of_device_id musb_dsps_of_match[] = {
735 { .compatible = "ti,musb-am33xx", 760 { .compatible = "ti,musb-am33xx",
736 .data = (void *) &ti81xx_driver_data, }, 761 .data = (void *) &ti81xx_driver_data, },
737 { }, 762 { },
@@ -741,7 +766,7 @@ MODULE_DEVICE_TABLE(of, musb_dsps_of_match);
741 766
742static struct platform_driver dsps_usbss_driver = { 767static struct platform_driver dsps_usbss_driver = {
743 .probe = dsps_probe, 768 .probe = dsps_probe,
744 .remove = __devexit_p(dsps_remove), 769 .remove = dsps_remove,
745 .driver = { 770 .driver = {
746 .name = "musb-dsps", 771 .name = "musb-dsps",
747 .pm = &dsps_pm_ops, 772 .pm = &dsps_pm_ops,
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index b6b84dacc791..876787438c2f 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1090,7 +1090,6 @@ static int musb_gadget_enable(struct usb_ep *ep,
1090 */ 1090 */
1091 musb_ep_select(mbase, epnum); 1091 musb_ep_select(mbase, epnum);
1092 if (usb_endpoint_dir_in(desc)) { 1092 if (usb_endpoint_dir_in(desc)) {
1093 u16 int_txe = musb_readw(mbase, MUSB_INTRTXE);
1094 1093
1095 if (hw_ep->is_shared_fifo) 1094 if (hw_ep->is_shared_fifo)
1096 musb_ep->is_in = 1; 1095 musb_ep->is_in = 1;
@@ -1102,8 +1101,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
1102 goto fail; 1101 goto fail;
1103 } 1102 }
1104 1103
1105 int_txe |= (1 << epnum); 1104 musb->intrtxe |= (1 << epnum);
1106 musb_writew(mbase, MUSB_INTRTXE, int_txe); 1105 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe);
1107 1106
1108 /* REVISIT if can_bulk_split(), use by updating "tmp"; 1107 /* REVISIT if can_bulk_split(), use by updating "tmp";
1109 * likewise high bandwidth periodic tx 1108 * likewise high bandwidth periodic tx
@@ -1130,7 +1129,6 @@ static int musb_gadget_enable(struct usb_ep *ep,
1130 musb_writew(regs, MUSB_TXCSR, csr); 1129 musb_writew(regs, MUSB_TXCSR, csr);
1131 1130
1132 } else { 1131 } else {
1133 u16 int_rxe = musb_readw(mbase, MUSB_INTRRXE);
1134 1132
1135 if (hw_ep->is_shared_fifo) 1133 if (hw_ep->is_shared_fifo)
1136 musb_ep->is_in = 0; 1134 musb_ep->is_in = 0;
@@ -1142,8 +1140,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
1142 goto fail; 1140 goto fail;
1143 } 1141 }
1144 1142
1145 int_rxe |= (1 << epnum); 1143 musb->intrrxe |= (1 << epnum);
1146 musb_writew(mbase, MUSB_INTRRXE, int_rxe); 1144 musb_writew(mbase, MUSB_INTRRXE, musb->intrrxe);
1147 1145
1148 /* REVISIT if can_bulk_combine() use by updating "tmp" 1146 /* REVISIT if can_bulk_combine() use by updating "tmp"
1149 * likewise high bandwidth periodic rx 1147 * likewise high bandwidth periodic rx
@@ -1231,14 +1229,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
1231 1229
1232 /* zero the endpoint sizes */ 1230 /* zero the endpoint sizes */
1233 if (musb_ep->is_in) { 1231 if (musb_ep->is_in) {
1234 u16 int_txe = musb_readw(musb->mregs, MUSB_INTRTXE); 1232 musb->intrtxe &= ~(1 << epnum);
1235 int_txe &= ~(1 << epnum); 1233 musb_writew(musb->mregs, MUSB_INTRTXE, musb->intrtxe);
1236 musb_writew(musb->mregs, MUSB_INTRTXE, int_txe);
1237 musb_writew(epio, MUSB_TXMAXP, 0); 1234 musb_writew(epio, MUSB_TXMAXP, 0);
1238 } else { 1235 } else {
1239 u16 int_rxe = musb_readw(musb->mregs, MUSB_INTRRXE); 1236 musb->intrrxe &= ~(1 << epnum);
1240 int_rxe &= ~(1 << epnum); 1237 musb_writew(musb->mregs, MUSB_INTRRXE, musb->intrrxe);
1241 musb_writew(musb->mregs, MUSB_INTRRXE, int_rxe);
1242 musb_writew(epio, MUSB_RXMAXP, 0); 1238 musb_writew(epio, MUSB_RXMAXP, 0);
1243 } 1239 }
1244 1240
@@ -1554,7 +1550,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1554 void __iomem *epio = musb->endpoints[epnum].regs; 1550 void __iomem *epio = musb->endpoints[epnum].regs;
1555 void __iomem *mbase; 1551 void __iomem *mbase;
1556 unsigned long flags; 1552 unsigned long flags;
1557 u16 csr, int_txe; 1553 u16 csr;
1558 1554
1559 mbase = musb->mregs; 1555 mbase = musb->mregs;
1560 1556
@@ -1562,8 +1558,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1562 musb_ep_select(mbase, (u8) epnum); 1558 musb_ep_select(mbase, (u8) epnum);
1563 1559
1564 /* disable interrupts */ 1560 /* disable interrupts */
1565 int_txe = musb_readw(mbase, MUSB_INTRTXE); 1561 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe & ~(1 << epnum));
1566 musb_writew(mbase, MUSB_INTRTXE, int_txe & ~(1 << epnum));
1567 1562
1568 if (musb_ep->is_in) { 1563 if (musb_ep->is_in) {
1569 csr = musb_readw(epio, MUSB_TXCSR); 1564 csr = musb_readw(epio, MUSB_TXCSR);
@@ -1587,7 +1582,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1587 } 1582 }
1588 1583
1589 /* re-enable interrupt */ 1584 /* re-enable interrupt */
1590 musb_writew(mbase, MUSB_INTRTXE, int_txe); 1585 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe);
1591 spin_unlock_irqrestore(&musb->lock, flags); 1586 spin_unlock_irqrestore(&musb->lock, flags);
1592} 1587}
1593 1588
@@ -1792,7 +1787,7 @@ static void musb_gadget_release(struct device *dev)
1792} 1787}
1793 1788
1794 1789
1795static void __devinit 1790static void
1796init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) 1791init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
1797{ 1792{
1798 struct musb_hw_ep *hw_ep = musb->endpoints + epnum; 1793 struct musb_hw_ep *hw_ep = musb->endpoints + epnum;
@@ -1829,7 +1824,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
1829 * Initialize the endpoints exposed to peripheral drivers, with backlinks 1824 * Initialize the endpoints exposed to peripheral drivers, with backlinks
1830 * to the rest of the driver state. 1825 * to the rest of the driver state.
1831 */ 1826 */
1832static inline void __devinit musb_g_init_endpoints(struct musb *musb) 1827static inline void musb_g_init_endpoints(struct musb *musb)
1833{ 1828{
1834 u8 epnum; 1829 u8 epnum;
1835 struct musb_hw_ep *hw_ep; 1830 struct musb_hw_ep *hw_ep;
@@ -1862,7 +1857,7 @@ static inline void __devinit musb_g_init_endpoints(struct musb *musb)
1862/* called once during driver setup to initialize and link into 1857/* called once during driver setup to initialize and link into
1863 * the driver model; memory is zeroed. 1858 * the driver model; memory is zeroed.
1864 */ 1859 */
1865int __devinit musb_gadget_setup(struct musb *musb) 1860int musb_gadget_setup(struct musb *musb)
1866{ 1861{
1867 int status; 1862 int status;
1868 1863
@@ -2176,10 +2171,9 @@ __acquires(musb->lock)
2176 u8 devctl = musb_readb(mbase, MUSB_DEVCTL); 2171 u8 devctl = musb_readb(mbase, MUSB_DEVCTL);
2177 u8 power; 2172 u8 power;
2178 2173
2179 dev_dbg(musb->controller, "<== %s addr=%x driver '%s'\n", 2174 dev_dbg(musb->controller, "<== %s driver '%s'\n",
2180 (devctl & MUSB_DEVCTL_BDEVICE) 2175 (devctl & MUSB_DEVCTL_BDEVICE)
2181 ? "B-Device" : "A-Device", 2176 ? "B-Device" : "A-Device",
2182 musb_readb(mbase, MUSB_FADDR),
2183 musb->gadget_driver 2177 musb->gadget_driver
2184 ? musb->gadget_driver->driver.name 2178 ? musb->gadget_driver->driver.name
2185 : NULL 2179 : NULL
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index e40d7647caf1..c9c1ac4e075f 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -673,10 +673,8 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
673 csr = musb_readw(regs, MUSB_CSR0); 673 csr = musb_readw(regs, MUSB_CSR0);
674 len = musb_readb(regs, MUSB_COUNT0); 674 len = musb_readb(regs, MUSB_COUNT0);
675 675
676 dev_dbg(musb->controller, "csr %04x, count %d, myaddr %d, ep0stage %s\n", 676 dev_dbg(musb->controller, "csr %04x, count %d, ep0stage %s\n",
677 csr, len, 677 csr, len, decode_ep0stage(musb->ep0_state));
678 musb_readb(mbase, MUSB_FADDR),
679 decode_ep0stage(musb->ep0_state));
680 678
681 if (csr & MUSB_CSR0_P_DATAEND) { 679 if (csr & MUSB_CSR0_P_DATAEND) {
682 /* 680 /*
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 3df6a76b851d..e9f0fd9ddd2d 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -740,7 +740,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
740 csr = musb_readw(epio, MUSB_TXCSR); 740 csr = musb_readw(epio, MUSB_TXCSR);
741 741
742 /* disable interrupt in case we flush */ 742 /* disable interrupt in case we flush */
743 int_txe = musb_readw(mbase, MUSB_INTRTXE); 743 int_txe = musb->intrtxe;
744 musb_writew(mbase, MUSB_INTRTXE, int_txe & ~(1 << epnum)); 744 musb_writew(mbase, MUSB_INTRTXE, int_txe & ~(1 << epnum));
745 745
746 /* general endpoint setup */ 746 /* general endpoint setup */
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 0fc6ca6bc60a..3d1fd52a15a9 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -380,8 +380,7 @@ void dma_controller_destroy(struct dma_controller *c)
380 kfree(controller); 380 kfree(controller);
381} 381}
382 382
383struct dma_controller *__devinit 383struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *base)
384dma_controller_create(struct musb *musb, void __iomem *base)
385{ 384{
386 struct musb_dma_controller *controller; 385 struct musb_dma_controller *controller;
387 struct device *dev = musb->controller; 386 struct device *dev = musb->controller;
diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h
index 320fd4afb93f..f7b13fd25257 100644
--- a/drivers/usb/musb/musbhsdma.h
+++ b/drivers/usb/musb/musbhsdma.h
@@ -31,10 +31,6 @@
31 * 31 *
32 */ 32 */
33 33
34#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
35#include "omap2430.h"
36#endif
37
38#ifndef CONFIG_BLACKFIN 34#ifndef CONFIG_BLACKFIN
39 35
40#define MUSB_HSDMA_BASE 0x200 36#define MUSB_HSDMA_BASE 0x200
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index a538fe17a966..da00af460794 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -333,6 +333,26 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work)
333 omap_musb_set_mailbox(glue); 333 omap_musb_set_mailbox(glue);
334} 334}
335 335
336static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci)
337{
338 unsigned long flags;
339 irqreturn_t retval = IRQ_NONE;
340 struct musb *musb = __hci;
341
342 spin_lock_irqsave(&musb->lock, flags);
343
344 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
345 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
346 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
347
348 if (musb->int_usb || musb->int_tx || musb->int_rx)
349 retval = musb_interrupt(musb);
350
351 spin_unlock_irqrestore(&musb->lock, flags);
352
353 return retval;
354}
355
336static int omap2430_musb_init(struct musb *musb) 356static int omap2430_musb_init(struct musb *musb)
337{ 357{
338 u32 l; 358 u32 l;
@@ -352,6 +372,8 @@ static int omap2430_musb_init(struct musb *musb)
352 return -ENODEV; 372 return -ENODEV;
353 } 373 }
354 374
375 musb->isr = omap2430_musb_interrupt;
376
355 status = pm_runtime_get_sync(dev); 377 status = pm_runtime_get_sync(dev);
356 if (status < 0) { 378 if (status < 0) {
357 dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); 379 dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
@@ -468,7 +490,7 @@ static const struct musb_platform_ops omap2430_ops = {
468 490
469static u64 omap2430_dmamask = DMA_BIT_MASK(32); 491static u64 omap2430_dmamask = DMA_BIT_MASK(32);
470 492
471static int __devinit omap2430_probe(struct platform_device *pdev) 493static int omap2430_probe(struct platform_device *pdev)
472{ 494{
473 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 495 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
474 struct omap_musb_board_data *data; 496 struct omap_musb_board_data *data;
@@ -478,7 +500,6 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
478 struct musb_hdrc_config *config; 500 struct musb_hdrc_config *config;
479 struct resource *res; 501 struct resource *res;
480 int ret = -ENOMEM; 502 int ret = -ENOMEM;
481 int musbid;
482 503
483 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); 504 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
484 if (!glue) { 505 if (!glue) {
@@ -486,21 +507,12 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
486 goto err0; 507 goto err0;
487 } 508 }
488 509
489 /* get the musb id */ 510 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
490 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
491 if (musbid < 0) {
492 dev_err(&pdev->dev, "failed to allocate musb id\n");
493 ret = -ENOMEM;
494 goto err0;
495 }
496
497 musb = platform_device_alloc("musb-hdrc", musbid);
498 if (!musb) { 511 if (!musb) {
499 dev_err(&pdev->dev, "failed to allocate musb device\n"); 512 dev_err(&pdev->dev, "failed to allocate musb device\n");
500 goto err1; 513 goto err0;
501 } 514 }
502 515
503 musb->id = musbid;
504 musb->dev.parent = &pdev->dev; 516 musb->dev.parent = &pdev->dev;
505 musb->dev.dma_mask = &omap2430_dmamask; 517 musb->dev.dma_mask = &omap2430_dmamask;
506 musb->dev.coherent_dma_mask = omap2430_dmamask; 518 musb->dev.coherent_dma_mask = omap2430_dmamask;
@@ -521,7 +533,7 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
521 dev_err(&pdev->dev, 533 dev_err(&pdev->dev,
522 "failed to allocate musb platfrom data\n"); 534 "failed to allocate musb platfrom data\n");
523 ret = -ENOMEM; 535 ret = -ENOMEM;
524 goto err1; 536 goto err2;
525 } 537 }
526 538
527 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 539 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
@@ -529,14 +541,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
529 dev_err(&pdev->dev, 541 dev_err(&pdev->dev,
530 "failed to allocate musb board data\n"); 542 "failed to allocate musb board data\n");
531 ret = -ENOMEM; 543 ret = -ENOMEM;
532 goto err1; 544 goto err2;
533 } 545 }
534 546
535 config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); 547 config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
536 if (!data) { 548 if (!data) {
537 dev_err(&pdev->dev, 549 dev_err(&pdev->dev,
538 "failed to allocate musb hdrc config\n"); 550 "failed to allocate musb hdrc config\n");
539 goto err1; 551 goto err2;
540 } 552 }
541 553
542 of_property_read_u32(np, "mode", (u32 *)&pdata->mode); 554 of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
@@ -589,19 +601,15 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
589err2: 601err2:
590 platform_device_put(musb); 602 platform_device_put(musb);
591 603
592err1:
593 musb_put_id(&pdev->dev, musbid);
594
595err0: 604err0:
596 return ret; 605 return ret;
597} 606}
598 607
599static int __devexit omap2430_remove(struct platform_device *pdev) 608static int omap2430_remove(struct platform_device *pdev)
600{ 609{
601 struct omap2430_glue *glue = platform_get_drvdata(pdev); 610 struct omap2430_glue *glue = platform_get_drvdata(pdev);
602 611
603 cancel_work_sync(&glue->omap_musb_mailbox_work); 612 cancel_work_sync(&glue->omap_musb_mailbox_work);
604 musb_put_id(&pdev->dev, glue->musb->id);
605 platform_device_unregister(glue->musb); 613 platform_device_unregister(glue->musb);
606 614
607 return 0; 615 return 0;
@@ -666,7 +674,7 @@ MODULE_DEVICE_TABLE(of, omap2430_id_table);
666 674
667static struct platform_driver omap2430_driver = { 675static struct platform_driver omap2430_driver = {
668 .probe = omap2430_probe, 676 .probe = omap2430_probe,
669 .remove = __devexit_p(omap2430_remove), 677 .remove = omap2430_remove,
670 .driver = { 678 .driver = {
671 .name = "musb-omap2430", 679 .name = "musb-omap2430",
672 .pm = DEV_PM_OPS, 680 .pm = DEV_PM_OPS,
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index dc4d75ea13ad..8bde6fc5eb75 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1153,14 +1153,13 @@ static const struct musb_platform_ops tusb_ops = {
1153 1153
1154static u64 tusb_dmamask = DMA_BIT_MASK(32); 1154static u64 tusb_dmamask = DMA_BIT_MASK(32);
1155 1155
1156static int __devinit tusb_probe(struct platform_device *pdev) 1156static int tusb_probe(struct platform_device *pdev)
1157{ 1157{
1158 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 1158 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
1159 struct platform_device *musb; 1159 struct platform_device *musb;
1160 struct tusb6010_glue *glue; 1160 struct tusb6010_glue *glue;
1161 1161
1162 int ret = -ENOMEM; 1162 int ret = -ENOMEM;
1163 int musbid;
1164 1163
1165 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 1164 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
1166 if (!glue) { 1165 if (!glue) {
@@ -1168,21 +1167,12 @@ static int __devinit tusb_probe(struct platform_device *pdev)
1168 goto err0; 1167 goto err0;
1169 } 1168 }
1170 1169
1171 /* get the musb id */ 1170 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
1172 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
1173 if (musbid < 0) {
1174 dev_err(&pdev->dev, "failed to allocate musb id\n");
1175 ret = -ENOMEM;
1176 goto err1;
1177 }
1178
1179 musb = platform_device_alloc("musb-hdrc", musbid);
1180 if (!musb) { 1171 if (!musb) {
1181 dev_err(&pdev->dev, "failed to allocate musb device\n"); 1172 dev_err(&pdev->dev, "failed to allocate musb device\n");
1182 goto err2; 1173 goto err1;
1183 } 1174 }
1184 1175
1185 musb->id = musbid;
1186 musb->dev.parent = &pdev->dev; 1176 musb->dev.parent = &pdev->dev;
1187 musb->dev.dma_mask = &tusb_dmamask; 1177 musb->dev.dma_mask = &tusb_dmamask;
1188 musb->dev.coherent_dma_mask = tusb_dmamask; 1178 musb->dev.coherent_dma_mask = tusb_dmamask;
@@ -1218,9 +1208,6 @@ static int __devinit tusb_probe(struct platform_device *pdev)
1218err3: 1208err3:
1219 platform_device_put(musb); 1209 platform_device_put(musb);
1220 1210
1221err2:
1222 musb_put_id(&pdev->dev, musbid);
1223
1224err1: 1211err1:
1225 kfree(glue); 1212 kfree(glue);
1226 1213
@@ -1228,13 +1215,11 @@ err0:
1228 return ret; 1215 return ret;
1229} 1216}
1230 1217
1231static int __devexit tusb_remove(struct platform_device *pdev) 1218static int tusb_remove(struct platform_device *pdev)
1232{ 1219{
1233 struct tusb6010_glue *glue = platform_get_drvdata(pdev); 1220 struct tusb6010_glue *glue = platform_get_drvdata(pdev);
1234 1221
1235 musb_put_id(&pdev->dev, glue->musb->id); 1222 platform_device_unregister(glue->musb);
1236 platform_device_del(glue->musb);
1237 platform_device_put(glue->musb);
1238 kfree(glue); 1223 kfree(glue);
1239 1224
1240 return 0; 1225 return 0;
@@ -1242,7 +1227,7 @@ static int __devexit tusb_remove(struct platform_device *pdev)
1242 1227
1243static struct platform_driver tusb_driver = { 1228static struct platform_driver tusb_driver = {
1244 .probe = tusb_probe, 1229 .probe = tusb_probe,
1245 .remove = __devexit_p(tusb_remove), 1230 .remove = tusb_remove,
1246 .driver = { 1231 .driver = {
1247 .name = "musb-tusb", 1232 .name = "musb-tusb",
1248 }, 1233 },
@@ -1251,15 +1236,4 @@ static struct platform_driver tusb_driver = {
1251MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer"); 1236MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
1252MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); 1237MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
1253MODULE_LICENSE("GPL v2"); 1238MODULE_LICENSE("GPL v2");
1254 1239module_platform_driver(tusb_driver);
1255static int __init tusb_init(void)
1256{
1257 return platform_driver_register(&tusb_driver);
1258}
1259module_init(tusb_init);
1260
1261static void __exit tusb_exit(void)
1262{
1263 platform_driver_unregister(&tusb_driver);
1264}
1265module_exit(tusb_exit);
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c
index 82310b6bc97b..98df17c984a8 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -668,8 +668,7 @@ void dma_controller_destroy(struct dma_controller *c)
668 kfree(tusb_dma); 668 kfree(tusb_dma);
669} 669}
670 670
671struct dma_controller *__devinit 671struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *base)
672dma_controller_create(struct musb *musb, void __iomem *base)
673{ 672{
674 void __iomem *tbase = musb->ctrl_base; 673 void __iomem *tbase = musb->ctrl_base;
675 struct tusb_omap_dma *tusb_dma; 674 struct tusb_omap_dma *tusb_dma;
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 0e62f504410e..a27ca1a9c994 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -36,6 +36,26 @@ struct ux500_glue {
36}; 36};
37#define glue_to_musb(g) platform_get_drvdata(g->musb) 37#define glue_to_musb(g) platform_get_drvdata(g->musb)
38 38
39static irqreturn_t ux500_musb_interrupt(int irq, void *__hci)
40{
41 unsigned long flags;
42 irqreturn_t retval = IRQ_NONE;
43 struct musb *musb = __hci;
44
45 spin_lock_irqsave(&musb->lock, flags);
46
47 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
48 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
49 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
50
51 if (musb->int_usb || musb->int_tx || musb->int_rx)
52 retval = musb_interrupt(musb);
53
54 spin_unlock_irqrestore(&musb->lock, flags);
55
56 return retval;
57}
58
39static int ux500_musb_init(struct musb *musb) 59static int ux500_musb_init(struct musb *musb)
40{ 60{
41 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 61 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
@@ -44,6 +64,8 @@ static int ux500_musb_init(struct musb *musb)
44 return -ENODEV; 64 return -ENODEV;
45 } 65 }
46 66
67 musb->isr = ux500_musb_interrupt;
68
47 return 0; 69 return 0;
48} 70}
49 71
@@ -59,13 +81,12 @@ static const struct musb_platform_ops ux500_ops = {
59 .exit = ux500_musb_exit, 81 .exit = ux500_musb_exit,
60}; 82};
61 83
62static int __devinit ux500_probe(struct platform_device *pdev) 84static int ux500_probe(struct platform_device *pdev)
63{ 85{
64 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 86 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
65 struct platform_device *musb; 87 struct platform_device *musb;
66 struct ux500_glue *glue; 88 struct ux500_glue *glue;
67 struct clk *clk; 89 struct clk *clk;
68 int musbid;
69 int ret = -ENOMEM; 90 int ret = -ENOMEM;
70 91
71 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 92 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
@@ -74,18 +95,10 @@ static int __devinit ux500_probe(struct platform_device *pdev)
74 goto err0; 95 goto err0;
75 } 96 }
76 97
77 /* get the musb id */ 98 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
78 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
79 if (musbid < 0) {
80 dev_err(&pdev->dev, "failed to allocate musb id\n");
81 ret = -ENOMEM;
82 goto err1;
83 }
84
85 musb = platform_device_alloc("musb-hdrc", musbid);
86 if (!musb) { 99 if (!musb) {
87 dev_err(&pdev->dev, "failed to allocate musb device\n"); 100 dev_err(&pdev->dev, "failed to allocate musb device\n");
88 goto err2; 101 goto err1;
89 } 102 }
90 103
91 clk = clk_get(&pdev->dev, "usb"); 104 clk = clk_get(&pdev->dev, "usb");
@@ -101,7 +114,6 @@ static int __devinit ux500_probe(struct platform_device *pdev)
101 goto err4; 114 goto err4;
102 } 115 }
103 116
104 musb->id = musbid;
105 musb->dev.parent = &pdev->dev; 117 musb->dev.parent = &pdev->dev;
106 musb->dev.dma_mask = pdev->dev.dma_mask; 118 musb->dev.dma_mask = pdev->dev.dma_mask;
107 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; 119 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
@@ -144,9 +156,6 @@ err4:
144err3: 156err3:
145 platform_device_put(musb); 157 platform_device_put(musb);
146 158
147err2:
148 musb_put_id(&pdev->dev, musbid);
149
150err1: 159err1:
151 kfree(glue); 160 kfree(glue);
152 161
@@ -154,13 +163,11 @@ err0:
154 return ret; 163 return ret;
155} 164}
156 165
157static int __devexit ux500_remove(struct platform_device *pdev) 166static int ux500_remove(struct platform_device *pdev)
158{ 167{
159 struct ux500_glue *glue = platform_get_drvdata(pdev); 168 struct ux500_glue *glue = platform_get_drvdata(pdev);
160 169
161 musb_put_id(&pdev->dev, glue->musb->id); 170 platform_device_unregister(glue->musb);
162 platform_device_del(glue->musb);
163 platform_device_put(glue->musb);
164 clk_disable(glue->clk); 171 clk_disable(glue->clk);
165 clk_put(glue->clk); 172 clk_put(glue->clk);
166 kfree(glue); 173 kfree(glue);
@@ -209,7 +216,7 @@ static const struct dev_pm_ops ux500_pm_ops = {
209 216
210static struct platform_driver ux500_driver = { 217static struct platform_driver ux500_driver = {
211 .probe = ux500_probe, 218 .probe = ux500_probe,
212 .remove = __devexit_p(ux500_remove), 219 .remove = ux500_remove,
213 .driver = { 220 .driver = {
214 .name = "musb-ux500", 221 .name = "musb-ux500",
215 .pm = DEV_PM_OPS, 222 .pm = DEV_PM_OPS,
@@ -219,15 +226,4 @@ static struct platform_driver ux500_driver = {
219MODULE_DESCRIPTION("UX500 MUSB Glue Layer"); 226MODULE_DESCRIPTION("UX500 MUSB Glue Layer");
220MODULE_AUTHOR("Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>"); 227MODULE_AUTHOR("Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>");
221MODULE_LICENSE("GPL v2"); 228MODULE_LICENSE("GPL v2");
222 229module_platform_driver(ux500_driver);
223static int __init ux500_init(void)
224{
225 return platform_driver_register(&ux500_driver);
226}
227module_init(ux500_init);
228
229static void __exit ux500_exit(void)
230{
231 platform_driver_unregister(&ux500_driver);
232}
233module_exit(ux500_exit);
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index f1059e725ea8..039e567dd3b6 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -364,8 +364,7 @@ void dma_controller_destroy(struct dma_controller *c)
364 kfree(controller); 364 kfree(controller);
365} 365}
366 366
367struct dma_controller *__devinit 367struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *base)
368dma_controller_create(struct musb *musb, void __iomem *base)
369{ 368{
370 struct ux500_dma_controller *controller; 369 struct ux500_dma_controller *controller;
371 struct platform_device *pdev = to_platform_device(musb->controller); 370 struct platform_device *pdev = to_platform_device(musb->controller);