From: Shawn Lin <shawn.lin@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>,
Rob Herring <robh+dt@kernel.org>,
Jaehoon Chung <jh80.chung@samsung.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
linux-rockchip@lists.infradead.org,
Douglas Anderson <dianders@chromium.org>,
Brian Norris <briannorris@chromium.org>,
Feng Xiao <xf@rock-chips.com>,
Elaine Zhang <zhangqing@rock-chips.com>,
linux-kernel@vger.kernel.org,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH 4/5] mmc: dw_mmc: add power domain support
Date: Fri, 29 Jul 2016 12:15:02 +0800 [thread overview]
Message-ID: <1469765703-30999-5-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1469765703-30999-1-git-send-email-shawn.lin@rock-chips.com>
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/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 <linux/ioport.h>
#include <linux/module.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/pm_opp.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/stat.h>
@@ -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
next prev parent reply other threads:[~2016-07-29 4:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-29 4:14 [PATCH 0/5] Add power domain support for dw_mmc/sdhci-of-arasan Shawn Lin
[not found] ` <1469765703-30999-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-29 4:14 ` [PATCH 1/5] Documentation: mmc: synopsys-dw-mshc: add power domain description Shawn Lin
2016-07-29 21:43 ` Rob Herring
2016-07-29 4:15 ` [PATCH 2/5] Documentation: mmc: sdhci-of-arasan: " Shawn Lin
[not found] ` <1469765703-30999-3-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-29 21:43 ` Rob Herring
2016-07-29 4:15 ` [PATCH 3/5] arm64: dts: rockchip: Provide power-domains for sd/sdio/emmc controllers Shawn Lin
2016-07-29 4:15 ` Shawn Lin [this message]
2016-07-29 4:16 ` [PATCH 5/5] mmc: sdhci-of-arasan: add power domain support Shawn Lin
2016-07-29 9:21 ` [PATCH 0/5] Add power domain support for dw_mmc/sdhci-of-arasan Ulf Hansson
[not found] ` <CAPDyKFq6itpANwnLqgOqKHT0fJH4SvZi2FWrafa=HSBfiZE52w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-01 3:10 ` Shawn Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469765703-30999-5-git-send-email-shawn.lin@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=briannorris@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=xf@rock-chips.com \
--cc=zhangqing@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox