All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>,
	"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Steam Lin" <STLin2@winbond.com>,
	"Santhosh Kumar K" <s-k6@ti.com>
Subject: Re: [PATCH 1/4] spi: spi-mem: Add a no_cs_assertion capability
Date: Wed, 10 Jun 2026 09:00:56 +0200	[thread overview]
Message-ID: <DJ56CDMRVFQ6.FOZRIQTF3VDW@kernel.org> (raw)
In-Reply-To: <20260326-winbond-v7-0-rc1-cadence-cont-read-v1-1-0d626e1dfb2b@bootlin.com>

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

Hi,

On Thu Mar 26, 2026 at 5:47 PM CET, Miquel Raynal wrote:
> Some controllers are 'smart', and that's a problem.
>
> For instance, the Cadence quadspi controller is capable of deasserting
> the CS automatically whenever a too long period of time without any data
> to transfer elapses.
>
> This 'feature' combined with a loaded interconnect with arbitration, a
> "long" transfer may be split into smaller DMA transfers. In this case
> the controller may allow itself to deassert the CS between chunks.
>
> Deasserting the CS stops any ongoing continuous read. Reasserting it
> later to continue the reading will only result in the host getting
> garbage.
>
> In this case, the host controller driver has no control over the CS
> state, so we cannot reliably enable continuous reads. Flag this
> limitation through a spi-mem controller capability.
>
> The inversion in the flag name (starting with 'no_') is voluntary, in
> order to avoid the need to set this flag in all controller drivers. Only
> the broken controllers shall set this bit, the default being that the
> controller masters its CS fully.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> I am open to suggestions regarding the naming of this flag.
> ---
>  include/linux/spi/spi-mem.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
> index bd2a73d46980..de153719a08e 100644
> --- a/include/linux/spi/spi-mem.h
> +++ b/include/linux/spi/spi-mem.h
> @@ -373,7 +373,10 @@ struct spi_controller_mem_ops {
>   * @swap16: Supports swapping bytes on a 16 bit boundary when configured in
>   *	    Octal DTR
>   * @per_op_freq: Supports per operation frequency switching
> - * @secondary_op_tmpl: Supports leveraging a secondary memory operation template

Is that removal intentional? Looks like a mistake.

-michael

> + * @no_cs_assertion: The controller may automatically deassert the CS if there
> + *                   is a pause in the transfer (eg. internal bus contention or
> + *                   DMA arbitration on an interconnect). Features such as NAND
> + *                   continuous reads shall not be leveraged.
>   */
>  struct spi_controller_mem_caps {
>  	bool dtr;
> @@ -381,6 +384,7 @@ struct spi_controller_mem_caps {
>  	bool swap16;
>  	bool per_op_freq;
>  	bool secondary_op_tmpl;
> +	bool no_cs_assertion;
>  };
>  
>  #define spi_mem_controller_is_capable(ctlr, cap)	\


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

WARNING: multiple messages have this Message-ID (diff)
From: "Michael Walle" <mwalle@kernel.org>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>,
	"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Steam Lin" <STLin2@winbond.com>,
	"Santhosh Kumar K" <s-k6@ti.com>
Subject: Re: [PATCH 1/4] spi: spi-mem: Add a no_cs_assertion capability
Date: Wed, 10 Jun 2026 09:00:56 +0200	[thread overview]
Message-ID: <DJ56CDMRVFQ6.FOZRIQTF3VDW@kernel.org> (raw)
In-Reply-To: <20260326-winbond-v7-0-rc1-cadence-cont-read-v1-1-0d626e1dfb2b@bootlin.com>


[-- Attachment #1.1: Type: text/plain, Size: 2532 bytes --]

Hi,

On Thu Mar 26, 2026 at 5:47 PM CET, Miquel Raynal wrote:
> Some controllers are 'smart', and that's a problem.
>
> For instance, the Cadence quadspi controller is capable of deasserting
> the CS automatically whenever a too long period of time without any data
> to transfer elapses.
>
> This 'feature' combined with a loaded interconnect with arbitration, a
> "long" transfer may be split into smaller DMA transfers. In this case
> the controller may allow itself to deassert the CS between chunks.
>
> Deasserting the CS stops any ongoing continuous read. Reasserting it
> later to continue the reading will only result in the host getting
> garbage.
>
> In this case, the host controller driver has no control over the CS
> state, so we cannot reliably enable continuous reads. Flag this
> limitation through a spi-mem controller capability.
>
> The inversion in the flag name (starting with 'no_') is voluntary, in
> order to avoid the need to set this flag in all controller drivers. Only
> the broken controllers shall set this bit, the default being that the
> controller masters its CS fully.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> I am open to suggestions regarding the naming of this flag.
> ---
>  include/linux/spi/spi-mem.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
> index bd2a73d46980..de153719a08e 100644
> --- a/include/linux/spi/spi-mem.h
> +++ b/include/linux/spi/spi-mem.h
> @@ -373,7 +373,10 @@ struct spi_controller_mem_ops {
>   * @swap16: Supports swapping bytes on a 16 bit boundary when configured in
>   *	    Octal DTR
>   * @per_op_freq: Supports per operation frequency switching
> - * @secondary_op_tmpl: Supports leveraging a secondary memory operation template

Is that removal intentional? Looks like a mistake.

-michael

> + * @no_cs_assertion: The controller may automatically deassert the CS if there
> + *                   is a pause in the transfer (eg. internal bus contention or
> + *                   DMA arbitration on an interconnect). Features such as NAND
> + *                   continuous reads shall not be leveraged.
>   */
>  struct spi_controller_mem_caps {
>  	bool dtr;
> @@ -381,6 +384,7 @@ struct spi_controller_mem_caps {
>  	bool swap16;
>  	bool per_op_freq;
>  	bool secondary_op_tmpl;
> +	bool no_cs_assertion;
>  };
>  
>  #define spi_mem_controller_is_capable(ctlr, cap)	\


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

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2026-06-10  7:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 16:47 [PATCH 0/4] spi: spi-mem/mtd: spinand: Prevent SPI NAND continuous reads on am65/am62 Miquel Raynal
2026-03-26 16:47 ` Miquel Raynal
2026-03-26 16:47 ` [PATCH 1/4] spi: spi-mem: Add a no_cs_assertion capability Miquel Raynal
2026-03-26 16:47   ` Miquel Raynal
2026-04-27 23:46   ` Mark Brown
2026-04-27 23:46     ` Mark Brown
2026-06-10  7:00   ` Michael Walle [this message]
2026-06-10  7:00     ` Michael Walle
2026-03-26 16:47 ` [PATCH 2/4] mtd: spinand: Make sure continuous read is always disabled during probe Miquel Raynal
2026-03-26 16:47   ` Miquel Raynal
2026-03-26 16:47 ` [PATCH 3/4] mtd: spinand: Prevent continuous reads on some controllers Miquel Raynal
2026-03-26 16:47   ` Miquel Raynal
2026-03-26 16:47 ` [PATCH 4/4] spi: cadence-qspi: Prevent SPI NAND continuous reads Miquel Raynal
2026-03-26 16:47   ` Miquel Raynal
2026-06-10  6:03   ` Santhosh Kumar K
2026-06-10  6:03     ` Santhosh Kumar K
2026-04-27 13:28 ` [PATCH 0/4] spi: spi-mem/mtd: spinand: Prevent SPI NAND continuous reads on am65/am62 Miquel Raynal
2026-04-27 13:28   ` Miquel Raynal
2026-04-27 23:45   ` Mark Brown
2026-04-27 23:45     ` Mark Brown
2026-04-28 12:44 ` Miquel Raynal
2026-04-28 12:44   ` Miquel Raynal

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=DJ56CDMRVFQ6.FOZRIQTF3VDW@kernel.org \
    --to=mwalle@kernel.org \
    --cc=STLin2@winbond.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=s-k6@ti.com \
    --cc=takahiro.kuwano@infineon.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.