Skip to content

Commit 96e0416

Browse files
ptalari27broonie
authored andcommitted
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: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260204162854.1206323-3-praveen.talari@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5046449 commit 96e0416

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

drivers/spi/spi-geni-qcom.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,20 @@ static void handle_se_timeout(struct spi_controller *spi,
161161
xfer = mas->cur_xfer;
162162
mas->cur_xfer = NULL;
163163

164-
if (spi->target) {
165-
/*
166-
* skip CMD Cancel sequnece since spi target
167-
* doesn`t support CMD Cancel sequnece
168-
*/
164+
/* The controller doesn't support the Cancel commnand in target mode */
165+
if (!spi->target) {
166+
reinit_completion(&mas->cancel_done);
167+
geni_se_cancel_m_cmd(se);
168+
169169
spin_unlock_irq(&mas->lock);
170-
goto reset_if_dma;
171-
}
172170

173-
reinit_completion(&mas->cancel_done);
174-
geni_se_cancel_m_cmd(se);
175-
spin_unlock_irq(&mas->lock);
171+
time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
172+
if (time_left)
173+
goto reset_if_dma;
176174

177-
time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
178-
if (time_left)
179-
goto reset_if_dma;
175+
spin_lock_irq(&mas->lock);
176+
}
180177

181-
spin_lock_irq(&mas->lock);
182178
reinit_completion(&mas->abort_done);
183179
geni_se_abort_m_cmd(se);
184180
spin_unlock_irq(&mas->lock);

0 commit comments

Comments
 (0)