diff options
author | Jerome Brunet <jbrunet@baylibre.com> | 2019-04-23 05:02:29 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2019-05-06 05:55:39 -0400 |
commit | 98849da63fffdc010dca6e6f6785c2e2ff34e807 (patch) | |
tree | b5c51dab07533936bb72f3a16e33d62e73ae8475 /drivers/mmc | |
parent | 7fc13b879fdd4fec75ffe6cd8770d512c3d6420f (diff) |
mmc: meson-gx: remove open coded read with timeout
There is already a function available to poll a register until a
condition is met. Let's use it instead of open coding it.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/meson-gx-mmc.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 2eba507790e4..2deeacc051b1 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
26 | #include <linux/iopoll.h> | ||
26 | #include <linux/of_device.h> | 27 | #include <linux/of_device.h> |
27 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
28 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
@@ -1100,7 +1101,6 @@ out: | |||
1100 | 1101 | ||
1101 | static int meson_mmc_wait_desc_stop(struct meson_host *host) | 1102 | static int meson_mmc_wait_desc_stop(struct meson_host *host) |
1102 | { | 1103 | { |
1103 | int loop; | ||
1104 | u32 status; | 1104 | u32 status; |
1105 | 1105 | ||
1106 | /* | 1106 | /* |
@@ -1110,20 +1110,10 @@ static int meson_mmc_wait_desc_stop(struct meson_host *host) | |||
1110 | * If we don't confirm the descriptor is stopped, it might raise new | 1110 | * If we don't confirm the descriptor is stopped, it might raise new |
1111 | * IRQs after we have called mmc_request_done() which is bad. | 1111 | * IRQs after we have called mmc_request_done() which is bad. |
1112 | */ | 1112 | */ |
1113 | for (loop = 50; loop; loop--) { | ||
1114 | status = readl(host->regs + SD_EMMC_STATUS); | ||
1115 | if (status & (STATUS_BUSY | STATUS_DESC_BUSY)) | ||
1116 | udelay(100); | ||
1117 | else | ||
1118 | break; | ||
1119 | } | ||
1120 | 1113 | ||
1121 | if (status & (STATUS_BUSY | STATUS_DESC_BUSY)) { | 1114 | return readl_poll_timeout(host->regs + SD_EMMC_STATUS, status, |
1122 | dev_err(host->dev, "Timed out waiting for host to stop\n"); | 1115 | !(status & (STATUS_BUSY | STATUS_DESC_BUSY)), |
1123 | return -ETIMEDOUT; | 1116 | 100, 5000); |
1124 | } | ||
1125 | |||
1126 | return 0; | ||
1127 | } | 1117 | } |
1128 | 1118 | ||
1129 | static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) | 1119 | static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) |