From: Felix Gu <ustc.gu@gmail.com>
To: Li-hao Kuo <lhjeff911@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] spi: sunplus-sp7021: Fix target transfer completion
Date: Sun, 15 Nov 2026 01:11:19 +0800 [thread overview]
Message-ID: <20261115-sunplus-sp7021-v1-1-43d06657fc90@gmail.com> (raw)
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>
reply other threads:[~2026-11-14 17:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115-sunplus-sp7021-v1-1-43d06657fc90@gmail.com \
--to=ustc.gu@gmail.com \
--cc=broonie@kernel.org \
--cc=lhjeff911@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®