summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2026-04-10 20:41:02 +0300
committerMark Brown <broonie@kernel.org>2026-04-11 13:53:54 +0300
commitf79ee9e4b23244e77b28d176ce99a2d84d813ac5 (patch)
tree426a2b5160a2bed392a1aed13e9eeae2e1957c99
parent5e75c1d4d386fb7d64e2b19355e4d38dd4fd8845 (diff)
downloadlinux-f79ee9e4b23244e77b28d176ce99a2d84d813ac5.tar.xz
spi: spi-mem: Add a packed command operation
Instead of repeating the command opcode twice, some flash devices try to pack command and address bits. In this case, the second opcode byte being sent (LSB) is free to be used. The input data must be ANDed to only provide the relevant bits. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20260410-winbond-6-19-rc1-oddr-v1-2-2ac4827a3868@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/linux/spi/spi-mem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index 37f709784350..c8e207522223 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -28,6 +28,14 @@
.dtr = true, \
}
+#define SPI_MEM_DTR_OP_PACKED_CMD(__opcode, __addr, __buswidth) \
+ { \
+ .nbytes = 2, \
+ .opcode = __opcode << 8 | __addr, \
+ .buswidth = __buswidth, \
+ .dtr = true, \
+ }
+
#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \
{ \
.nbytes = __nbytes, \