summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-msm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2020-10-06 16:19:24 +0100
committerMark Brown <broonie@kernel.org>2020-10-06 16:19:24 +0100
commitfd6b519a30a7179026d22c98d6bf10bb5ca8ca27 (patch)
treee4a6bc4d8548a5b8db7148a18eb257b84e72d48b /drivers/mmc/host/sdhci-msm.c
parent43499134f50a77844f0503df2c995f43b858f4c3 (diff)
parent856deb866d16e29bd65952e0289066f6078af773 (diff)
downloadlinux-stable-fd6b519a30a7179026d22c98d6bf10bb5ca8ca27.tar.gz
linux-stable-fd6b519a30a7179026d22c98d6bf10bb5ca8ca27.tar.bz2
linux-stable-fd6b519a30a7179026d22c98d6bf10bb5ca8ca27.zip
Merge tag 'v5.9-rc5' into asoc-5.10
Linux 5.9-rc5
Diffstat (limited to 'drivers/mmc/host/sdhci-msm.c')
-rw-r--r--drivers/mmc/host/sdhci-msm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 5a33389037cd..729868abd2db 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1166,7 +1166,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable)
static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
{
struct sdhci_host *host = mmc_priv(mmc);
- int tuning_seq_cnt = 3;
+ int tuning_seq_cnt = 10;
u8 phase, tuned_phases[16], tuned_phase_cnt = 0;
int rc;
struct mmc_ios ios = host->mmc->ios;
@@ -1222,6 +1222,22 @@ retry:
} while (++phase < ARRAY_SIZE(tuned_phases));
if (tuned_phase_cnt) {
+ if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) {
+ /*
+ * All phases valid is _almost_ as bad as no phases
+ * valid. Probably all phases are not really reliable
+ * but we didn't detect where the unreliable place is.
+ * That means we'll essentially be guessing and hoping
+ * we get a good phase. Better to try a few times.
+ */
+ dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n",
+ mmc_hostname(mmc));
+ if (--tuning_seq_cnt) {
+ tuned_phase_cnt = 0;
+ goto retry;
+ }
+ }
+
rc = msm_find_most_appropriate_phase(host, tuned_phases,
tuned_phase_cnt);
if (rc < 0)