Skip to content

Commit 76ee023

Browse files
msperlbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent b787f68 commit 76ee023

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/spi/spi-bcm2835.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,12 @@ static int bcm2835_spi_transfer_one_poll(struct spi_master *master,
164164
unsigned long xfer_time_us)
165165
{
166166
struct bcm2835_spi *bs = spi_master_get_devdata(master);
167-
unsigned long timeout = jiffies +
168-
max(4 * xfer_time_us * HZ / 1000000, 2uL);
167+
/* set timeout to 1 second of maximum polling */
168+
unsigned long timeout = jiffies + HZ;
169169

170170
/* enable HW block without interrupts */
171171
bcm2835_wr(bs, BCM2835_SPI_CS, cs | BCM2835_SPI_CS_TA);
172172

173-
/* set timeout to 4x the expected time, or 2 jiffies */
174173
/* loop until finished the transfer */
175174
while (bs->rx_len) {
176175
/* read from fifo as much as possible */

0 commit comments

Comments
 (0)