From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shawn Lin Subject: [PATCH 4/5] mmc: dw_mmc: add power domain support Date: Fri, 29 Jul 2016 12:15:02 +0800 Message-ID: <1469765703-30999-5-git-send-email-shawn.lin@rock-chips.com> References: <1469765703-30999-1-git-send-email-shawn.lin@rock-chips.com> Return-path: In-Reply-To: <1469765703-30999-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-mmc-owner@vger.kernel.org To: Heiko Stuebner , Rob Herring , Jaehoon Chung , Ulf Hansson Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, Douglas Anderson , Brian Norris , Feng Xiao , Elaine Zhang , linux-kernel@vger.kernel.org, Shawn Lin List-Id: linux-rockchip.vger.kernel.org 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 --- drivers/mmc/host/dw_mmc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 32380d5..8b39168 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -3024,6 +3026,9 @@ int dw_mci_probe(struct dw_mci *host) host->bus_hz = clk_get_rate(host->ciu_clk); } + pm_runtime_enable(host->dev); + pm_runtime_get_sync(host->dev); + if (!host->bus_hz) { dev_err(host->dev, "Platform data must supply bus speed\n"); @@ -3197,6 +3202,9 @@ err_clk_biu: if (!IS_ERR(host->biu_clk)) clk_disable_unprepare(host->biu_clk); + pm_runtime_put(host->dev); + pm_runtime_disable(host->dev); + return ret; } EXPORT_SYMBOL(dw_mci_probe); @@ -3226,6 +3234,9 @@ void dw_mci_remove(struct dw_mci *host) if (!IS_ERR(host->biu_clk)) clk_disable_unprepare(host->biu_clk); + + pm_runtime_put(host->dev); + pm_runtime_disable(host->dev); } EXPORT_SYMBOL(dw_mci_remove); -- 2.3.7