Skip to content

Commit 0737c69

Browse files
committed
mtd: spinand: winbond: Add support for W35N01JW in single mode
Add support for the W35N series by describing the smaller (single die) chip. It has 1b/512B ECC support and its own OOB layout. Acked-by: Tudor Ambarus <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 140bb9e commit 0737c69

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

drivers/mtd/nand/spi/winbond.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
* "X4" in the core is equivalent to "quad output" in the datasheets.
2424
*/
2525

26+
static SPINAND_OP_VARIANTS(read_cache_octal_variants,
27+
SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(0, 1, NULL, 0),
28+
SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0));
29+
30+
static SPINAND_OP_VARIANTS(write_cache_octal_variants,
31+
SPINAND_PROG_LOAD_1S_1S_1S_OP(true, 0, NULL, 0));
32+
33+
static SPINAND_OP_VARIANTS(update_cache_octal_variants,
34+
SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0));
35+
2636
static SPINAND_OP_VARIANTS(read_cache_dual_quad_dtr_variants,
2737
SPINAND_PAGE_READ_FROM_CACHE_1S_4D_4D_OP(0, 8, NULL, 0, 80 * HZ_PER_MHZ),
2838
SPINAND_PAGE_READ_FROM_CACHE_1S_1D_4D_OP(0, 2, NULL, 0, 80 * HZ_PER_MHZ),
@@ -141,6 +151,41 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
141151
.free = w25n02kv_ooblayout_free,
142152
};
143153

154+
static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
155+
struct mtd_oob_region *region)
156+
{
157+
if (section > 7)
158+
return -ERANGE;
159+
160+
region->offset = (16 * section) + 12;
161+
region->length = 4;
162+
163+
return 0;
164+
}
165+
166+
static int w35n01jw_ooblayout_free(struct mtd_info *mtd, int section,
167+
struct mtd_oob_region *region)
168+
{
169+
if (section > 7)
170+
return -ERANGE;
171+
172+
region->offset = 16 * section;
173+
region->length = 12;
174+
175+
/* Extract BBM */
176+
if (!section) {
177+
region->offset += 2;
178+
region->length -= 2;
179+
}
180+
181+
return 0;
182+
}
183+
184+
static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
185+
.ecc = w35n01jw_ooblayout_ecc,
186+
.free = w35n01jw_ooblayout_free,
187+
};
188+
144189
static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
145190
u8 status)
146191
{
@@ -227,6 +272,15 @@ static const struct spinand_info winbond_spinand_table[] = {
227272
&update_cache_variants),
228273
0,
229274
SPINAND_ECCINFO(&w25n01kv_ooblayout, w25n02kv_ecc_get_status)),
275+
SPINAND_INFO("W35N01JW", /* 1.8V */
276+
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xdc, 0x21),
277+
NAND_MEMORG(1, 4096, 128, 64, 512, 10, 1, 1, 1),
278+
NAND_ECCREQ(1, 512),
279+
SPINAND_INFO_OP_VARIANTS(&read_cache_octal_variants,
280+
&write_cache_octal_variants,
281+
&update_cache_octal_variants),
282+
0,
283+
SPINAND_ECCINFO(&w35n01jw_ooblayout, NULL)),
230284
/* 2G-bit densities */
231285
SPINAND_INFO("W25M02GV", /* 2x1G-bit 3.3V */
232286
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab, 0x21),

0 commit comments

Comments
 (0)