From: Vignesh R <vigneshr@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: <linux-spi@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Vignesh R <vigneshr@ti.com>,
Sekhar Nori <nsekhar@ti.com>
Subject: [PATCH 1/3] spi: omap2-mcspi: Switch to readl_poll_timeout()
Date: Mon, 15 Oct 2018 12:08:27 +0530 [thread overview]
Message-ID: <20181015063829.26978-2-vigneshr@ti.com> (raw)
In-Reply-To: <20181015063829.26978-1-vigneshr@ti.com>
Use standard readl_poll_timeout() macro for polling on status bits.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 17 ++++-------------
1 file 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 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi,
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)
--
2.19.1
next prev parent reply other threads:[~2018-10-15 6:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 6:38 [PATCH 0/3] omap2-mcspi: Add slave mode support Vignesh R
2018-10-15 6:38 ` Vignesh R [this message]
2018-10-19 12:29 ` Applied "spi: omap2-mcspi: Switch to readl_poll_timeout()" to the spi tree Mark Brown
2018-10-15 6:38 ` [PATCH 2/3] spi: omap2-mcspi: Set FIFO DMA trigger level to word length Vignesh R
2018-10-19 12:29 ` Applied "spi: omap2-mcspi: Set FIFO DMA trigger level to word length" to the spi tree Mark Brown
2018-10-15 6:38 ` [PATCH 3/3] spi: omap2-mcspi: Add slave mode support Vignesh R
2018-10-15 8:23 ` Sekhar Nori
2018-10-15 9:42 ` Vignesh R
2018-10-15 10:04 ` Sekhar Nori
2018-10-15 14:56 ` Tony Lindgren
2018-10-19 12:29 ` Applied "spi: omap2-mcspi: Add slave mode support" to the spi tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181015063829.26978-2-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nsekhar@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).