c28ae1d797ca8c5d26c82af5f032b32d84056627
[openwrt/staging/stintel.git] /
1 From d014717d50b1efd011a3a028ce92563a4dc9bae5 Mon Sep 17 00:00:00 2001
2 From: Jeff Kletsky <git-commits@allycomm.com>
3 Date: Wed, 22 May 2019 15:05:53 -0700
4 Subject: [PATCH 1/3] mtd: spinand: Define macros for page-read ops with
5 three-byte addresses
6
7 The GigaDevice GD5F1GQ4UFxxG SPI NAND utilizes three-byte addresses
8 for its page-read ops.
9
10 http://www.gigadevice.com/datasheet/gd5f1gq4xfxxg/
11
12 Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
13 Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
14 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
15 ---
16 include/linux/mtd/spinand.h | 30 ++++++++++++++++++++++++++++++
17 1 file changed, 30 insertions(+)
18
19 --- a/include/linux/mtd/spinand.h
20 +++ b/include/linux/mtd/spinand.h
21 @@ -68,30 +68,60 @@
22 SPI_MEM_OP_DUMMY(ndummy, 1), \
23 SPI_MEM_OP_DATA_IN(len, buf, 1))
24
25 +#define SPINAND_PAGE_READ_FROM_CACHE_OP_3A(fast, addr, ndummy, buf, len) \
26 + SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
27 + SPI_MEM_OP_ADDR(3, addr, 1), \
28 + SPI_MEM_OP_DUMMY(ndummy, 1), \
29 + SPI_MEM_OP_DATA_IN(len, buf, 1))
30 +
31 #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \
32 SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
33 SPI_MEM_OP_ADDR(2, addr, 1), \
34 SPI_MEM_OP_DUMMY(ndummy, 1), \
35 SPI_MEM_OP_DATA_IN(len, buf, 2))
36
37 +#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(addr, ndummy, buf, len) \
38 + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
39 + SPI_MEM_OP_ADDR(3, addr, 1), \
40 + SPI_MEM_OP_DUMMY(ndummy, 1), \
41 + SPI_MEM_OP_DATA_IN(len, buf, 2))
42 +
43 #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \
44 SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
45 SPI_MEM_OP_ADDR(2, addr, 1), \
46 SPI_MEM_OP_DUMMY(ndummy, 1), \
47 SPI_MEM_OP_DATA_IN(len, buf, 4))
48
49 +#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(addr, ndummy, buf, len) \
50 + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
51 + SPI_MEM_OP_ADDR(3, addr, 1), \
52 + SPI_MEM_OP_DUMMY(ndummy, 1), \
53 + SPI_MEM_OP_DATA_IN(len, buf, 4))
54 +
55 #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \
56 SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
57 SPI_MEM_OP_ADDR(2, addr, 2), \
58 SPI_MEM_OP_DUMMY(ndummy, 2), \
59 SPI_MEM_OP_DATA_IN(len, buf, 2))
60
61 +#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP_3A(addr, ndummy, buf, len) \
62 + SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
63 + SPI_MEM_OP_ADDR(3, addr, 2), \
64 + SPI_MEM_OP_DUMMY(ndummy, 2), \
65 + SPI_MEM_OP_DATA_IN(len, buf, 2))
66 +
67 #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \
68 SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
69 SPI_MEM_OP_ADDR(2, addr, 4), \
70 SPI_MEM_OP_DUMMY(ndummy, 4), \
71 SPI_MEM_OP_DATA_IN(len, buf, 4))
72
73 +#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP_3A(addr, ndummy, buf, len) \
74 + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
75 + SPI_MEM_OP_ADDR(3, addr, 4), \
76 + SPI_MEM_OP_DUMMY(ndummy, 4), \
77 + SPI_MEM_OP_DATA_IN(len, buf, 4))
78 +
79 #define SPINAND_PROG_EXEC_OP(addr) \
80 SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \
81 SPI_MEM_OP_ADDR(3, addr, 1), \