Skip to content

Commit 51b252c

Browse files
committed
mtd: spinand: Define octal operations
SPI NAND chips may support octal "read from cache" and "program load" transfers. List the opcodes by defining the relevant macros describing these operations. However, due to the hardware available I had, 0x82 and 0xc2 are untested and given as reference, only 0xc4 could be (successfully) tested. Controllers supporting operations mixing SDR and DTR operations might even leverage octal DTR data I/O transfers. Acked-by: Tudor Ambarus <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent ac3a4b1 commit 51b252c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

include/linux/mtd/spinand.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,27 @@
170170
SPI_MEM_DTR_OP_DATA_IN(len, buf, 4), \
171171
SPI_MEM_OP_MAX_FREQ(freq))
172172

173+
#define SPINAND_PAGE_READ_FROM_CACHE_1S_1S_8S_OP(addr, ndummy, buf, len, freq) \
174+
SPI_MEM_OP(SPI_MEM_OP_CMD(0x8b, 1), \
175+
SPI_MEM_OP_ADDR(2, addr, 1), \
176+
SPI_MEM_OP_DUMMY(ndummy, 1), \
177+
SPI_MEM_OP_DATA_IN(len, buf, 8), \
178+
SPI_MEM_OP_MAX_FREQ(freq))
179+
180+
#define SPINAND_PAGE_READ_FROM_CACHE_1S_8S_8S_OP(addr, ndummy, buf, len, freq) \
181+
SPI_MEM_OP(SPI_MEM_OP_CMD(0xcb, 1), \
182+
SPI_MEM_OP_ADDR(2, addr, 8), \
183+
SPI_MEM_OP_DUMMY(ndummy, 8), \
184+
SPI_MEM_OP_DATA_IN(len, buf, 8), \
185+
SPI_MEM_OP_MAX_FREQ(freq))
186+
187+
#define SPINAND_PAGE_READ_FROM_CACHE_1S_1D_8D_OP(addr, ndummy, buf, len, freq) \
188+
SPI_MEM_OP(SPI_MEM_OP_CMD(0x9d, 1), \
189+
SPI_MEM_DTR_OP_ADDR(2, addr, 1), \
190+
SPI_MEM_DTR_OP_DUMMY(ndummy, 1), \
191+
SPI_MEM_DTR_OP_DATA_IN(len, buf, 8), \
192+
SPI_MEM_OP_MAX_FREQ(freq))
193+
173194
#define SPINAND_PROG_EXEC_1S_1S_0_OP(addr) \
174195
SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \
175196
SPI_MEM_OP_ADDR(3, addr, 1), \
@@ -188,6 +209,18 @@
188209
SPI_MEM_OP_NO_DUMMY, \
189210
SPI_MEM_OP_DATA_OUT(len, buf, 4))
190211

212+
#define SPINAND_PROG_LOAD_1S_1S_8S_OP(addr, buf, len) \
213+
SPI_MEM_OP(SPI_MEM_OP_CMD(0x82, 1), \
214+
SPI_MEM_OP_ADDR(2, addr, 1), \
215+
SPI_MEM_OP_NO_DUMMY, \
216+
SPI_MEM_OP_DATA_OUT(len, buf, 8))
217+
218+
#define SPINAND_PROG_LOAD_1S_8S_8S_OP(reset, addr, buf, len) \
219+
SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0xc2 : 0xc4, 1), \
220+
SPI_MEM_OP_ADDR(2, addr, 8), \
221+
SPI_MEM_OP_NO_DUMMY, \
222+
SPI_MEM_OP_DATA_OUT(len, buf, 8))
223+
191224
/**
192225
* Standard SPI NAND flash commands
193226
*/

0 commit comments

Comments
 (0)