* [PATCH] spi: sunplus-sp7021: Fix target transfer completion
@ 2026-11-14 17:11 Felix Gu
0 siblings, 0 replies; only message in thread
From: Felix Gu @ 2026-11-14 17:11 UTC (permalink / raw)
To: Li-hao Kuo, Mark Brown; +Cc: linux-spi, linux-kernel, Felix Gu
Target transfers wait on isr_done, but the target IRQ handler completes
target_isr. Consequently, a target interrupt does not wake the transfer
wait.
Use target_isr consistently for both TX and RX, and stop completing
isr_done in target_abort()
Found by code review, no hardware for test.
Fixes: f62ca4e2a863 ("spi: Add spi driver for Sunplus SP7021")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/spi/spi-sunplus-sp7021.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
index 54431c363bbc..c5706f557ce9 100644
--- a/drivers/spi/spi-sunplus-sp7021.c
+++ b/drivers/spi/spi-sunplus-sp7021.c
@@ -113,7 +113,6 @@ static int sp7021_spi_target_abort(struct spi_controller *ctlr)
struct sp7021_spi_ctlr *pspim = spi_controller_get_devdata(ctlr);
complete(&pspim->target_isr);
- complete(&pspim->isr_done);
return 0;
}
@@ -130,7 +129,7 @@ static int sp7021_spi_target_tx(struct spi_device *spi, struct spi_transfer *xfe
value = readl(pspim->s_base + SP7021_DATA_RDY_REG);
value |= SP7021_SLAVE_DATA_RDY;
writel(value, pspim->s_base + SP7021_DATA_RDY_REG);
- if (wait_for_completion_interruptible(&pspim->isr_done)) {
+ if (wait_for_completion_interruptible(&pspim->target_isr)) {
dev_err(&spi->dev, "%s() wait_for_completion err\n", __func__);
return -EINTR;
}
@@ -142,12 +141,12 @@ static int sp7021_spi_target_rx(struct spi_device *spi, struct spi_transfer *xfe
struct sp7021_spi_ctlr *pspim = spi_controller_get_devdata(spi->controller);
u32 value;
- reinit_completion(&pspim->isr_done);
+ reinit_completion(&pspim->target_isr);
value = SP7021_SLAVE_DMA_EN | FIELD_PREP(SP7021_SLAVE_DMA_CMD, 3);
writel(value, pspim->s_base + SP7021_SLAVE_DMA_CTRL_REG);
writel(xfer->len, pspim->s_base + SP7021_SLAVE_DMA_LENGTH_REG);
writel(xfer->rx_dma, pspim->s_base + SP7021_SLAVE_DMA_ADDR_REG);
- if (wait_for_completion_interruptible(&pspim->isr_done)) {
+ if (wait_for_completion_interruptible(&pspim->target_isr)) {
dev_err(&spi->dev, "%s() wait_for_completion err\n", __func__);
return -EINTR;
}
---
base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
change-id: 20261115-sunplus-sp7021-af094801e806
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-14 17:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 17:11 [PATCH] spi: sunplus-sp7021: Fix target transfer completion Felix Gu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®