Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci: add delay after the last tuning command

When host set the host->tuning_delay, even the last tuning
command need a delay, otherwise the first command after the
tuning will meet issue.

Take i.MX7D as an example, there will be the following log:
mmc2: switch to high-speed from hs200 failed, err:-110
mmc2: error -110 whilst initialising MMC card

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

BOUGH CHEN and committed by
Ulf Hansson
2b06e159 d00ab101

+4 -3
+4 -3
drivers/mmc/host/sdhci.c
··· 2376 2376 return -ETIMEDOUT; 2377 2377 } 2378 2378 2379 + /* Spec does not require a delay between tuning cycles */ 2380 + if (host->tuning_delay > 0) 2381 + mdelay(host->tuning_delay); 2382 + 2379 2383 ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); 2380 2384 if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) { 2381 2385 if (ctrl & SDHCI_CTRL_TUNED_CLK) ··· 2387 2383 break; 2388 2384 } 2389 2385 2390 - /* Spec does not require a delay between tuning cycles */ 2391 - if (host->tuning_delay > 0) 2392 - mdelay(host->tuning_delay); 2393 2386 } 2394 2387 2395 2388 pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",