aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-11 20:12:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-11 20:13:16 -0500
commit3a3f2e50951faaac1c67b5c6c0c70dec5b150e9b (patch)
treee27ce9aa85d26b978096a1eb6acbf4e297488953
parent8e06c6a7f4404f10e6630932dffcb06de023a7a2 (diff)
parentd928cd2ef8f7f4194e479d4a66452901ec82ccda (diff)
Merge tag 'musb-for-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
USB musb merge from Felipe: "usb: musb: patches for v3.8 merge window We have here the usual set of cleanups for the MUSB driver; a big set of patches converting platform_device_del() and platform_device_put() into platform_device_unregister(). Another big set was applied converting to module_platform_driver() macro in order to reduce some boilerplate code from all glue layers. Other than that, we had a series fixing one known silicon errata where we couldn't read a few registers. In order to fix that we're now using shadow variables for reads and only writing to the registers which are known to break functionality when read."
-rw-r--r--Documentation/devicetree/bindings/usb/am33xx-usb.txt8
-rw-r--r--drivers/usb/musb/am35x.c34
-rw-r--r--drivers/usb/musb/blackfin.c34
-rw-r--r--drivers/usb/musb/cppi_dma.c1
-rw-r--r--drivers/usb/musb/da8xx.c34
-rw-r--r--drivers/usb/musb/davinci.c34
-rw-r--r--drivers/usb/musb/musb_core.c96
-rw-r--r--drivers/usb/musb/musb_core.h5
-rw-r--r--drivers/usb/musb/musb_dsps.c125
-rw-r--r--drivers/usb/musb/musb_gadget.c30
-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.h4
-rw-r--r--drivers/usb/musb/omap2430.c46
-rw-r--r--drivers/usb/musb/tusb6010.c34
-rw-r--r--drivers/usb/musb/ux500.c56
16 files changed, 192 insertions, 357 deletions
diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index ca8fa56e9f03..a92250512a4e 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -3,12 +3,12 @@ AM33XX MUSB GLUE
3 - ti,hwmods : must be "usb_otg_hs" 3 - ti,hwmods : must be "usb_otg_hs"
4 - multipoint : Should be "1" indicating the musb controller supports 4 - multipoint : Should be "1" indicating the musb controller supports
5 multipoint. This is a MUSB configuration-specific setting. 5 multipoint. This is a MUSB configuration-specific setting.
6 - num_eps : Specifies the number of endpoints. This is also a 6 - num-eps : Specifies the number of endpoints. This is also a
7 MUSB configuration-specific setting. Should be set to "16" 7 MUSB configuration-specific setting. Should be set to "16"
8 - ram_bits : Specifies the ram address size. Should be set to "12" 8 - ram-bits : Specifies the ram address size. Should be set to "12"
9 - port0_mode : Should be "3" to represent OTG. "1" signifies HOST and "2" 9 - port0-mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
10 represents PERIPHERAL. 10 represents PERIPHERAL.
11 - port1_mode : Should be "1" to represent HOST. "3" signifies OTG and "2" 11 - port1-mode : Should be "1" to represent HOST. "3" signifies OTG and "2"
12 represents PERIPHERAL. 12 represents PERIPHERAL.
13 - power : Should be "250". This signifies the controller can supply upto 13 - power : Should be "250". This signifies the controller can supply upto
14 500mA when operating in host mode. 14 500mA when operating in host mode.
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index c964d6af178b..3baccf765418 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -465,7 +465,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
465 struct clk *clk; 465 struct clk *clk;
466 466
467 int ret = -ENOMEM; 467 int ret = -ENOMEM;
468 int musbid;
469 468
470 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 469 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
471 if (!glue) { 470 if (!glue) {
@@ -473,18 +472,10 @@ static int __devinit am35x_probe(struct platform_device *pdev)
473 goto err0; 472 goto err0;
474 } 473 }
475 474
476 /* get the musb id */ 475 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
477 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
478 if (musbid < 0) {
479 dev_err(&pdev->dev, "failed to allocate musb id\n");
480 ret = -ENOMEM;
481 goto err1;
482 }
483
484 musb = platform_device_alloc("musb-hdrc", musbid);
485 if (!musb) { 476 if (!musb) {
486 dev_err(&pdev->dev, "failed to allocate musb device\n"); 477 dev_err(&pdev->dev, "failed to allocate musb device\n");
487 goto err2; 478 goto err1;
488 } 479 }
489 480
490 phy_clk = clk_get(&pdev->dev, "fck"); 481 phy_clk = clk_get(&pdev->dev, "fck");
@@ -513,7 +504,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
513 goto err6; 504 goto err6;
514 } 505 }
515 506
516 musb->id = musbid;
517 musb->dev.parent = &pdev->dev; 507 musb->dev.parent = &pdev->dev;
518 musb->dev.dma_mask = &am35x_dmamask; 508 musb->dev.dma_mask = &am35x_dmamask;
519 musb->dev.coherent_dma_mask = am35x_dmamask; 509 musb->dev.coherent_dma_mask = am35x_dmamask;
@@ -563,9 +553,6 @@ err4:
563err3: 553err3:
564 platform_device_put(musb); 554 platform_device_put(musb);
565 555
566err2:
567 musb_put_id(&pdev->dev, musbid);
568
569err1: 556err1:
570 kfree(glue); 557 kfree(glue);
571 558
@@ -577,9 +564,7 @@ static int __devexit am35x_remove(struct platform_device *pdev)
577{ 564{
578 struct am35x_glue *glue = platform_get_drvdata(pdev); 565 struct am35x_glue *glue = platform_get_drvdata(pdev);
579 566
580 musb_put_id(&pdev->dev, glue->musb->id); 567 platform_device_unregister(glue->musb);
581 platform_device_del(glue->musb);
582 platform_device_put(glue->musb);
583 clk_disable(glue->clk); 568 clk_disable(glue->clk);
584 clk_disable(glue->phy_clk); 569 clk_disable(glue->phy_clk);
585 clk_put(glue->clk); 570 clk_put(glue->clk);
@@ -654,15 +639,4 @@ static struct platform_driver am35x_driver = {
654MODULE_DESCRIPTION("AM35x MUSB Glue Layer"); 639MODULE_DESCRIPTION("AM35x MUSB Glue Layer");
655MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>"); 640MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>");
656MODULE_LICENSE("GPL v2"); 641MODULE_LICENSE("GPL v2");
657 642module_platform_driver(am35x_driver);
658static int __init am35x_init(void)
659{
660 return platform_driver_register(&am35x_driver);
661}
662module_init(am35x_init);
663
664static void __exit am35x_exit(void)
665{
666 platform_driver_unregister(&am35x_driver);
667}
668module_exit(am35x_exit);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index e8cff9bb9d23..7e4d60a41728 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -455,7 +455,6 @@ static int __devinit bfin_probe(struct platform_device *pdev)
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
@@ -527,9 +514,7 @@ static int __devexit 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..3a6c2fd1f913 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -1314,6 +1314,7 @@ 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 *__devinit
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 8bc44b76eec2..67b8ae704e9a 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -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
@@ -572,9 +559,7 @@ static int __devexit 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);
@@ -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..b3c0a943950c 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -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
@@ -604,9 +591,7 @@ static int __devexit 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);
@@ -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..774d8154a286 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 */
@@ -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
@@ -1919,7 +1869,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1919 musb->ops = plat->platform_ops; 1869 musb->ops = plat->platform_ops;
1920 1870
1921 /* The musb_platform_init() call: 1871 /* The musb_platform_init() call:
1922 * - adjusts musb->mregs and musb->isr if needed, 1872 * - adjusts musb->mregs
1873 * - sets the musb->isr
1923 * - may initialize an integrated tranceiver 1874 * - may initialize an integrated tranceiver
1924 * - initializes musb->xceiv, usually by otg_get_phy() 1875 * - initializes musb->xceiv, usually by otg_get_phy()
1925 * - stops powering VBUS 1876 * - stops powering VBUS
@@ -1929,7 +1880,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1929 * external/discrete ones in various flavors (twl4030 family, 1880 * external/discrete ones in various flavors (twl4030 family,
1930 * isp1504, non-OTG, etc) mostly hooking up through ULPI. 1881 * isp1504, non-OTG, etc) mostly hooking up through ULPI.
1931 */ 1882 */
1932 musb->isr = generic_interrupt;
1933 status = musb_platform_init(musb); 1883 status = musb_platform_init(musb);
1934 if (status < 0) 1884 if (status < 0)
1935 goto fail1; 1885 goto fail1;
@@ -2120,8 +2070,6 @@ static void musb_save_context(struct musb *musb)
2120 musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE); 2070 musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE);
2121 musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs); 2071 musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs);
2122 musb->context.power = musb_readb(musb_base, MUSB_POWER); 2072 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); 2073 musb->context.intrusbe = musb_readb(musb_base, MUSB_INTRUSBE);
2126 musb->context.index = musb_readb(musb_base, MUSB_INDEX); 2074 musb->context.index = musb_readb(musb_base, MUSB_INDEX);
2127 musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); 2075 musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL);
@@ -2194,8 +2142,8 @@ static void musb_restore_context(struct musb *musb)
2194 musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); 2142 musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode);
2195 musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); 2143 musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl);
2196 musb_writeb(musb_base, MUSB_POWER, musb->context.power); 2144 musb_writeb(musb_base, MUSB_POWER, musb->context.power);
2197 musb_writew(musb_base, MUSB_INTRTXE, musb->context.intrtxe); 2145 musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
2198 musb_writew(musb_base, MUSB_INTRRXE, musb->context.intrrxe); 2146 musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
2199 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); 2147 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);
2200 musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); 2148 musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
2201 2149
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_dsps.c b/drivers/usb/musb/musb_dsps.c
index ff5f112053d2..cf08966af5c2 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -124,8 +124,44 @@ struct dsps_glue {
124 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ 124 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
125 struct timer_list timer[2]; /* otg_workaround timer */ 125 struct timer_list timer[2]; /* otg_workaround timer */
126 unsigned long last_timer[2]; /* last timer data for each instance */ 126 unsigned long last_timer[2]; /* last timer data for each instance */
127 u32 __iomem *usb_ctrl[2];
127}; 128};
128 129
130#define DSPS_AM33XX_CONTROL_MODULE_PHYS_0 0x44e10620
131#define DSPS_AM33XX_CONTROL_MODULE_PHYS_1 0x44e10628
132
133static const resource_size_t dsps_control_module_phys[] = {
134 DSPS_AM33XX_CONTROL_MODULE_PHYS_0,
135 DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
136};
137
138/**
139 * musb_dsps_phy_control - phy on/off
140 * @glue: struct dsps_glue *
141 * @id: musb instance
142 * @on: flag for phy to be switched on or off
143 *
144 * This is to enable the PHY using usb_ctrl register in system control
145 * module space.
146 *
147 * XXX: This function will be removed once we have a seperate driver for
148 * control module
149 */
150static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
151{
152 u32 usbphycfg;
153
154 usbphycfg = readl(glue->usb_ctrl[id]);
155
156 if (on) {
157 usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
158 usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
159 } else {
160 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
161 }
162
163 writel(usbphycfg, glue->usb_ctrl[id]);
164}
129/** 165/**
130 * dsps_musb_enable - enable interrupts 166 * dsps_musb_enable - enable interrupts
131 */ 167 */
@@ -365,11 +401,9 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
365static int dsps_musb_init(struct musb *musb) 401static int dsps_musb_init(struct musb *musb)
366{ 402{
367 struct device *dev = musb->controller; 403 struct device *dev = musb->controller;
368 struct musb_hdrc_platform_data *plat = dev->platform_data;
369 struct platform_device *pdev = to_platform_device(dev); 404 struct platform_device *pdev = to_platform_device(dev);
370 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 405 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
371 const struct dsps_musb_wrapper *wrp = glue->wrp; 406 const struct dsps_musb_wrapper *wrp = glue->wrp;
372 struct omap_musb_board_data *data = plat->board_data;
373 void __iomem *reg_base = musb->ctrl_base; 407 void __iomem *reg_base = musb->ctrl_base;
374 u32 rev, val; 408 u32 rev, val;
375 int status; 409 int status;
@@ -377,7 +411,8 @@ static int dsps_musb_init(struct musb *musb)
377 /* mentor core register starts at offset of 0x400 from musb base */ 411 /* mentor core register starts at offset of 0x400 from musb base */
378 musb->mregs += wrp->musb_core_offset; 412 musb->mregs += wrp->musb_core_offset;
379 413
380 /* Get the NOP PHY */ 414 /* NOP driver needs change if supporting dual instance */
415 usb_nop_xceiv_register();
381 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 416 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
382 if (IS_ERR_OR_NULL(musb->xceiv)) 417 if (IS_ERR_OR_NULL(musb->xceiv))
383 return -ENODEV; 418 return -ENODEV;
@@ -395,8 +430,7 @@ static int dsps_musb_init(struct musb *musb)
395 dsps_writel(reg_base, wrp->control, (1 << wrp->reset)); 430 dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
396 431
397 /* Start the on-chip PHY and its PLL. */ 432 /* Start the on-chip PHY and its PLL. */
398 if (data->set_phy_power) 433 musb_dsps_phy_control(glue, pdev->id, 1);
399 data->set_phy_power(1);
400 434
401 musb->isr = dsps_interrupt; 435 musb->isr = dsps_interrupt;
402 436
@@ -418,16 +452,13 @@ err0:
418static int dsps_musb_exit(struct musb *musb) 452static int dsps_musb_exit(struct musb *musb)
419{ 453{
420 struct device *dev = musb->controller; 454 struct device *dev = musb->controller;
421 struct musb_hdrc_platform_data *plat = dev->platform_data;
422 struct omap_musb_board_data *data = plat->board_data;
423 struct platform_device *pdev = to_platform_device(dev); 455 struct platform_device *pdev = to_platform_device(dev);
424 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 456 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
425 457
426 del_timer_sync(&glue->timer[pdev->id]); 458 del_timer_sync(&glue->timer[pdev->id]);
427 459
428 /* Shutdown the on-chip PHY and its PLL. */ 460 /* Shutdown the on-chip PHY and its PLL. */
429 if (data->set_phy_power) 461 musb_dsps_phy_control(glue, pdev->id, 0);
430 data->set_phy_power(0);
431 462
432 /* NOP driver needs change if supporting dual instance */ 463 /* NOP driver needs change if supporting dual instance */
433 usb_put_phy(musb->xceiv); 464 usb_put_phy(musb->xceiv);
@@ -459,24 +490,33 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
459 struct resource *res; 490 struct resource *res;
460 struct resource resources[2]; 491 struct resource resources[2];
461 char res_name[11]; 492 char res_name[11];
462 int ret, musbid; 493 int ret;
463 494
464 /* get memory resource */ 495 resources[0].start = dsps_control_module_phys[id];
465 snprintf(res_name, sizeof(res_name), "musb%d", id); 496 resources[0].end = resources[0].start + SZ_4 - 1;
466 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); 497 resources[0].flags = IORESOURCE_MEM;
498
499 glue->usb_ctrl[id] = devm_request_and_ioremap(&pdev->dev, resources);
500 if (glue->usb_ctrl[id] == NULL) {
501 dev_err(dev, "Failed to obtain usb_ctrl%d memory\n", id);
502 ret = -ENODEV;
503 goto err0;
504 }
505
506 /* first resource is for usbss, so start index from 1 */
507 res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1);
467 if (!res) { 508 if (!res) {
468 dev_err(dev, "%s get mem resource failed\n", res_name); 509 dev_err(dev, "failed to get memory for instance %d\n", id);
469 ret = -ENODEV; 510 ret = -ENODEV;
470 goto err0; 511 goto err0;
471 } 512 }
472 res->parent = NULL; 513 res->parent = NULL;
473 resources[0] = *res; 514 resources[0] = *res;
474 515
475 /* get irq resource */ 516 /* first resource is for usbss, so start index from 1 */
476 snprintf(res_name, sizeof(res_name), "musb%d-irq", id); 517 res = platform_get_resource(pdev, IORESOURCE_IRQ, id + 1);
477 res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
478 if (!res) { 518 if (!res) {
479 dev_err(dev, "%s get irq resource failed\n", res_name); 519 dev_err(dev, "failed to get irq for instance %d\n", id);
480 ret = -ENODEV; 520 ret = -ENODEV;
481 goto err0; 521 goto err0;
482 } 522 }
@@ -484,22 +524,14 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
484 resources[1] = *res; 524 resources[1] = *res;
485 resources[1].name = "mc"; 525 resources[1].name = "mc";
486 526
487 /* get the musb id */
488 musbid = musb_get_id(dev, GFP_KERNEL);
489 if (musbid < 0) {
490 dev_err(dev, "failed to allocate musb id\n");
491 ret = -ENOMEM;
492 goto err0;
493 }
494 /* allocate the child platform device */ 527 /* allocate the child platform device */
495 musb = platform_device_alloc("musb-hdrc", musbid); 528 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
496 if (!musb) { 529 if (!musb) {
497 dev_err(dev, "failed to allocate musb device\n"); 530 dev_err(dev, "failed to allocate musb device\n");
498 ret = -ENOMEM; 531 ret = -ENOMEM;
499 goto err1; 532 goto err0;
500 } 533 }
501 534
502 musb->id = musbid;
503 musb->dev.parent = dev; 535 musb->dev.parent = dev;
504 musb->dev.dma_mask = &musb_dmamask; 536 musb->dev.dma_mask = &musb_dmamask;
505 musb->dev.coherent_dma_mask = musb_dmamask; 537 musb->dev.coherent_dma_mask = musb_dmamask;
@@ -556,19 +588,10 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
556 588
557err2: 589err2:
558 platform_device_put(musb); 590 platform_device_put(musb);
559err1:
560 musb_put_id(dev, musbid);
561err0: 591err0:
562 return ret; 592 return ret;
563} 593}
564 594
565static void dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id)
566{
567 musb_put_id(glue->dev, glue->musb[id]->id);
568 platform_device_del(glue->musb[id]);
569 platform_device_put(glue->musb[id]);
570}
571
572static int __devinit dsps_probe(struct platform_device *pdev) 595static int __devinit dsps_probe(struct platform_device *pdev)
573{ 596{
574 struct device_node *np = pdev->dev.of_node; 597 struct device_node *np = pdev->dev.of_node;
@@ -628,7 +651,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
628 dev_err(&pdev->dev, "failed to create child pdev\n"); 651 dev_err(&pdev->dev, "failed to create child pdev\n");
629 /* release resources of previously created instances */ 652 /* release resources of previously created instances */
630 for (i--; i >= 0 ; i--) 653 for (i--; i >= 0 ; i--)
631 dsps_delete_musb_pdev(glue, i); 654 platform_device_unregister(glue->musb[i]);
632 goto err3; 655 goto err3;
633 } 656 }
634 } 657 }
@@ -653,7 +676,7 @@ static int __devexit dsps_remove(struct platform_device *pdev)
653 676
654 /* delete the child platform device */ 677 /* delete the child platform device */
655 for (i = 0; i < wrp->instances ; i++) 678 for (i = 0; i < wrp->instances ; i++)
656 dsps_delete_musb_pdev(glue, i); 679 platform_device_unregister(glue->musb[i]);
657 680
658 /* disable usbss clocks */ 681 /* disable usbss clocks */
659 pm_runtime_put(&pdev->dev); 682 pm_runtime_put(&pdev->dev);
@@ -666,24 +689,26 @@ static int __devexit dsps_remove(struct platform_device *pdev)
666#ifdef CONFIG_PM_SLEEP 689#ifdef CONFIG_PM_SLEEP
667static int dsps_suspend(struct device *dev) 690static int dsps_suspend(struct device *dev)
668{ 691{
669 struct musb_hdrc_platform_data *plat = dev->platform_data; 692 struct platform_device *pdev = to_platform_device(dev->parent);
670 struct omap_musb_board_data *data = plat->board_data; 693 struct dsps_glue *glue = platform_get_drvdata(pdev);
694 const struct dsps_musb_wrapper *wrp = glue->wrp;
695 int i;
671 696
672 /* Shutdown the on-chip PHY and its PLL. */ 697 for (i = 0; i < wrp->instances; i++)
673 if (data->set_phy_power) 698 musb_dsps_phy_control(glue, i, 0);
674 data->set_phy_power(0);
675 699
676 return 0; 700 return 0;
677} 701}
678 702
679static int dsps_resume(struct device *dev) 703static int dsps_resume(struct device *dev)
680{ 704{
681 struct musb_hdrc_platform_data *plat = dev->platform_data; 705 struct platform_device *pdev = to_platform_device(dev->parent);
682 struct omap_musb_board_data *data = plat->board_data; 706 struct dsps_glue *glue = platform_get_drvdata(pdev);
707 const struct dsps_musb_wrapper *wrp = glue->wrp;
708 int i;
683 709
684 /* Start the on-chip PHY and its PLL. */ 710 for (i = 0; i < wrp->instances; i++)
685 if (data->set_phy_power) 711 musb_dsps_phy_control(glue, i, 1);
686 data->set_phy_power(1);
687 712
688 return 0; 713 return 0;
689} 714}
@@ -719,7 +744,7 @@ static const struct dsps_musb_wrapper ti81xx_driver_data __devinitconst = {
719 .rxep_bitmap = (0xfffe << 16), 744 .rxep_bitmap = (0xfffe << 16),
720 .musb_core_offset = 0x400, 745 .musb_core_offset = 0x400,
721 .poll_seconds = 2, 746 .poll_seconds = 2,
722 .instances = 2, 747 .instances = 1,
723}; 748};
724 749
725static const struct platform_device_id musb_dsps_id_table[] __devinitconst = { 750static const struct platform_device_id musb_dsps_id_table[] __devinitconst = {
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d0b87e7b4abf..28b9790e84ea 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1068,7 +1068,6 @@ static int musb_gadget_enable(struct usb_ep *ep,
1068 */ 1068 */
1069 musb_ep_select(mbase, epnum); 1069 musb_ep_select(mbase, epnum);
1070 if (usb_endpoint_dir_in(desc)) { 1070 if (usb_endpoint_dir_in(desc)) {
1071 u16 int_txe = musb_readw(mbase, MUSB_INTRTXE);
1072 1071
1073 if (hw_ep->is_shared_fifo) 1072 if (hw_ep->is_shared_fifo)
1074 musb_ep->is_in = 1; 1073 musb_ep->is_in = 1;
@@ -1080,8 +1079,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
1080 goto fail; 1079 goto fail;
1081 } 1080 }
1082 1081
1083 int_txe |= (1 << epnum); 1082 musb->intrtxe |= (1 << epnum);
1084 musb_writew(mbase, MUSB_INTRTXE, int_txe); 1083 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe);
1085 1084
1086 /* REVISIT if can_bulk_split(), use by updating "tmp"; 1085 /* REVISIT if can_bulk_split(), use by updating "tmp";
1087 * likewise high bandwidth periodic tx 1086 * likewise high bandwidth periodic tx
@@ -1108,7 +1107,6 @@ static int musb_gadget_enable(struct usb_ep *ep,
1108 musb_writew(regs, MUSB_TXCSR, csr); 1107 musb_writew(regs, MUSB_TXCSR, csr);
1109 1108
1110 } else { 1109 } else {
1111 u16 int_rxe = musb_readw(mbase, MUSB_INTRRXE);
1112 1110
1113 if (hw_ep->is_shared_fifo) 1111 if (hw_ep->is_shared_fifo)
1114 musb_ep->is_in = 0; 1112 musb_ep->is_in = 0;
@@ -1120,8 +1118,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
1120 goto fail; 1118 goto fail;
1121 } 1119 }
1122 1120
1123 int_rxe |= (1 << epnum); 1121 musb->intrrxe |= (1 << epnum);
1124 musb_writew(mbase, MUSB_INTRRXE, int_rxe); 1122 musb_writew(mbase, MUSB_INTRRXE, musb->intrrxe);
1125 1123
1126 /* REVISIT if can_bulk_combine() use by updating "tmp" 1124 /* REVISIT if can_bulk_combine() use by updating "tmp"
1127 * likewise high bandwidth periodic rx 1125 * likewise high bandwidth periodic rx
@@ -1209,14 +1207,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
1209 1207
1210 /* zero the endpoint sizes */ 1208 /* zero the endpoint sizes */
1211 if (musb_ep->is_in) { 1209 if (musb_ep->is_in) {
1212 u16 int_txe = musb_readw(musb->mregs, MUSB_INTRTXE); 1210 musb->intrtxe &= ~(1 << epnum);
1213 int_txe &= ~(1 << epnum); 1211 musb_writew(musb->mregs, MUSB_INTRTXE, musb->intrtxe);
1214 musb_writew(musb->mregs, MUSB_INTRTXE, int_txe);
1215 musb_writew(epio, MUSB_TXMAXP, 0); 1212 musb_writew(epio, MUSB_TXMAXP, 0);
1216 } else { 1213 } else {
1217 u16 int_rxe = musb_readw(musb->mregs, MUSB_INTRRXE); 1214 musb->intrrxe &= ~(1 << epnum);
1218 int_rxe &= ~(1 << epnum); 1215 musb_writew(musb->mregs, MUSB_INTRRXE, musb->intrrxe);
1219 musb_writew(musb->mregs, MUSB_INTRRXE, int_rxe);
1220 musb_writew(epio, MUSB_RXMAXP, 0); 1216 musb_writew(epio, MUSB_RXMAXP, 0);
1221 } 1217 }
1222 1218
@@ -1532,7 +1528,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1532 void __iomem *epio = musb->endpoints[epnum].regs; 1528 void __iomem *epio = musb->endpoints[epnum].regs;
1533 void __iomem *mbase; 1529 void __iomem *mbase;
1534 unsigned long flags; 1530 unsigned long flags;
1535 u16 csr, int_txe; 1531 u16 csr;
1536 1532
1537 mbase = musb->mregs; 1533 mbase = musb->mregs;
1538 1534
@@ -1540,8 +1536,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1540 musb_ep_select(mbase, (u8) epnum); 1536 musb_ep_select(mbase, (u8) epnum);
1541 1537
1542 /* disable interrupts */ 1538 /* disable interrupts */
1543 int_txe = musb_readw(mbase, MUSB_INTRTXE); 1539 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe & ~(1 << epnum));
1544 musb_writew(mbase, MUSB_INTRTXE, int_txe & ~(1 << epnum));
1545 1540
1546 if (musb_ep->is_in) { 1541 if (musb_ep->is_in) {
1547 csr = musb_readw(epio, MUSB_TXCSR); 1542 csr = musb_readw(epio, MUSB_TXCSR);
@@ -1565,7 +1560,7 @@ static void musb_gadget_fifo_flush(struct usb_ep *ep)
1565 } 1560 }
1566 1561
1567 /* re-enable interrupt */ 1562 /* re-enable interrupt */
1568 musb_writew(mbase, MUSB_INTRTXE, int_txe); 1563 musb_writew(mbase, MUSB_INTRTXE, musb->intrtxe);
1569 spin_unlock_irqrestore(&musb->lock, flags); 1564 spin_unlock_irqrestore(&musb->lock, flags);
1570} 1565}
1571 1566
@@ -2154,10 +2149,9 @@ __acquires(musb->lock)
2154 u8 devctl = musb_readb(mbase, MUSB_DEVCTL); 2149 u8 devctl = musb_readb(mbase, MUSB_DEVCTL);
2155 u8 power; 2150 u8 power;
2156 2151
2157 dev_dbg(musb->controller, "<== %s addr=%x driver '%s'\n", 2152 dev_dbg(musb->controller, "<== %s driver '%s'\n",
2158 (devctl & MUSB_DEVCTL_BDEVICE) 2153 (devctl & MUSB_DEVCTL_BDEVICE)
2159 ? "B-Device" : "A-Device", 2154 ? "B-Device" : "A-Device",
2160 musb_readb(mbase, MUSB_FADDR),
2161 musb->gadget_driver 2155 musb->gadget_driver
2162 ? musb->gadget_driver->driver.name 2156 ? musb->gadget_driver->driver.name
2163 : NULL 2157 : 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.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..32f531e7a2e6 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);
@@ -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,9 +601,6 @@ 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}
@@ -601,7 +610,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
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;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index dc4d75ea13ad..812719b683d1 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1160,7 +1160,6 @@ static int __devinit tusb_probe(struct platform_device *pdev)
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
@@ -1232,9 +1219,7 @@ static int __devexit 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;
@@ -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/ux500.c b/drivers/usb/musb/ux500.c
index d62a91fedc22..286f1be6594a 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
@@ -65,7 +87,6 @@ static int __devinit ux500_probe(struct platform_device *pdev)
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
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
@@ -158,9 +167,7 @@ static int __devexit 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);
@@ -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);