From: Adrian Hunter <adrian.hunter@intel.com>
To: Claudiu Beznea <claudiu.beznea@microchip.com>,
eugen.hristev@microchip.com, ulf.hansson@linaro.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
ludovic.desroches@microchip.com
Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout
Date: Fri, 24 Sep 2021 14:34:42 +0300 [thread overview]
Message-ID: <10b77993-8ab9-75dc-69e8-2775f8fcc7b1@intel.com> (raw)
In-Reply-To: <20210924082851.2132068-3-claudiu.beznea@microchip.com>
On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Replace while loop with read_poll_timeout().
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 134ba01d3063..d1a1c548c515 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
> static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
> {
> u16 clk;
> - unsigned long timeout;
>
> host->mmc->actual_clock = 0;
>
> @@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
> sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>
> /* Wait max 20 ms */
> - timeout = 20;
> - while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> - & SDHCI_CLOCK_INT_STABLE)) {
> - if (timeout == 0) {
> - pr_err("%s: Internal clock never stabilised.\n",
> - mmc_hostname(host->mmc));
> - return;
> - }
> - timeout--;
> - mdelay(1);
> + if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
> + 1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
> + pr_err("%s: Internal clock never stabilised.\n",
> + mmc_hostname(host->mmc));
> + return;
> }
>
> clk |= SDHCI_CLOCK_CARD_EN;
>
next prev parent reply other threads:[~2021-09-24 11:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 8:28 [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91 Claudiu Beznea
2021-09-24 8:28 ` [PATCH v2 1/2] mmc: sdhci-of-at91: wait for calibration done before proceed Claudiu Beznea
2021-09-24 11:34 ` Adrian Hunter
2021-09-24 8:28 ` [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with read_poll_timeout Claudiu Beznea
2021-09-24 11:34 ` Adrian Hunter [this message]
2021-09-27 22:31 ` [PATCH v2 0/2] mmc: sdhci-of-at91: fix for shdci-of-at91 Ulf Hansson
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=10b77993-8ab9-75dc-69e8-2775f8fcc7b1@intel.com \
--to=adrian.hunter@intel.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=eugen.hristev@microchip.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.com \
--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
all inboxes | Powered by JetHome®