[PATCH v5] mtd: spi-nor: Fix SST AAI write mode opcode handling
Michael Walle
mwalle at kernel.org
Fri Sep 11 01:09:27 PDT 2026
On Tue Mar 31, 2026 at 11:50 AM CEST, Sanjaikumar V S wrote:
> 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.
So it looks like that mtd->_write override in sst.c is rather
hacky..
> Additionally, controllers that do support direct mapping will also use
> the wrong opcode since the dirmap template is created at probe time
> with the standard page program opcode.
>
> Fix this by:
> 1. Checking the nodirmap flag in spi_nor_spimem_write_data() to ensure
> the code falls through to spi_nor_spimem_exec_op() path which builds
> the operation at runtime with the correct program_opcode.
> 2. Setting nodirmap=true for SST AAI devices in sst_nor_late_init() to
> disable dirmap and force the runtime opcode path.
I'd be fine with disabling dirmap support as a workaround. But I'm
not sure if we are supposed to change the nodirmap property as that
is a property owned/set by the controller.
Could we just compare the mtd->_write == spi_nor_write and then skip
the dirmap support? With a big here be dragons warning.
-michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20260911/b280bf97/attachment.sig>
More information about the linux-mtd
mailing list