Skip to content

Commit aa70e56

Browse files
Nobuteru Hayashibroonie
authored andcommitted
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>
1 parent a12ddd6 commit aa70e56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/spi/spi-fsl-espi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
245245
if (ret)
246246
return ret;
247247

248-
wait_for_completion(&mpc8xxx_spi->done);
248+
/* Won't hang up forever, SPI bus sometimes got lost interrupts... */
249+
ret = wait_for_completion_timeout(&mpc8xxx_spi->done, 2 * HZ);
250+
if (ret == 0)
251+
dev_err(mpc8xxx_spi->dev,
252+
"Transaction hanging up (left %d bytes)\n",
253+
mpc8xxx_spi->count);
249254

250255
/* disable rx ints */
251256
mpc8xxx_spi_write_reg(&reg_base->mask, 0);

0 commit comments

Comments
 (0)