Skip to content

Commit e2a9fcb

Browse files
robimarkomiquelraynal
authored andcommitted
mtd: spinand: winbond: add support for W25N01KV
Add support for Winbond W25N01KV 1Gbit SPI-NAND. It has 4-bit on-die ECC. Signed-off-by: Robert Marko <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 8400291 commit e2a9fcb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/mtd/nand/spi/winbond.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
7676
return spi_mem_exec_op(spinand->spimem, &op);
7777
}
7878

79+
static int w25n01kv_ooblayout_ecc(struct mtd_info *mtd, int section,
80+
struct mtd_oob_region *region)
81+
{
82+
if (section > 3)
83+
return -ERANGE;
84+
85+
region->offset = 64 + (8 * section);
86+
region->length = 7;
87+
88+
return 0;
89+
}
90+
7991
static int w25n02kv_ooblayout_ecc(struct mtd_info *mtd, int section,
8092
struct mtd_oob_region *region)
8193
{
@@ -100,6 +112,11 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section,
100112
return 0;
101113
}
102114

115+
static const struct mtd_ooblayout_ops w25n01kv_ooblayout = {
116+
.ecc = w25n01kv_ooblayout_ecc,
117+
.free = w25n02kv_ooblayout_free,
118+
};
119+
103120
static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
104121
.ecc = w25n02kv_ooblayout_ecc,
105122
.free = w25n02kv_ooblayout_free,
@@ -163,6 +180,15 @@ static const struct spinand_info winbond_spinand_table[] = {
163180
&update_cache_variants),
164181
0,
165182
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
183+
SPINAND_INFO("W25N01KV",
184+
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),
185+
NAND_MEMORG(1, 2048, 96, 64, 1024, 20, 1, 1, 1),
186+
NAND_ECCREQ(4, 512),
187+
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
188+
&write_cache_variants,
189+
&update_cache_variants),
190+
0,
191+
SPINAND_ECCINFO(&w25n01kv_ooblayout, w25n02kv_ecc_get_status)),
166192
SPINAND_INFO("W25N02KV",
167193
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x22),
168194
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),

0 commit comments

Comments
 (0)