]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
mmc: tegra: Enable I/O trimmer voltage
authorR Raj Kumar <rrajk@nvidia.com>
Wed, 24 Sep 2014 05:13:38 +0000 (10:43 +0530)
committerR Raj Kumar <rrajk@nvidia.com>
Wed, 15 Oct 2014 06:57:43 +0000 (23:57 -0700)
- Enabled I/O trimmer voltage for eMMC device and for
SD/SDIO tunable modes (SDR104 & SDR50 mode).
- Disabled it for SD/SDIO non-tunable modes
- Added en_io_trim_volt and is_emmc in sdhci
pltform data and parsing them in driver.

Bug 1552708

Change-Id: Ic22e2b8cbe429fd087c4f23ca3f01cea93122937
Signed-off-by: R Raj Kumar <rrajk@nvidia.com>
Reviewed-on: http://git-master/r/534081
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
drivers/mmc/host/sdhci-tegra.c
include/linux/platform_data/mmc-sdhci-tegra.h

index 8718c436ef0dc5748b0d7e05b17ae44f145c18bc..495b1d58a30285a4d032669b6d4b5e5624763cad 100644 (file)
@@ -1200,6 +1200,25 @@ static int tegra_sdhci_set_uhs_signaling(struct sdhci_host *host,
        vndr_ctrl |= (best_tap_value <<
                SDHCI_VNDR_CLK_CTRL_TAP_VALUE_SHIFT);
        sdhci_writel(host, vndr_ctrl, SDHCI_VNDR_CLK_CTRL);
+
+       /* T21x: Enable Band Gap trimmers and VIO supply for eMMC all modes
+        * and for SD/SDIO tunable modes only.
+        * Wait for 3usec after enabling the trimmers.
+        */
+       if (!plat->en_io_trim_volt)
+              return 0;
+
+       vndr_ctrl = sdhci_readl(host, SDMMC_VNDR_IO_TRIM_CNTRL_0);
+
+       if (plat->is_emmc || (uhs == MMC_TIMING_UHS_SDR104) ||
+                       (uhs == MMC_TIMING_UHS_SDR50))
+               vndr_ctrl &= ~(SDMMC_VNDR_IO_TRIM_CNTRL_0_SEL_VREG);
+       else
+               vndr_ctrl |= (SDMMC_VNDR_IO_TRIM_CNTRL_0_SEL_VREG);
+
+       sdhci_writel(host, vndr_ctrl, SDMMC_VNDR_IO_TRIM_CNTRL_0);
+       udelay(3);
+
        return 0;
 }
 
@@ -1393,10 +1412,6 @@ static void tegra_sdhci_reset_exit(struct sdhci_host *host, u8 mask)
                misc_ctrl = sdhci_readl(host, SDMMC_IO_SPARE_0);
                misc_ctrl |= (1 << SPARE_OUT_3_OFFSET);
                sdhci_writel(host, misc_ctrl, SDMMC_IO_SPARE_0);
-
-               vendor_ctrl = sdhci_readl(host, SDMMC_VNDR_IO_TRIM_CNTRL_0);
-               vendor_ctrl &= ~(SDMMC_VNDR_IO_TRIM_CNTRL_0_SEL_VREG);
-               sdhci_writel(host, vendor_ctrl, SDMMC_VNDR_IO_TRIM_CNTRL_0);
        }
 
        if (soc_data->nvquirks & NVQUIRK_DISABLE_AUTO_CMD23)
@@ -1455,18 +1470,6 @@ static void tegra_sdhci_reset_exit(struct sdhci_host *host, u8 mask)
                sdhci_writel(host, misc_ctrl, SDHCI_VNDR_CAP_OVERRIDES_0);
        }
 
-#if defined(CONFIG_ARCH_TEGRA_21x_SOC)
-       /* Enable Band Gap trimmers and VIO supply.
-        * Wait for 3usec after enabling the trimmers.
-        */
-       misc_ctrl = sdhci_readl(host, SDMMC_VNDR_IO_TRIM_CNTRL_0);
-       misc_ctrl &= ~(SDMMC_VNDR_IO_TRIM_CNTRL_0_SEL_VREG);
-       sdhci_writel(host, misc_ctrl, SDMMC_VNDR_IO_TRIM_CNTRL_0);
-       udelay(3);
-       if (tegra_host->en_strobe)
-               tegra_sdhci_en_strobe(host);
-#endif
-
        /* Use timeout clk data timeout counter for generating wr crc status */
        if (soc_data->nvquirks &
                NVQUIRK_USE_TMCLK_WR_CRC_TIMEOUT) {
@@ -4487,6 +4490,9 @@ static struct tegra_sdhci_platform_data *sdhci_tegra_dt_parse_pdata(
        plat->disable_clock_gate = of_property_read_bool(np,
                "disable-clock-gate");
        of_property_read_u8(np, "default-drv-type", &plat->default_drv_type);
+       plat->en_io_trim_volt = of_property_read_bool(np,
+                       "nvidia,en-io-trim-volt");
+       plat->is_emmc = of_property_read_bool(np, "nvidia,is-emmc");
 
        if (!of_property_read_u32(np, "mmc-ocr-mask", &val)) {
                if (val == 0)
index 49c9bc68041930078b0c9807981e3ca3d60f8887..57ccd62194cde74736e2dd7984e6a580e075500f 100644 (file)
@@ -78,6 +78,8 @@ struct tegra_sdhci_platform_data {
        bool pwr_off_during_lp0;
        bool disable_auto_cal;
        unsigned int auto_cal_step;
+       bool en_io_trim_volt;
+       bool is_emmc;
 };
 
 #endif