[PATCH 2/2] spi: mxs: Terminate DMA in case of DMA timeout

Marek Vasut marex at denx.de
Sat Oct 13 22:32:56 EDT 2012


In case the SPI DMA times out, the DMA might still be in some kind of
inconsistent state. Issue dmaengine_terminate_all() on the particular
channel to kill off all operations before continuing.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Chris Ball <cjb at laptop.org>
Cc: Fabio Estevam <fabio.estevam at freescale.com>
Cc: Grant Likely <grant.likely at secretlab.ca>
Cc: Mark Brown <broonie at opensource.wolfsonmicro.com>
Cc: Shawn Guo <shawn.guo at linaro.org>
---
 drivers/spi/spi-mxs.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 5a63bcd..86dd04d 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -323,6 +323,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs,
 	if (!ret) {
 		dev_err(ssp->dev, "DMA transfer timeout\n");
 		ret = -ETIMEDOUT;
+		dmaengine_terminate_all(ssp->dmach);
 		goto err_vmalloc;
 	}
 
-- 
1.7.10.4




More information about the linux-arm-kernel mailing list