From: Adrian Hunter <adrian.hunter@intel.com>
To: Michael Walle <michael@walle.cc>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Yangbo Lu <yangbo.lu@nxp.com>, Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH] mmc: sdhci-of-esdhc: set timeout to max before tuning
Date: Fri, 16 Oct 2020 11:45:50 +0300 [thread overview]
Message-ID: <d3546633-18d6-9ebf-0581-a3bf043178c3@intel.com> (raw)
In-Reply-To: <20201015231149.9333-1-michael@walle.cc>
On 16/10/20 2:11 am, Michael Walle wrote:
> On rare occations there is the following error:
>
> mmc0: Tuning timeout, falling back to fixed sampling clock
>
> There are SD cards which takes a significant longer time to reply to the
> first CMD19 command. The eSDHC takes the data timeout value into account
> during the tuning period. The SDHCI core doesn't explicitly set this
> timeout for the tuning procedure. Thus on the slow cards, there might be
> a spurious "Buffer Read Ready" interrupt, which in turn triggers a wrong
> sequence of events. In the end this will lead to an unsuccessful tuning
> procedure and to the above error.
>
> To workaround this, set the timeout to the maximum value (which is the
> best we can do) and the SDHCI core will take care of the proper timeout
> handling.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-esdhc.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 0b45eff6fed4..baf7801a1804 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -1052,6 +1052,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
>
> esdhc_tuning_block_enable(host, true);
>
> + /*
> + * The eSDHC controller takes the data timeout value into account
> + * during tuning. If the SD card is too slow sending the response, the
> + * timer will expire and a "Buffer Read Ready" interrupt without data
> + * is triggered. This leads to tuning errors.
> + *
> + * Just set the timeout to the maximum value because the core will
> + * already take care of it in sdhci_send_tuning().
> + */
> + sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
> +
> hs400_tuning = host->flags & SDHCI_HS400_TUNING;
>
> do {
>
next prev parent reply other threads:[~2020-10-16 8:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 23:11 [PATCH] mmc: sdhci-of-esdhc: set timeout to max before tuning Michael Walle
2020-10-16 8:45 ` Adrian Hunter [this message]
2020-10-16 10:53 ` Ulf Hansson
2020-10-16 12:50 ` Michael Walle
2020-10-21 15:04 ` Ulf Hansson
2020-10-21 17:29 ` Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d3546633-18d6-9ebf-0581-a3bf043178c3@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=michael@walle.cc \
--cc=ulf.hansson@linaro.org \
--cc=yangbo.lu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox