linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Bean Huo <huobean@gmail.com>, Ulf Hansson <ulf.hansson@linaro.org>
Cc: Bean Huo <beanhuo@micron.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] mmc: sdhci: Use the SW timer when the HW timer cannot meet the timeout value required by the device
Date: Fri, 24 Sep 2021 08:29:51 +0300	[thread overview]
Message-ID: <fc14d8e1-9438-d4b0-80f4-ccf9055ab7d3@intel.com> (raw)
In-Reply-To: <20210917172727.26834-3-huobean@gmail.com>

On 17/09/21 8:27 pm, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> If the data transmission timeout value required by the device exceeds
> the maximum timeout value of the host HW timer, we still use the HW
> timer with the maximum timeout value of the HW timer. This setting is
> suitable for most R/W situations. But sometimes, the device will complete
> the R/W task within its required timeout value (greater than the HW timer).
> In this case, the HW timer for data transmission will time out.
> 
> Currently, in this condition, we  disable the HW timer and use the SW
> timer only when the SDHCI_QUIRK2_DISABLE_HW_TIMEOUT quirk is set by the
> host driver. The patch is to remove this if statement restriction and
> allow data transmission to use the SW timer when the hardware timer cannot
> meet the required timeout value.

The reason it is a quirk is because it does not work for all hardware.
For some controllers the timeout cannot really be disabled, only the
interrupt is disabled, and then the controller never indicates completion
if the timeout is exceeded.

> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/mmc/host/sdhci.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 357b365bf0ec..463517fd9886 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -969,9 +969,6 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>  		count++;
>  		current_timeout <<= 1;
>  		if (count > host->max_timeout_count) {
> -			if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT))
> -				DBG("Too large timeout 0x%x requested for CMD%d!\n",
> -				    count, cmd->opcode);
>  			count = host->max_timeout_count;
>  			*too_big = true;
>  			break;
> @@ -1016,8 +1013,7 @@ void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
>  	bool too_big = false;
>  	u8 count = sdhci_calc_timeout(host, cmd, &too_big);
>  
> -	if (too_big &&
> -	    host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) {
> +	if (too_big) {
>  		sdhci_calc_sw_timeout(host, cmd);
>  		sdhci_set_data_timeout_irq(host, false);
>  	} else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) {
> 


  reply	other threads:[~2021-09-24  5:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210917172727.26834-1-huobean@gmail.com>
2021-09-17 17:27 ` [PATCH v1 1/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer Bean Huo
2021-09-24  6:32   ` Adrian Hunter
2021-09-27 22:31   ` Ulf Hansson
2021-09-17 17:27 ` [PATCH v1 2/2] mmc: sdhci: Use the SW timer when the HW timer cannot meet the timeout value required by the device Bean Huo
2021-09-24  5:29   ` Adrian Hunter [this message]
2021-09-24  9:17     ` Bean Huo
2021-09-24 10:07       ` Adrian Hunter
2021-09-24 11:45         ` Bean Huo
2021-09-24 12:17           ` Adrian Hunter
2021-09-24 13:08             ` Bean Huo
2021-09-24 13:26               ` Adrian Hunter
2021-09-24 21:33                 ` Bean Huo
2021-09-28  9:39                   ` Bean Huo
2021-09-28 10:18                   ` Adrian Hunter
2021-09-29 10:49                     ` Bean Huo
2021-09-29 12:38                       ` Adrian Hunter
2021-09-30  8:34                         ` Bean Huo
2021-09-30  8:59                           ` Adrian Hunter
2021-09-30  9:02                             ` Bean Huo

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=fc14d8e1-9438-d4b0-80f4-ccf9055ab7d3@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=beanhuo@micron.com \
    --cc=huobean@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).