mmc: tegra: Allow masking of UHS modes
Pavan Kunapuli [Fri, 7 Dec 2012 14:47:46 +0000 (19:47 +0530)]
Add support for masking any of the UHS modes
due to issues on specific platforms.

Bug 1181574

Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/169396
(cherry picked from commit e8e28a080144de184d57b2037460a3e9b0133bb9)

Change-Id: Ic898a1d178a3cc200d3993a558ad732243e189f9
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/170404
Reviewed-by: Rakesh Kumar <krakesh@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

arch/arm/mach-tegra/include/mach/sdhci.h
drivers/mmc/host/sdhci-tegra.c

index 89bd702..c9d7a45 100644 (file)
 #define MMC_OCR_1V8_MASK    0x00000008
 #define MMC_OCR_2V8_MASK    0x00010000
 
+/* uhs mask can be used to mask any of the UHS modes support */
+#define MMC_UHS_MASK_SDR25     1
+#define MMC_UHS_MASK_SDR50     2
+#define MMC_UHS_MASK_DDR50     4
+#define MMC_UHS_MASK_SDR104    8
+
 struct tegra_sdhci_platform_data {
        int cd_gpio;
        int wp_gpio;
@@ -40,6 +46,7 @@ struct tegra_sdhci_platform_data {
        unsigned int ddr_clk_limit;
        unsigned int tap_delay;
        unsigned int trim_delay;
+       unsigned int uhs_mask;
        struct mmc_platform_data mmc_data;
 };
 
index 33836e8..31e4b45 100644 (file)
@@ -372,10 +372,24 @@ static void tegra_sdhci_reset_exit(struct sdhci_host *sdhci, u8 mask)
 {
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
        struct sdhci_tegra *tegra_host = pltfm_host->priv;
+       const struct tegra_sdhci_platform_data *plat = tegra_host->plat;
 
        if (mask & SDHCI_RESET_ALL) {
                if (tegra_host->hw_ops->sdhost_init)
                        tegra_host->hw_ops->sdhost_init(sdhci);
+
+               /* Mask the support for any UHS modes if specified */
+               if (plat->uhs_mask & MMC_UHS_MASK_SDR104)
+                       sdhci->mmc->caps &= ~MMC_CAP_UHS_SDR104;
+
+               if (plat->uhs_mask & MMC_UHS_MASK_DDR50)
+                       sdhci->mmc->caps &= ~MMC_CAP_UHS_DDR50;
+
+               if (plat->uhs_mask & MMC_UHS_MASK_SDR50)
+                       sdhci->mmc->caps &= ~MMC_CAP_UHS_SDR50;
+
+               if (plat->uhs_mask & MMC_UHS_MASK_SDR25)
+                       sdhci->mmc->caps &= ~MMC_CAP_UHS_SDR25;
        }
 }