spi: omap2-mcspi: Switch to readl_poll_timeout()

Use standard readl_poll_timeout() macro for polling on status bits.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Vignesh R 2018-10-15 12:08:27 +05:30 committed by Mark Brown
parent c530cd1d9d
commit 13d515c796
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 3 additions and 12 deletions

View File

@ -33,6 +33,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/gcd.h>
#include <linux/iopoll.h>
#include <linux/spi/spi.h>
#include <linux/gpio.h>
@ -353,19 +354,9 @@ disable_fifo:
static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit)
{
unsigned long timeout;
u32 val;
timeout = jiffies + msecs_to_jiffies(1000);
while (!(readl_relaxed(reg) & bit)) {
if (time_after(jiffies, timeout)) {
if (!(readl_relaxed(reg) & bit))
return -ETIMEDOUT;
else
return 0;
}
cpu_relax();
}
return 0;
return readl_poll_timeout(reg, val, val & bit, 1, MSEC_PER_SEC);
}
static void omap2_mcspi_rx_callback(void *data)