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>
This commit is contained in:
committed by
Ulf Hansson
parent
7fc13b879f
commit
98849da63f
@@ -23,6 +23,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
#include <linux/iopoll.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
@@ -1100,7 +1101,6 @@ out:
|
|||||||
|
|
||||||
static int meson_mmc_wait_desc_stop(struct meson_host *host)
|
static int meson_mmc_wait_desc_stop(struct meson_host *host)
|
||||||
{
|
{
|
||||||
int loop;
|
|
||||||
u32 status;
|
u32 status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1110,20 +1110,10 @@ static int meson_mmc_wait_desc_stop(struct meson_host *host)
|
|||||||
* If we don't confirm the descriptor is stopped, it might raise new
|
* If we don't confirm the descriptor is stopped, it might raise new
|
||||||
* IRQs after we have called mmc_request_done() which is bad.
|
* IRQs after we have called mmc_request_done() which is bad.
|
||||||
*/
|
*/
|
||||||
for (loop = 50; loop; loop--) {
|
|
||||||
status = readl(host->regs + SD_EMMC_STATUS);
|
|
||||||
if (status & (STATUS_BUSY | STATUS_DESC_BUSY))
|
|
||||||
udelay(100);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status & (STATUS_BUSY | STATUS_DESC_BUSY)) {
|
return readl_poll_timeout(host->regs + SD_EMMC_STATUS, status,
|
||||||
dev_err(host->dev, "Timed out waiting for host to stop\n");
|
!(status & (STATUS_BUSY | STATUS_DESC_BUSY)),
|
||||||
return -ETIMEDOUT;
|
100, 5000);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
|
static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user