]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
mmc: sdhci: Skip tuning if it is already done.
authorNaveen Kumar Arepalli <naveenk@nvidia.com>
Thu, 23 Apr 2015 09:35:46 +0000 (15:05 +0530)
committerNaveen Kumar Arepalli <naveenk@nvidia.com>
Tue, 5 May 2015 06:35:26 +0000 (23:35 -0700)
-Skip tuning if it is already done.
-Restore the best tap value if tuning is already done.

Bug 200098030

Change-Id: Ic67350a4607979259fb75882660fcbc36af97000
Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Reviewed-on: http://git-master/r/734836
(cherry picked from commit aa406ea7610c7cb61c2e52a3f96fac44a9226bfa)
Reviewed-on: http://git-master/r/738344
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
drivers/mmc/host/sdhci-tegra.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
include/linux/mmc/sdhci.h

index e2715f9507413685136a0daa032b4a70b615feef..4f716c65fa45de1e9a8cd5542a9a662a91ea5270 100644 (file)
@@ -791,6 +791,21 @@ static void tegra_sdhci_dumpregs(struct sdhci_host *sdhci)
                                SDMMC_VENDOR_ERR_INTR_STATUS_0));
 }
 
+static bool tegra_sdhci_is_tuning_done(struct sdhci_host *sdhci)
+{
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
+       struct sdhci_tegra *tegra_host = pltfm_host->priv;
+
+       if (tegra_host->tuning_status == TUNING_STATUS_DONE) {
+               dev_info(mmc_dev(sdhci->mmc),
+                       "Tuning already done, restoring the best tap value : %u\n",
+                               tegra_host->tuned_tap_delay);
+               sdhci_tegra_set_tap_delay(sdhci, tegra_host->tuned_tap_delay);
+               return true;
+       }
+       return false;
+}
+
 static int sdhci_tegra_get_max_tuning_loop_counter(struct sdhci_host *sdhci)
 {
        u16 hw_tuning_iterations;
@@ -5077,6 +5092,7 @@ static const struct sdhci_ops tegra_sdhci_ops = {
        .dump_host_cust_regs    = tegra_sdhci_dumpregs,
        .get_max_tuning_loop_counter = sdhci_tegra_get_max_tuning_loop_counter,
        .config_tap_delay       = tegra_sdhci_config_tap,
+       .is_tuning_done         = tegra_sdhci_is_tuning_done,
        .get_max_pio_transfer_limits = tegra_sdhci_set_max_pio_transfer_limits,
 };
 
@@ -5136,6 +5152,7 @@ static struct sdhci_pltfm_data sdhci_tegra21_pdata = {
        .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
                   SDHCI_QUIRK2_NON_STD_VOLTAGE_SWITCHING |
                   SDHCI_QUIRK2_NON_STD_TUNING_LOOP_CNTR |
+                  SDHCI_QUIRK2_SKIP_TUNING |
                   SDHCI_QUIRK2_NO_CALC_MAX_DISCARD_TO |
                   SDHCI_QUIRK2_REG_ACCESS_REQ_HOST_CLK |
                   SDHCI_QUIRK2_HOST_OFF_CARD_ON |
index ec429e89c0c4a6f0f5c2202af77ec283962d0289..db2ad7e01357171737c46059d9016954a9e19550 100644 (file)
@@ -2500,6 +2500,15 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
                return err;
        }
 
+       if ((host->quirks2 & SDHCI_QUIRK2_SKIP_TUNING) &&
+               host->ops->is_tuning_done) {
+               if(host->ops->is_tuning_done(host)) {
+                       enable_irq(host->irq);
+                       sdhci_runtime_pm_put(host);
+                       return 0;
+               }
+       }
+
        if ((host->quirks2 & SDHCI_QUIRK2_NON_STD_TUNING_LOOP_CNTR) &&
                (host->ops->get_max_tuning_loop_counter))
                tuning_loop_counter =
index 1df8771ba33bfd2d26d3a59dd74d1d94a35bb3d6..c0ee766bec5c6981a76db819a3715c2e9c93a918 100644 (file)
@@ -391,6 +391,7 @@ struct sdhci_ops {
        void    (*dump_host_cust_regs)(struct sdhci_host *host);
        int     (*get_max_tuning_loop_counter)(struct sdhci_host *sdhci);
        void    (*config_tap_delay)(struct sdhci_host *host, u8 option);
+       bool    (*is_tuning_done)(struct sdhci_host *sdhci);
        int     (*validate_sd2_0)(struct sdhci_host *sdhci);
        void    (*get_max_pio_transfer_limits)(struct sdhci_host *sdhci);
 };
index 08c65db3106c285923c20a047d2b2f47f2b3fbb3..a1dadcc58985e68af9755b9febf5366fc35febed 100644 (file)
@@ -160,6 +160,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK2_NON_STD_TUNING_LOOP_CNTR          (1<<14)
 #define SDHCI_QUIRK2_NON_STD_RTPM                      (1<<15)
 #define SDHCI_QUIRK2_PERIODIC_CALIBRATION              (1<<16)
+/*Controller skips tuning if it is already done*/
+#define SDHCI_QUIRK2_SKIP_TUNING                       (1<<17)
 
        unsigned int  acmd12_ctrl;
        unsigned int  ier;