spi: double time out tolerance
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 16 Apr 2017 23:38:05 +0000 (01:38 +0200)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 03:03:01 +0000 (03:03 +0000)
commit42438dff75b9228a70e18d6962045c65f5284dbf
treedfe593056a19a8aa0936565b9f87e574f00057ed
parent3b2c73fa6411841946ef2e3a855718bccb560d4f
spi: double time out tolerance

commit 833bfade96561216aa2129516a5926a0326860a2 upstream.

The generic SPI code calculates how long the issued transfer would take
and adds 100ms in addition to the timeout as tolerance. On my 500 MHz
Lantiq Mips SoC I am getting timeouts from the SPI like this when the
system boots up:

m25p80 spi32766.4: SPI transfer timed out
blk_update_request: I/O error, dev mtdblock3, sector 2
SQUASHFS error: squashfs_read_data failed to read block 0x6e

After increasing the tolerance for the timeout to 200ms I haven't seen
these SPI transfer time outs any more.
The Lantiq SPI driver in use here has an extra work queue in between,
which gets triggered when the controller send the last word and the
hardware FIFOs used for reading and writing are only 8 words long.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi.c