Skip to content

Commit f79ee9e

Browse files
miquelraynalbroonie
authored andcommitted
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>
1 parent 5e75c1d commit f79ee9e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

include/linux/spi/spi-mem.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
.dtr = true, \
2929
}
3030

31+
#define SPI_MEM_DTR_OP_PACKED_CMD(__opcode, __addr, __buswidth) \
32+
{ \
33+
.nbytes = 2, \
34+
.opcode = __opcode << 8 | __addr, \
35+
.buswidth = __buswidth, \
36+
.dtr = true, \
37+
}
38+
3139
#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \
3240
{ \
3341
.nbytes = __nbytes, \

0 commit comments

Comments
 (0)