[PATCH 5/5] mmc: sdhci-of-arasan: add power domain support

Shawn Lin
2016-07-29T04:16:45Z

We should enable power domain once provided. Otherwise
we take risk of bus err as it's maybe in off state before
probing.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

drivers/mmc/host/sdhci-of-arasan.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index e0f193f..e507e94 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -25,6 +25,8 @@
#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/regmap.h>
+#include <linux/pm_runtime.h>
+#include <linux/pm_opp.h>
#include "sdhci-pltfm.h"

#define SDHCI_ARASAN_CLK_CTRL_OFFSET 0x2c
@@ -515,6 +517,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
goto clk_dis_ahb;
}

+ pm_runtime_enable(host->dev);
+ pm_runtime_get_sync(host->dev);
+
sdhci_get_of_property(pdev);
pltfm_host->clk = clk_xin;

@@ -577,6 +582,8 @@ clk_dis_ahb:
clk_disable_unprepare(sdhci_arasan->clk_ahb);
err_pltfm_free:
sdhci_pltfm_free(pdev);
+ pm_runtime_put(host->dev);
+ pm_runtime_disable(host->dev);
return ret;
}

@@ -599,6 +606,9 @@ static int sdhci_arasan_remove(struct platform_device *pdev)

clk_disable_unprepare(clk_ahb);

+ pm_runtime_put(host->dev);
+ pm_runtime_disable(host->dev);
+
return ret;
}

--
2.3.7