* [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW
@ 2025-02-13 6:00 Santhosh Kumar K
2025-02-14 18:27 ` Miquel Raynal
2025-02-14 18:32 ` Miquel Raynal
0 siblings, 2 replies; 3+ messages in thread
From: Santhosh Kumar K @ 2025-02-13 6:00 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, quic_sridsn, quic_mdalam
Cc: linux-mtd, linux-kernel, p-mantena, s-k6, stable
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>
Cc: stable@vger.kernel.org
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
---
Changes in v2:
- Detach patch 3/3 from v1
- Rebase on next
- Link to v1: https://lore.kernel.org/linux-mtd/20250102115110.1402440-1-s-k6@ti.com/
Repo: https://github.com/santhosh21/linux/tree/uL_next
Test results: https://gist.github.com/santhosh21/71ab6646dccc238a0b3c47c0382f219a
---
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 ea11ae12423f..41cd0a51e450 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -134,6 +134,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)
{
@@ -173,6 +197,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)
{
@@ -249,7 +278,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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW
2025-02-13 6:00 [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
@ 2025-02-14 18:27 ` Miquel Raynal
2025-02-14 18:32 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-02-14 18:27 UTC (permalink / raw)
To: Santhosh Kumar K
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena, stable
Hello Santhosh,
On 13/02/2025 at 11:30:18 +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>
> Cc: stable@vger.kernel.org
> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
I am sorry this patch does not apply, are you sure you rebased on next?
Can you please fix and resend ?
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW
2025-02-13 6:00 [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
2025-02-14 18:27 ` Miquel Raynal
@ 2025-02-14 18:32 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-02-14 18:32 UTC (permalink / raw)
To: Santhosh Kumar K
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena, stable
On 13/02/2025 at 11:30:18 +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>
> Cc: stable@vger.kernel.org
> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
> ---
>
> Changes in v2:
> - Detach patch 3/3 from v1
> - Rebase on next
> - Link to v1: https://lore.kernel.org/linux-mtd/20250102115110.1402440-1-s-k6@ti.com/
>
> Repo: https://github.com/santhosh21/linux/tree/uL_next
> Test results: https://gist.github.com/santhosh21/71ab6646dccc238a0b3c47c0382f219a
>
> ---
> 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 ea11ae12423f..41cd0a51e450 100644
> --- a/drivers/mtd/nand/spi/winbond.c
> +++ b/drivers/mtd/nand/spi/winbond.c
> @@ -134,6 +134,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;
This is actually wrong i believe. Only the first section needs + 2.
You can probably have the following condition:
if (section > 3) {
offset += 2;
length -= 2;
}
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-14 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 6:00 [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
2025-02-14 18:27 ` Miquel Raynal
2025-02-14 18:32 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).