mmc: sdhci: check 1.2v IO capability for SDHC host
authorChuanxiao.Dong <chuanxiao.dong@intel.com>
Tue, 19 Aug 2014 03:02:41 +0000 (11:02 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 9 Sep 2014 11:59:25 +0000 (13:59 +0200)
Right now enable 1.2v IO voltage for SDHC is by using vqmmc.
Thus for the host which doesn't have vqmmc, or its vqmmc does
not support 1.2v, directly use MMC_CAP2_HS200 may cause HS200
failure.

So needs to check if vqmmc is able to support 1.2v. If it does
not support, disable 1.2v IO for HS200.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c

index 335cdf3..7481bd8 100644 (file)
@@ -3037,8 +3037,13 @@ int sdhci_add_host(struct sdhci_host *host)
                /* SD3.0: SDR104 is supported so (for eMMC) the caps2
                 * field can be promoted to support HS200.
                 */
-               if (!(host->quirks2 & SDHCI_QUIRK2_BROKEN_HS200))
+               if (!(host->quirks2 & SDHCI_QUIRK2_BROKEN_HS200)) {
                        mmc->caps2 |= MMC_CAP2_HS200;
+                       if (IS_ERR(mmc->supply.vqmmc) ||
+                                       !regulator_is_supported_voltage
+                                       (mmc->supply.vqmmc, 1100000, 1300000))
+                               mmc->caps2 &= ~MMC_CAP2_HS200_1_2V_SDR;
+               }
        } else if (caps[1] & SDHCI_SUPPORT_SDR50)
                mmc->caps |= MMC_CAP_UHS_SDR50;