[PATCH] spi: bcm2835: remove timeout code from polling function
kernel at martin.sperl.org
kernel at martin.sperl.org
Tue Apr 14 09:39:44 PDT 2015
From: Martin Sperl <kernel at martin.sperl.org>
The way that the timeout code is written in the polling function
the timeout does also trigger when interrupted/rescheduled while
inside the polling loop.
This removes the code until we have a "better" solution that can also
handle external delays and uses something more exact than jiffies.
Signed-off-by: Martin Sperl <kernel at martin.sperl.org>
---
drivers/spi/spi-bcm2835.c | 12 ------------
1 file changed, 12 deletions(-)
This fixes a regression due to the introduction of this polling mode.
See email with detailed observations on the issue.
This patch is an implementation of one of those mentioned options to
fix the issue.
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index f63864a..af29467 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -164,28 +164,16 @@ static int bcm2835_spi_transfer_one_poll(struct spi_master *master,
unsigned long xfer_time_us)
{
struct bcm2835_spi *bs = spi_master_get_devdata(master);
- unsigned long timeout = jiffies +
- max(4 * xfer_time_us * HZ / 1000000, 2uL);
/* enable HW block without interrupts */
bcm2835_wr(bs, BCM2835_SPI_CS, cs | BCM2835_SPI_CS_TA);
- /* set timeout to 4x the expected time, or 2 jiffies */
/* loop until finished the transfer */
while (bs->rx_len) {
/* read from fifo as much as possible */
bcm2835_rd_fifo(bs);
/* fill in tx fifo as much as possible */
bcm2835_wr_fifo(bs);
- /* if we still expect some data after the read,
- * check for a possible timeout
- */
- if (bs->rx_len && time_after(jiffies, timeout)) {
- /* Transfer complete - reset SPI HW */
- bcm2835_spi_reset_hw(master);
- /* and return timeout */
- return -ETIMEDOUT;
- }
}
/* Transfer complete - reset SPI HW */
--
1.7.10.4
More information about the linux-rpi-kernel
mailing list