Commit 30d4b990 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Ulf Hansson

mmc: sdhci-of-at91: replace while loop with read_poll_timeout

Replace while loop with read_poll_timeout().
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210924082851.2132068-3-claudiu.beznea@microchip.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent af467fad
...@@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host) ...@@ -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) static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
{ {
u16 clk; u16 clk;
unsigned long timeout;
host->mmc->actual_clock = 0; host->mmc->actual_clock = 0;
...@@ -87,17 +86,12 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -87,17 +86,12 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
/* Wait max 20 ms */ /* Wait max 20 ms */
timeout = 20; if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) 1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
& SDHCI_CLOCK_INT_STABLE)) {
if (timeout == 0) {
pr_err("%s: Internal clock never stabilised.\n", pr_err("%s: Internal clock never stabilised.\n",
mmc_hostname(host->mmc)); mmc_hostname(host->mmc));
return; return;
} }
timeout--;
mdelay(1);
}
clk |= SDHCI_CLOCK_CARD_EN; clk |= SDHCI_CLOCK_CARD_EN;
sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment