diff options
Diffstat (limited to 'drivers/mmc/host/sdhci-msm.c')
-rw-r--r-- | drivers/mmc/host/sdhci-msm.c | 16 |
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: |