diff options
Diffstat (limited to 'drivers/usb/musb/da8xx.c')
-rw-r--r-- | drivers/usb/musb/da8xx.c | 49 |
1 files changed, 17 insertions, 32 deletions
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: |