mmc: host: Use SDR104 UHS mode for SDR50 mode
R Raj Kumar [Mon, 11 Jul 2016 12:05:14 +0000 (17:05 +0530)]
- Program SDR104 mode in the UHS_MODE_SEL register for
  SDR50 mode as well.
- This is required for better timing and reliable transfers
  in SDR50 mode.

Bug 1423423
Bug 200217784

Change-Id: I9513b9d5a153842a1e1dcea79ddc29bdc27e4591
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Signed-off-by: R Raj Kumar <rrajk@nvidia.com>
Reviewed-on: http://git-master/r/1201716
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>

drivers/mmc/host/sdhci-tegra.c
drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index 35a3125..0a04ed6 100644 (file)
@@ -5288,6 +5288,7 @@ static struct sdhci_pltfm_data sdhci_tegra21_pdata = {
                   SDHCI_QUIRK2_USE_64BIT_ADDR |
                   SDHCI_QUIRK2_NON_STD_TUN_CARD_CLOCK |
                   SDHCI_QUIRK2_NON_STD_RTPM |
+                  SDHCI_QUIRK2_SEL_SDR104_UHS_MODE_IN_SDR50 |
                   SDHCI_QUIRK2_SUPPORT_64BIT_DMA,
        .ops  = &tegra_sdhci_ops,
 };
index 382bc12..80979e5 100644 (file)
@@ -2186,6 +2186,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
                                ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
                        else if (ios->timing == MMC_TIMING_UHS_SDR25)
                                ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
+                       else if ((ios->timing == MMC_TIMING_UHS_SDR50) &&
+                               (host->quirks2 &
+                                SDHCI_QUIRK2_SEL_SDR104_UHS_MODE_IN_SDR50))
+                               ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
                        else if (ios->timing == MMC_TIMING_UHS_SDR50)
                                ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
                        else if (ios->timing == MMC_TIMING_UHS_SDR104)
index 6abeacf..59df28e 100644 (file)
@@ -2,7 +2,7 @@
  *  linux/include/linux/mmc/sdhci.h - Secure Digital Host Controller Interface
  *
  *  Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
- *  Copyright (c) 2013-2015, NVIDIA CORPORATION. All Rights Reserved.
+ *  Copyright (c) 2013-2016, NVIDIA CORPORATION. All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -162,6 +162,7 @@ struct sdhci_host {
 #define SDHCI_QUIRK2_PERIODIC_CALIBRATION              (1<<16)
 /*Controller skips tuning if it is already done*/
 #define SDHCI_QUIRK2_SKIP_TUNING                       (1<<17)
+#define SDHCI_QUIRK2_SEL_SDR104_UHS_MODE_IN_SDR50      (1<<18)
 
        unsigned int  acmd12_ctrl;
        unsigned int  ier;