[PATCH v4 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available
Sanjaikumar V S
sanjaikumarvs at gmail.com
Wed Mar 11 03:30:57 PDT 2026
From: Sanjaikumar V S <sanjaikumar.vs at 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.
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 at vger.kernel.org
Signed-off-by: Sanjaikumar V S <sanjaikumar.vs at 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 {
--
2.43.0
More information about the linux-mtd
mailing list