[PATCH 3/3] mmc: sh_mmcif: re-read the clock frequency upon re-enabling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <g.liakhovetski@xxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux