Skip to contentSkip to conversation

sdhci-pxav3: Fix runtime PM initialization

PATCH In review Daniel Drake 2 participants 2 messages Jun 10, 2013 – Jun 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdhci-pxav3: Fix runtime PM initialization

Commit bb691ae464b77d30e74c66480e98d74e88d6b194 breaks boot on OLPC XO-4, it hangs somewhere inside sdhci_add_host.

When pm_runtime_set_autosuspend_delay() was being called, the device's usage counter was 0, causing the PM layer to runtime-suspend the device. We then went on to call sdhci_add_host() on a suspended device, which hung.

Fix this by making the driver consistent with the omap_hsmmc driver, both in terms of runtime PM initialization and error handling. Now the device is not runtime-suspended until we exit the probe routine.

---
 drivers/mmc/host/sdhci-pxav3.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-pxav3.c +4 -4
index a0cdbc5..86d8ac8 100644
@@ -300,18 +300,15 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 
 	sdhci_get_of_property(pdev);
 
-	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS);
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_suspend_ignore_children(&pdev->dev, 1);
-	pm_runtime_get_noresume(&pdev->dev);
 
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add host\n");
-		pm_runtime_forbid(&pdev->dev);
-		pm_runtime_disable(&pdev->dev);
 		goto err_add_host;
 	}
 
@@ -324,11 +321,14 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 		device_init_wakeup(&pdev->dev, 0);
 	}
 
+	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_put_autosuspend(&pdev->dev);
 
 	return 0;
 
 err_add_host:
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	clk_disable_unprepare(clk);
 	clk_put(clk);
 err_cd_req:
Signature · 1 line
1.8.1.4
#1 lore raw

Hi Daniel,

Quoted 7 lines · Daniel Drake

Commit bb691ae464b77d30e74c66480e98d74e88d6b194 breaks boot on OLPC XO-4, it hangs somewhere inside sdhci_add_host.

When pm_runtime_set_autosuspend_delay() was being called, the device's usage counter was 0, causing the PM layer to runtime-suspend the device. We then went on to call sdhci_add_host() on a suspended device, which hung.

Quoted 5 lines

Fix this by making the driver consistent with the omap_hsmmc driver, both in terms of runtime PM initialization and error handling. Now the device is not runtime-suspended until we exit the probe routine.

Thanks for the fix, pushed to mmc-next for 3.11.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child