Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 185ecd35 authored by Vipin Deep Kaur's avatar Vipin Deep Kaur
Browse files

spi: spi-geni-qcom: Reset the dma engine on failure



On a DMA transfer timeout failure, reset the TX/RX DMA
engines to avoid any SMMU fault caused as a consequence
of the DMA engine getting restarted and trying to access
the unmapped buffer addresses.

Change-Id: Ic2f637b3a90dc63a27d2b2f53442ac071a56337c
Signed-off-by: default avatarVipin Deep Kaur <vkaur@codeaurora.org>
parent 3423e083
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -1108,13 +1108,31 @@ static void handle_fifo_timeout(struct spi_geni_master *mas,
				"Failed to cancel/abort m_cmd\n");
	}
	if (mas->cur_xfer_mode == SE_DMA) {
		if (xfer->tx_buf)
		if (xfer->tx_buf) {
			reinit_completion(&mas->xfer_done);
			writel_relaxed(1, mas->base +
				SE_DMA_TX_FSM_RST);
			timeout =
			wait_for_completion_timeout(&mas->xfer_done, HZ);
			if (!timeout)
				dev_err(mas->dev,
					"DMA TX RESET failed\n");
			geni_se_tx_dma_unprep(mas->wrapper_dev,
				xfer->tx_dma, xfer->len);
		if (xfer->rx_buf)
		}
		if (xfer->rx_buf) {
			reinit_completion(&mas->xfer_done);
			writel_relaxed(1, mas->base +
				SE_DMA_RX_FSM_RST);
			timeout =
			wait_for_completion_timeout(&mas->xfer_done, HZ);
			if (!timeout)
				dev_err(mas->dev,
					"DMA RX RESET failed\n");
			geni_se_rx_dma_unprep(mas->wrapper_dev,
				xfer->rx_dma, xfer->len);
		}
	}

}