All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dominique Martinet <dominique.martinet@atmark-techno.com>
Cc: Richard Weinberger <richard@nod.at>,
	 Md Sadre Alam <md.alam@oss.qualcomm.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org,  linux-kernel@vger.kernel.org,
	 Daisuke Mizobuchi <mizo@atmark-techno.com>
Subject: Re: [PATCH RFC v2] mtd: spinand: winbond: add support for W25N04LW
Date: Thu, 13 Aug 2026 12:44:32 +0200	[thread overview]
Message-ID: <875x1el2pb.fsf@bootlin.com> (raw)
In-Reply-To: <an2OtHX62YRg0ZYZ@atmark-techno.com> (Dominique Martinet's message of "Thu, 13 Aug 2026 18:30:28 +0900")

On 13/08/2026 at 18:30:28 +09, Dominique Martinet <dominique.martinet@atmark-techno.com> wrote:

> Thanks for the feedback!
>
> Miquel Raynal wrote on Thu, Aug 13, 2026 at 10:19:08AM +0200:
>> > OOB layout was defined to only show ECC-protected "user data I", leaving
>> > "user data II" unavailable.
>> 
>> Fine, there is not strong rule, and anyway this is only useful for non
>> UBI users (jffs2, typically).
>
> Yeah, I was expecting UBI to use it too but I looked it up after posting
> and saw it doesn't, so I agree it doesn't matter much for us either way.
>
>> > As an extra data point, this "user area I and II" distinction is the same
>> > in W25N04KW (same 2+12), but w25n02kv_ooblayout_free() use there returns
>> > the whole 14 bytes as a single chunk, so I explicitly made a different
>> > choice here.
>> > (I believe that's not something that can be changed easily, so we should
>> > discuss this before merging)
>> 
>> If it's the same layout, I would go for keeping the existing one and
>> avoid the proliferation of these helpers.
>
> The layout is similar (each section has 2 bytes for BB marker / 2 bytes
> user data II / 12 bytes user data I), but the number of sections per
> erase block is different (went from 4 to 8)
> For ECC it's the same (4 to 8 sections, and offset changed from 64 to
> 128 accordingly because there were more data sections before)
>
> I see similar helpers in other drivers (e.g. alliancememory.c) use
> mtd->oobsize; so if you prefer I can reuse the existing
> w25n02kv_ooblayout* helpers based on this?

Yes, that would be ideal.

> (
>   Technically could go as far as checking the ecc strength[1] and also
>   merge in w25n01kv_ooblayout_ecc (variable ecc length/offset step),
>   then if we're greedy also handle oobsize == 64 to replace
>   w25m02gv_ooblayout_ecc/w25m02gv_ooblayout_free, but that's starting to
>   make the functions more complex than I'm confident in... :)
>   [1] mtd_to_nanddev(mtd)->eccreq.strength
> )

Up to you :)

> (And in that case I'll happily give up on the non-ECC distinction and
> keep the current behavior that exposes the non-protected bits)
>
>> > That aside:
>> > - Alam, would you like your name somewhere in the commit? I didn't keep
>> >   anything from your commit because I already had one, but happy to add
>> >   a Co-developed-by or something
>> > - I kept NAND_ECCREQ(8, 512) like W25N04KW but the datasheet says it's
>> >   based on 8-bits/544-bytes ECC, so I should set it as (8, 544)?
>> 
>> No, we are protecting 512 bytes of data. 544 is the area including bytes
>> used for the ECC operation itself and we are not interested by those in
>> this field.
>
> There's also the 12 bytes in "user data I", but I agree it's probably
> fine to ignore here.
> nandbiterrs passes, so I'll leave it as is.

https://elixir.bootlin.com/linux/v7.1.8/source/include/linux/mtd/nand.h#L187
It is not very clear, but this macro is about the main data ("bytes per step").

>> > - I'll shamefully admit I do not understand the read / write /
>> >   update_cache_variants() I copied from KW,
>> >   Alam had the same but it'd be great to confirm using the same
>> >   callbacks makes sense?
>> 
>> There are various operations available for I/Os. Depending on the spi
>> controller capability and the routing at the board level, you might want
>> to use single, dual, quad, dtr or not transfers. And depending on the
>> speed you may need extra dummy cycles. All of this is captured in this
>> array.
>
> Ok, so I ought to check that e.g.
> SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP still needs 2 dummy op
> delay?
> (I couldn't find the _1S_4S_4S_ meaning explained anywhere, but looking
> at the commands used the number is the number of lines used for the
> command instruction itself, the column address and the data itself?

Yes.

Dummy width is the same as address width BTW.

> the datasheet doesn't seem to handle any command with a *D so I'll
> ignore the S/D...)

SDR vs DTR. You chip may or may not support it.

Good luck!
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dominique Martinet <dominique.martinet@atmark-techno.com>
Cc: Richard Weinberger <richard@nod.at>,
	 Md Sadre Alam <md.alam@oss.qualcomm.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org,  linux-kernel@vger.kernel.org,
	 Daisuke Mizobuchi <mizo@atmark-techno.com>
Subject: Re: [PATCH RFC v2] mtd: spinand: winbond: add support for W25N04LW
Date: Thu, 13 Aug 2026 12:44:32 +0200	[thread overview]
Message-ID: <875x1el2pb.fsf@bootlin.com> (raw)
In-Reply-To: <an2OtHX62YRg0ZYZ@atmark-techno.com> (Dominique Martinet's message of "Thu, 13 Aug 2026 18:30:28 +0900")

On 13/08/2026 at 18:30:28 +09, Dominique Martinet <dominique.martinet@atmark-techno.com> wrote:

> Thanks for the feedback!
>
> Miquel Raynal wrote on Thu, Aug 13, 2026 at 10:19:08AM +0200:
>> > OOB layout was defined to only show ECC-protected "user data I", leaving
>> > "user data II" unavailable.
>> 
>> Fine, there is not strong rule, and anyway this is only useful for non
>> UBI users (jffs2, typically).
>
> Yeah, I was expecting UBI to use it too but I looked it up after posting
> and saw it doesn't, so I agree it doesn't matter much for us either way.
>
>> > As an extra data point, this "user area I and II" distinction is the same
>> > in W25N04KW (same 2+12), but w25n02kv_ooblayout_free() use there returns
>> > the whole 14 bytes as a single chunk, so I explicitly made a different
>> > choice here.
>> > (I believe that's not something that can be changed easily, so we should
>> > discuss this before merging)
>> 
>> If it's the same layout, I would go for keeping the existing one and
>> avoid the proliferation of these helpers.
>
> The layout is similar (each section has 2 bytes for BB marker / 2 bytes
> user data II / 12 bytes user data I), but the number of sections per
> erase block is different (went from 4 to 8)
> For ECC it's the same (4 to 8 sections, and offset changed from 64 to
> 128 accordingly because there were more data sections before)
>
> I see similar helpers in other drivers (e.g. alliancememory.c) use
> mtd->oobsize; so if you prefer I can reuse the existing
> w25n02kv_ooblayout* helpers based on this?

Yes, that would be ideal.

> (
>   Technically could go as far as checking the ecc strength[1] and also
>   merge in w25n01kv_ooblayout_ecc (variable ecc length/offset step),
>   then if we're greedy also handle oobsize == 64 to replace
>   w25m02gv_ooblayout_ecc/w25m02gv_ooblayout_free, but that's starting to
>   make the functions more complex than I'm confident in... :)
>   [1] mtd_to_nanddev(mtd)->eccreq.strength
> )

Up to you :)

> (And in that case I'll happily give up on the non-ECC distinction and
> keep the current behavior that exposes the non-protected bits)
>
>> > That aside:
>> > - Alam, would you like your name somewhere in the commit? I didn't keep
>> >   anything from your commit because I already had one, but happy to add
>> >   a Co-developed-by or something
>> > - I kept NAND_ECCREQ(8, 512) like W25N04KW but the datasheet says it's
>> >   based on 8-bits/544-bytes ECC, so I should set it as (8, 544)?
>> 
>> No, we are protecting 512 bytes of data. 544 is the area including bytes
>> used for the ECC operation itself and we are not interested by those in
>> this field.
>
> There's also the 12 bytes in "user data I", but I agree it's probably
> fine to ignore here.
> nandbiterrs passes, so I'll leave it as is.

https://elixir.bootlin.com/linux/v7.1.8/source/include/linux/mtd/nand.h#L187
It is not very clear, but this macro is about the main data ("bytes per step").

>> > - I'll shamefully admit I do not understand the read / write /
>> >   update_cache_variants() I copied from KW,
>> >   Alam had the same but it'd be great to confirm using the same
>> >   callbacks makes sense?
>> 
>> There are various operations available for I/Os. Depending on the spi
>> controller capability and the routing at the board level, you might want
>> to use single, dual, quad, dtr or not transfers. And depending on the
>> speed you may need extra dummy cycles. All of this is captured in this
>> array.
>
> Ok, so I ought to check that e.g.
> SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP still needs 2 dummy op
> delay?
> (I couldn't find the _1S_4S_4S_ meaning explained anywhere, but looking
> at the commands used the number is the number of lines used for the
> command instruction itself, the column address and the data itself?

Yes.

Dummy width is the same as address width BTW.

> the datasheet doesn't seem to handle any command with a *D so I'll
> ignore the S/D...)

SDR vs DTR. You chip may or may not support it.

Good luck!
Miquèl

  reply	other threads:[~2026-08-13 10:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  4:14 [PATCH RFC v2] mtd: spinand: winbond: add support for W25N04LW Dominique Martinet
2026-08-12  4:14 ` Dominique Martinet
2026-08-12  5:04 ` Dominique Martinet
2026-08-12  5:04   ` Dominique Martinet
2026-08-12  7:35   ` Miquel Raynal
2026-08-12  7:35     ` Miquel Raynal
2026-08-12  8:08     ` Dominique Martinet
2026-08-12  8:08       ` Dominique Martinet
2026-08-13  8:19 ` Miquel Raynal
2026-08-13  8:19   ` Miquel Raynal
2026-08-13  9:30   ` Dominique Martinet
2026-08-13  9:30     ` Dominique Martinet
2026-08-13 10:44     ` Miquel Raynal [this message]
2026-08-13 10:44       ` Miquel Raynal

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=875x1el2pb.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=dominique.martinet@atmark-techno.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=md.alam@oss.qualcomm.com \
    --cc=mizo@atmark-techno.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.