Devicetree
 help / color / mirror / Atom feed
From: Paul Cercueil <paul.cercueil@bootlin.com>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Kees Cook <kees@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Tanmay Jagdale <tanmay@marvell.com>,
	Paul Cercueil <paul.cercueil@bootlin.com>
Subject: [PATCH v6 1/4] spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready()
Date: Thu,  3 Dec 2026 10:11:09 +0100	[thread overview]
Message-ID: <20261203091112.9449-2-paul.cercueil@bootlin.com> (raw)
In-Reply-To: <20261203091112.9449-1-paul.cercueil@bootlin.com>

From: Tanmay Jagdale <tanmay@marvell.com>

Handle SDMA transfer errors reported by the hardware in
cdns_xspi_is_dma_ready(). When a transfer error is found, just print an
error message and return false.

Signed-off-by: Tanmay Jagdale <tanmay@marvell.com>
Co-developed-by: Paul Cercueil <paul.cercueil@bootlin.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---

Changelog:

v6: Return SDMA transfer error after cleaning the IRQ flag, and also
    clear the CDNS_XSPI_SDMA_ERROR IRQ flag.

v5: New patch
---
 drivers/spi/spi-cadence-xspi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
index a42fab719b7a..d041f90321f6 100644
--- a/drivers/spi/spi-cadence-xspi.c
+++ b/drivers/spi/spi-cadence-xspi.c
@@ -1236,16 +1236,21 @@ static bool cdns_xspi_is_sdma_ready(struct cdns_xspi_dev *cdns_xspi, bool sleep)
 	if (readl_relaxed_poll_timeout
 	    (cdns_xspi->iobase + CDNS_XSPI_INTR_STATUS_REG,
 	     ctrl_stat,
-	     (ctrl_stat & CDNS_XSPI_SDMA_TRIGGER),
+	     ctrl_stat & (CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR),
 	     sleep ? MRVL_XSPI_POLL_DELAY_US : 0,
 	     sleep ? MRVL_XSPI_POLL_TIMEOUT_US : 0)) {
 		return false;
 	}
 
 	/* Clear the flag */
-	writel(CDNS_XSPI_SDMA_TRIGGER,
+	writel(CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR,
 	       cdns_xspi->iobase + CDNS_XSPI_INTR_STATUS_REG);
 
+	if (ctrl_stat & CDNS_XSPI_SDMA_ERROR) {
+		dev_err(cdns_xspi->dev, "Slave DMA transaction error\n");
+		return false;
+	}
+
 	return true;
 }
 
-- 
2.47.3


  reply	other threads:[~2026-12-03  9:11 UTC|newest]

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

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=20261203091112.9449-2-paul.cercueil@bootlin.com \
    --to=paul.cercueil@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gpiccoli@igalia.com \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sgoutham@marvell.com \
    --cc=tanmay@marvell.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tony.luck@intel.com \
    /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