diff options
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/am35x.c | 50 | ||||
-rw-r--r-- | drivers/usb/musb/da8xx.c | 49 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 48 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 49 |
4 files changed, 68 insertions, 128 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 5c310c664218..790b22b296b1 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -89,7 +89,6 @@ struct am35x_glue { | |||
89 | struct clk *phy_clk; | 89 | struct clk *phy_clk; |
90 | struct clk *clk; | 90 | struct clk *clk; |
91 | }; | 91 | }; |
92 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | ||
93 | 92 | ||
94 | /* | 93 | /* |
95 | * am35x_musb_enable - enable interrupts | 94 | * am35x_musb_enable - enable interrupts |
@@ -452,14 +451,18 @@ static const struct musb_platform_ops am35x_ops = { | |||
452 | .set_vbus = am35x_musb_set_vbus, | 451 | .set_vbus = am35x_musb_set_vbus, |
453 | }; | 452 | }; |
454 | 453 | ||
455 | static u64 am35x_dmamask = DMA_BIT_MASK(32); | 454 | static const struct platform_device_info am35x_dev_info = { |
455 | .name = "musb-hdrc", | ||
456 | .id = PLATFORM_DEVID_AUTO, | ||
457 | .dma_mask = DMA_BIT_MASK(32), | ||
458 | }; | ||
456 | 459 | ||
457 | static int am35x_probe(struct platform_device *pdev) | 460 | static int am35x_probe(struct platform_device *pdev) |
458 | { | 461 | { |
459 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); | 462 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); |
460 | struct platform_device *musb; | 463 | struct platform_device *musb; |
461 | struct am35x_glue *glue; | 464 | struct am35x_glue *glue; |
462 | 465 | struct platform_device_info pinfo; | |
463 | struct clk *phy_clk; | 466 | struct clk *phy_clk; |
464 | struct clk *clk; | 467 | struct clk *clk; |
465 | 468 | ||
@@ -471,12 +474,6 @@ static int am35x_probe(struct platform_device *pdev) | |||
471 | goto err0; | 474 | goto err0; |
472 | } | 475 | } |
473 | 476 | ||
474 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
475 | if (!musb) { | ||
476 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
477 | goto err1; | ||
478 | } | ||
479 | |||
480 | phy_clk = clk_get(&pdev->dev, "fck"); | 477 | phy_clk = clk_get(&pdev->dev, "fck"); |
481 | if (IS_ERR(phy_clk)) { | 478 | if (IS_ERR(phy_clk)) { |
482 | dev_err(&pdev->dev, "failed to get PHY clock\n"); | 479 | dev_err(&pdev->dev, "failed to get PHY clock\n"); |
@@ -503,12 +500,7 @@ static int am35x_probe(struct platform_device *pdev) | |||
503 | goto err6; | 500 | goto err6; |
504 | } | 501 | } |
505 | 502 | ||
506 | musb->dev.parent = &pdev->dev; | ||
507 | musb->dev.dma_mask = &am35x_dmamask; | ||
508 | musb->dev.coherent_dma_mask = am35x_dmamask; | ||
509 | |||
510 | glue->dev = &pdev->dev; | 503 | glue->dev = &pdev->dev; |
511 | glue->musb = musb; | ||
512 | glue->phy_clk = phy_clk; | 504 | glue->phy_clk = phy_clk; |
513 | glue->clk = clk; | 505 | glue->clk = clk; |
514 | 506 | ||
@@ -516,22 +508,17 @@ static int am35x_probe(struct platform_device *pdev) | |||
516 | 508 | ||
517 | platform_set_drvdata(pdev, glue); | 509 | platform_set_drvdata(pdev, glue); |
518 | 510 | ||
519 | ret = platform_device_add_resources(musb, pdev->resource, | 511 | pinfo = am35x_dev_info; |
520 | pdev->num_resources); | 512 | pinfo.parent = &pdev->dev; |
521 | if (ret) { | 513 | pinfo.res = pdev->resource; |
522 | dev_err(&pdev->dev, "failed to add resources\n"); | 514 | pinfo.num_res = pdev->num_resources; |
523 | goto err7; | 515 | pinfo.data = pdata; |
524 | } | 516 | pinfo.size_data = sizeof(*pdata); |
525 | 517 | ||
526 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | 518 | glue->musb = musb = platform_device_register_full(&pinfo); |
527 | if (ret) { | 519 | if (IS_ERR(musb)) { |
528 | dev_err(&pdev->dev, "failed to add platform_data\n"); | 520 | ret = PTR_ERR(musb); |
529 | goto err7; | 521 | dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); |
530 | } | ||
531 | |||
532 | ret = platform_device_add(musb); | ||
533 | if (ret) { | ||
534 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
535 | goto err7; | 522 | goto err7; |
536 | } | 523 | } |
537 | 524 | ||
@@ -550,9 +537,6 @@ err4: | |||
550 | clk_put(phy_clk); | 537 | clk_put(phy_clk); |
551 | 538 | ||
552 | err3: | 539 | err3: |
553 | platform_device_put(musb); | ||
554 | |||
555 | err1: | ||
556 | kfree(glue); | 540 | kfree(glue); |
557 | 541 | ||
558 | err0: | 542 | err0: |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index d9ddf4122f37..2f2c1cb36421 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -472,7 +472,11 @@ static const struct musb_platform_ops da8xx_ops = { | |||
472 | .set_vbus = da8xx_musb_set_vbus, | 472 | .set_vbus = da8xx_musb_set_vbus, |
473 | }; | 473 | }; |
474 | 474 | ||
475 | static u64 da8xx_dmamask = DMA_BIT_MASK(32); | 475 | static const struct platform_device_info da8xx_dev_info = { |
476 | .name = "musb-hdrc", | ||
477 | .id = PLATFORM_DEVID_AUTO, | ||
478 | .dma_mask = DMA_BIT_MASK(32), | ||
479 | }; | ||
476 | 480 | ||
477 | static int da8xx_probe(struct platform_device *pdev) | 481 | static int da8xx_probe(struct platform_device *pdev) |
478 | { | 482 | { |
@@ -480,7 +484,7 @@ static int da8xx_probe(struct platform_device *pdev) | |||
480 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); | 484 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); |
481 | struct platform_device *musb; | 485 | struct platform_device *musb; |
482 | struct da8xx_glue *glue; | 486 | struct da8xx_glue *glue; |
483 | 487 | struct platform_device_info pinfo; | |
484 | struct clk *clk; | 488 | struct clk *clk; |
485 | 489 | ||
486 | int ret = -ENOMEM; | 490 | int ret = -ENOMEM; |
@@ -491,12 +495,6 @@ static int da8xx_probe(struct platform_device *pdev) | |||
491 | goto err0; | 495 | goto err0; |
492 | } | 496 | } |
493 | 497 | ||
494 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
495 | if (!musb) { | ||
496 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
497 | goto err1; | ||
498 | } | ||
499 | |||
500 | clk = clk_get(&pdev->dev, "usb20"); | 498 | clk = clk_get(&pdev->dev, "usb20"); |
501 | if (IS_ERR(clk)) { | 499 | if (IS_ERR(clk)) { |
502 | dev_err(&pdev->dev, "failed to get clock\n"); | 500 | dev_err(&pdev->dev, "failed to get clock\n"); |
@@ -510,12 +508,7 @@ static int da8xx_probe(struct platform_device *pdev) | |||
510 | goto err4; | 508 | goto err4; |
511 | } | 509 | } |
512 | 510 | ||
513 | musb->dev.parent = &pdev->dev; | ||
514 | musb->dev.dma_mask = &da8xx_dmamask; | ||
515 | musb->dev.coherent_dma_mask = da8xx_dmamask; | ||
516 | |||
517 | glue->dev = &pdev->dev; | 511 | glue->dev = &pdev->dev; |
518 | glue->musb = musb; | ||
519 | glue->clk = clk; | 512 | glue->clk = clk; |
520 | 513 | ||
521 | pdata->platform_ops = &da8xx_ops; | 514 | pdata->platform_ops = &da8xx_ops; |
@@ -535,22 +528,17 @@ static int da8xx_probe(struct platform_device *pdev) | |||
535 | musb_resources[1].end = pdev->resource[1].end; | 528 | musb_resources[1].end = pdev->resource[1].end; |
536 | musb_resources[1].flags = pdev->resource[1].flags; | 529 | musb_resources[1].flags = pdev->resource[1].flags; |
537 | 530 | ||
538 | ret = platform_device_add_resources(musb, musb_resources, | 531 | pinfo = da8xx_dev_info; |
539 | ARRAY_SIZE(musb_resources)); | 532 | pinfo.parent = &pdev->dev; |
540 | if (ret) { | 533 | pinfo.res = musb_resources; |
541 | dev_err(&pdev->dev, "failed to add resources\n"); | 534 | pinfo.num_res = ARRAY_SIZE(musb_resources); |
542 | goto err5; | 535 | pinfo.data = pdata; |
543 | } | 536 | pinfo.size_data = sizeof(*pdata); |
544 | 537 | ||
545 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | 538 | glue->musb = musb = platform_device_register_full(&pinfo); |
546 | if (ret) { | 539 | if (IS_ERR(musb)) { |
547 | dev_err(&pdev->dev, "failed to add platform_data\n"); | 540 | ret = PTR_ERR(musb); |
548 | goto err5; | 541 | dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); |
549 | } | ||
550 | |||
551 | ret = platform_device_add(musb); | ||
552 | if (ret) { | ||
553 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
554 | goto err5; | 542 | goto err5; |
555 | } | 543 | } |
556 | 544 | ||
@@ -563,9 +551,6 @@ err4: | |||
563 | clk_put(clk); | 551 | clk_put(clk); |
564 | 552 | ||
565 | err3: | 553 | err3: |
566 | platform_device_put(musb); | ||
567 | |||
568 | err1: | ||
569 | kfree(glue); | 554 | kfree(glue); |
570 | 555 | ||
571 | err0: | 556 | err0: |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index ed0834e2b72e..45aae0bbb8df 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -505,7 +505,11 @@ static const struct musb_platform_ops davinci_ops = { | |||
505 | .set_vbus = davinci_musb_set_vbus, | 505 | .set_vbus = davinci_musb_set_vbus, |
506 | }; | 506 | }; |
507 | 507 | ||
508 | static u64 davinci_dmamask = DMA_BIT_MASK(32); | 508 | static const struct platform_device_info davinci_dev_info = { |
509 | .name = "musb-hdrc", | ||
510 | .id = PLATFORM_DEVID_AUTO, | ||
511 | .dma_mask = DMA_BIT_MASK(32), | ||
512 | }; | ||
509 | 513 | ||
510 | static int davinci_probe(struct platform_device *pdev) | 514 | static int davinci_probe(struct platform_device *pdev) |
511 | { | 515 | { |
@@ -513,6 +517,7 @@ static int davinci_probe(struct platform_device *pdev) | |||
513 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); | 517 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); |
514 | struct platform_device *musb; | 518 | struct platform_device *musb; |
515 | struct davinci_glue *glue; | 519 | struct davinci_glue *glue; |
520 | struct platform_device_info pinfo; | ||
516 | struct clk *clk; | 521 | struct clk *clk; |
517 | 522 | ||
518 | int ret = -ENOMEM; | 523 | int ret = -ENOMEM; |
@@ -523,12 +528,6 @@ static int davinci_probe(struct platform_device *pdev) | |||
523 | goto err0; | 528 | goto err0; |
524 | } | 529 | } |
525 | 530 | ||
526 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
527 | if (!musb) { | ||
528 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
529 | goto err1; | ||
530 | } | ||
531 | |||
532 | clk = clk_get(&pdev->dev, "usb"); | 531 | clk = clk_get(&pdev->dev, "usb"); |
533 | if (IS_ERR(clk)) { | 532 | if (IS_ERR(clk)) { |
534 | dev_err(&pdev->dev, "failed to get clock\n"); | 533 | dev_err(&pdev->dev, "failed to get clock\n"); |
@@ -542,12 +541,7 @@ static int davinci_probe(struct platform_device *pdev) | |||
542 | goto err4; | 541 | goto err4; |
543 | } | 542 | } |
544 | 543 | ||
545 | musb->dev.parent = &pdev->dev; | ||
546 | musb->dev.dma_mask = &davinci_dmamask; | ||
547 | musb->dev.coherent_dma_mask = davinci_dmamask; | ||
548 | |||
549 | glue->dev = &pdev->dev; | 544 | glue->dev = &pdev->dev; |
550 | glue->musb = musb; | ||
551 | glue->clk = clk; | 545 | glue->clk = clk; |
552 | 546 | ||
553 | pdata->platform_ops = &davinci_ops; | 547 | pdata->platform_ops = &davinci_ops; |
@@ -567,22 +561,17 @@ static int davinci_probe(struct platform_device *pdev) | |||
567 | musb_resources[1].end = pdev->resource[1].end; | 561 | musb_resources[1].end = pdev->resource[1].end; |
568 | musb_resources[1].flags = pdev->resource[1].flags; | 562 | musb_resources[1].flags = pdev->resource[1].flags; |
569 | 563 | ||
570 | ret = platform_device_add_resources(musb, musb_resources, | 564 | pinfo = davinci_dev_info; |
571 | ARRAY_SIZE(musb_resources)); | 565 | pinfo.parent = &pdev->dev; |
572 | if (ret) { | 566 | pinfo.res = musb_resources; |
573 | dev_err(&pdev->dev, "failed to add resources\n"); | 567 | pinfo.num_res = ARRAY_SIZE(musb_resources); |
574 | goto err5; | 568 | pinfo.data = pdata; |
575 | } | 569 | pinfo.size_data = sizeof(*pdata); |
576 | 570 | ||
577 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | 571 | glue->musb = musb = platform_device_register_full(&pinfo); |
578 | if (ret) { | 572 | if (IS_ERR(musb)) { |
579 | dev_err(&pdev->dev, "failed to add platform_data\n"); | 573 | ret = PTR_ERR(musb); |
580 | goto err5; | 574 | dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); |
581 | } | ||
582 | |||
583 | ret = platform_device_add(musb); | ||
584 | if (ret) { | ||
585 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
586 | goto err5; | 575 | goto err5; |
587 | } | 576 | } |
588 | 577 | ||
@@ -595,9 +584,6 @@ err4: | |||
595 | clk_put(clk); | 584 | clk_put(clk); |
596 | 585 | ||
597 | err3: | 586 | err3: |
598 | platform_device_put(musb); | ||
599 | |||
600 | err1: | ||
601 | kfree(glue); | 587 | kfree(glue); |
602 | 588 | ||
603 | err0: | 589 | err0: |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index b3b3ed723882..4432314d70ee 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1152,7 +1152,11 @@ static const struct musb_platform_ops tusb_ops = { | |||
1152 | .set_vbus = tusb_musb_set_vbus, | 1152 | .set_vbus = tusb_musb_set_vbus, |
1153 | }; | 1153 | }; |
1154 | 1154 | ||
1155 | static u64 tusb_dmamask = DMA_BIT_MASK(32); | 1155 | static const struct platform_device_info tusb_dev_info = { |
1156 | .name = "musb-hdrc", | ||
1157 | .id = PLATFORM_DEVID_AUTO, | ||
1158 | .dma_mask = DMA_BIT_MASK(32), | ||
1159 | }; | ||
1156 | 1160 | ||
1157 | static int tusb_probe(struct platform_device *pdev) | 1161 | static int tusb_probe(struct platform_device *pdev) |
1158 | { | 1162 | { |
@@ -1160,7 +1164,7 @@ static int tusb_probe(struct platform_device *pdev) | |||
1160 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); | 1164 | struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); |
1161 | struct platform_device *musb; | 1165 | struct platform_device *musb; |
1162 | struct tusb6010_glue *glue; | 1166 | struct tusb6010_glue *glue; |
1163 | 1167 | struct platform_device_info pinfo; | |
1164 | int ret = -ENOMEM; | 1168 | int ret = -ENOMEM; |
1165 | 1169 | ||
1166 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 1170 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
@@ -1169,18 +1173,7 @@ static int tusb_probe(struct platform_device *pdev) | |||
1169 | goto err0; | 1173 | goto err0; |
1170 | } | 1174 | } |
1171 | 1175 | ||
1172 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
1173 | if (!musb) { | ||
1174 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
1175 | goto err1; | ||
1176 | } | ||
1177 | |||
1178 | musb->dev.parent = &pdev->dev; | ||
1179 | musb->dev.dma_mask = &tusb_dmamask; | ||
1180 | musb->dev.coherent_dma_mask = tusb_dmamask; | ||
1181 | |||
1182 | glue->dev = &pdev->dev; | 1176 | glue->dev = &pdev->dev; |
1183 | glue->musb = musb; | ||
1184 | 1177 | ||
1185 | pdata->platform_ops = &tusb_ops; | 1178 | pdata->platform_ops = &tusb_ops; |
1186 | 1179 | ||
@@ -1204,31 +1197,23 @@ static int tusb_probe(struct platform_device *pdev) | |||
1204 | musb_resources[2].end = pdev->resource[2].end; | 1197 | musb_resources[2].end = pdev->resource[2].end; |
1205 | musb_resources[2].flags = pdev->resource[2].flags; | 1198 | musb_resources[2].flags = pdev->resource[2].flags; |
1206 | 1199 | ||
1207 | ret = platform_device_add_resources(musb, musb_resources, | 1200 | pinfo = tusb_dev_info; |
1208 | ARRAY_SIZE(musb_resources)); | 1201 | pinfo.parent = &pdev->dev; |
1209 | if (ret) { | 1202 | pinfo.res = musb_resources; |
1210 | dev_err(&pdev->dev, "failed to add resources\n"); | 1203 | pinfo.num_res = ARRAY_SIZE(musb_resources); |
1211 | goto err3; | 1204 | pinfo.data = pdata; |
1212 | } | 1205 | pinfo.size_data = sizeof(*pdata); |
1213 | 1206 | ||
1214 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | 1207 | glue->musb = musb = platform_device_register_full(&pinfo); |
1215 | if (ret) { | 1208 | if (IS_ERR(musb)) { |
1216 | dev_err(&pdev->dev, "failed to add platform_data\n"); | 1209 | ret = PTR_ERR(musb); |
1217 | goto err3; | 1210 | dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); |
1218 | } | ||
1219 | |||
1220 | ret = platform_device_add(musb); | ||
1221 | if (ret) { | ||
1222 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
1223 | goto err3; | 1211 | goto err3; |
1224 | } | 1212 | } |
1225 | 1213 | ||
1226 | return 0; | 1214 | return 0; |
1227 | 1215 | ||
1228 | err3: | 1216 | err3: |
1229 | platform_device_put(musb); | ||
1230 | |||
1231 | err1: | ||
1232 | kfree(glue); | 1217 | kfree(glue); |
1233 | 1218 | ||
1234 | err0: | 1219 | err0: |