summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/sdhci-xenon.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2018-12-10 10:56:26 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2018-12-17 08:26:24 +0100
commit0e6e7c2ff397e1bbebc882ca3132148aaaef1ddd (patch)
tree63666dc6b772877057e7f6be8013c7a77fb2331f /drivers/mmc/host/sdhci-xenon.c
parent9f0ea0bda1d06120b053bb0c283f54afec59293d (diff)
mmc: sdhci-xenon: Fix timeout checks
Always check the wait condition before returning timeout. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Zhoujie Wu <zjwu@marvell.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/sdhci-xenon.c')
-rw-r--r--drivers/mmc/host/sdhci-xenon.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 4d0791f6ec23..a0b5089b3274 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -34,9 +34,13 @@ static int xenon_enable_internal_clk(struct sdhci_host *host)
sdhci_writel(host, reg, SDHCI_CLOCK_CONTROL);
/* Wait max 20 ms */
timeout = ktime_add_ms(ktime_get(), 20);
- while (!((reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
- & SDHCI_CLOCK_INT_STABLE)) {
- if (ktime_after(ktime_get(), timeout)) {
+ while (1) {
+ bool timedout = ktime_after(ktime_get(), timeout);
+
+ reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+ if (reg & SDHCI_CLOCK_INT_STABLE)
+ break;
+ if (timedout) {
dev_err(mmc_dev(host->mmc), "Internal clock never stabilised.\n");
return -ETIMEDOUT;
}