All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huasin Liao <huasinliao@gmail.com>
To: asmadeus@codewreck.org
Cc: miquel.raynal@bootlin.com, vigneshr@ti.com, richard@nod.at,
	tudor.ambarus@linaro.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, huasin.liao@airoha.com
Subject: Re: [PATCH] mtd: spinand: winbond: add support for W25N04LV
Date: Mon, 17 Aug 2026 00:56:14 +0800	[thread overview]
Message-ID: <20260816165614.16262-1-huasinliao@gmail.com> (raw)
In-Reply-To: <aoGcpsZFxXdtkspZ@codewreck.org>

Dominique Martinet wrote on Sun, Aug 16, 2026 at 20:19:02 +0900:
> Huasin Liao wrote on Sun, Aug 16, 2026 at 05:31:24PM +0800:
>> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
>> index 9b78c1e6cbc9..892220a12b22 100644
>> --- a/drivers/mtd/nand/spi/winbond.c
>> +++ b/drivers/mtd/nand/spi/winbond.c
>> @@ -345,6 +345,35 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
>>  	.free = w25n02kv_ooblayout_free,
>>  };
>>  
>> +static int w25n04lv_ooblayout_ecc(struct mtd_info *mtd, int section,
>> +				  struct mtd_oob_region *region)
>> +{
>> +	if (section > 7)
>> +		return -ERANGE;
>> +
>> +	region->offset = 128 + (16 * section);
>> +	region->length = 13;
>> +
>> +	return 0;
>> +}
>> +
>> +static int w25n04lv_ooblayout_free(struct mtd_info *mtd, int section,
>> +				   struct mtd_oob_region *region)
>> +{
>> +	if (section > 7)
>> +		return -ERANGE;
>> +
>> +	region->offset = (16 * section) + 2;
>> +	region->length = 14;
>> +
>> +	return 0;
>> +}
>> +
>> +static const struct mtd_ooblayout_ops w25n04lv_ooblayout = {
>> +	.ecc = w25n04lv_ooblayout_ecc,
>> +	.free = w25n04lv_ooblayout_free,
> 
> FWIW, these two are the same as what I consolidated in
> https://lore.kernel.org/r/20260814-w25n04lw-v3-1-c6a7423ac7d0@atmark-techno.com
> using oobsize, so we probably want to reuse that here too

Thanks for the pointer, and good to see Miquel is fine with reusing
w25n02kv_ooblayout. Once your patch lands, I'll rebase on top of it
and switch from w25n04lv_ooblayout to w25n02kv_ooblayout — is that in
line with what you'd expect?

Huasin Liao

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

WARNING: multiple messages have this Message-ID (diff)
From: Huasin Liao <huasinliao@gmail.com>
To: asmadeus@codewreck.org
Cc: miquel.raynal@bootlin.com, vigneshr@ti.com, richard@nod.at,
	tudor.ambarus@linaro.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, huasin.liao@airoha.com
Subject: Re: [PATCH] mtd: spinand: winbond: add support for W25N04LV
Date: Mon, 17 Aug 2026 00:56:14 +0800	[thread overview]
Message-ID: <20260816165614.16262-1-huasinliao@gmail.com> (raw)
In-Reply-To: <aoGcpsZFxXdtkspZ@codewreck.org>

Dominique Martinet wrote on Sun, Aug 16, 2026 at 20:19:02 +0900:
> Huasin Liao wrote on Sun, Aug 16, 2026 at 05:31:24PM +0800:
>> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
>> index 9b78c1e6cbc9..892220a12b22 100644
>> --- a/drivers/mtd/nand/spi/winbond.c
>> +++ b/drivers/mtd/nand/spi/winbond.c
>> @@ -345,6 +345,35 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
>>  	.free = w25n02kv_ooblayout_free,
>>  };
>>  
>> +static int w25n04lv_ooblayout_ecc(struct mtd_info *mtd, int section,
>> +				  struct mtd_oob_region *region)
>> +{
>> +	if (section > 7)
>> +		return -ERANGE;
>> +
>> +	region->offset = 128 + (16 * section);
>> +	region->length = 13;
>> +
>> +	return 0;
>> +}
>> +
>> +static int w25n04lv_ooblayout_free(struct mtd_info *mtd, int section,
>> +				   struct mtd_oob_region *region)
>> +{
>> +	if (section > 7)
>> +		return -ERANGE;
>> +
>> +	region->offset = (16 * section) + 2;
>> +	region->length = 14;
>> +
>> +	return 0;
>> +}
>> +
>> +static const struct mtd_ooblayout_ops w25n04lv_ooblayout = {
>> +	.ecc = w25n04lv_ooblayout_ecc,
>> +	.free = w25n04lv_ooblayout_free,
> 
> FWIW, these two are the same as what I consolidated in
> https://lore.kernel.org/r/20260814-w25n04lw-v3-1-c6a7423ac7d0@atmark-techno.com
> using oobsize, so we probably want to reuse that here too

Thanks for the pointer, and good to see Miquel is fine with reusing
w25n02kv_ooblayout. Once your patch lands, I'll rebase on top of it
and switch from w25n04lv_ooblayout to w25n02kv_ooblayout — is that in
line with what you'd expect?

Huasin Liao

  reply	other threads:[~2026-08-16 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16  9:31 [PATCH] mtd: spinand: winbond: add support for W25N04LV Huasin Liao
2026-08-16  9:31 ` Huasin Liao
2026-08-16 11:19 ` Dominique Martinet
2026-08-16 11:19   ` Dominique Martinet
2026-08-16 16:56   ` Huasin Liao [this message]
2026-08-16 16:56     ` Huasin Liao

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=20260816165614.16262-1-huasinliao@gmail.com \
    --to=huasinliao@gmail.com \
    --cc=asmadeus@codewreck.org \
    --cc=huasin.liao@airoha.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@linaro.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 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.