Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Cercueil" <paul.cercueil@bootlin.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 2/4] spi: cadence-xspi: Add irq-less support
Date: Wed, 02 Dec 2026 13:33:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-245886@kernel.org> (raw)
In-Reply-To: <20261202132135.470814-3-paul.cercueil@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] spi: cadence-xspi: uncleared SDMA error bit in
  cdns_xspi_is_sdma_ready()
--

commit b91e40d7ac9f80d3f34f93797643594a93cbc82d
Author: Tanmay Jagdale <tanmay@marvell.com>

spi: cadence-xspi: Add irq-less support

This commit makes the interrupt line optional in spi-cadence-xspi and
falls back to polling cdns_xspi_is_sdma_ready() and
cdns_xspi_is_stig_ready() when no IRQ is provided.

> diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
> index f5106df933552..4a5376e495c6a 100644
> --- a/drivers/spi/spi-cadence-xspi.c
> +++ b/drivers/spi/spi-cadence-xspi.c
[ ... ]
> @@ -687,7 +690,8 @@ static int cdns_xspi_send_stig_command(struct cdns_xspi_dev *cdns_xspi,
>  
>  	reinit_completion(&cdns_xspi->cmd_complete);
>  	reinit_completion(&cdns_xspi->sdma_complete);
> -	cdns_xspi->set_interrupts_handler(cdns_xspi, true);
> +	if (cdns_xspi->irq >= 0)
> +		cdns_xspi->set_interrupts_handler(cdns_xspi, true);
>  	cdns_xspi->sdma_error = false;
>  
>  	memset(cmd_regs, 0, sizeof(cmd_regs));
> @@ -716,20 +720,29 @@ static int cdns_xspi_send_stig_command(struct cdns_xspi_dev *cdns_xspi,
>  
>  		cdns_xspi_trigger_command(cdns_xspi, cmd_regs);
>  
> -		wait_for_completion(&cdns_xspi->sdma_complete);
> -		if (cdns_xspi->sdma_error) {
> -			cdns_xspi->set_interrupts_handler(cdns_xspi, false);
> +		if (cdns_xspi->irq >= 0) {
> +			wait_for_completion(&cdns_xspi->sdma_complete);
> +			if (cdns_xspi->sdma_error) {
> +				cdns_xspi->set_interrupts_handler(cdns_xspi, false);
> +				return -EIO;
> +			}
> +		} else if (!cdns_xspi_is_sdma_ready(cdns_xspi, true)) {
>  			return -EIO;
>  		}

[Severity: Medium]
Does cdns_xspi_is_sdma_ready() leave CDNS_XSPI_SDMA_ERROR latched in
CDNS_XSPI_INTR_STATUS_REG when a Slave DMA error occurs?

drivers/spi/spi-cadence-xspi.c:cdns_xspi_is_sdma_ready() {
	...
	if (ctrl_stat & CDNS_XSPI_SDMA_ERROR) {
		dev_err(cdns_xspi->dev, "Slave DMA transaction error\n");
		return false;
	}

	/* Clear the flag */
	writel(CDNS_XSPI_SDMA_TRIGGER,
	       cdns_xspi->iobase + CDNS_XSPI_INTR_STATUS_REG);
	...
}

CDNS_XSPI_INTR_STATUS_REG is write-1-to-clear.  In IRQ mode,
cdns_xspi_irq_handler() writes irq_status back to
CDNS_XSPI_INTR_STATUS_REG, clearing CDNS_XSPI_SDMA_ERROR.  In IRQ-less
mode, nothing clears CDNS_XSPI_INTR_STATUS_REG between commands, so once
CDNS_XSPI_SDMA_ERROR is set, every subsequent cdns_xspi_is_sdma_ready()
call will immediately see the stale error bit and fail with -EIO.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202132135.470814-1-paul.cercueil@bootlin.com?part=2

  reply	other threads:[~2026-12-02 13:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 13:21 [PATCH v5 0/4] spi: cadence-xspi: Add support for panic mem writes Paul Cercueil
2026-12-02 13:21 ` [PATCH v5 1/4] spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready() Paul Cercueil
2026-12-02 13:27   ` sashiko-bot
2026-12-02 13:21 ` [PATCH v5 2/4] spi: cadence-xspi: Add irq-less support Paul Cercueil
2026-12-02 13:33   ` sashiko-bot [this message]
2026-12-02 13:21 ` [PATCH v5 3/4] spi: cadence-xspi: Add support for panic writes Paul Cercueil
2026-12-02 13:31   ` sashiko-bot
2026-12-02 13:21 ` [PATCH v5 4/4] spi: dt-bindings: cadence: Make XSPI's IRQ line optional Paul Cercueil

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=sashiko-outbox-245886@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=paul.cercueil@bootlin.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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