[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260201165817.53-3-sanjaikumar.vs@dicortech.com>
Date: Sun, 1 Feb 2026 16:58:17 +0000
From: Sanjaikumar V S <sanjaikumarvs@...il.com>
To: tudor.ambarus@...aro.org,
pratyush@...nel.org,
michael.walle@...nel.org
Cc: linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Sanjaikumar V S <sanjaikumar.vs@...ortech.com>,
stable@...r.kernel.org
Subject: [PATCH 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available
When the SPI controller does not support direct mapping (nodirmap=true),
spi_nor_spimem_write_data() calls spi_mem_dirmap_write() which falls
back to spi_mem_no_dirmap_write(). This fallback uses the operation
template created at probe time with the standard page program opcode.
For SST flashes using AAI mode, this fails because the template cannot
handle the dynamic opcode and address byte changes required by AAI.
Fix by checking nodirmap and using spi_nor_spimem_exec_op() directly,
which uses the runtime-built operation with correct AAI configuration.
Cc: stable@...r.kernel.org
Signed-off-by: Sanjaikumar V S <sanjaikumar.vs@...ortech.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 d3f8a78efd3b..7caeb508d628 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 {
--
2.43.0
Powered by blists - more mailing lists