Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Haibo Chen <haibo.chen@nxp.com>
Cc: Han Xu <han.xu@nxp.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-spi@vger.kernel.org, imx@lists.linux.dev,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/2] spi: add driver for NXP XSPI controller
Date: Mon, 17 Nov 2025 17:25:55 +0000	[thread overview]
Message-ID: <aRtao9FoPug78T93@sirena.co.uk> (raw)
In-Reply-To: <20251117-xspi-v2-2-e651323993fe@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]

On Mon, Nov 17, 2025 at 07:04:25PM +0800, Haibo Chen wrote:

> Add driver support for NXP XSPI controller.
> 
> XSPI is a flexsible SPI host controller which supports up to
> 2 external devices (2 CS). It support Single/Dual/Quad/Octal
> mode data transfer.

This looks pretty good, a couple of small points:

> +static irqreturn_t nxp_xspi_irq_handler(int irq, void *dev_id)
> +{
> +	struct nxp_xspi *xspi = dev_id;
> +	u32 reg;
> +
> +	/* Clear interrupt */
> +	reg = readl(xspi->iobase + XSPI_FR);
> +	writel(XSPI_FR_TFF, xspi->iobase + XSPI_FR);
> +
> +	if (reg & XSPI_FR_TFF)
> +		complete(&xspi->c);
> +
> +	return IRQ_HANDLED;
> +}

This just unconditionally acks interrupts without checking if there was
actually anything there - that means that if some design shares the
interrupt or it spuriously fires then the interrupt core won't handle
things properly.  The driver should really return IRQ_NONE if there is
no interrupt pending.

> +		WARN_ON(!(reg & XSPI_FR_TBFF));
> +		if (i == ALIGN_DOWN(op->data.nbytes, 4)) {
> +			/* Use 0xFF for extra bytes */
> +			left = 0xFFFFFFFF;
> +			/* The last 1 to 3 bytes */
> +			memcpy((u8 *)&left, buf + i, op->data.nbytes - i);
> +			writel(left, base + XSPI_TBDR);
> +		} else
> +			writel(*(u32 *)(buf + i), base + XSPI_TBDR);

If one side of the if has { } they both should.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2025-11-17 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 11:04 [PATCH v2 0/2] Add support for NXP XSPI Haibo Chen
2025-11-17 11:04 ` [PATCH v2 1/2] dt-bindings: spi: Document imx94 xspi Haibo Chen
2025-11-17 12:04   ` Krzysztof Kozlowski
2025-11-17 11:04 ` [PATCH v2 2/2] spi: add driver for NXP XSPI controller Haibo Chen
2025-11-17 14:47   ` Marc Kleine-Budde
2025-11-17 17:25   ` Mark Brown [this message]
2025-11-18  2:29     ` Bough Chen
2025-11-17 14:47 ` [PATCH v2 0/2] Add support for NXP XSPI Marc Kleine-Budde
2025-11-18  2:30   ` Bough Chen

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=aRtao9FoPug78T93@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=haibo.chen@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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