@@ -230,6 +230,7 @@ struct sh_mmcif_host {
struct platform_device *pd;
struct clk *hclk;
unsigned int clk;
+ unsigned int clk_cache;
int bus_width;
unsigned char timing;
bool sd_error;
@@ -1020,6 +1021,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
sh_mmcif_clock_control(host, ios->clock);
+ host->clk_cache = ios->clock;
host->timing = ios->timing;
host->bus_width = ios->bus_width;
host->state = STATE_IDLE;
@@ -1551,6 +1553,9 @@ static int sh_mmcif_runtime_suspend(struct device *dev)
{
struct sh_mmcif_host *host = dev_get_drvdata(dev);
+ if (host->clk_cache)
+ sh_mmcif_clock_control(host, 0);
+
clk_disable_unprepare(host->hclk);
return 0;
}
@@ -1560,6 +1565,11 @@ static int sh_mmcif_runtime_resume(struct device *dev)
struct sh_mmcif_host *host = dev_get_drvdata(dev);
sh_mmcif_clk_update(host);
+
+ if (host->clk_cache) {
+ sh_mmcif_sync_reset(host);
+ sh_mmcif_clock_control(host, host->clk_cache);
+ }
return 0;
}
#endif
At request inactivity, we don't want to rely on gating the clock only through the clock API since this will depend on the clock tree and the clients using the clocks. To make sure the clock is fully gated towards the card in runtime suspend, we perform clock gating using the internal registers of the controller. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/mmc/host/sh_mmcif.c | 10 ++++++++++ 1 file changed, 10 insertions(+)