summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorApurva Nandan <a-nandan@ti.com>2023-01-23 23:13:14 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-01-25 14:10:19 -0600
commit87850d1ee1a6135d0f3577fae1244d7379b21400 (patch)
tree3f42b57d7fbbe3ce407185c6c6dc0b0f9472c008 /include
parent55bcd524ac17f05789d704a109da9890e651e222 (diff)
spi: spi-mem: Add DTR templates for cmd, address, dummy and data phase
Setting dtr field of spi_mem_op is used when creating templates for DTR ops in spinand.h. Also, 2 bytes cmd phases are required when operating in Octal DTR SPI mode. Create new templates for dtr mode cmd, address, dummy and data phase in spi_mem_op, to set the dtr field to 1 and also allow passing the nbytes for the cmd phase. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/spi-mem.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/include/spi-mem.h b/include/spi-mem.h
index 1719fe0820..8255c54c6e 100644
--- a/include/spi-mem.h
+++ b/include/spi-mem.h
@@ -13,44 +13,59 @@
struct udevice;
-#define SPI_MEM_OP_CMD(__opcode, __buswidth) \
+#define SPI_MEM_OP_DTR .dtr = 1
+
+#define SPI_MEM_OP_CMD(__opcode, __buswidth, ...) \
{ \
.buswidth = __buswidth, \
.opcode = __opcode, \
.nbytes = 1, \
+ __VA_ARGS__ \
+ }
+
+#define SPI_MEM_OP_EXT_CMD(__nbytes, __opcode, __buswidth, ...) \
+ { \
+ .buswidth = __buswidth, \
+ .opcode = __opcode, \
+ .nbytes = __nbytes, \
+ __VA_ARGS__ \
}
-#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \
+#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth, ...) \
{ \
.nbytes = __nbytes, \
.val = __val, \
.buswidth = __buswidth, \
+ __VA_ARGS__ \
}
#define SPI_MEM_OP_NO_ADDR { }
-#define SPI_MEM_OP_DUMMY(__nbytes, __buswidth) \
+#define SPI_MEM_OP_DUMMY(__nbytes, __buswidth, ...) \
{ \
.nbytes = __nbytes, \
.buswidth = __buswidth, \
+ __VA_ARGS__ \
}
#define SPI_MEM_OP_NO_DUMMY { }
-#define SPI_MEM_OP_DATA_IN(__nbytes, __buf, __buswidth) \
+#define SPI_MEM_OP_DATA_IN(__nbytes, __buf, __buswidth, ...) \
{ \
.dir = SPI_MEM_DATA_IN, \
.nbytes = __nbytes, \
.buf.in = __buf, \
.buswidth = __buswidth, \
+ __VA_ARGS__ \
}
-#define SPI_MEM_OP_DATA_OUT(__nbytes, __buf, __buswidth) \
+#define SPI_MEM_OP_DATA_OUT(__nbytes, __buf, __buswidth, ...) \
{ \
.dir = SPI_MEM_DATA_OUT, \
.nbytes = __nbytes, \
.buf.out = __buf, \
.buswidth = __buswidth, \
+ __VA_ARGS__ \
}
#define SPI_MEM_OP_NO_DATA { }