Skip to content
/ linux Public

Commit c3ac651

Browse files
ptalari27Sasha Levin
authored andcommitted
spi: geni-qcom: Fix abort sequence execution for serial engine errors
[ Upstream commit 96e0416 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 42068f7 commit c3ac651

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/spi/spi-geni-qcom.c

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

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

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

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

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

0 commit comments

Comments
 (0)