From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Santhosh Kumar K <s-k6@ti.com>
Cc: <richard@nod.at>, <vigneshr@ti.com>, <quic_sridsn@quicinc.com>,
<quic_mdalam@quicinc.com>, <linux-mtd@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <p-mantena@ti.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v2] mtd: spinand: winbond: Fix oob_layout for W25N01JW
Date: Fri, 14 Feb 2025 19:32:12 +0100 [thread overview]
Message-ID: <87wmdsml77.fsf@bootlin.com> (raw)
In-Reply-To: <20250213060018.2664518-1-s-k6@ti.com> (Santhosh Kumar K.'s message of "Thu, 13 Feb 2025 11:30:18 +0530")
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
prev parent reply other threads:[~2025-02-14 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=87wmdsml77.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=p-mantena@ti.com \
--cc=quic_mdalam@quicinc.com \
--cc=quic_sridsn@quicinc.com \
--cc=richard@nod.at \
--cc=s-k6@ti.com \
--cc=stable@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).