[PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW

Santhosh Kumar K posted 3 patches 1 year, 1 month ago
[PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
Posted by Santhosh Kumar K 1 year, 1 month ago
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: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
CC: Sridharan S N <quic_sridsn@quicinc.com>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
---

Hi, Sridharan,

Do you have a different revision of W25N01JW with a different oob_layout?
If yes, can you please provide the datasheet of that?

Regards,
Santhosh.

 drivers/mtd/nand/spi/winbond.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index fbe41e76ad64..de05b3e2b9df 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -115,6 +115,30 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section,
 	return 0;
 }
 
+static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
+				  struct mtd_oob_region *region)
+{
+	if (section > 3)
+		return -ERANGE;
+
+	region->offset = (16 * section) + 12;
+	region->length = 4;
+
+	return 0;
+}
+
+static int w25n01jw_ooblayout_free(struct mtd_info *mtd, int section,
+				   struct mtd_oob_region *region)
+{
+	if (section > 3)
+		return -ERANGE;
+
+	region->offset = (16 * section) + 2;
+	region->length = 10;
+
+	return 0;
+}
+
 static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
 				  struct mtd_oob_region *region)
 {
@@ -154,6 +178,11 @@ static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
 	.free = w35n01jw_ooblayout_free,
 };
 
+static const struct mtd_ooblayout_ops w25n01jw_ooblayout = {
+	.ecc = w25n01jw_ooblayout_ecc,
+	.free = w25n01jw_ooblayout_free,
+};
+
 static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
 				   u8 status)
 {
@@ -230,7 +259,7 @@ static const struct spinand_info winbond_spinand_table[] = {
 					      &write_cache_variants,
 					      &update_cache_variants),
 		     0,
-		     SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
+		     SPINAND_ECCINFO(&w25n01jw_ooblayout, NULL)),
 	SPINAND_INFO("W25N01KV", /* 3.3V */
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),
 		     NAND_MEMORG(1, 2048, 96, 64, 1024, 20, 1, 1, 1),
-- 
2.34.1
Re: [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
Posted by Miquel Raynal 1 year ago
Hello Santhosh,

On 02/01/2025 at 17:21:10 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:

> 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: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
> CC: Sridharan S N <quic_sridsn@quicinc.com>
> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>

There have been changes in this driver, I'd suggest to rebase your work
once -rc1 is out.

Also, Please add Cc: stable in copy and either move this patch first in
the series, or even detach it because it has little to do with the two
other patches.

Thanks!
Miquèl
Re: [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
Posted by Santhosh Kumar K 1 year ago
Hello, Miquel,

On 16/01/25 00:46, Miquel Raynal wrote:
> Hello Santhosh,
> 
> On 02/01/2025 at 17:21:10 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
> 
>> 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: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
>> CC: Sridharan S N <quic_sridsn@quicinc.com>
>> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
> 
> There have been changes in this driver, I'd suggest to rebase your work
> once -rc1 is out.
> 
> Also, Please add Cc: stable in copy and either move this patch first in
> the series, or even detach it because it has little to do with the two
> other patches.

Got it, I'll detach this one.

Regards,
Santhosh.

> 
> Thanks!
> Miquèl