linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Bean Huo <huobean@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Bean Huo <beanhuo@micron.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer
Date: Tue, 28 Sep 2021 00:31:38 +0200	[thread overview]
Message-ID: <CAPDyKFo+vVE_nH7b6HoZA==psx1+BiL8GqKCFXScRQKcnu+-OA@mail.gmail.com> (raw)
In-Reply-To: <20210917172727.26834-2-huobean@gmail.com>

On Fri, 17 Sept 2021 at 19:27, Bean Huo <huobean@gmail.com> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> Clean up sdhci_calc_timeout() a bit,  and let it set too_big to be true only
> when the timeout value required by the eMMC device exceeds the capability of
> the host hardware timer.
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Applied for next (deferring patch2), thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7ae398f8d4d3..357b365bf0ec 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -930,7 +930,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>         struct mmc_data *data;
>         unsigned target_timeout, current_timeout;
>
> -       *too_big = true;
> +       *too_big = false;
>
>         /*
>          * If the host controller provides us with an incorrect timeout
> @@ -941,7 +941,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>         if (host->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL)
>                 return host->max_timeout_count;
>
> -       /* Unspecified command, asume max */
> +       /* Unspecified command, assume max */
>         if (cmd == NULL)
>                 return host->max_timeout_count;
>
> @@ -968,17 +968,14 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
>         while (current_timeout < target_timeout) {
>                 count++;
>                 current_timeout <<= 1;
> -               if (count > host->max_timeout_count)
> +               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;
> -       }
> -
> -       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;
> -       } else {
> -               *too_big = false;
> +               }
>         }
>
>         return count;
> --
> 2.25.1
>

  parent reply	other threads:[~2021-09-27 22:32 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 [this message]
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
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='CAPDyKFo+vVE_nH7b6HoZA==psx1+BiL8GqKCFXScRQKcnu+-OA@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=beanhuo@micron.com \
    --cc=huobean@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.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).