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>
This commit is contained in:
parent
f309f971e0
commit
f72874b1a5
|
|
@ -13,44 +13,59 @@
|
||||||
|
|
||||||
struct udevice;
|
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, \
|
.buswidth = __buswidth, \
|
||||||
.opcode = __opcode, \
|
.opcode = __opcode, \
|
||||||
.nbytes = 1, \
|
.nbytes = 1, \
|
||||||
|
__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \
|
#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, ...) \
|
||||||
{ \
|
{ \
|
||||||
.nbytes = __nbytes, \
|
.nbytes = __nbytes, \
|
||||||
.val = __val, \
|
.val = __val, \
|
||||||
.buswidth = __buswidth, \
|
.buswidth = __buswidth, \
|
||||||
|
__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPI_MEM_OP_NO_ADDR { }
|
#define SPI_MEM_OP_NO_ADDR { }
|
||||||
|
|
||||||
#define SPI_MEM_OP_DUMMY(__nbytes, __buswidth) \
|
#define SPI_MEM_OP_DUMMY(__nbytes, __buswidth, ...) \
|
||||||
{ \
|
{ \
|
||||||
.nbytes = __nbytes, \
|
.nbytes = __nbytes, \
|
||||||
.buswidth = __buswidth, \
|
.buswidth = __buswidth, \
|
||||||
|
__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPI_MEM_OP_NO_DUMMY { }
|
#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, \
|
.dir = SPI_MEM_DATA_IN, \
|
||||||
.nbytes = __nbytes, \
|
.nbytes = __nbytes, \
|
||||||
.buf.in = __buf, \
|
.buf.in = __buf, \
|
||||||
.buswidth = __buswidth, \
|
.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, \
|
.dir = SPI_MEM_DATA_OUT, \
|
||||||
.nbytes = __nbytes, \
|
.nbytes = __nbytes, \
|
||||||
.buf.out = __buf, \
|
.buf.out = __buf, \
|
||||||
.buswidth = __buswidth, \
|
.buswidth = __buswidth, \
|
||||||
|
__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPI_MEM_OP_NO_DATA { }
|
#define SPI_MEM_OP_NO_DATA { }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue