Skip to content

Commit 4550d33

Browse files
Santhosh Kumar Kmiquelraynal
authored andcommitted
mtd: spinand: winbond: Fix oob_layout for W25N01JW
Fix the W25N01JW's oob_layout according to the datasheet [1] [1] https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-flash/?__locale=en&partNo=W25N01JW Fixes: 6a804fb ("mtd: spinand: winbond: add support for serial NAND flash") Cc: Sridharan S N <quic_sridsn@quicinc.com> Cc: stable@vger.kernel.org Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent fd779ea commit 4550d33

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

drivers/mtd/nand/spi/winbond.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,36 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
176176
.free = w25n02kv_ooblayout_free,
177177
};
178178

179+
static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
180+
struct mtd_oob_region *region)
181+
{
182+
if (section > 3)
183+
return -ERANGE;
184+
185+
region->offset = (16 * section) + 12;
186+
region->length = 4;
187+
188+
return 0;
189+
}
190+
191+
static int w25n01jw_ooblayout_free(struct mtd_info *mtd, int section,
192+
struct mtd_oob_region *region)
193+
{
194+
if (section > 3)
195+
return -ERANGE;
196+
197+
region->offset = (16 * section);
198+
region->length = 12;
199+
200+
/* Extract BBM */
201+
if (!section) {
202+
region->offset += 2;
203+
region->length -= 2;
204+
}
205+
206+
return 0;
207+
}
208+
179209
static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
180210
struct mtd_oob_region *region)
181211
{
@@ -206,6 +236,11 @@ static int w35n01jw_ooblayout_free(struct mtd_info *mtd, int section,
206236
return 0;
207237
}
208238

239+
static const struct mtd_ooblayout_ops w25n01jw_ooblayout = {
240+
.ecc = w25n01jw_ooblayout_ecc,
241+
.free = w25n01jw_ooblayout_free,
242+
};
243+
209244
static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
210245
.ecc = w35n01jw_ooblayout_ecc,
211246
.free = w35n01jw_ooblayout_free,
@@ -394,7 +429,7 @@ static const struct spinand_info winbond_spinand_table[] = {
394429
&write_cache_variants,
395430
&update_cache_variants),
396431
0,
397-
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
432+
SPINAND_ECCINFO(&w25n01jw_ooblayout, NULL),
398433
SPINAND_CONFIGURE_CHIP(w25n0xjw_hs_cfg)),
399434
SPINAND_INFO("W25N01KV", /* 3.3V */
400435
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),

0 commit comments

Comments
 (0)