summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-esdhc-imx.c
diff options
context:
space:
mode:
authorLucas Stach2013-06-05 15:13:25 +0200
committerChris Ball2013-06-27 17:29:14 +0200
commit8ba9580a8045b6d5fed66e13b77599f3d8a77fed (patch)
tree6c6cc85feb82547669750b87ddc36bad355b509f /drivers/mmc/host/sdhci-esdhc-imx.c
parentmmc: card: fixing an false identification of SANITIZE command (diff)
downloadkernel-qcow2-linux-8ba9580a8045b6d5fed66e13b77599f3d8a77fed.tar.gz
kernel-qcow2-linux-8ba9580a8045b6d5fed66e13b77599f3d8a77fed.tar.xz
kernel-qcow2-linux-8ba9580a8045b6d5fed66e13b77599f3d8a77fed.zip
mmc: sdhci-esdhc: calculate sdclk divider from controller clock
The SDCLK is divided down from the host controller clock. Host controller clock may be different from the maximum SDCLK, so get it from the platform, instead of just using the max SDCLK. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc-imx.c')
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 98f46704baa6..eb1310ca021e 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -391,6 +391,14 @@ static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
return clk_get_rate(pltfm_host->clk) / 256 / 16;
}
+static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
+ unsigned int clock)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+ esdhc_set_clock(host, clock, clk_get_rate(pltfm_host->clk));
+}
+
static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -438,7 +446,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
.write_l = esdhc_writel_le,
.write_w = esdhc_writew_le,
.write_b = esdhc_writeb_le,
- .set_clock = esdhc_set_clock,
+ .set_clock = esdhc_pltfm_set_clock,
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
.get_min_clock = esdhc_pltfm_get_min_clock,
.get_ro = esdhc_pltfm_get_ro,