Skip to content

Commit 044ba8d

Browse files
Santhosh Kumar Kgregkh
authored andcommitted
mtd: spinand: winbond: Fix oob_layout for W25N01JW
[ Upstream commit 4550d33 ] 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> [ Adjust context ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent deccd93 commit 044ba8d

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

drivers/mtd/nand/spi/winbond.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,41 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
122122
.free = w25n02kv_ooblayout_free,
123123
};
124124

125+
static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
126+
struct mtd_oob_region *region)
127+
{
128+
if (section > 3)
129+
return -ERANGE;
130+
131+
region->offset = (16 * section) + 12;
132+
region->length = 4;
133+
134+
return 0;
135+
}
136+
137+
static int w25n01jw_ooblayout_free(struct mtd_info *mtd, int section,
138+
struct mtd_oob_region *region)
139+
{
140+
if (section > 3)
141+
return -ERANGE;
142+
143+
region->offset = (16 * section);
144+
region->length = 12;
145+
146+
/* Extract BBM */
147+
if (!section) {
148+
region->offset += 2;
149+
region->length -= 2;
150+
}
151+
152+
return 0;
153+
}
154+
155+
static const struct mtd_ooblayout_ops w25n01jw_ooblayout = {
156+
.ecc = w25n01jw_ooblayout_ecc,
157+
.free = w25n01jw_ooblayout_free,
158+
};
159+
125160
static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
126161
u8 status)
127162
{
@@ -206,7 +241,7 @@ static const struct spinand_info winbond_spinand_table[] = {
206241
&write_cache_variants,
207242
&update_cache_variants),
208243
0,
209-
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
244+
SPINAND_ECCINFO(&w25n01jw_ooblayout, NULL)),
210245
SPINAND_INFO("W25N02JWZEIF",
211246
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xbf, 0x22),
212247
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 2, 1),

0 commit comments

Comments
 (0)