Re: [PATCH] mtd: spinand: winbond: add support for W25N04LV

Huasin Liao <[email protected]>
Newsgroups org.infradead.lists.linux-mtd,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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/[email protected]
> 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.