Once the clock is disabled by a driver, nothing prevents it from being 
reconfigured by another user. Drivers, that save power by disabling the 
clock when not in use must re-read its frequency every time they re-enable 
it.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
---
 drivers/mmc/host/sh_mmcif.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 0441140..ed59392 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -916,6 +916,13 @@ static void sh_mmcif_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
        sh_mmcif_start_cmd(host, mrq);
 }
 
+static void sh_mmcif_clk_update(struct sh_mmcif_host *host)
+{
+       host->clk = clk_get_rate(host->hclk);
+       host->mmc->f_max = host->clk / 2;
+       host->mmc->f_min = host->clk / 512;
+}
+
 static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
        struct sh_mmcif_host *host = mmc_priv(mmc);
@@ -962,6 +969,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
                        if (p->set_pwr)
                                p->set_pwr(host->pd, ios->power_mode);
                        clk_enable(host->hclk);
+                       sh_mmcif_clk_update(host);
                        pm_runtime_get_sync(&host->pd->dev);
                        host->power = true;
                        sh_mmcif_sync_reset(host);
@@ -1313,9 +1321,7 @@ static int __devinit sh_mmcif_probe(struct 
platform_device *pdev)
                goto eclkget;
        }
        clk_enable(host->hclk);
-       host->clk = clk_get_rate(host->hclk);
-       mmc->f_max = host->clk / 2;
-       mmc->f_min = host->clk / 512;
+       sh_mmcif_clk_update(host);
 
        ret = pm_runtime_resume(&pdev->dev);
        if (ret < 0)
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to