Skip to content

Commit f000689

Browse files
miquelraynalbroonie
authored andcommitted
spi: spi-mem: Create macros for DTR operation
We do have macros for defining command, address, dummy and data cycles. We also have a .dtr flag that implies sampling the bus on both edges, but there are currently no macros enabling it. We might make use of such macros, so let's create: - SPI_MEM_DTR_OP_CMD - SPI_MEM_DTR_OP_ADDR - SPI_MEM_DTR_OP_DUMMY - SPI_MEM_DTR_OP_DATA_OUT - SPI_MEM_DTR_OP_DATA_OUT Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-19-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d1f8587 commit f000689

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

include/linux/spi/spi-mem.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@
2020
.opcode = __opcode, \
2121
}
2222

23+
#define SPI_MEM_DTR_OP_CMD(__opcode, __buswidth) \
24+
{ \
25+
.nbytes = 1, \
26+
.opcode = __opcode, \
27+
.buswidth = __buswidth, \
28+
.dtr = true, \
29+
}
30+
2331
#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \
2432
{ \
2533
.nbytes = __nbytes, \
2634
.buswidth = __buswidth, \
2735
.val = __val, \
2836
}
2937

38+
#define SPI_MEM_DTR_OP_ADDR(__nbytes, __val, __buswidth) \
39+
{ \
40+
.nbytes = __nbytes, \
41+
.val = __val, \
42+
.buswidth = __buswidth, \
43+
.dtr = true, \
44+
}
45+
3046
#define SPI_MEM_OP_NO_ADDR { }
3147

3248
#define SPI_MEM_OP_DUMMY(__nbytes, __buswidth) \
@@ -35,6 +51,13 @@
3551
.buswidth = __buswidth, \
3652
}
3753

54+
#define SPI_MEM_DTR_OP_DUMMY(__nbytes, __buswidth) \
55+
{ \
56+
.nbytes = __nbytes, \
57+
.buswidth = __buswidth, \
58+
.dtr = true, \
59+
}
60+
3861
#define SPI_MEM_OP_NO_DUMMY { }
3962

4063
#define SPI_MEM_OP_DATA_IN(__nbytes, __buf, __buswidth) \
@@ -45,6 +68,15 @@
4568
.buf.in = __buf, \
4669
}
4770

71+
#define SPI_MEM_DTR_OP_DATA_IN(__nbytes, __buf, __buswidth) \
72+
{ \
73+
.dir = SPI_MEM_DATA_IN, \
74+
.nbytes = __nbytes, \
75+
.buf.in = __buf, \
76+
.buswidth = __buswidth, \
77+
.dtr = true, \
78+
}
79+
4880
#define SPI_MEM_OP_DATA_OUT(__nbytes, __buf, __buswidth) \
4981
{ \
5082
.buswidth = __buswidth, \
@@ -53,6 +85,15 @@
5385
.buf.out = __buf, \
5486
}
5587

88+
#define SPI_MEM_DTR_OP_DATA_OUT(__nbytes, __buf, __buswidth) \
89+
{ \
90+
.dir = SPI_MEM_DATA_OUT, \
91+
.nbytes = __nbytes, \
92+
.buf.out = __buf, \
93+
.buswidth = __buswidth, \
94+
.dtr = true, \
95+
}
96+
5697
#define SPI_MEM_OP_NO_DATA { }
5798

5899
/**

0 commit comments

Comments
 (0)