mmc: host: support runtime enable/disable SDCLK
vjagadish [Thu, 13 Oct 2011 12:20:28 +0000 (17:20 +0530)]
Implement functions needed in struct mmc_host_ops to support
enable/disable SDCLK dynamically.

BUG 886285

Change-Id: Ic48ac63af495cea30ce926c39ec2e0a9f2d26244
Reviewed-on: http://git-master/r/57856
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rfae7d6001a827395824716fb858ef18d0d2c4d68

drivers/mmc/host/sdhci-tegra.c
drivers/mmc/host/sdhci.c

index fba2d43..e9995a1 100644 (file)
@@ -503,6 +503,7 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev)
        host->mmc->pm_caps = plat->pm_flags;
 
        host->mmc->caps |= MMC_CAP_ERASE;
+       host->mmc->caps |= MMC_CAP_DISABLE;
        if (plat->is_8bit)
                host->mmc->caps |= MMC_CAP_8_BIT_DATA;
        host->mmc->caps |= MMC_CAP_SDIO_IRQ;
index b277f3d..08b710f 100644 (file)
@@ -1819,10 +1819,37 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable)
        spin_unlock_irqrestore(&host->lock, flags);
 }
 
+int sdhci_enable(struct mmc_host *mmc)
+{
+       struct sdhci_host *host = mmc_priv(mmc);
+
+       if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
+               return 0;
+
+       if (mmc->ios.clock)
+               sdhci_set_clock(host, mmc->ios.clock);
+
+       return 0;
+}
+
+int sdhci_disable(struct mmc_host *mmc, int lazy)
+{
+       struct sdhci_host *host = mmc_priv(mmc);
+
+       if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
+               return 0;
+
+       sdhci_set_clock(host, 0);
+
+       return 0;
+}
+
 static const struct mmc_host_ops sdhci_ops = {
        .request        = sdhci_request,
        .set_ios        = sdhci_set_ios,
        .get_ro         = sdhci_get_ro,
+       .enable         = sdhci_enable,
+       .disable        = sdhci_disable,
        .enable_sdio_irq = sdhci_enable_sdio_irq,
        .start_signal_voltage_switch    = sdhci_start_signal_voltage_switch,
        .execute_tuning                 = sdhci_execute_tuning,