summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMartin Sperl <kernel@martin.sperl.org>2015-04-16 21:18:47 +0100
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:12:32 +0100
commit48e908ced6de576001380124c34e0105fe4790ca (patch)
tree7f8ac59fd512c786355840acc73bb3f2691236f9 /drivers
parentbe9d7796df81800f24ade24313cd9c7de0d81bf1 (diff)
downloadlinux-48e908ced6de576001380124c34e0105fe4790ca.tar.gz
spi: bcm2835: change timeout of polling driver to 1s
The way that the timeout code is written in the polling function the timeout does also trigger when interrupted or rescheduled while in the polling loop. This patch changes the timeout from effectively 20ms (=2 jiffies) to 1 second and removes the time that the transfer really takes out of the computation, as - per design - this is <30us and the jiffie resolution is 10ms so that does not make any difference what so ever. Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-bcm2835.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 44ee1f39c6da..1a915e5526dd 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -164,13 +164,12 @@ 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);
+ /* set timeout to 1 second of maximum polling */
+ unsigned long timeout = jiffies + HZ;
/* 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 */