Skip to content

Commit dba90f5

Browse files
committed
mtd: spinand: winbond: Prevent unsupported frequencies on dual/quad I/O variants
Dual and quad capable chips natively support dual and quad I/O variants at up to 104MHz (1-2-2 and 1-4-4 operations). Reaching the maximum speed of 166MHz is theoretically possible (while still unsupported in the field) by adding a few more dummy cycles. Let's be accurate and clearly state this limit. Setting a maximum frequency implies adding the frequency parameter to the macro, which is done using a variadic argument to avoid impacting all the other drivers which already make use of this macro. Fixes: 1ea808b ("mtd: spinand: winbond: Update the *JW chip definitions") Signed-off-by: Miquel Raynal <[email protected]>
1 parent 29384bb commit dba90f5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

drivers/mtd/nand/spi/winbond.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ static SPINAND_OP_VARIANTS(update_cache_octal_variants,
4242
static SPINAND_OP_VARIANTS(read_cache_dual_quad_dtr_variants,
4343
SPINAND_PAGE_READ_FROM_CACHE_1S_4D_4D_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ),
4444
SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ),
45-
SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0),
45+
SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0, 104 * HZ_PER_MHZ),
4646
SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0),
4747
SPINAND_PAGE_READ_FROM_CACHE_1S_2D_2D_OP(0, 4, NULL, 0, 80 * HZ_PER_MHZ),
4848
SPINAND_PAGE_READ_FROM_CACHE_1S_1D_2D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ),
49-
SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0),
49+
SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0, 104 * HZ_PER_MHZ),
5050
SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0),
5151
SPINAND_PAGE_READ_FROM_CACHE_1S_1D_1D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ),
5252
SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0),

include/linux/mtd/spinand.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@
113113
SPI_MEM_DTR_OP_DATA_IN(len, buf, 2), \
114114
SPI_MEM_OP_MAX_FREQ(freq))
115115

116-
#define SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(addr, ndummy, buf, len) \
116+
#define SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(addr, ndummy, buf, len, ...) \
117117
SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
118118
SPI_MEM_OP_ADDR(2, addr, 2), \
119119
SPI_MEM_OP_DUMMY(ndummy, 2), \
120-
SPI_MEM_OP_DATA_IN(len, buf, 2))
120+
SPI_MEM_OP_DATA_IN(len, buf, 2), \
121+
SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0))
121122

122123
#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_2S_2S_OP(addr, ndummy, buf, len) \
123124
SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
@@ -151,11 +152,12 @@
151152
SPI_MEM_DTR_OP_DATA_IN(len, buf, 4), \
152153
SPI_MEM_OP_MAX_FREQ(freq))
153154

154-
#define SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(addr, ndummy, buf, len) \
155+
#define SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(addr, ndummy, buf, len, ...) \
155156
SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
156157
SPI_MEM_OP_ADDR(2, addr, 4), \
157158
SPI_MEM_OP_DUMMY(ndummy, 4), \
158-
SPI_MEM_OP_DATA_IN(len, buf, 4))
159+
SPI_MEM_OP_DATA_IN(len, buf, 4), \
160+
SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0))
159161

160162
#define SPINAND_PAGE_READ_FROM_CACHE_3A_1S_4S_4S_OP(addr, ndummy, buf, len) \
161163
SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \

0 commit comments

Comments
 (0)