0093-spi-double-time-out-tolerance.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 833bfade96561216aa2129516a5926a0326860a2 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke@hauke-m.de>
  3. Date: Mon, 17 Apr 2017 01:38:05 +0200
  4. Subject: spi: double time out tolerance
  5. The generic SPI code calculates how long the issued transfer would take
  6. and adds 100ms in addition to the timeout as tolerance. On my 500 MHz
  7. Lantiq Mips SoC I am getting timeouts from the SPI like this when the
  8. system boots up:
  9. m25p80 spi32766.4: SPI transfer timed out
  10. blk_update_request: I/O error, dev mtdblock3, sector 2
  11. SQUASHFS error: squashfs_read_data failed to read block 0x6e
  12. After increasing the tolerance for the timeout to 200ms I haven't seen
  13. these SPI transfer time outs any more.
  14. The Lantiq SPI driver in use here has an extra work queue in between,
  15. which gets triggered when the controller send the last word and the
  16. hardware FIFOs used for reading and writing are only 8 words long.
  17. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  18. Signed-off-by: Mark Brown <broonie@kernel.org>
  19. ---
  20. drivers/spi/spi.c | 2 +-
  21. 1 file changed, 1 insertion(+), 1 deletion(-)
  22. --- a/drivers/spi/spi.c
  23. +++ b/drivers/spi/spi.c
  24. @@ -1004,7 +1004,7 @@ static int spi_transfer_one_message(stru
  25. ret = 0;
  26. ms = 8LL * 1000LL * xfer->len;
  27. do_div(ms, xfer->speed_hz);
  28. - ms += ms + 100; /* some tolerance */
  29. + ms += ms + 200; /* some tolerance */
  30. if (ms > UINT_MAX)
  31. ms = UINT_MAX;