summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuteru Hayashi <hayashi.nbb@ncos.nec.co.jp>2016-03-18 14:35:21 +0300
committerMark Brown <broonie@kernel.org>2016-03-28 21:41:18 +0300
commitaa70e567c4f0eeb849c6bcef3685bdf1fc3ca19d (patch)
treeecf0a927a1b369d3e7251ddf0d5d3c33af485034
parenta12ddd60ed0a88c3bb83a8d4c07762e41620bf8c (diff)
downloadlinux-aa70e567c4f0eeb849c6bcef3685bdf1fc3ca19d.tar.xz
spi/fsl-espi: Don't wait transaction completion forever
Because the eSPI driver uses wait_for_completion(), any stuck-able phenomenon at half-way transaction progress made worker task hang up. This phenomenon is perhaps caused by eSPI device errata which seems not to be published from vendor site yet. Anyway, we fix hang task by using fixed 2 seconds timeout that is our preferred value for eSPI maximum transaction size. It seems to be better that eSPI driver can detect this stuck and report error (EMSGSIZE) to the upper device driver because the upper device driver can decide to retry or recover. Signed-off-by: Nobuteru Hayashi <hayashi.nbb@ncos.nec.co.jp> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-fsl-espi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 5d7fb81240cd..64d794b99803 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -245,7 +245,12 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
if (ret)
return ret;
- wait_for_completion(&mpc8xxx_spi->done);
+ /* Won't hang up forever, SPI bus sometimes got lost interrupts... */
+ ret = wait_for_completion_timeout(&mpc8xxx_spi->done, 2 * HZ);
+ if (ret == 0)
+ dev_err(mpc8xxx_spi->dev,
+ "Transaction hanging up (left %d bytes)\n",
+ mpc8xxx_spi->count);
/* disable rx ints */
mpc8xxx_spi_write_reg(&reg_base->mask, 0);