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

mmc: sdhci: Always allow tuning to fall back to fixed sampling

SDHCI falls back to fixed sampling if there is an error during tuning.
However it also reports an error unless there is periodic re-tuning.
That is not the best option because:
a) there is a reasonable chance that fixed sampling will work, especially
at room temperature.
b) re-tuning will be done again anyway if there are CRC errors.
Change to return no error always when falling back to fixed sampling.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
0760c355 5ef5203b

+2 -18
+2 -18
drivers/mmc/host/sdhci.c
··· 2098 2098 sdhci_do_reset(host, SDHCI_RESET_CMD); 2099 2099 sdhci_do_reset(host, SDHCI_RESET_DATA); 2100 2100 2101 - err = -EIO; 2102 - 2103 2101 if (cmd.opcode != MMC_SEND_TUNING_BLOCK_HS200) 2104 2102 goto out; 2105 2103 ··· 2135 2137 ctrl &= ~SDHCI_CTRL_EXEC_TUNING; 2136 2138 sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); 2137 2139 } 2138 - if (!(ctrl & SDHCI_CTRL_TUNED_CLK)) { 2140 + if (!(ctrl & SDHCI_CTRL_TUNED_CLK)) 2139 2141 pr_info(DRIVER_NAME ": Tuning procedure failed, falling back to fixed sampling clock\n"); 2140 - err = -EIO; 2141 - } 2142 - 2143 2142 out: 2144 - if (tuning_count) { 2145 - /* 2146 - * In case tuning fails, host controllers which support 2147 - * re-tuning can try tuning again at a later time, when the 2148 - * re-tuning timer expires. So for these controllers, we 2149 - * return 0. Since there might be other controllers who do not 2150 - * have this capability, we return error for them. 2151 - */ 2152 - err = 0; 2153 - } 2154 - 2155 - host->mmc->retune_period = err ? 0 : tuning_count; 2143 + host->mmc->retune_period = tuning_count; 2156 2144 2157 2145 sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); 2158 2146 sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);