|
Takashi Iwai |
95239b |
From 0add6e9b88d0632a25323aaf4987dbacb0e4ae64 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
95239b |
From: Michael Walle <michael@walle.cc>
|
|
Takashi Iwai |
95239b |
Date: Fri, 23 Oct 2020 00:23:37 +0200
|
|
Takashi Iwai |
95239b |
Subject: [PATCH] mmc: sdhci-of-esdhc: set timeout to max before tuning
|
|
Takashi Iwai |
95239b |
Git-commit: 0add6e9b88d0632a25323aaf4987dbacb0e4ae64
|
|
Takashi Iwai |
95239b |
Patch-mainline: v5.10-rc2
|
|
Takashi Iwai |
95239b |
References: git-fixes
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
On rare occations there is the following error:
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
mmc0: Tuning timeout, falling back to fixed sampling clock
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
There are SD cards which takes a significant longer time to reply to the
|
|
Takashi Iwai |
95239b |
first CMD19 command. The eSDHC takes the data timeout value into account
|
|
Takashi Iwai |
95239b |
during the tuning period. The SDHCI core doesn't explicitly set this
|
|
Takashi Iwai |
95239b |
timeout for the tuning procedure. Thus on the slow cards, there might be
|
|
Takashi Iwai |
95239b |
a spurious "Buffer Read Ready" interrupt, which in turn triggers a wrong
|
|
Takashi Iwai |
95239b |
sequence of events. In the end this will lead to an unsuccessful tuning
|
|
Takashi Iwai |
95239b |
procedure and to the above error.
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
To workaround this, set the timeout to the maximum value (which is the
|
|
Takashi Iwai |
95239b |
best we can do) and the SDHCI core will take care of the proper timeout
|
|
Takashi Iwai |
95239b |
handling.
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
Fixes: ba49cbd0936e ("mmc: sdhci-of-esdhc: add tuning support")
|
|
Takashi Iwai |
95239b |
Signed-off-by: Michael Walle <michael@walle.cc>
|
|
Takashi Iwai |
95239b |
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
|
|
Takashi Iwai |
95239b |
Cc: stable@vger.kernel.org
|
|
Takashi Iwai |
95239b |
Link: https://lore.kernel.org/r/20201022222337.19857-1-michael@walle.cc
|
|
Takashi Iwai |
95239b |
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
|
|
Takashi Iwai |
95239b |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
---
|
|
Takashi Iwai |
95239b |
drivers/mmc/host/sdhci-of-esdhc.c | 11 +++++++++++
|
|
Takashi Iwai |
95239b |
1 file changed, 11 insertions(+)
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
--- a/drivers/mmc/host/sdhci-of-esdhc.c
|
|
Takashi Iwai |
95239b |
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
|
|
Takashi Iwai |
95239b |
@@ -830,6 +830,17 @@ static int esdhc_execute_tuning(struct m
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
esdhc_tuning_block_enable(host, true);
|
|
Takashi Iwai |
95239b |
|
|
Takashi Iwai |
95239b |
+ /*
|
|
Takashi Iwai |
95239b |
+ * The eSDHC controller takes the data timeout value into account
|
|
Takashi Iwai |
95239b |
+ * during tuning. If the SD card is too slow sending the response, the
|
|
Takashi Iwai |
95239b |
+ * timer will expire and a "Buffer Read Ready" interrupt without data
|
|
Takashi Iwai |
95239b |
+ * is triggered. This leads to tuning errors.
|
|
Takashi Iwai |
95239b |
+ *
|
|
Takashi Iwai |
95239b |
+ * Just set the timeout to the maximum value because the core will
|
|
Takashi Iwai |
95239b |
+ * already take care of it in sdhci_send_tuning().
|
|
Takashi Iwai |
95239b |
+ */
|
|
Takashi Iwai |
95239b |
+ sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
|
|
Takashi Iwai |
95239b |
+
|
|
Takashi Iwai |
95239b |
hs400_tuning = host->flags & SDHCI_HS400_TUNING;
|
|
Takashi Iwai |
95239b |
ret = sdhci_execute_tuning(mmc, opcode);
|
|
Takashi Iwai |
95239b |
|