Unverified Commit 96e04164 authored by Praveen Talari's avatar Praveen Talari Committed by Mark Brown
Browse files

spi: geni-qcom: Fix abort sequence execution for serial engine errors



The driver currently skips the abort sequence for target mode when serial
engine errors occur. This leads to improper error recovery as the serial
engine may remain in an undefined state without proper cleanup, potentially
causing subsequent operations to fail or behave unpredictably.

Fix this by ensuring the abort sequence and DMA reset always execute during
error recovery, as both are required for proper serial engine error
handling.

Co-developed-by: default avatarKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: default avatarPraveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260204162854.1206323-3-praveen.talari@oss.qualcomm.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 50464497
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -161,17 +161,11 @@ static void handle_se_timeout(struct spi_controller *spi,
	xfer = mas->cur_xfer;
	mas->cur_xfer = NULL;

	if (spi->target) {
		/*
		 * skip CMD Cancel sequnece since spi target
		 * doesn`t support CMD Cancel sequnece
		 */
		spin_unlock_irq(&mas->lock);
		goto reset_if_dma;
	}

	/* The controller doesn't support the Cancel commnand in target mode */
	if (!spi->target) {
		reinit_completion(&mas->cancel_done);
		geni_se_cancel_m_cmd(se);

		spin_unlock_irq(&mas->lock);

		time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
@@ -179,6 +173,8 @@ static void handle_se_timeout(struct spi_controller *spi,
			goto reset_if_dma;

		spin_lock_irq(&mas->lock);
	}

	reinit_completion(&mas->abort_done);
	geni_se_abort_m_cmd(se);
	spin_unlock_irq(&mas->lock);