]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: spi-mem: Create a repeated address operation
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 9 Jan 2026 17:18:00 +0000 (18:18 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 12 Jan 2026 12:40:29 +0000 (12:40 +0000)
In octal DTR mode addresses may either be long enough to cover at least
two bytes (in which case the existing macro works), or otherwise for
single byte addresses, the byte must also be duplicated and sent twice:
on each front of the clock.

Create a macro for this common case.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20260109-winbond-v6-17-rc1-oddr-v2-2-1fff6a2ddb80@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/spi/spi-mem.h

index 81c9c7e793b6ab894675e0198d412d84b8525c2e..e4db0924898ce5b17d2b6d4269495bb968db2871 100644 (file)
                .dtr = true,                                    \
        }
 
+#define SPI_MEM_DTR_OP_RPT_ADDR(__val, __buswidth)             \
+       {                                                       \
+               .nbytes = 2,                                    \
+               .val = __val | __val << 8,                      \
+               .buswidth = __buswidth,                         \
+               .dtr = true,                                    \
+       }
+
 #define SPI_MEM_OP_NO_ADDR     { }
 
 #define SPI_MEM_OP_DUMMY(__nbytes, __buswidth)                 \