mmc: sh_mmcif: support aggressive clock gating
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Fri, 25 Feb 2011 15:58:38 +0000 (16:58 +0100)
committerChris Ball <cjb@laptop.org>
Wed, 16 Mar 2011 16:30:25 +0000 (12:30 -0400)
To support MMC aggressive clock gating the driver has to stop the
interface clock when the .set_ios() method is called with .clock == 0.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sh_mmcif.c

index aea86262ed66cf8437ed3d8ace9dfc2649a882fa..af97015a2fc7f57b216992a2032869f40cbf5e59 100644 (file)
@@ -844,15 +844,15 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        struct sh_mmcif_host *host = mmc_priv(mmc);
        struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;
 
-       if (ios->power_mode == MMC_POWER_OFF) {
+       if (ios->power_mode == MMC_POWER_UP) {
+               if (p->set_pwr)
+                       p->set_pwr(host->pd, ios->power_mode);
+       } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {
                /* clock stop */
                sh_mmcif_clock_control(host, 0);
-               if (p->down_pwr)
+               if (ios->power_mode == MMC_POWER_OFF && p->down_pwr)
                        p->down_pwr(host->pd);
                return;
-       } else if (ios->power_mode == MMC_POWER_UP) {
-               if (p->set_pwr)
-                       p->set_pwr(host->pd, ios->power_mode);
        }
 
        if (ios->clock)