summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVeerabhadrarao Badiganti <vbadigan@codeaurora.org>2017-06-15 18:44:19 +0530
committerVeerabhadrarao Badiganti <vbadigan@codeaurora.org>2017-06-16 23:05:13 +0530
commitb3c43dda50ddbb0bab781c47f533b74debb9046b (patch)
tree601b169abdeacbac64eda53a2f42389ddcfec2c4
parente822583117ab0cf8af8a03d5bb78d782007b557f (diff)
mmc: sdhci-msm: Set dll to good phase while sending cmd13 in tuning
Set the dll to last known good phase before sending status command while executing tuning. This is to ensure that status command won't fail due to bad phase. Thus we can avoid sending status command multiple times and reduce tuning latency. Change-Id: Ib7fa5a8acbbffd9662617a357d221b36494a98b9 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
-rw-r--r--drivers/mmc/host/sdhci-msm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 1eeab7db9722..034be9b1ae64 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1139,6 +1139,7 @@ int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
bool drv_type_changed = false;
struct mmc_card *card = host->mmc->card;
int sts_retry;
+ u8 last_good_phase = 0;
/*
* Tuning is required for SDR104, HS200 and HS400 cards and
@@ -1224,6 +1225,22 @@ retry:
mmc_wait_for_req(mmc, &mrq);
if (card && (cmd.error || data.error)) {
+ /*
+ * Set the dll to last known good phase while sending
+ * status command to ensure that status command won't
+ * fail due to bad phase.
+ */
+ if (tuned_phase_cnt)
+ last_good_phase =
+ tuned_phases[tuned_phase_cnt-1];
+ else if (msm_host->saved_tuning_phase !=
+ INVALID_TUNING_PHASE)
+ last_good_phase = msm_host->saved_tuning_phase;
+
+ rc = msm_config_cm_dll_phase(host, last_good_phase);
+ if (rc)
+ goto kfree;
+
sts_cmd.opcode = MMC_SEND_STATUS;
sts_cmd.arg = card->rca << 16;
sts_cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;