From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gw2.atmark-techno.com (gw2.atmark-techno.com [35.74.137.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52379397937 for ; Mon, 10 Aug 2026 08:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.74.137.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786351070; cv=none; b=miDpJyYIO/A6nd4p8VFxFzV5DWghYfHjEsQVp5MOcCKuGyxBL6ONsrJF5Ly+QrOGmGTCjcs6hre0U+j8aRT1Oxce3j9o1uc3h4Y+cH+ETwzPRJ9e+QeUBBRp0kXuL4ZVwFOCWxG9FTUlDVY0EA8qeul+P84s62oEHIcE1YPbNxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786351070; c=relaxed/simple; bh=2SkkM4YgkNmS1+Xj89EIHMiAatHdKmDfEKIgtKqQT3w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YuXsOAcXNpl3yXJkV8FNs1sSb8MOLJoH7ctu4WHkG8CKc5aGuTn57ewP9iyinr0Imte6hUk/HO70HoYUWoFcwJ6FrQaUcDynu4i9BGhpwQzdGt5tkaN9Hwve98TunwdB5Bzb6fMz6tk1t3H0mDl09QNCZqLT9eeffAuz7w9e+vU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=atmark-techno.com; spf=pass smtp.mailfrom=atmark-techno.com; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b=AmlQ6XBW; arc=none smtp.client-ip=35.74.137.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=atmark-techno.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atmark-techno.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b="AmlQ6XBW" Authentication-Results: gw2.atmark-techno.com; dkim=pass (2048-bit key; unprotected) header.d=atmark-techno.com header.i=@atmark-techno.com header.a=rsa-sha256 header.s=google header.b=AmlQ6XBW; dkim-atps=neutral Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 33174356 for ; Mon, 10 Aug 2026 17:28:46 +0900 (JST) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2cc73f47bdcso34129265ad.3 for ; Mon, 10 Aug 2026 01:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atmark-techno.com; s=google; t=1786350525; x=1786955325; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=u4MUSaLyqTf+3fB7iyjh29jIrOONjD5n3IKyvNblWb8=; b=AmlQ6XBW3pJaIDvLEwmHhWcZFEnbCuEv8N2KkL5n46vsU3Yz1ZeTFtckvIhy5TBxNN PsTxbsRr+FnUjmq37vEMRQv6HD72Ofh+zX+omi2jlU7Cwe7xoxI6kAxE8Z/4sSqM/kn0 nqvLBKyesNhERtW8nrdY1FLfsaJgp49/o7NDt4ACEvWLXqF9wm5bUNw/emYjSrerhzXJ x3Ft894GikNFzDjc27fouH4TEj+qSqeT/g2H/0u+k5/EBVoanO6nooM5YWNEChgQDB/P DuetuZ/nFYggeB0HvuFi/8Yf+jRsTmZ4DSzoMdwWqYFL1RK88Dp+PbQw9qMx09ywoyvk IutQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786350525; x=1786955325; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=u4MUSaLyqTf+3fB7iyjh29jIrOONjD5n3IKyvNblWb8=; b=JNRSVRr+IV1HEU4V+t3KgzNjt8T0l+/+9DZ8iQPkSt6vhYv4cGkLkDbt6FUF4wC0os /tKeYmVBpBf7NQAC16G8AzmWB5PntCs6bS6M2wIKbXr82ciXSy3atURWwKuuXUU4jYk+ Yem3VZYsXaopVJEJWMegoTm7cJ0AMQ4//qGUNYZf5n6DN7AKRYa3iRTDDovntlv327j3 mhTFLtnYsa8IKo6rYne3zuy5segSyxGaCQrHXAh0FvC3gfjsBImlRd6mLd7Ucxk/GWZU G5eCN8h4Zy8BS6SoIrwDdpUHCb/gaTyNvlDOvulAT8Ih3IWs1s3fonJPsDQOCPLeaU3n h8OA== X-Forwarded-Encrypted: i=1; AHgh+RpfR0aA4Qd/SWlsicovrrHV6zsQOkugE/s/yskxk0tvBDRMWotfpyhNG83PlMS3/8qx8igVuzQvXWrDaxg=@vger.kernel.org X-Gm-Message-State: AOJu0YzeJSG78ds0C3fg7FU1ehE5ohv81nX49MGsUs4X+LMdiEMky3Ps Y1NMKJyclZia6kIVj9LiytVAaFliFLQVFZjFQFBvDZLh+AVUHlUklGfU5lb23VrGSEsqrSbBddf jpuoDWRu6T+AW1DFIfUq+ZZibcVuArMZJ/d/uwRBS7joH8fOmBK731RpoUyM+LG0bo80A9izvQh M= X-Gm-Gg: AR+sD123ieWQib0AkA0Z1E0oZ/M58IkVPKyiWAXswEkoJDfOvZtkgeQ4bhSUjj49Kf8 ff4T9U1i8+BQzztnIFHfwhJlyFV21ZrnLek6AN65kXUqXpDI9MnUumnHc2BmcTIJ4VwwmE8qHQQ SN7hp8redq+dn2lJDcqgtIxPhPmeLQkduiXeOkUj0lsJ6xq4rcR8QwX8dMFLNjWhbMZocgIBhrK FN+ZirWlfJqoet0U9PP7Kqe8Aio/1dnQ9ZsVH832nzm1qNVIxDFJtxFNp+4UNjvnGSZ6yQ1z0zC wfeYCOEt4s8wLBcglTm42G30rSkqzFc7Wf1aiRhAOSr+dzbFQIAmJ0oNDHz1iC2hFxK9wqOiCvU t7MQHTXg1McpwdSl7MWmbxfNjeuN4SDUnPJ/sL2HucvdYaH8i X-Received: by 2002:a17:903:1746:b0:2cf:afe8:b722 with SMTP id d9443c01a7336-2d0ca761e0amr465419955ad.11.1786350525113; Mon, 10 Aug 2026 01:28:45 -0700 (PDT) X-Received: by 2002:a17:903:1746:b0:2cf:afe8:b722 with SMTP id d9443c01a7336-2d0ca761e0amr465419535ad.11.1786350524696; Mon, 10 Aug 2026 01:28:44 -0700 (PDT) Received: from localhost (sodcd-04p2-40.ppp11.odn.ad.jp. [203.139.65.40]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-2d14dbeaad6sm31374505ad.51.2026.08.10.01.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 01:28:44 -0700 (PDT) Date: Mon, 10 Aug 2026 17:28:32 +0900 From: Dominique MARTINET To: Md Sadre Alam Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, tudor.ambarus@linaro.org, s-k6@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, varadarajan.narayanan@oss.qualcomm.com Subject: Re: [PATCH 1/2] mtd: spinand: winbond: add support for W25N04LW Message-ID: References: <20260807064339.1632249-1-md.alam@oss.qualcomm.com> <20260807064339.1632249-2-md.alam@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260807064339.1632249-2-md.alam@oss.qualcomm.com> Md Sadre Alam wrote on Fri, Aug 07, 2026 at 12:13:38PM +0530: > Add support for Winbond W25N04LW 4Gbit SPI-NAND. > It has 8-bit on-die ECC and a 4096+256 byte page > (4096 byte main area, 128 byte usable OOB once > on-chip ECC hides the 128 byte parity area), > organized as 2048 blocks of 64 pages each, unlike > the existing 2048 byte page W25N04KV/W25N04KW parts. This is pretty good timing, I was just looking at sending a patch for W25N04LW myself! I agree with Miquèl that your patch looks odd, you wrote > + NAND_MEMORG(1, 4096, 128, 64, 2048, 40, 1, 1, 1), but the erase blocks are 256K long so it should be + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), did you actually test this device? If it helps, the datasheet for W25N04LWZExx / W25N04LWTBxx is freely available from digikey here[1] [1] https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/7182/W25N04LWZExx_W25N04LWTBxx_RevD_2025-08-05.pdf (And it also supports continuous read, so I'm curious to see if it'd work with the recent continous read support from Miquèl[2] merged in 7.2... I'm not familiar with the subsystem so will need a bit of time to plug all the hooks in properly) [2] https://lore.kernel.org/linux-mtd/20260429-winbond-v6-18-rc1-cont-read-v3-0-0f38b3c229ad@bootlin.com/ FWIW, I've confirmed it works with the following diff (at least up to the point of creating an ubi volume and booting from it); happy to send this as a patch if this has indeed not been tested ------------ diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c index 9b78c1e6cbc9..43a4886dc4a5 100644 --- a/drivers/mtd/nand/spi/winbond.c +++ b/drivers/mtd/nand/spi/winbond.c @@ -335,6 +335,30 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section, return 0; } +static int w25n04lw_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 w25n04lw_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 w25n01kv_ooblayout = { .ecc = w25n01kv_ooblayout_ecc, .free = w25n02kv_ooblayout_free, @@ -345,6 +369,11 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = { .free = w25n02kv_ooblayout_free, }; +static const struct mtd_ooblayout_ops w25n04lw_ooblayout = { + .ecc = w25n04lw_ooblayout_ecc, + .free = w25n04lw_ooblayout_free, +}; + static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { @@ -768,6 +797,15 @@ static const struct spinand_info winbond_spinand_table[] = { &update_cache_variants), 0, SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)), + SPINAND_INFO("W25N04LW", /* 1.8V */ + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xb2, 0x23), + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), + NAND_ECCREQ(8, 512), + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, + &write_cache_variants, + &update_cache_variants), + 0, + SPINAND_ECCINFO(&w25n04lw_ooblayout, w25n02kv_ecc_get_status)), SPINAND_INFO("W35N04JW", /* 1.8V */ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xdf, 0x23), NAND_MEMORG(1, 4096, 128, 64, 512, 10, 1, 4, 1), ----------------- Thanks, -- Dominique Martinet | Asmadeus