mmc: tegra: Set proper emmc voltage
rrajk [Mon, 5 Nov 2012 14:23:47 +0000 (19:23 +0530)]
Check interface supply voltage limit of emmc
and set it to 1.8V or 3.3V at resume
Bug 1167312
Bug 1167307

Change-Id: I2dda670ed9c270761f61eacb93233a7487894d84
Signed-off-by: rrajk <rrajk@nvidia.com>
Reviewed-on: http://git-master/r/161246
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/mmc/host/sdhci-tegra.c

index 603f011..b3bfac7 100644 (file)
@@ -1022,7 +1022,11 @@ static int tegra_sdhci_resume(struct sdhci_host *sdhci)
 {
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
        struct sdhci_tegra *tegra_host = pltfm_host->priv;
+       struct platform_device *pdev;
+       struct tegra_sdhci_platform_data *plat;
 
+       pdev = to_platform_device(mmc_dev(sdhci->mmc));
+       plat = pdev->dev.platform_data;
        /* Enable the power rails if any */
        if (tegra_host->card_present) {
                if (!tegra_host->is_rail_enabled) {
@@ -1030,7 +1034,13 @@ static int tegra_sdhci_resume(struct sdhci_host *sdhci)
                                regulator_enable(tegra_host->vdd_slot_reg);
                        if (tegra_host->vdd_io_reg) {
                                regulator_enable(tegra_host->vdd_io_reg);
-                               tegra_sdhci_signal_voltage_switch(sdhci, MMC_SIGNAL_VOLTAGE_330);
+                               if (plat->mmc_data.ocr_mask &
+                                                       SDHOST_1V8_OCR_MASK)
+                                       tegra_sdhci_signal_voltage_switch(sdhci,
+                                                       MMC_SIGNAL_VOLTAGE_180);
+                               else
+                                       tegra_sdhci_signal_voltage_switch(sdhci,
+                                                       MMC_SIGNAL_VOLTAGE_330);
                        }
                        tegra_host->is_rail_enabled = 1;
                }