diff options
-rw-r--r-- | drivers/usb/musb/omap2430.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 70f2b8a2e6cf..1bd9232ff76f 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -391,9 +391,20 @@ static int omap2430_musb_init(struct musb *musb) | |||
391 | } | 391 | } |
392 | musb->isr = omap2430_musb_interrupt; | 392 | musb->isr = omap2430_musb_interrupt; |
393 | 393 | ||
394 | /* | ||
395 | * Enable runtime PM for musb parent (this driver). We can't | ||
396 | * do it earlier as struct musb is not yet allocated and we | ||
397 | * need to touch the musb registers for runtime PM. | ||
398 | */ | ||
399 | pm_runtime_enable(glue->dev); | ||
400 | status = pm_runtime_get_sync(glue->dev); | ||
401 | if (status < 0) | ||
402 | goto err1; | ||
403 | |||
394 | status = pm_runtime_get_sync(dev); | 404 | status = pm_runtime_get_sync(dev); |
395 | if (status < 0) { | 405 | if (status < 0) { |
396 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); | 406 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); |
407 | pm_runtime_put_sync(glue->dev); | ||
397 | goto err1; | 408 | goto err1; |
398 | } | 409 | } |
399 | 410 | ||
@@ -426,6 +437,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
426 | phy_power_on(musb->phy); | 437 | phy_power_on(musb->phy); |
427 | 438 | ||
428 | pm_runtime_put_noidle(musb->controller); | 439 | pm_runtime_put_noidle(musb->controller); |
440 | pm_runtime_put_noidle(glue->dev); | ||
429 | return 0; | 441 | return 0; |
430 | 442 | ||
431 | err1: | 443 | err1: |
@@ -626,7 +638,11 @@ static int omap2430_probe(struct platform_device *pdev) | |||
626 | goto err2; | 638 | goto err2; |
627 | } | 639 | } |
628 | 640 | ||
629 | pm_runtime_enable(&pdev->dev); | 641 | /* |
642 | * Note that we cannot enable PM runtime yet for this | ||
643 | * driver as we need struct musb initialized first. | ||
644 | * See omap2430_musb_init above. | ||
645 | */ | ||
630 | 646 | ||
631 | ret = platform_device_add(musb); | 647 | ret = platform_device_add(musb); |
632 | if (ret) { | 648 | if (ret) { |
@@ -675,11 +691,12 @@ static int omap2430_runtime_resume(struct device *dev) | |||
675 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 691 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
676 | struct musb *musb = glue_to_musb(glue); | 692 | struct musb *musb = glue_to_musb(glue); |
677 | 693 | ||
678 | if (musb) { | 694 | if (!musb) |
679 | omap2430_low_level_init(musb); | 695 | return -EPROBE_DEFER; |
680 | musb_writel(musb->mregs, OTG_INTERFSEL, | 696 | |
681 | musb->context.otg_interfsel); | 697 | omap2430_low_level_init(musb); |
682 | } | 698 | musb_writel(musb->mregs, OTG_INTERFSEL, |
699 | musb->context.otg_interfsel); | ||
683 | 700 | ||
684 | return 0; | 701 | return 0; |
685 | } | 702 | } |