mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Santhosh Kumar K <s-k6@ti.com>
To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
	<quic_sridsn@quicinc.com>, <quic_mdalam@quicinc.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<p-mantena@ti.com>, <s-k6@ti.com>
Subject: [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
Date: Thu, 2 Jan 2025 17:21:10 +0530	[thread overview]
Message-ID: <20250102115110.1402440-4-s-k6@ti.com> (raw)
In-Reply-To: <20250102115110.1402440-1-s-k6@ti.com>

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


  parent reply	other threads:[~2025-01-02 11:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-02 11:51 [PATCH 0/3] Add OSPI NAND support Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
2025-01-15 19:19   ` Miquel Raynal
2025-01-27  6:48     ` Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 2/3] mtd: spinand: winbond: Add support for W35N01JW Santhosh Kumar K
2025-01-02 11:51 ` Santhosh Kumar K [this message]
2025-01-15 19:16   ` [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW Miquel Raynal
2025-01-27  6:48     ` Santhosh Kumar K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250102115110.1402440-4-s-k6@ti.com \
    --to=s-k6@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=p-mantena@ti.com \
    --cc=quic_mdalam@quicinc.com \
    --cc=quic_sridsn@quicinc.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®