All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: Sanjaikumar V S <sanjaikumarvs@gmail.com>
Cc: mwalle@kernel.org,  linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,  miquel.raynal@bootlin.com,
	pratyush@kernel.org,  richard@nod.at,
	 sanjaikumar.vs@dicortech.com, stable@vger.kernel.org,
	 tudor.ambarus@linaro.org,  vigneshr@ti.com
Subject: Re: [PATCH v4 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available
Date: Mon, 30 Mar 2026 14:23:25 +0000	[thread overview]
Message-ID: <2vxz1ph11jmq.fsf@kernel.org> (raw)
In-Reply-To: <20260311103057.29-3-sanjaikumarvs@gmail.com> (Sanjaikumar V. S.'s message of "Wed, 11 Mar 2026 10:30:57 +0000")

On Wed, Mar 11 2026, Sanjaikumar V S wrote:

> From: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
>
> When the SPI controller lacks direct mapping support, the fallback path
> in spi_nor_spimem_write_data() uses nor->write_proto based operation
> template. However, this template uses the standard page program opcode
> set during probe, not the AAI opcode required for SST flash.

But if the controller does support direct mapping, won't it end up using
the wrong opcode? Would it be a better idea to update the dirmap_info
with the right opcodes?

>
> Add check for nodirmap flag to ensure the code falls through to
> spi_nor_spimem_exec_op() path which builds the operation at runtime
> with the correct program_opcode set by sst_nor_write_data().
>
> Fixes: df5c21002cf4 ("mtd: spi-nor: use spi-mem dirmap API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
> ---
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 8ffeb41c3e08..cb7f4d447156 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -281,7 +281,7 @@ static ssize_t spi_nor_spimem_write_data(struct spi_nor *nor, loff_t to,
>  	if (spi_nor_spimem_bounce(nor, &op))
>  		memcpy(nor->bouncebuf, buf, op.data.nbytes);
>  
> -	if (nor->dirmap.wdesc) {
> +	if (nor->dirmap.wdesc && !nor->dirmap.wdesc->nodirmap) {
>  		nbytes = spi_mem_dirmap_write(nor->dirmap.wdesc, op.addr.val,
>  					      op.data.nbytes, op.data.buf.out);
>  	} else {

-- 
Regards,
Pratyush Yadav

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

WARNING: multiple messages have this Message-ID (diff)
From: Pratyush Yadav <pratyush@kernel.org>
To: Sanjaikumar V S <sanjaikumarvs@gmail.com>
Cc: mwalle@kernel.org,  linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,  miquel.raynal@bootlin.com,
	pratyush@kernel.org,  richard@nod.at,
	 sanjaikumar.vs@dicortech.com, stable@vger.kernel.org,
	 tudor.ambarus@linaro.org,  vigneshr@ti.com
Subject: Re: [PATCH v4 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available
Date: Mon, 30 Mar 2026 14:23:25 +0000	[thread overview]
Message-ID: <2vxz1ph11jmq.fsf@kernel.org> (raw)
In-Reply-To: <20260311103057.29-3-sanjaikumarvs@gmail.com> (Sanjaikumar V. S.'s message of "Wed, 11 Mar 2026 10:30:57 +0000")

On Wed, Mar 11 2026, Sanjaikumar V S wrote:

> From: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
>
> When the SPI controller lacks direct mapping support, the fallback path
> in spi_nor_spimem_write_data() uses nor->write_proto based operation
> template. However, this template uses the standard page program opcode
> set during probe, not the AAI opcode required for SST flash.

But if the controller does support direct mapping, won't it end up using
the wrong opcode? Would it be a better idea to update the dirmap_info
with the right opcodes?

>
> Add check for nodirmap flag to ensure the code falls through to
> spi_nor_spimem_exec_op() path which builds the operation at runtime
> with the correct program_opcode set by sst_nor_write_data().
>
> Fixes: df5c21002cf4 ("mtd: spi-nor: use spi-mem dirmap API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
> ---
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 8ffeb41c3e08..cb7f4d447156 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -281,7 +281,7 @@ static ssize_t spi_nor_spimem_write_data(struct spi_nor *nor, loff_t to,
>  	if (spi_nor_spimem_bounce(nor, &op))
>  		memcpy(nor->bouncebuf, buf, op.data.nbytes);
>  
> -	if (nor->dirmap.wdesc) {
> +	if (nor->dirmap.wdesc && !nor->dirmap.wdesc->nodirmap) {
>  		nbytes = spi_mem_dirmap_write(nor->dirmap.wdesc, op.addr.val,
>  					      op.data.nbytes, op.data.buf.out);
>  	} else {

-- 
Regards,
Pratyush Yadav

  parent reply	other threads:[~2026-03-30 14:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 10:30 [PATCH v4 0/2] mtd: spi-nor: Fix SST AAI write mode Sanjaikumar V S
2026-03-11 10:30 ` Sanjaikumar V S
2026-03-11 10:30 ` [PATCH v4 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence Sanjaikumar V S
2026-03-11 10:30   ` Sanjaikumar V S
2026-03-16 13:44   ` Hendrik Donner
2026-03-16 13:44     ` Hendrik Donner
2026-03-30 14:21   ` Pratyush Yadav
2026-03-30 14:21     ` Pratyush Yadav
2026-03-11 10:30 ` [PATCH v4 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available Sanjaikumar V S
2026-03-11 10:30   ` Sanjaikumar V S
2026-03-16 13:44   ` Hendrik Donner
2026-03-16 13:44     ` Hendrik Donner
2026-03-30 14:23   ` Pratyush Yadav [this message]
2026-03-30 14:23     ` Pratyush Yadav
2026-03-31  6:24     ` Sanjaikumar V S
2026-03-31  6:24       ` Sanjaikumar V S
2026-03-30  7:31 ` [PATCH v4 0/2] mtd: spi-nor: Fix SST AAI write mode Sanjaikumar V S
2026-03-30  7:31   ` Sanjaikumar V S
2026-03-30 14:25   ` Pratyush Yadav
2026-03-30 14:25     ` Pratyush Yadav

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=2vxz1ph11jmq.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=richard@nod.at \
    --cc=sanjaikumar.vs@dicortech.com \
    --cc=sanjaikumarvs@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tudor.ambarus@linaro.org \
    --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.