]> git.ipfire.org Git - thirdparty/linux.git/commit
spi: spi-mem: Create a secondary read operation
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 29 Apr 2026 17:56:42 +0000 (19:56 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 4 May 2026 13:02:07 +0000 (15:02 +0200)
commit6f96f2fa152518d93ffeedbea781db50aef7f7dc
tree6cb74020dd4690d9e17988affc37cf081d35db0d
parent39d0ea33123ffe0214217b529830ad91574c8757
spi: spi-mem: Create a secondary read operation

In some situations, direct mappings may need to use different
operation templates.

For instance, when enabling continuous reads, Winbond SPI NANDs no
longer expect address cycles because they would be ignoring them
otherwise. Hence, right after the command opcode, they start counting
dummy cycles, followed by the data cycles as usual.

This breaks the assumptions of "reads from cache" always being done
identically once the best variant has been picked up, across the
lifetime of the system.

In order to support this feature, we must give direct mapping more than
a single operation template to use, in order to switch to using
secondary operations upon request by the upper layer.

Create the concept of optional secondary operation template, which may
or may not be fulfilled by the SPI NAND and SPI NOR cores. If the
underlying SPI controller does not leverage any kind of direct mapping
acceleration, the feature has no impact and can be freely
used. Otherwise, the controller driver needs to opt-in for using this
feature, if supported.

The condition checked to know whether a secondary operation has been
provided or not is to look for a non zero opcode to limit the creation
of extra variables. In practice, the opcode 0x00 exist, but is not
related to any cache related operation.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/spi/spi-mem.c
include/linux/spi/spi-mem.h