summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2018-10-15 09:38:27 +0300
committerMark Brown <broonie@kernel.org>2018-10-19 15:32:57 +0300
commit13d515c796adc49a49b0cd2212ccd7f43a37fc5a (patch)
tree2d660ab5092c8371441cfebfa0a2809fd335fb34 /drivers
parentc530cd1d9d5e7741c641c5c366ddb4e23aa5caec (diff)
downloadlinux-13d515c796adc49a49b0cd2212ccd7f43a37fc5a.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 508c61c669e7..985f00d8a964 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -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;
-
- 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;
+ u32 val;
+
+ return readl_poll_timeout(reg, val, val & bit, 1, MSEC_PER_SEC);
}
static void omap2_mcspi_rx_callback(void *data)