summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSahitya Tummala <stummala@codeaurora.org>2013-06-13 10:36:57 +0530
committerSubhash Jadavani <subhashj@codeaurora.org>2016-05-27 10:28:44 -0700
commit573858a3b64167f27a2968dbebf661007b324439 (patch)
tree89e1403d12ec8c955451966ae3584d987012230f
parent7bb14bf282fce0829d110dfc05f215f6ad69b7cd (diff)
mmc: sdhci-msm: Add retry mechanism in case of tuning failure
The specification indicates that the tuning process is normally shorter than 40 exections of tuning command. Hence, retry the tuning sequence for at least 3 times before returning the error. Change-Id: I21724a73af7b997e128b56a2600bdcb12e414996 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
-rw-r--r--drivers/mmc/host/sdhci-msm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 2c71f9cf563b..08558b511af0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -565,6 +565,7 @@ out:
int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
{
unsigned long flags;
+ int tuning_seq_cnt = 3;
u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0;
const u32 *tuning_block_pattern = tuning_block_64;
int size = sizeof(tuning_block_64); /* Tuning pattern size in bytes */
@@ -591,17 +592,18 @@ int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
}
spin_unlock_irqrestore(&host->lock, flags);
- /* first of all reset the tuning block */
- rc = msm_init_cm_dll(host);
- if (rc)
- goto out;
-
data_buf = kmalloc(size, GFP_KERNEL);
if (!data_buf) {
rc = -ENOMEM;
goto out;
}
+retry:
+ /* first of all reset the tuning block */
+ rc = msm_init_cm_dll(host);
+ if (rc)
+ goto kfree;
+
phase = 0;
do {
struct mmc_command cmd = {0};
@@ -658,10 +660,12 @@ int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
pr_debug("%s: %s: finally setting the tuning phase to %d\n",
mmc_hostname(mmc), __func__, phase);
} else {
+ if (--tuning_seq_cnt)
+ goto retry;
/* tuning failed */
pr_err("%s: %s: no tuning point found\n",
mmc_hostname(mmc), __func__);
- rc = -EAGAIN;
+ rc = -EIO;
}
kfree: