From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 DFFCC447808 for ; Sun, 20 Sep 2026 14:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912832; cv=none; b=CGfLZ1IZpbe68qW3DbyhUeh8/b4d0HtEPE0Uo0KAVsre9n/hOtiY5jRtIzBkjuHALxMSBDZzFKF9BNQL6aN5rlb7nBXHDPQxx/YkKVZmH6sRF8/vYZtm4xi8zvzlanjVqPs3S2vpOgTGxyNjkSupoLoJtyHiFqsJua4IA6Mi2/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912832; c=relaxed/simple; bh=0zNN5EMKyLHp+gHTfKhqaUAnQZcH5RA7KeS0l9bnz4Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NQDHYiS77o/VIEbpWt7DYHt6dgUGTlZ1cyqdVpHI3EpwPMClt5rjV/0gZmlaXAOw6zBlfuv5KkWFP5jPiHscihGY6qymcOzAEm8iKkdIjcAnHTETIauR+tSCTwsl1amswuZ86wl1rHh8TNy6IEtUdDa5ZHj2bdjfjw+LbdGT/vM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=s8XDyKc7; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="s8XDyKc7" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 335A84E407D5; Sun, 20 Sep 2026 14:00:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 015726033F; Sun, 20 Sep 2026 14:00:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B4F5F1032906C; Sun, 20 Sep 2026 16:00:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912823; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=VgAafngqW7qJ5v4+IjgL/cytyMQZkw0gU3BV4hiArOg=; b=s8XDyKc7IZYZCBvVp/giYkBDsLmZQTuKDzLOUrbgu+uPp53sS+Fth/+jyh7Cl06Ua9BoeW u8xqBlLoyom6q6pccIiiN0kAvO6ZIzXA4IytdrbXUXWDD7CIUuaM1DipTa54aAbwxckGpM LfYFUUHLflQtvkyGVIVBslUymg07wnrL4e7riJDZfPbaP1cP3PBKHQwYdy1z6e9MJNMZIc qCGU4+y7eNJnEmEYcNPr92rYW7LaxMwAAvIUmtzUXyr0MQ5VPSoZ9GfqI1IaWVlpI4YJBl fKtm1CDECu4U9x+19sZUd9ffBGe908YlfUaTLLqT56nh0J5liv2fbnB42fxJDQ== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:10 +0200 Subject: [PATCH v2 01/25] mtd: spi-nor: winbond: W25Q32xW-Q/N: Enhance identification of the chips 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-1-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The EF 60 16 ID has been reused for: - DW-P/G (no SFDP support, but CMP and quad capable) - FW-G/Q (SFDP, CMP and quad capable) - JW-Q/N (SFDP, CMP and quad capable) Add a comment to flag these chips. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index f6321c1dc7dc..55c55e41ec92 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -322,6 +322,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q32DW-P/G, W25Q32FW-G/Q, W25Q32JW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x16), .name =3D "w25q32dw", .size =3D SZ_4M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 3757C3E8351 for ; Sun, 20 Sep 2026 14:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912839; cv=none; b=eiev25lTC6W4Ui4yaJQ3sOPMZStMW+A0ejDJIHI33y6cHhFI4f56DD0xrOBVuBP/WNGhRkzds0E/ECWOgQnd/+NSWBSCH32a10Yp6OhWHBDXmeR2kYdEG/2CGnx5J1IJ9gz/y9YzUBGd9HR6xoFT3tqtUgf8hlI5yU9wqe1+5DY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912839; c=relaxed/simple; bh=s5LKbVQbY7zQS+0NQ4TGik+lbSyIeG5RVCCyAW0stIk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XZZbe94gxZj+oqmc+gia32il1sngKnY80Ff5W5aqsv4Zgg5/JSHsUVPtrevLISNcpymN6MVcIN5FgwtYzDEfbwt5N9p5DkVLWsBdS6zxXdBa2VyDZcQ8fSe2u6rVrEn9wxrlEnO1nonmJ2zN3Cv5ze74RZH2MMNah9RQyEoMnZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BWb6cwpB; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BWb6cwpB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D9EDD1A09A4; Sun, 20 Sep 2026 14:00:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AF29B6033F; Sun, 20 Sep 2026 14:00:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E6EFC1032906F; Sun, 20 Sep 2026 16:00:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912826; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=doyiamMhxH6XuJwCWnexHapFGv5TIbpIYj6Vqv3mNhA=; b=BWb6cwpBibrK+x9ayOHS5OCwJj7vMdSfLckZuSfWP9OoNCPF3cK1esqBRwAVc1kGf5Q1RX r3GpCATsTdlXWqEPhAs3SOhM6dgj9xYHPdFwTWDm8NzCafnR4SEHdbeqAgpUbgtLkoqTNn 4FBs2CE/ZqI6tEL+qviFvF+q+ENu+N6Rgbe7voW3wH0f4A5AbFlxWuoWagP2PV7swiLSoT fP4FBbZHVi+I9CBARrjYjz16zaIeSE0bl7V43ID4wwbGMVrW1aiMLD0crMZm4nIKgx3G8l amX2SM+yQ0mdESNIzuSTUkyCH6amfam2G6tMzW84lCd7SF7MPJM5dBjkYjlgtw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:11 +0200 Subject: [PATCH v2 02/25] mtd: spi-nor: winbond: W25Q64xW-Q/N: Enhance identification of the chips 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-2-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The EF 60 17 ID has been reused for: - DW-P/G (no SFDP support, but CMP and quad capable) - FW-G/Q (SFDP, CMP and quad capable) - JW-Q/N (SFDP, CMP and quad capable) Add a comment to flag these chips. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 55c55e41ec92..5ce29987a13c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -330,6 +330,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { + /* W25Q64DW-P/G, W25Q64FW-G/Q, W25Q64JW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x17), .name =3D "w25q64dw", .size =3D SZ_8M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 12A263B95E0 for ; Sun, 20 Sep 2026 14:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912839; cv=none; b=lOKnsg6ogA6lb13uH0tNfCZX+PQi2ZqtGSHLHOMvVWYXixI1HijVbg1qVKPuZh1OOA5W2F0IaHMTW7zQ7ofvkfjIpeOs2yCuNlpojhz9tlAhYjNeXbrSGQjNjPSH6Yjw29NpYdut+cARcnD0j+uVGThw5+el3zI7sVSJZWiXO7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912839; c=relaxed/simple; bh=3ke+3qn4cVuQXcXfOm3dBWC/ECOIDrDI9Z7wb4GWUUA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AHIrakVv8OJsL5DeN9oOlEH3i+1y+71GBe8ggg6ot9jqOFgk5+u0FK1KAvLp7qC2Th0PC496U2T6RHUldM/+ynt80lJ1pHPsLMS8GiPM8zgro7CNURbqEQBeHIhv+4kW3re4oOc3A1RZAzfQoKc4N/P2e7V0+APIdnCwbaL24UM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JepZsMMg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JepZsMMg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B41861A09A9; Sun, 20 Sep 2026 14:00:31 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 824776033F; Sun, 20 Sep 2026 14:00:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 789E910329071; Sun, 20 Sep 2026 16:00:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912830; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Xleh9MY4f8nxIveM8Dar9gA9Yu2NBP9ypAN3oHy8NMw=; b=JepZsMMgUw9FfGmvQzLtE30r+nLT9m+rLuks+QFbcZYX0/Co3wyslRCf1xtHcUDaetDcLs XV8lpUo/QwnGtp4w7kAjE2db0skmS+++2tobzpJbQXvNsMIwY+PnD58LmLxC2crVxmSyfJ Szu29BBAo/Df5rGH2cvM4f45fK7evwWnTN6MEkZK/4iB290+W21lWUQ/Aj4BmrT+PJG8iM 4G9/BzQ4t0t2V5NIZly9umShzqEhlO0gNANAm9i1jAuYmKp68nkvGPuiGjL8X85LULplMI lIGAwjzj3WQRFxkiZJFr+G0c3OO1N1QIqohAI3ENpISRpLaYIEqylGqIXwZ1dA== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:12 +0200 Subject: [PATCH v2 03/25] mtd: spi-nor: winbond: W25Q32xW-Q/N: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-3-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. This feature is identical across the various datasheets exposing the same ID, however I could only test it on the JW-Q variant. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_read 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_read 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_read 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_read2 5a6402283d548e191d2a6189a536a4878bda9e6191556aae9abf21063170f189 spi_test c9029efcf9476adb19a5b2cf7ddb26dcce2bd5210be7dea90c4134e0a8cd6f9e spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D4194304 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 4063232 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-003fffff | unlocked | 62 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-003fffff | unlocked | 63 + all_but_one=3D63 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 5ce29987a13c..fe541c6fd939 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -326,7 +326,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x16), .name =3D "w25q32dw", .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 4E3BE314A60 for ; Sun, 20 Sep 2026 14:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912845; cv=none; b=r2EIPXzZn2RVfWRLI+yMgx1WHIdgvGHSqtgeYLGvcgr3Hwf6v1FwCblVRFpASm1V4qKB1PL+OlDwWvmQ8iPpeXlX+ncdkP/TTlETW2cWMOXNrAuMujxJP5OnOdbVfomWE935PsJxbjs0zY6/9rO555qFWGU6VjtS1bIzvsmtI+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912845; c=relaxed/simple; bh=0x8ci7/kbx8ZK4Bc8+8K6rRHUSeRkoF8OqlVUMmDzCU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H//sViuUYNMyuUoLGj2tRkHldpFobSUCeVfe2a8m5DNZdoUsoIgT6OfhqhNZGfP2eVTBb8vSKx55BFJ6SfTVz97ggIUEnW2dQWArmg+xihVkTqVKMMspGB4OXDPdyp0ngSjrz6tRPOx6JDPmBqMyf1BUdNQ3/1m9B/3ZHOs0QWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ULSpmnD7; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ULSpmnD7" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 5EC7B1A07C4; Sun, 20 Sep 2026 14:00:35 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2D3416033F; Sun, 20 Sep 2026 14:00:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C35F81032906C; Sun, 20 Sep 2026 16:00:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912834; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=pdnTDoTdkYsMkfPFjhQtytxCxnMytcCCGSTn7ukjBN4=; b=ULSpmnD7TwZz/g+xBW3mtupH0JfrJw57jKKmOU5hxMTCFzu00Ki07Ss7eqJGNGBgC/SRy0 M3/4DqXIfx5+RGKYooIMBMRsbo8/qI05W031MWJfiJLFC1Kuuw7/DqTgR2pp2ve4SBhM/7 Uu9KwLUxrK6slwe+DlEI9pVpcouwTvzIiU4XQchLXW2wQDhhbgzGQ6Ckt+Cq1S0pnhCg8q tzy87l4a5SdJgUA6eg4CZbHFcgXCUaHUZ1d9uZZ5SycgUWIRSR14qDb4JxgIqQjhJUWrcs pCYfvJHg+wbZll5tNhFTCw9UXGHKA1Bq4GOzI2AmnPtlVrph9j+aj//b+XJ4RQ== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:13 +0200 Subject: [PATCH v2 04/25] mtd: spi-nor: winbond: W25Q64xW-Q/N: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-4-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. This feature is identical across the various datasheets exposing the same ID, however I could only test it on the JW-Q variant. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_read 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_read 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_read 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_read2 5571f5b1deca4414397a96746a87a77ddbe37381cdfc8b104638763d72fa04f1 spi_test 896f1008afff470b95ada9696d79308125a86a6e72fe6f0106b1df93a874aca4 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 2 00040000-007fffff | unlocked | 62 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 1 00020000-007fffff | unlocked | 63 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index fe541c6fd939..7097948e7dba 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -334,7 +334,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x17), .name =3D "w25q64dw", .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q128FW-G/Q, W25Q128JW-Q/N */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 D7B28448391 for ; Sun, 20 Sep 2026 14:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912848; cv=none; b=mjjoEgEEbcMe1bvW0yoOu4ZD/367s5Gd/qHd+VVQcqNGHqePdx/yqs69Vax7DPqRBWveGOjjXAtTwFrWdl2w4JsylbxEK+KAmDGKOiPiJ06PFI/myA1mG4EMEFEUETpTn+iyJJSF8YnQI6kSin/jmd/L2+I6wbwj7qqcldeHKXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912848; c=relaxed/simple; bh=Hxp1V+y01/OrDRZdkFrkpVj5XO2o4tAmaGPBF7qWBuc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b9dNI4InF746r8fV2GSEhkWPTkYwgAPj2l36InT1qnoHOvqjdxS0FjmaN3TxjSVjPWg/o69pHUtCATSxfVGl+O0UMmn4UfVINVdlCL7HvZoc4kqvQnO7ivw7UGDJ70v9/onLqgmLiHhla4P0K/hAaBs9Xg36+ZNV7pRfIyQ+jSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=LtQ6NOt2; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LtQ6NOt2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id AFD7EC51468; Sun, 20 Sep 2026 14:01:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E3CEB6033F; Sun, 20 Sep 2026 14:00:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E7994103286A4; Sun, 20 Sep 2026 16:00:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912837; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=6rIxyCNIZQQChj9zVyr9i4wRH4aie1owi+ABdv7HXC0=; b=LtQ6NOt2/htrT9+xZMomSsKEPN6nmwFUNQCrpy9151Ng4ocG32nl8VU7mU1E0jitZNEz1l gPQEXOHJS5BAnhY6cTXd5Z47BqqGR2KFXGxoEssW4T2e4gJbLKW1WMfAOPKpeNvabH/s/0 BuY4A34IFAxqHpFNO4l22Fx1YrRt5cuVFICuuhopewk48bagR1S7PasPKZS6THiGitos4Y 6Z+O+H8dcYUPeq/3pmQgBaAREOi6rBTJoQIQvnwC34sw3gAd2mbM/FFLt52kf6/SZj/Qn3 IR5ouzACCCTATetqEle3p2iVbQtrCfMUtEx4jKvomlv+x/cASsHQD7XTslmvzQ== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:14 +0200 Subject: [PATCH v2 05/25] mtd: spi-nor: winbond: W25Q128JW-Q/N: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-5-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_read 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_read 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_read 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_read2 0c4503d92f7abc786a21bfb42f8500309b82c1f80080991ed06ab360924ff15e spi_test c6faba05df93beb9ea5cc41b035d58a7761ae79ee8ac09b5ca17b3e5a3c162ed spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D262144 + bps=3D4 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 16252928 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | unlocked | 62 00f80000-00ffffff | locked | 2 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | unlocked | 63 00fc0000-00ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | locked | 2 00080000-00ffffff | unlocked | 62 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 1 00040000-00ffffff | unlocked | 63 + all_but_one=3D252 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 262144 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 7097948e7dba..4201bda91dcd 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -341,7 +341,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x18), .name =3D "w25q128fw", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q256JW-Q/N */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 4815F324B0A for ; Sun, 20 Sep 2026 14:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912852; cv=none; b=R2LqrmyCpbEUfKdEMEjldZtZiG9UcOsySKpWPH3b2UrhPOSaHZIqM2DKduxmN+tDDJbFJlz5Os97LmOFtcb31qUVdLqkyokvFrvtc8WyUNmKgtLloT5ho0lo85gpwfPIwaQmBYp3sLDUxf20oBBZSQaE/LlMTV0eDDD5Ugb1TqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912852; c=relaxed/simple; bh=LctPgH7+dcwY+hoYBxc31gDgV/sj1YC4RhoJ1uNElwE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HQYZBDAkQDSTYUP6fQZp4cjN2BWotnnSnW3Zs+49V/Md3dIuZjmeo1EMTqL2UZXSheVVqiupTWYg4vGrx3jG/0Vd5PqLtZ3quDyehYSknmJPGxIKKm92gTUgBy149DtVUq9bm+HQxJU2CxU6EvniEsoAmR3zMF2u0QEm5JMnrdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=vGQMPQKg; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="vGQMPQKg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id E6D604E404FF; Sun, 20 Sep 2026 14:00:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B9D9F6033F; Sun, 20 Sep 2026 14:00:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2545510329078; Sun, 20 Sep 2026 16:00:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912840; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=u7opC6Go3CZ95i+kc/JjDtenq6ozSetr8LVLoMj3+U8=; b=vGQMPQKggjfqQ0Aa1X63b+kcRh6WTfmGownXf36c10TgUaNvoocKYwwCnTsrMJQmRJC3Ci s2Kip381zm/n4VBb/XRkYd/Dj1L69vtj8zmoLqbSQlyh0AcESEubpe2sXavgABrVKp55oS huWqMOToNWTXAZ1/8Uw7CNlFX7Kglqm/wzs0Rb5E2yrNMZWn2cya0vJu1ZuGAzOsL4qa4+ u9vk4MPUzid6V3WFW59Sgz/crDfPfhzDeDGw55pMhKhOFtdQ5RtktKIqH/fzL0Ek3TnSGx EXxzRZeYgWyFmROiU1mLxM2uU6ykyN5iKK/xmK9MENScuJ0A6FcCwg41EMezCg== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:15 +0200 Subject: [PATCH v2 06/25] mtd: spi-nor: winbond: W25Q32JW-M: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-6-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_read e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_read e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_read e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_read2 e27e656b32704a0e73334be9976f640a44275c5700ff5b00870b8467bc5d685e spi_test d758b42d89798db6b9c4ec51ef81c182441a2156f6675aaa3e80acdee0391544 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D4194304 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 4063232 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-003fffff | unlocked | 62 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-003fffff | unlocked | 63 + all_but_one=3D63 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 4201bda91dcd..1177e00513d7 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -419,7 +419,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x16), .name =3D "w25q32jwm", .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 31CF2449B01 for ; Sun, 20 Sep 2026 14:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912851; cv=none; b=PpKQAE3OAFmv4tMncXGf1jmT9U4FDLAYp+wi0mwsYHOPYrcdwoLx9uRJe2FkoYVMsLgP2/1JcljxgfskiMhy6tOj1rx0L0NWe+UiAauHJtLwmH700Jtpb5ukD2J3FzmU2uFACm/uBXdmnsf2uz/zXrNXXPUVoM92At7+bkUB4vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912851; c=relaxed/simple; bh=nkJ+Xb2Xy1LDFMzbMmMx4LjsPdVRrx6d3Opm7gQaSew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oY6a03O+7BCTIlGNqvslfBq2i5NIw1QrmJwpe1PVkyOQOdm5euqxIjjDER7HTQH1UBZfLrlloeUKzBFNA3xgWxHIBJjG005/iMVFRaP5Plk2FyNpp3HwdNnFYBHkF3tFWZUPsc6tTajjMdttQNoKTCTcFa4O6wcrGpqey/uaxGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=YTJsSVH2; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="YTJsSVH2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 211B74E407D5; Sun, 20 Sep 2026 14:00:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E8D3E6033F; Sun, 20 Sep 2026 14:00:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 69F6C10329079; Sun, 20 Sep 2026 16:00:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912844; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=nM0r5+NLC3FnWiRC/s2jeeeAv/Cn2E1moc+4R+HglIo=; b=YTJsSVH2QD2l+za5DTc4JIn7PAbc6ieAMQD9QuIYzFtnXJj5xNvD2pNAreYBSLbUWaJquW IdRVoXq/efzsQjCLRF+gH7O5KcfgkpIE10tohSbvunV6i+ddL421tuE7+uiwpMRe5HvJQd aG/LsgEHQp5hI3L//xi6S9HouOeV7unKz/L8AcUWVnHyv16+bYnnQUq2CNFrNBWiIoSfgz DLPhDCUeJMLBYHBlVnTCy+od9VGePw0Q7z7M0grufB70Y9GhJq9ahBNIGm+9IBqqAqVmlG bF2CpFGTktZ6xotpf0kpcLZrbuDnuNpa/EY1Vz84yM9t44aV06w7tK1ZE6P43g== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:16 +0200 Subject: [PATCH v2 07/25] mtd: spi-nor: winbond: W25Q64JW-M: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-7-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_read 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_read 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_read 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_read2 0ddafd3bffb8a1568f0621602caa65a527076307c7bd1a5dbab5b395c7047e39 spi_test 0b78bc34748f826c82efbdd8264b931abedbc55b4798365364250ae56c476221 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 2 00040000-007fffff | unlocked | 62 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 1 00020000-007fffff | unlocked | 63 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 1177e00513d7..d0da8f29fe5f 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -427,7 +427,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x17), .name =3D "w25q64jwm", .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q128JW-M */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 8F80544A3E6 for ; Sun, 20 Sep 2026 14:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912855; cv=none; b=qjkmEw0qRlWbFPNj37ow97Jh11JUPXyOputZg1+MtQklf4yra0doBvBK+0Q2yJccZ+1dJk4XEsy/EIho2fad3irqvEC22EWFtAitsM1Jjw+F5G6RgqpopfLj5wJ7s0Du6Y6NfAqgVrtxLYAeyKXPspdTSjDTdEjORlfYzHND4hA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912855; c=relaxed/simple; bh=dQ2AD4ugK7G4sG7SCyCVGD2ZZGE622riUDYCaUyVIIM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZegWf7gYsbC+M1N4lfdRwyi98vFU2gnFE2/sCyZZzVCkem8KtT3bo5g6Wd8TdaxtiL3pOEoxIkS15Yusap3/GO9BSkzU8r2grOX8cLPvkgYNJ6GviuMAp4g2ZqCedQaekIFSPO0kB3TpRfnIo7JH5jXsYY5gY6tZUmFyM21GF6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=rL215NjP; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="rL215NjP" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id B4A4C4E40929; Sun, 20 Sep 2026 14:00:47 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 87FB96033F; Sun, 20 Sep 2026 14:00:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2B8DD10329077; Sun, 20 Sep 2026 16:00:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912846; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=LEJMNiRxJlfqQunueEkwosv/x9ys3Lz4flU3y4ULSpc=; b=rL215NjPk0wCkWP2ISr8lyfYe7YkX+3/2ztTd5b/Dn0jfJCNDvLlOU7Hk5owO5ZA28Xq0/ 9lyBgiKFK+XL7l+InGTVZgAwnf6lpR/OItJL7xxq1TrAhk5+YVfcKFTidDAJj+p6Klhcdc A0idl2JLjSlhTluXQGBgTWdZc/FPf9CDE5nH/0Bv2YcHtfTJ6X3nDXv1VXeOt+5fb1RKmH 3bK+2Ogpt3hinwvFY/j9a3xDua9/LWoybQXhlRp4XHsZn78IDr4nk+BrkD42+mQgZLnRyr Vofqq0W2rRcyjPOwKSl5lIcClVuCJnftr2xlmTv6tK/fQ1Y0NJpnlA/97Yvzsg== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:17 +0200 Subject: [PATCH v2 08/25] mtd: spi-nor: winbond: W25Q128JW-M: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-8-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing capabilities. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_read 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_read 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_read 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_read2 96949af8654a85b6455db627c5154773954ab295742038c1bc95cbe29aa4bcb5 spi_test ed7b778dfbd16c83772901462340558886b5adecd7d61b176996325ae4e4de9f spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D262144 + bps=3D4 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 16252928 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | unlocked | 62 00f80000-00ffffff | locked | 2 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | unlocked | 63 00fc0000-00ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | locked | 2 00080000-00ffffff | unlocked | 62 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 1 00040000-00ffffff | unlocked | 63 + all_but_one=3D252 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 262144 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index d0da8f29fe5f..4ffc7a39ac6d 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -434,7 +434,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x18), .name =3D "w25q128jwm", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q256JW-M */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 333E9448B8F for ; Sun, 20 Sep 2026 14:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912859; cv=none; b=TsujrPRTSxUioV6E9D0q0aeW1d6z2dwacHnloZAgPaSn9qOVXsYExah10v5SRmpgqHJGMocYyoSFYnEtJ3kuCG2Rh/JYaNty4yYMLOIHNQZwE5etDynzFaBpWNEmb7EmC7MesXI6qcHNYVJP2u6c5hunlxkrMF9uJF33hE8d8NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912859; c=relaxed/simple; bh=Nun300RwQnZksLzRvNqoPHXDt1RAK/iUIi5qvomWc4A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UlJXbg8SKqkfSaqO1Q1PtVUPkVofqkqPBsLp44YC+6PDLEdghg/qRoJ9AZCovmna7MfstNK0a3ARvtVC+/tVpbyH7CX36jvmiNlU90hUSlfsnJceSNE1a5PxGIFZZJuOi6nOr0zwFLOeSw1shIGh6H6pdKgFHpysW5a9fKM7OIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=lAzEajqa; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lAzEajqa" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id AFC8C4E4092A; Sun, 20 Sep 2026 14:00:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 851596033F; Sun, 20 Sep 2026 14:00:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5E971103286A4; Sun, 20 Sep 2026 16:00:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912849; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JX145afNqmwx7gx0nctZs7OY5qzDSHefsh4nXWmrx18=; b=lAzEajqarAZndx4d3hJRHLAtdq+dnpFisUDKuuGCXcw+SvoHGt5SU7H8+VxeHiHmnNAmE9 RRborJfmpf1dA9wF3olECPJEYCoHHIQhR1ML68HY6JCyyVyYQt3jBXg89KZEJzRdxK2cn7 q7EHD6NS3ZkZX5IjnNfTKpdA6yREb5sG12x+HqA0NZsorwjfYMrAQicrEE8nmB1EgtW2zx 8FXnSk30qKdbyUWoRNc45hhwAJIzUed+3Y46QkyfYNn3SyeB2XSyr0OAlcFBWuczhR1hCN 2U4lRllMqQUoBtyyzRW6aVZXlYyGVvvSQBjH+Dd066n0/yQsCYkg6H4FVvEy7Q== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:18 +0200 Subject: [PATCH v2 09/25] mtd: spi-nor: winbond: W25Q256JW-Q/N/M: Fill locking information 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-9-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 I do not have any W25Q256JW-Q/N/M in hand, but since all the other chips from this family have the same locking pattern, we can reasonably expect that these chips follow the exact same rules. Add the missing CMP flags. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 4ffc7a39ac6d..62f69e868d7d 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -348,7 +348,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x19), .name =3D "w25q256jw", .size =3D SZ_32M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_= NOR_4BIT_BP, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q512NW-Q/N */ @@ -441,7 +442,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x19), .name =3D "w25q256jwm", .size =3D SZ_32M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_= NOR_4BIT_BP, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q512NW-M */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 6FA1844AB78 for ; Sun, 20 Sep 2026 14:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912860; cv=none; b=LqXboqTkRl4hKzknBUGXJzgp3J0UyAIwalYm0pQGc5HE83TKQuhX/d6Q4xc9tU2f5jYAAypFJvbl09MAhoog1oSGx/U+FndQJaS8kOnv4G6GS7xaHib8SneG88nlCGMLcI3zyf2ETuwJtfJlWXQ8UziV+e0wimZXSoeKNQWyCEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912860; c=relaxed/simple; bh=3w8k1meOfsNi/Obul4wc/aV5Nh0ReYiuObVcp2+exrA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YnOMtNL6t+nmN06lIMdK6mO94BODFxHxYp1YtuH/tF84sbWczP6mhHkW0furfXRpStLgTRj0EqgFzyJqEzZX3FSkjsKQwZbfYBSPAxHdrFhXxSz7CxZv9rwrPOj+IMA7hrKnFhdE81yGOfAOmgO4+wCMo0pahDf2LPKsgp5a0E4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JXtx1Azf; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JXtx1Azf" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id DE0D94E404FF; Sun, 20 Sep 2026 14:00:53 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A26BC6033F; Sun, 20 Sep 2026 14:00:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3E4981032906C; Sun, 20 Sep 2026 16:00:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912852; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=3BlwM7DkGk4m7JeGFpFivlQgZ5cyR6Z3082muigsVKg=; b=JXtx1AzfRH+HsIFrMgY11t3FSXXqVYaqhevVvsitKjoDi9vrtSdgoEPXBoKAgbz93iYzmE C7xqOc7Gdi9Gkcp6tpFVo/BCZyadKf+1Yu7JyPSDMIpmvuSygQeyNuH+cSS38LxWobAdnf z1Xf+vHT/kY+0oVdH8awJPfR2Huj+orpSStZPEvuwU3Rr87FfM48CW1e2vT1IBWsu6aoue T5LMHuR3X/CMCVOyhUXquG3mIiqi0cIEWcI7/Dtb/y+ZRoW1JuyiLHrVsdplIp0YsY4/yB W1/9jn/JSmkXKuHv1unqQ+0DjcBwdCRWbw5Ns1WqzDM1cfj4QHOboZVOTBKu3g== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:19 +0200 Subject: [PATCH v2 10/25] mtd: spi-nor: winbond: W25Q32JW-Q/N: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-10-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 393 KiB/s page write speed is 391 KiB/s 2 page write speed is 391 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 402 KiB/s page write speed is 400 KiB/s 2 page write speed is 400 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 62f69e868d7d..022fcfd05da2 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -326,7 +326,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x16), .name =3D "w25q32dw", .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 13C1F449B34 for ; Sun, 20 Sep 2026 14:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912865; cv=none; b=ZR6v33KYH5woaJ4K/hh3h3YwsvUUTCl1BeX2c5IDVXES42cfVuIpcnoy/4IihF4Nbci6PMTzigja4UHb8dLZ5RLpTpzJhaUnB8pRSer921hU3obtU6XwUu6BGx1FJbhdiiwpFVvNOs70h8T4cudfDP2esM1il8E/ZJzLJO2jZhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912865; c=relaxed/simple; bh=cgwnQqcZqGo5NQIEPV2DTPuv26h3lNsvsDrOv4yhMGs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IvrRkkFGgrX3j299nFotj0a2mMwYMwaZreVWc87f7DDbnocRtY8qZOQDD0GNFEe7yKfK5Vz7lFG+xvuOHFDmH4cEUWAebhws5+8rTwFnJ67no9zeoZVKurGKZzOpNBffc8mQ3PuGvQkrLuaM6z9s7hKCrrkSyqVAVt6Qqj0PFXc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kutltVmA; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kutltVmA" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 250071A07C4; Sun, 20 Sep 2026 14:00:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id ED9786033F; Sun, 20 Sep 2026 14:00:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0488210329071; Sun, 20 Sep 2026 16:00:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912857; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fyG6h/F5DGIOpU5ckjpkKd9PbF63MTcO+98o8dtj2n0=; b=kutltVmA6Q8VM+daXEd/lodcEhfkQcOq84sakVzzJbtnGaHdcy7SQ4cULToKI4KsO3rszL W1+Dwx2a5slxgGRwatkA/WMVeUNXXn0ngx8xC0Onwal8F/UhU0pABBBzRjovj/MXiS5fhC 81Qpi2UBSWtevlgpbSx5oH2XZIyCUOBIFl8Jhp95GpVltCwLF7jPPkqNZ5hxJIk3kJFZbh f+OkuUqPD5IHXkqzYciIKomQgoaaZKmqkl4jsXrD0q06iiNUkTqx+b0L13paK4dctbGjr2 1ajLkd/BWMmbKbAbLSqZ7yTP0CThUw3wgtfkWaINasX7Bj02O8VMVP3L7i4Lgw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:20 +0200 Subject: [PATCH v2 11/25] mtd: spi-nor: winbond: W25Q64JW-Q/N: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-11-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 707 KiB/s page write speed is 699 KiB/s 2 page write speed is 703 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 735 KiB/s page write speed is 726 KiB/s 2 page write speed is 730 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 022fcfd05da2..7e79a415db4b 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -334,7 +334,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x17), .name =3D "w25q64dw", .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q128FW-G/Q, W25Q128JW-Q/N */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 94DD144CF29 for ; Sun, 20 Sep 2026 14:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912867; cv=none; b=SeI6FwuMLUrapLH0eF74czDwoABoPSixzRSCBdpAWSQUwrXKSqmQtP/FdT7sBgD5v36xCY4nSfKZGawEi8nsWIqUdDDncWDshb8V3wKpuXxU7jdUjW/rSeqSpHDNsLi9tsk1bADiX13gkYzkZDQgFXCthFzRwD+BRsPoZrostME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912867; c=relaxed/simple; bh=aFvEEy2ob5c9uaAYQgDvsc0NHbtTHZ3lrVxtQdfKfpc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WLWoJP7EdchZOsO0006guNhfq6WKmqd/gBgGo5swy1oBrigpAPbifWrNQxrsPaos/Tr4Ra45jCVNiYgadGR3xXvUTMXhtV8tKAmC9rLZoyESv4i/DsZSHFE4TAJttZBhxZsCuCmdnFsOFHrBBvNwv322YJ8Fzxb+naUbeC0FeAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=DDkEPMbB; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="DDkEPMbB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 036411A09A4; Sun, 20 Sep 2026 14:01:02 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id CC5346033F; Sun, 20 Sep 2026 14:01:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AFD401032906F; Sun, 20 Sep 2026 16:00:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912860; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=zrordzHJ+Hm9G4+D6z7BJUku8Qa3cmh36QTR22d12E4=; b=DDkEPMbBybYch+ZBCDezRZJc0/OePb7GgSvNCRFAxy5GpJ38sr+bdeDvzspUw0yzBf88tf PtehtEAfWEH/JhnO1Yog+h9mZpVZrqLg5p/aKcVnbBYYfampJcM/v4V5u3ENHRylZcI1Qx +ADmW34qqrrJr8qT2F5aiJ+GY4erIGVY2d+qXOuNifbmrEu9uH/w9Tfgmb9TKSn9xNGrQk WFIbsIRwZYAM2Rh4vj545clkQzaEDcIdz4TM7+UoFXqeGaTGAcxJrUSijNgsnDtydZHvIX 8sikBxTbI0476CD9s7xsUEWWjvmVLPMDUFvFuMUS7gnQv4h0XXCEH4+AUBnuNw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:21 +0200 Subject: [PATCH v2 12/25] mtd: spi-nor: winbond: W25Q128JW-Q/N: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-12-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 378 KiB/s page write speed is 375 KiB/s 2 page write speed is 375 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 386 KiB/s page write speed is 382 KiB/s 2 page write speed is 384 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef6018 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450060101ff00060110800000ff84000102d00000ffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0744eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14c9e96376337a757a75 f7bdd55c19f75dffe930f880ffffffffffffffffffffffffffffffff0000 f0ffffffffff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 9f09054bceec22f43966246eb3043944d50cb679d0a56e8579f78ebe4f99b5a1 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 60 18 00 00 00 size 16.0 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP | HAS_SR2_C= MP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (16.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-00ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test a4fc3a4bd8163710f3a51f6bda131e0146dd7f9e92b7b201e0a8df18e7b89040 spi_read a4fc3a4bd8163710f3a51f6bda131e0146dd7f9e92b7b201e0a8df18e7b89040 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read a4fc3a4bd8163710f3a51f6bda131e0146dd7f9e92b7b201e0a8df18e7b89040 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 16777216 (16M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 7e79a415db4b..a4ac11785d25 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -341,7 +341,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x18), .name =3D "w25q128fw", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q256JW-Q/N */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 857A644F54C for ; Sun, 20 Sep 2026 14:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912870; cv=none; b=kTJhaX6Cj77WaSg2l4xPaOCbabM+HIMf0YDawlCSirfytST55LLz4qwbwzyAF4EZ/h7cPNpnIYbu54mUF8SGsVANXFzxWOrekHyXYuM32x7NQ4d5L87pLAlqEohSGSpnZs9WvLhFRDCuxIgihAH29zV1jxpMd4P67mxn7keBWTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912870; c=relaxed/simple; bh=xo2gVc1KcjT1Unypq7Ohf1M9IjFAYlPnniRq8iFBvlM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pHkUs3uClMMMz2CElitZO2+48Wi1y+7GnoZeaThQrolV65n8ubtRzUaAGi337ztNQwTijtEZv/ukN4z1bnw76dMkDO0SH8748CzEliCuKS49InHQr+FtBbUHKDA8lSTMzqD69O5ZTCKIolb3oDytDkqXGUoUYDCPkSgHTIluezY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EhEMT0SN; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EhEMT0SN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 501C8C5CD44; Sun, 20 Sep 2026 14:01:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 99A396033F; Sun, 20 Sep 2026 14:01:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BBCB110329080; Sun, 20 Sep 2026 16:01:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912864; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MRC9qvTqZrpWIonRs8TglZmtXqsVP7f9eMt/Za9gR1o=; b=EhEMT0SNWs7NeaSqiYWM0WDevfoDaNSw6eht2UUjUs9S9Eu5FzDECUfWlSbkf46ETckJxD xGJ9NWet2y9AkG14HMH/Hzuusu+enlah4cCQn1Z/UuTLfxRIqPrR7xL8nP8YlmQre7H6CU 6Uoa5BOiHxGSkbsEV5d/pBway7iK820YMcPxNUaPG/B9MhOwkBN5Fju1dWBX3AZdjvZpGE ffb7hQlGMEm4j/eM0rrahGYn0SbTUqow2WJWvXekOUH4wepOXl4UXHO47AguTOYktpWXml Xfn3X6UDy2Wk0K7RPJ5k6mcEiikH6K6cBM0ngvX+cvcfA5HCRuPyublyjtnidQ== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:22 +0200 Subject: [PATCH v2 13/25] mtd: spi-nor: winbond: W25Q32JW-M: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-13-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % of write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 416 KiB/s page write speed is 413 KiB/s 2 page write speed is 415 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 424 KiB/s page write speed is 421 KiB/s 2 page write speed is 423 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 16 00 00 00 size 4.00 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP | HAS_SR2_C= MP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (4.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-003fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test d5d5966e19c29fcd8007cf50d715943db3d8468d3f93a71a43d2c026c1cbfb00 spi_read d5d5966e19c29fcd8007cf50d715943db3d8468d3f93a71a43d2c026c1cbfb00 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read d5d5966e19c29fcd8007cf50d715943db3d8468d3f93a71a43d2c026c1cbfb00 spi_test --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index a4ac11785d25..98a1e063e7fe 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -420,7 +420,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x16), .name =3D "w25q32jwm", .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 83BDF314A60 for ; Sun, 20 Sep 2026 14:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912873; cv=none; b=Y8m/5diX+IaFfofcENy1OyrcyCE1JnVpndrqBl1DZpiiYLABTrWrg60FtU3hh/PHBV/6Tf8j76eG/iBtE+7IRq+BZaRvjxyocJdQWjvblHTwaTYsWJ2B2sa743NYd6dqfemEZT0zmsdRQ5CrZ/0OjZZsxuYWrBsPljm89HQ+IgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912873; c=relaxed/simple; bh=AHYwjawO+TreZccrlxWyAbTJE2j0ftLn55+mrfEdU7M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SsdYtx+2V13AEOshsm+HnQ7CmxCO41xwcme+IrSlGT+grl6rf+s2/8coaLUCBvOPi1VGZrchPZx/xuv1k92SR2jv6MMFtrMIuhL4ynmXjZ0kiGiQ0Zbaf3N+9wM+VgCdiWkVvro45AjatIZHwA5czz8EMDTk5E7EAQCrUln36JA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=QLNsjhC5; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="QLNsjhC5" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id A334B4E404FF; Sun, 20 Sep 2026 14:01:09 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 70A136033F; Sun, 20 Sep 2026 14:01:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 772E81032909D; Sun, 20 Sep 2026 16:01:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912868; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=3NbdKKd83YR1kvFls9B3jdIqq5J2V9j9jiNj9sENYuI=; b=QLNsjhC5IZWxhcgHU99OBU0PMOqcDwdy9L2IrQQOueS8m3M6Mp5bWmlK62i3dSp3gY1usb fN2P4K4tfrWQbx/yyz1SOl6Q9u34M46FkReM+MqJU/QL5koe2P6VsT3CfjE0yOYWS1oqdH kLHYMfLIM+H+7UitcE6407bB9VP+lKCS4UljjJBXUak9IXyMhJAv/ehrswCu6o/+JKwPYP V3/OCj0vkxZa6tJFIbqwuZnP8h0JfY0+9lvjjWgG80bniFaHLOFIsMAk8OkHEPGikFG66A gfIthkFr7v4Qmk/97MqHeoESHgUYy3vw0+V7gs4UAX2PuPQ/zZOshP1TGw4J+Q== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:23 +0200 Subject: [PATCH v2 14/25] mtd: spi-nor: winbond: W25Q64JW-M: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-14-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % of write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 707 KiB/s page write speed is 699 KiB/s 2 page write speed is 703 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 739 KiB/s page write speed is 730 KiB/s 2 page write speed is 733 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef8017 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450060101ff00060110800000ff84000102d00000ffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14c4e96376337a757a75 f7bdd55c19f75dffe930f880ffffffffffffffffffffffffffffffff0000 f0ffffffffff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 4b9a53f823cc5483babb4b6a8e816cb9ae11cbb7021cfb375bead1c42ae98fc2 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 17 00 00 00 size 8.00 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP | HAS_SR2_C= MP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-007fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 819fcf52ab4866740190d2eed271f1b30341619e598386a6d7566154f5b2d979 spi_read 819fcf52ab4866740190d2eed271f1b30341619e598386a6d7566154f5b2d979 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 819fcf52ab4866740190d2eed271f1b30341619e598386a6d7566154f5b2d979 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 8388608 (8M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 98a1e063e7fe..945363fd52a2 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -428,7 +428,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x17), .name =3D "w25q64jwm", .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q128JW-M */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 7A52045090A for ; Sun, 20 Sep 2026 14:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912877; cv=none; b=Fr9XqWcV8IpVSjY2h9R9XFsn98b5DeQFbL8yjGeqq0KoHm4vAfvCORjhMuMs7dDcCvDpu9zCWPmRM/awjGPabXgyhhbCciPALeC+FItLUfOJiIPKe+Aps4YbphRg2P7zbN0NX4fvnisAhDxt2u9ZeWY9VAouiOwL75XaEisDfBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912877; c=relaxed/simple; bh=1Y/Ltep67Giy5+CdHPm9+GGDxMWANx0zRd2PmSOXAhw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AJqvEuRuBiAwm7ypWo/hlv/HcsKrOtqDKSBY2CZw6kh4s1AxCx8CtqC19S/ZZO45QZ/Bt1tXIXANAxWIrRJoez7KSI5vF/twD8wNgSze+KK7JyETwpRdxekYdIYlG/R5pwpsH3/fDNqZdInJ53uJaieces3GHkKuPedHCqx/ic8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=yKQv3HyN; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="yKQv3HyN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 35D3AC5CD44; Sun, 20 Sep 2026 14:01:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7F4A66033F; Sun, 20 Sep 2026 14:01:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 98C52103286A4; Sun, 20 Sep 2026 16:01:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912871; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=W6G8a/cJgye8ywGHsxP4vC9jmY6wqxE7/kULFc1ilew=; b=yKQv3HyN6uEgYFXKjhVnMSqXNZEe4u8EnCAycLuWhJqM99SJe0Jkv/hBhmVluJf968n860 ZrtPMzgup4HIRoleKxKESdG9sbN0SQswBrPb40WY6Gd6P4rHJiizF96xuJUlz0+4Kp0fjg 5SAAXYtwgm9sNhqszrwmDqT312EaixSJ2CgrkdfKZFAIaC0mj9ZunUWntZJLeEQGW/083m u0b37CX2bx6S12uXyIaCwy43WsXZO3S+WQHv+ftonQCmTpfZ4dsKRJqpXQpoBmUXIg37oo BhnLFTsi4aw3auMlULdQWPLzmPVEnf9HiEhmuvhphyiYTvZi0CcB094LTrtGGA== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:24 +0200 Subject: [PATCH v2 15/25] mtd: spi-nor: winbond: W25Q128JW-M: Add quad page program capability 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-15-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn a few % write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 379 KiB/s page write speed is 376 KiB/s 2 page write speed is 378 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 387 KiB/s page write speed is 385 KiB/s 2 page write speed is 386 KiB/s Signed-off-by: Miquel Raynal --- + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 18 00 00 00 size 16.0 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP | HAS_SR2_C= MP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (16.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-00ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 62363c62c7fcdb2181eab9031b13814d9fe8f22e38a68353ae81405676138ad0 spi_read 62363c62c7fcdb2181eab9031b13814d9fe8f22e38a68353ae81405676138ad0 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 62363c62c7fcdb2181eab9031b13814d9fe8f22e38a68353ae81405676138ad0 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 16777216 (16M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 945363fd52a2..fbad9e408d7a 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -435,7 +435,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x18), .name =3D "w25q128jwm", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { /* W25Q256JW-M */ --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 9607D446C1B for ; Sun, 20 Sep 2026 14:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912880; cv=none; b=Jony+bmTZngLqHtgTuyC4IiMsAirmqKz3wOJjXySE+sxY2XHnDwtzjbUuqs8zhlaG/p4poSNYpI8UcTRngW7TurZs+oLc/yfCM71p/VudtId3350znoGH4Gx64L8dW4ShS24E3g/ZHSfQE10DSAvB2doMahoZiF7EkPPIBUPB2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912880; c=relaxed/simple; bh=6GYcIxHgbDg1UAEWjiPpdOQs6eOAfPZXneL2+2X11F0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uUeX96qRfPnDcoV1kl6O7rnwdJHLXlwu0V7ahnVkNZ2hiKEYFNzQEgDFlIoCJMHP/2ltu80PwEpLxd+hVKJY7XrRv6iBR1ZFm6gHZkqSwnc/zfUl7GnHkoMndqSPB3awAmKXB17iy7Q5z2zq4xs+SPOy4yvHv9nQhxdTGSWqSN8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Qw/LU/Sp; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Qw/LU/Sp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 7EF21C5CD5C; Sun, 20 Sep 2026 14:02:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C88066033F; Sun, 20 Sep 2026 14:01:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 598261032906F; Sun, 20 Sep 2026 16:01:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912874; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fIQkmrxe4yQKydaR2Oor670GuE12nnU6/hA+wULGODI=; b=Qw/LU/Sp1vqiB3zwWKOfUElg/m5J90nUz698/e+73jZo0QRkGeHH521+cjQSVUDpcY2ou5 ML9LOhfeesPh+GKzlZYV+TOqgcfTkBBK8xvJjcKlOct7u7w6uwHIvrvO+wwbdkGNpvCrgm qEnZCkIBMHd9hlpeBNHaL45QPACxjg1QuX8rQTGrgjT99A8la+jQ1pnwhusZ0RkqvfPtJT O7PljT8FjfQLi2/fRV/hYK0XpEFEG0fv0ZWec7eOhmDIGCV1CaYuH6sXHvs5ta6h54IVJX 2h3SB3l4vZFwVE+rvx+Akz0h0UAc8vW5G1OEPU5SE6Ac5pYsD/4OLY8C3IZ0ew== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:25 +0200 Subject: [PATCH v2 16/25] mtd: spi-nor: winbond: Prepare introduction of W25QxxPW-Q/N parts 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-16-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision between chips of same density from the JW family (which it self conflicted with yet another family) with new PW parts. Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability for the higher devices (> 32Mb). Chips with ECC capability protect 16 bytes chunks are against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 55 +++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 55 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index fbad9e408d7a..a2dea77dfc2c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -71,6 +71,41 @@ static bool winbond_rv_match(const struct spi_nor *nor) return nor->sfdp && is_w25qxxrv(nor); } =20 +static bool is_w25qxxpw(const struct spi_nor *nor) +{ + struct sfdp_header *sfdp_h =3D spi_nor_sfdp_get_header(nor); + + /* + * W25QxxPW chips re-use the same ID as the W25QxxJW/NW family. + * + * Chips are very similar, W25QxxPW brings mostly performance and power + * consumption improvements. One key difference in behaviour is the + * automatic 16-byte based error correction. + * + * They can be distinguished based on their SFDP minor revision: + * W25QxxJW: JESD216B, minor revision =3D=3D 06h + * W25Q51/01/02NW: JESD216B, minor revision =3D=3D 06h + * W25QxxPW: JESD216F, minor revision >=3D 0Ah + */ + return sfdp_h->minor >=3D SFDP_JESD216F_MINOR; +} + +static bool winbond_pw_match(const struct spi_nor *nor) +{ + return nor->sfdp && is_w25qxxpw(nor); +} + +static bool winbond_pw_with_ecc_match(const struct spi_nor *nor) +{ + const struct spi_nor_id *id =3D nor->info->id; + + if (!winbond_pw_match(nor)) + return false; + + /* W25QxxPW densities <=3D 32 Mbit (id[2] <=3D 0x16) do not have built-in= ECC support */ + return id->len =3D=3D 3 && id->bytes[2] >=3D 0x17; +} + static int w25q128_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, @@ -201,6 +236,22 @@ static const struct spi_nor_fixups winbond_nor_partnam= e_fixups =3D { .post_sfdp =3D winbond_nor_partname_post_sfdp_fixups, }; =20 +static int winbond_nor_ecc_configuration_post_sfdp_fixups(struct spi_nor *= nor) +{ + /* + * PW chips feature automatic error correction. Non 16-byte aligned + * writes work, but disable error correction on the region until next era= se. + */ + nor->params->writesize =3D 16; + nor->params->flags |=3D SNOR_F_ECC; + + return 0; +} + +static const struct spi_nor_fixups winbond_nor_ecc_configuration_fixups = =3D { + .post_sfdp =3D winbond_nor_ecc_configuration_post_sfdp_fixups, +}; + static const struct flash_info winbond_nor_parts[] =3D { { .id =3D SNOR_ID(0xef, 0x30, 0x10), @@ -622,6 +673,10 @@ static const struct spi_nor_fixup winbond_fixups[] =3D= { .fixups =3D &winbond_nor_multi_die_fixups }, { .id =3D SNOR_ID(0xef, 0x40, 0x22), .match =3D winbond_jv_match, .fixups =3D &winbond_nor_multi_die_fixups }, + { .id =3D SNOR_ID(0xef, 0x60), .match =3D winbond_pw_with_ecc_match, + .fixups =3D &winbond_nor_ecc_configuration_fixups }, + { .id =3D SNOR_ID(0xef, 0x60), .match =3D winbond_pw_match, + .fixups =3D &winbond_nor_partname_fixups }, { .id =3D SNOR_ID(0xef, 0x70), .match =3D winbond_rv_match, .fixups =3D &winbond_nor_partname_fixups }, { .id =3D SNOR_ID(0xef, 0x70, 0x18), .fixups =3D &w25q128_fixups }, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 C604E44064C for ; Sun, 20 Sep 2026 14:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912885; cv=none; b=jBAqIPdFwoStmaYce+PfOkG/IVpjX+Wj9eclk2i/TcYzW+eNYnGd/d8yAkeMnKrF4gqzjB/G/65pocc8tSQu36e5g7qcaoIp+Ctno/Y6feGhMDjQyxXNd9xP9uubqYn7XRtknnO6WHa+dPZRw4mzcUYdNPPYdAPxT/taVNEdTG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912885; c=relaxed/simple; bh=MjjKPScWPCQrR0h1kN2ofk6EPZqDoaLsDazvilxY5NI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Tymi9qSxuVTUoUypfhUY4u6Q3RUT4l9hd25hyW0KbPzT7D4b4LHfG1bPu+W1tT+WKs3B+eYpEUCHLJPL1U162FOr4Y0WjkwmaJJR9YMgi/CBK6BqQu2eSCXOkUVWL+1QX/ewEBl9KO9ipPOqRXHL48pTCFm1rrwwQcbMkV41gv4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=2trds6v6; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="2trds6v6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 324A91A07C4; Sun, 20 Sep 2026 14:01:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 053816033F; Sun, 20 Sep 2026 14:01:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D983610329071; Sun, 20 Sep 2026 16:01:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912879; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=mN4GAXAlxn0vftK1InXHg2HO7wf+egkTSi43iZS+Fm0=; b=2trds6v6hDkp4q0eTXfk0HErnPU/uaVFXeJ7hgMBzm35sMHZyS1dMWqxBfTY+4P3Wzbs+Q dB6FTgf0bev9eia5osOrVTn5xzD6X1AjyfuiQTLQaZhU2ktYZqP1L/HlBtYvV74kDeCOSr NcUpJ9kilE+g+JpdwdoSRjw5h2gQixkA+h5CzlIOVWlYYi4pYaiNZMWWeMXHs9YHT1LAUZ Rk39dnc8TpyAT1i47z4wiHNYjIQm8k/n58aCuO6Hz/CFonOI6zB3oDBT8nny3PiRqitnj1 u4iSaY/LKFv56kho90ZMYyaEgG95jUBbBeBr4rxIDK+T6bZ8uFWOU4j4A74TIg== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:26 +0200 Subject: [PATCH v2 17/25] mtd: spi-nor: winbond: Add support for W25Q33PW-Q/N 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-17-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef6016 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p p/sys/us/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0144eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d800001432010181e314c2e96376337a757a75 f7a9d55c39f66dffe930f880000000000000ac0000000000f7f5ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 9b4e76b3ab30d374abbf4cc35893b86e3891acd0c86ba4d8deb111b42f890036 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 60 16 00 00 00 size 4.00 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (4.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-003fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_read 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 4194304 (4M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_read 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_read 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_read 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_read2 2fe145f574fac7fcef563647ebaba99ec9226462f5fd520601bbd2cee946529b spi_test 5a4c95f5e812cf8d0123ddb8fc0cece797e41e0ad76ab35340c5680ebdd54073 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D4194304 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 4063232 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-003fffff | unlocked | 62 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-003fffff | unlocked | 63 + all_but_one=3D63 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index a2dea77dfc2c..6934f3e10ec3 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -373,7 +373,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q32DW-P/G, W25Q32FW-G/Q, W25Q32JW-Q/N */ + /* W25Q32DW-P/G, W25Q32FW-G/Q, W25Q32JW-Q/N, W25Q33PW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x16), .name =3D "w25q32dw", .size =3D SZ_4M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 56D79448CF5 for ; Sun, 20 Sep 2026 14:01:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912889; cv=none; b=Nm16nCox9G0rl2pVNn+RhVeYf8EQtg32+Ieas6RKEhsmRmmnU0JcUBu7XDMvZuohchyY86vs697rJuwUE1E1zerVKEiQPG99IupQa3uPNunoUjAtSs651gESN1NDXE8/eVP2zKCxNr828vn9PqIgsf9/Mf+jwESAVPIKmDAb024= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912889; c=relaxed/simple; bh=tHq4hgzxXOz11GkjT6PvTNa2glqXIDJ7vy3Ek0t1wPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pFcm9kmxbYNgSF+B/ZEp9NKte3RfJUirJQoT7noSgvrBzTdy7COke5srQcKOGUAW8L9yN91vlVfEGl2x/meRGfNkh8x6q9dZ6BwJ2y/N6+jIEpaSF0u8HTRFVM3UWTXyNmYvn8x1X2R2vuja3MOW+Jq0gsoijwOuIibdfl9Pguo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=N5ZW2BS1; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="N5ZW2BS1" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 76C3DC5CD44; Sun, 20 Sep 2026 14:02:11 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BF9166033F; Sun, 20 Sep 2026 14:01:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1606110329077; Sun, 20 Sep 2026 16:01:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912885; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=/9kvKmWi8EjNNs610bz6klPI4TGQZkWo6/+rLh4ejKw=; b=N5ZW2BS1/xEiFUtLdOHP2Hkqq9NXVEegwo1pYfMimoRxwLiBr5t4+UeWzqIAhUlHzRH/Li LmqhDIB+tSw2ODUf0SweD9zb+s9amH4rzUQGWoOIpb+8sRes8qrM/xLxOCIzW8ZvB0/auf dgrSHAiCGD5BYIGLe7dTDLX4ZCQ0pGcFnmxctjBaNCAZXfmkQnSotgbecydDbaEexzZE4M FT6DjpRyw80IoO+yOiWZ7TQFr/GYDHLDCAJ5tOfbUC6Zp1cKkKtd1SlIuyVWgRH9SklCLx kML/xT6wa2oqhYvTiEgtEy2KBOcJi+kEsiGeznxNFfPI8+qFQLZYy3E8HJ1orw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:27 +0200 Subject: [PATCH v2 18/25] mtd: spi-nor: winbond: Add support for W25Q64PW-Q/N 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-18-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef6017 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000142a010186e114c1e96376337a757a75 f7a2d55c39f66dffe930f880000000000000ac0000000000f7f5ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 94b52d6e903a2046e144eab0760384b6932c6fdbfec17eb7336f1778c3898daf /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 60 17 00 00 00 size 8.00 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-007fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 115.019352] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 118.449659] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_read 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 123.409877] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 8388608 (8M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 127.458853] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_read 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 129.128621] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_read 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 [ 131.565787] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_read 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_read2 4e60da5ba4514b322c9ef27604a6974ba40a3395a197b618ad9922f79d7fc847 spi_test b78aa1fb51c98dfe5d915bcada1e605c45b30709a16ec879afd8078ef63f21b3 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 2 00040000-007fffff | unlocked | 62 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 1 00020000-007fffff | unlocked | 63 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 6934f3e10ec3..d65e2fbadd03 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -381,7 +381,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { - /* W25Q64DW-P/G, W25Q64FW-G/Q, W25Q64JW-Q/N */ + /* W25Q64DW-P/G, W25Q64FW-G/Q, W25Q64JW-Q/N, W25Q64PW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x17), .name =3D "w25q64dw", .size =3D SZ_8M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 5310345090A for ; Sun, 20 Sep 2026 14:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912893; cv=none; b=MhL1CXNlaQOZDtKbU6r9jH1c7gWe9BEfH+B6ChR4KNgCKe+JUvKPysV+ykreswtHYkj7NIA6UEcPBN+GSi0U16YZNWS4tU7LYoZeOqgREshCr+3ToP48OHPiz74Rqp8n9duBwVMZub0DHpiWi/lbtnIVlppOo+PhGp17HBjTz5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912893; c=relaxed/simple; bh=ctOQiGQ5/szlsTfSUy2uxN7/udIGfCPmqe72vPncXXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qRVoNUl8PgsotIdbB1Rsej1fwboWoPUZ+5Ub+I8rMa0VONUQqEeZh0uhpON4W5WTQEJab0KVi3VN40FwUTjnMB+fma0bKwwauVQ2L7heKqd6u0lkbuZKBcCGlmeErMCVMvwW5IBG9emxKGKlKmIcnr7TE9VAPpniS6HYVDzz7dw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=doYiA7wV; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="doYiA7wV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 5F4DDC5CD44 for ; Sun, 20 Sep 2026 14:02:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A46266033F; Sun, 20 Sep 2026 14:01:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A3F901032906C; Sun, 20 Sep 2026 16:01:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912888; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Hn+uIEnMV9fp+iqSDlNj+stUXfy7EFFdlqqDco8SuCY=; b=doYiA7wVP+dcgjZED38A9sqjOI/Bt0f/yi3lYzYu8YLNAXbUwcaYjeC2wONp2RkalqvwEP lnfvCDGdpQedSxB1pXAzIY5N5pAZugudN+y/pNGd7OBbSd+z2KfgjElGqKhDTpUBLUImW/ vE0fYFqyoCDuJrKdTYIwNhhbbOT642/F8HOiy3u/Anz+zwGRuN3bWbhE/T0xuDIUbi9JU0 whM79W++Mnw6bK2n8CGy0ztyv5orOVhaFvOXXFgvK5fYANsh0ztlSIBtbCZRf2KljkcXAX kFKQzkCO2GnRwh055YfAxvAtEegKNbDSOtf2pBoCk5uo5BLzWo5xO44aQB0eeA== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:28 +0200 Subject: [PATCH v2 19/25] mtd: spi-nor: winbond: Add support for W25Q12PW-Q/N 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-19-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef6018 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0744eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000162a010186e114c2e96376337a757a75 f7a2d55c39f66dffe930f8800000000000002c0000000000f6f4ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp c75ed992ea0351bcecb90f163e1e1c60134b42329bd5d243fb3b8b7fccc5f191 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 60 18 00 00 00 size 16.0 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (16.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-00ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 8.632646] random: crng init done 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 12.751052] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 16.108898] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_read 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 20.442758] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 16777216 (16M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 24.388330] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_read 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 26.058557] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_read 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 [ 28.495793] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_read 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_read2 25ff7ef1035a41d8af9df41ede8b2e77c8d3b5d2631188bdc3faa340030e92ca spi_test cc82f5dade79cb7aaf1050756458b0c6033e7a043604afeee42721d9461e0cca spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D262144 + bps=3D4 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 16252928 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | unlocked | 62 00f80000-00ffffff | locked | 2 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | unlocked | 63 00fc0000-00ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | locked | 2 00080000-00ffffff | unlocked | 62 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 1 00040000-00ffffff | unlocked | 63 + all_but_one=3D252 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 262144 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index d65e2fbadd03..75cca5ab1d8c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -388,7 +388,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q128FW-G/Q, W25Q128JW-Q/N */ + /* W25Q128FW-G/Q, W25Q128JW-Q/N, W25Q12PW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x18), .name =3D "w25q128fw", .size =3D SZ_16M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 4CB8644A3E0 for ; Sun, 20 Sep 2026 14:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912897; cv=none; b=qJKrI3hXjRnkQouUeRGTgLXHNU3qGfqoelFDnHnh0HNPACUPFxdxPznqGstqDKd2ZjI37GnON1GyIdB8BJgY8DghDAvxvmFOkGySQlOCEhVjH2GikNzdKXRUzzRO5FJGVyn6y8saAjmkE7l3tQPsFOP5WcIgL4PqaGWC4AZ+ec4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912897; c=relaxed/simple; bh=byhcBONBHJ6DoX8hLro7IbDFC2sQgWOuKtIJfdhyrmM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IKMj4CARNqKX5Ncdk9DCl6VOVzmdLuK/zHK/oz/KnsEz/ajINpmSs3jgUsxop8Mo91MB+DJInUxmk+v9MfbRZ+ZCyQC5R/PHZcR20b6DQPuLS5j1zW8tq5EojNIO4PJwQhx4/w3tzjkN184LJq5OrrtsB/FxCKkZP9rBl9DiVIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=gbnhYTwb; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="gbnhYTwb" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 33AC3C5CD44; Sun, 20 Sep 2026 14:02:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7D4686033F; Sun, 20 Sep 2026 14:01:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7056B1032906F; Sun, 20 Sep 2026 16:01:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912892; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wCbb20YyvbjJSVU1cIdaut5ljRpCYInu1FLdenA6i3k=; b=gbnhYTwb8Knu7NSy0qJUTsiLdHk0AyEe5krP3s0gii6AKWJWi+w4XADyAEAjpUmySryRiB Tduo8BaxoSKYiGJwYKvMdMPfXKbVQPIVcahw9bFx87XRQiROh8tGmOzjcxe3kPxyOA1Xgy sDpaD87UC8HY4GhH9ze9I4Tw2clPBSDq+IMJfWfb2yh62WF6v4m8nOQalM4J/BS1Dp2wyi INN2IkXABwOOaY+1tN44WjDMOLToFWCB2zShnGbnhJFDwbYv6XJaAKXmt0BJDDDW3fM6Vt fh0Ayi7t9Yp2PlAGHr8ywD6kAG5bV+g4juDVIb7+qt7/lz3bjeyXI3OGI07Trw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:29 +0200 Subject: [PATCH v2 20/25] mtd: spi-nor: winbond: Add support for W25Q25PW-Q/N 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-20-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef6019 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0101ff00080117800000ff84010102e00000ffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520fbffffffff0f44eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000142a010186e114c4e96376337a757a75 f7a4d55c39f66dffe970f9a50000000000002c0000000000f7f5ffff0f00 0000060d44bd27ed080dffffffffff0a00fe21ffdcff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 55268b59c742e7b0fde6cf6c5601676e9e4666daec41316171feb82f0d2d5352 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 60 19 00 00 00 size 32.0 MiB write size 16 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_SR_TB_BIT6 | HAS= _4BIT_BP | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xec dummy cycles 6 erase 0xdc program 0x34 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] dc (64.0 KiB) [3] c7 (32.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-01ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | unlocked | 512 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 16.617667] random: crng init done 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 18.720786] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 22.127861] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_read fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 26.680043] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 33554432 (32M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x2000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_rea[ 30.654003] spi_nor_read [18= 82] [ret: 0] SR3 0x4 @ offset 0x0 d Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_read fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | unlocked | 512 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x2000000 Lock status: locked [ 32.326253] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_read fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug[ 34.766835] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_read fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_read2 fa35f237917a2785516d21e010b8422cbe5e49ba88b962696f188ce807c1857e spi_test 63bfc5b2f0f156a1a4551d6511d4d20b5b6d5cd12b825a6ceb66d167f1223ef8 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | locked | 512 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D33554432 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D512 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 33423360 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01fdffff | unlocked | 510 01fe0000-01ffffff | locked | 2 + flash_lock -u /dev/mtd0 33423360 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01feffff | unlocked | 511 01ff0000-01ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 25165824 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-017fffff | unlocked | 384 01800000-01ffffff | locked | 128 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-01ffffff | unlocked | 510 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-01ffffff | unlocked | 511 + all_but_one=3D511 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 511 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-01ffffff | locked | 511 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-01ffffff | locked | 510 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 511 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01feffff | locked | 511 01ff0000-01ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 33423360 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01fdffff | locked | 510 01fe0000-01ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 75cca5ab1d8c..4c9cbe0240d8 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -395,7 +395,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q256JW-Q/N */ + /* W25Q256JW-Q/N, W25Q25PW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x19), .name =3D "w25q256jw", .size =3D SZ_32M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 A572B44F557 for ; Sun, 20 Sep 2026 14:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912900; cv=none; b=XMqAQ+4ui8SqI18E5Zayt+x6g0qXNzEwlDDQeh+XA1i6rHaBPLFALse0w/bagn4Q7JDaz0owCwhAiVekz5OtZ/vzHo4wKdlOij2WkLQJ9guqb4UhP2y4c31dYGBm0UdCymRFXWDOr5q53R1ClVy7aNG91gryD8agfuviLoMqGWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912900; c=relaxed/simple; bh=yEGCqjKiHy/H+ci/K53gxQ3XF64ysOHqPAbVbHED/HE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FCxW4Mw7t79mYBiyzXJGwAYxQMX2wSIvpEOR8crRhsK6XvDJ3E7QNqcSzDeqpZNn14UvVBaftUbHdhejC1tFAjM6Qjc0ta6DkqKSXE9PaFDTPC7fRTEzos40p+HXwElYFrB6PPifbAzEwc6iDjpu6LPR0L+kK2KcrAnUcrs+JVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=TgkXc45j; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TgkXc45j" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 458571A09A4; Sun, 20 Sep 2026 14:01:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1AA026033F; Sun, 20 Sep 2026 14:01:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4AF05103286A4; Sun, 20 Sep 2026 16:01:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912896; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Rqtx2xl9E7jS5Ru/exlFY1XMfpvRfYdJmFNa4tW5yMU=; b=TgkXc45j5iN28Lyzufyk83yvjpteO0BC/OSui0w3CgubGLITqxnEy9Mg8rrbGwYRHmMHzX L/DLmrm4Ib6ONQBLoW72HvajwNfnfO/floVk6MAVs9P/7dTspyhgZIwrj9rZXQaO67kuSs zdQMXGtIHWmAVenLaL3TnYPpNQr9GxM3hnTiV37V6w2g7fl2cbUsm5jHvUFlWhxRHlD564 EY4CTyKvKUKb196g3c0enzUFP4ntC/GubPRcC2zXMOf9U6Bcj/e3FVA2XJxubvQsvfoFh6 SfnTgorMlxMrvM1AP7JYaOIyWAAZ5lce4RyXLjsyFZSdQK0PilZ69rBDNBmVYw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:30 +0200 Subject: [PATCH v2 21/25] mtd: spi-nor: winbond: Prepare introduction of W25QxxPW-M parts 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-21-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision between chips of same density from the JW family (which it self conflicted with yet another family) with new PW parts. Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability for the higher devices (> 32Mb). Chips with ECC capability protect 16 bytes chunks are against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 4c9cbe0240d8..c1792b12db63 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -684,6 +684,10 @@ static const struct spi_nor_fixup winbond_fixups[] =3D= { .fixups =3D &winbond_nor_multi_die_fixups }, { .id =3D SNOR_ID(0xef, 0x70, 0x22), .match =3D winbond_jv_match, .fixups =3D &winbond_nor_multi_die_fixups }, + { .id =3D SNOR_ID(0xef, 0x80), .match =3D winbond_pw_with_ecc_match, + .fixups =3D &winbond_nor_ecc_configuration_fixups }, + { .id =3D SNOR_ID(0xef, 0x80), .match =3D winbond_pw_match, + .fixups =3D &winbond_nor_partname_fixups }, }; =20 const struct spi_nor_manufacturer spi_nor_winbond =3D { --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 8B09844E66A for ; Sun, 20 Sep 2026 14:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912903; cv=none; b=p0Utp6sAYHSiacA+wDrNgb3AO5rnxRmr/1gS2VADAY7w0HNkrowlzo7Rlg4w2bPT+6GbOoDtw29avNEcmjKAOoLhztCqeRRf/pZSBI8OUBMCY3+3osjUu4OSfC3VK/3CCqzU091RGo3X40oBJJLD2HUs7LiZ05/pMKC0CnDgJcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912903; c=relaxed/simple; bh=J37V5grB0mT5kFd5xlDrAJ+6V2T8F+Pp8OEH9hKCtk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ovvoS8FZNWnm6y8yIq7OB0JCeeMrsyL3RCimKEm0rFgZcaemA42qquUQABtVs1KkolrmCjx+P5Qa/wOphBEXd5NVh9I51IVvLpcUzYqH/xKya4rA52WqUG/L5P+7gp3cHH8VXJkXTYsNT72qh8tK/HEjr3vK9XarTjjJvHw4Tp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pP9sCSeq; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pP9sCSeq" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id AEC89C5CD44; Sun, 20 Sep 2026 14:02:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 033BC6033F; Sun, 20 Sep 2026 14:01:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0E83D10329071; Sun, 20 Sep 2026 16:01:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912899; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=zN/fhUFgVJsoFZDJIv0+wVv9v3ZPtm/olc1uebYJodU=; b=pP9sCSeqzGLpLS6UP0Ki5kg5GjErGZhp8uVMyfXtq+vGY4k6WIa+UkfhAq1t1uKvqC5cwh FEFuFr8f4atAbUIzlBdmPwEWX5xKaQUzw3hoCLCFylMZHX3PcmpgG9cKEJ95zGZ1A8PEY+ 7uKnCf4Dqk0xXXmU5vxWRIpHqfNefthagXFlUg/4I+VYvA5szAOxN7jRQi/cqLPbLXR7ix pnUF7kqrXnuYWv+XroPvBCnqzCXagj83+JAcyMxqZI6QHqmfMd8dko7SuPNFJ1z+dQj6ID 6zVkKHpixe7jZBD7K0wpZYB6P5vERhDiKBAKWhuTnQZf/fzoB3AG5UD4q2Zrjw== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:31 +0200 Subject: [PATCH v2 22/25] mtd: spi-nor: winbond: Add support for W25Q33PW-M 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-22-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef8016 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0144eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d800001432010181e314c2e96376337a757a75 f7a9d55c39f66dffe930f880000000000000ac0000000000f7f5ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 9b4e76b3ab30d374abbf4cc35893b86e3891acd0c86ba4d8deb111b42f890036 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 16 00 00 00 size 4.00 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (4.00 MiB) sector map region (in hex) | erase mask | overlaid ----------------[ 80.211413] random: crng init done --+------------+--------- 00000000-003fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_read 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 4194304 (4M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_read 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_read 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_read 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_read2 0671ee5d1726aa6047aebf939f3b2e776deb8e0bd885c51e77a8f595814bcfb3 spi_test a8868ca46a2af0674110d0fa3ba18602d3538f475a3287ebe26cf0d58ecbc6e6 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D4194304 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 4063232 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-003fffff | unlocked | 62 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-003fffff | unlocked | 63 + all_but_one=3D63 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index c1792b12db63..c56bb01c197b 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -467,7 +467,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q32JW-M */ + /* W25Q32JW-M, W25Q33PW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x16), .name =3D "w25q32jwm", .size =3D SZ_4M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 66A5744F564 for ; Sun, 20 Sep 2026 14:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912906; cv=none; b=nuEJ8xqsv7MGj1fQDpJ/n7nPZBpf4JxfGzIsolZbyfahLxW1l3syIOj/VC9YGwbwoErNtZrYw3cs3vi8ADsFu4zl/w5gPVEHEdq7slD6YeQ32TDepkK686KHLyo3ba3/g8ldZ+OR0/gzHWh9cMBxGKyhBTah6ubTAZm4zTk6FXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912906; c=relaxed/simple; bh=wnIthEosTsa9G3apmxPUfzjqiWok+5sjy49+xj7yUjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CNJlwAnSP17nIOnS/v88iObRba4p28y/6j2fP6Sz83hkCI+95H1w4t9ddHxMWsc9qz5qsxrEr+jLkfDFmk4pBher/hSHKp+4H88dgip+fxIfBaGA/7iLtM3P4Z+sfp7pGm52XNjQ74h5u9kmFRatrCNEG0a94HTxj2EO1GSPYPc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Zd6xUAbJ; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Zd6xUAbJ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D2EFE4E404FF; Sun, 20 Sep 2026 14:01:42 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A63B46033F; Sun, 20 Sep 2026 14:01:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B1C7E10329077; Sun, 20 Sep 2026 16:01:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912902; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2GAAl9iZP3CTUskW4NTselWL3zh/bwryKcTn6Ai07Vo=; b=Zd6xUAbJ0geLe6ZKmLFbLjAVOjv7BrkUnYDYNDS3TfWVlUHcm9lmwXmVL0m48KLO3MF5Nm I1bqJpOkKWZ6rJZJ85bph6kx1UO3SwZR9L91TBhb63Ni58ZQjCQVaYEHDeuupkEJDM3XsA LZIgGjetndoAMcnn8w5IurgMQI6ZKv6MnuVhJcC5joq9bfoR0bm7GPV8Z5vgC6lhhRAp/U j39VCSB5AFunVEVrJlavgcASGvZStRMmUnJQy2Mtw/HCDAZXU0ZfPBqtl/gjdXJzkwb6H0 bjidwUZ+61lbEL+VJIHDmXgXZC7SiNQCutvE74vD6oxE32ioLy57mFCqITc3vA== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:32 +0200 Subject: [PATCH v2 23/25] mtd: spi-nor: winbond: Add support for W25Q64PW-M 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-23-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef8017 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000142a010186e114c1e96376337a757a75 f7a2d55c39f66dffe930f880000000000000ac0000000000f7f5ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 94b52d6e903a2046e144eab0760384b6932c6fdbfec17eb7336f1778c3898daf /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 17 00 00 00 size 8.00 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-007fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 37.385731] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 40.826253] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_read 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 45.590686] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 8388608 (8M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 49.709879] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_read 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 51.379933] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_read 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 [ 53.817562] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_read 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_read2 5d849ed7c9837b24510fe6b6b6b5bec59b67f70680c30da58c29fa35c435a846 spi_test 1e0e0886fe7f4451f72d439efde8fd4a608eb16506f15af4644a30d7c0e82195 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 2 00040000-007fffff | unlocked | 62 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 1 00020000-007fffff | unlocked | 63 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index c56bb01c197b..6bb0f2bda14c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -475,7 +475,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { - /* W25Q64JW-M */ + /* W25Q64JW-M, W25Q64PW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x17), .name =3D "w25q64jwm", .size =3D SZ_8M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 35112453A57 for ; Sun, 20 Sep 2026 14:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912909; cv=none; b=qXtueFmJxF75K6bNfvz/93T/AUWsdpLAazlIDCYdDohCga8Udn5aH5Unm5yYNZAsjXeHXe3JvKcDQcxb4ufWMds7yJiHBH+OK6ZxpcfsW4J6nGKZ8SOKuds990wZpaYqXSuFOmfCe9u7rM4x+B8qmmz0qTynJQweCwGBIYNsXRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912909; c=relaxed/simple; bh=FwC9CWjH0u7qT9qI+xG6+hbzFIl+mQoIdwu8VMK53TU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OCEGbM8KWg0ToH57XZAAZYexQ9Y6gNGPT2lKKw9Xq0VVqaY69/gWLF6/Xada3LkBsEM311qSVvvtEzOYFkDFO6Ne4nf0zFBgjVHmDZv4CGW2DqqKfXhCqLbPX4qJwOiVTV3+v5dz4Po3MQI5txqAB5Bp+UylE6sRTlaaaIQiSeo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=trMxjKnr; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="trMxjKnr" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C387B1A07C4; Sun, 20 Sep 2026 14:01:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 98B336033F; Sun, 20 Sep 2026 14:01:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9931D10329078; Sun, 20 Sep 2026 16:01:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912905; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=nL5b59hNLJCFvN2BGthOExxf9Dn5FrKqMUUc/6St8LA=; b=trMxjKnrudZBbQhOGNZo/BIEkf4aEBHH28wOpwSW/H5u470ZHNd5NFd2odxCrLsoiZK+h+ N2BZp2a8Zss/f87k5Juz9bf3zFaZL0ycVAcaSvn3UK92dgp8v/LfanR2l9D/OmB7VBGBcc CwYprucAfB0f/7IK7xPDWkC/VlshIPY5mE2zTLlleN1Br5rEe5V4aitZFwOoBkjuFwcLBI 0lLGKj/FWUlkFpM7cz2NR/Z0ydFw2kfRFLVAwjHMu0eKhRPlra5HvPAT5CtyJOQEsiGjG5 wwMWO5yTE4RpX/rUnY81NCCwnOxfYB8VA5Lj86Gh2QMNMK6AmRN7FiimkZrm1g== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:33 +0200 Subject: [PATCH v2 24/25] mtd: spi-nor: winbond: Add support for W25Q12PW-M 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-24-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef8018 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0100ff00080117800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0744eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000162a010186e114c2e96376337a757a75 f7a2d55c39f66dffe930f8800000000000002c0000000000f6f4ffff0f00 0000060d44bd27ed080d + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp c75ed992ea0351bcecb90f163e1e1c60134b42329bd5d243fb3b8b7fccc5f191 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 18 00 00 00 size 16.0 MiB write size 16 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (16.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-00ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 12.302899] random: crng init done 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 15.598693] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 18.978675] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_read 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 24.039820] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 16777216 (16M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 28.091333] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_read 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 29.760841] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_read 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 [ 32.197530] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_read 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_read2 93cc0d279e6b70748274c433d54ab6f0b27b0a5d284d3f5b0304c851aec9b18c spi_test bf4144b44ed85988564abb12c69edb49a1c5558909d1bd10db9c943f21e87eca spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D262144 + bps=3D4 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 16252928 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | unlocked | 62 00f80000-00ffffff | locked | 2 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | unlocked | 63 00fc0000-00ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | locked | 2 00080000-00ffffff | unlocked | 62 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 1 00040000-00ffffff | unlocked | 63 + all_but_one=3D252 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 262144 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 6bb0f2bda14c..86e043cb20e4 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -482,7 +482,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q128JW-M */ + /* W25Q128JW-M, W25Q12PW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x18), .name =3D "w25q128jwm", .size =3D SZ_16M, --=20 2.54.0 From nobody Thu Sep 24 21:21:08 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 A1C16449EB8 for ; Sun, 20 Sep 2026 14:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912913; cv=none; b=u0D0ioOGM2BV8rmAgz+WSZrjhGBd8J/YVXIocyvtdtR8874ZhAKAErum7KNqyfwzF/wMDY+CPUB4s+XOo8k7JlRPEnXGZUtxJNFPwhu2hgwIHWVdlXWlgEUXKzZRgPPrL32TjaXF/5AHDj5YoV7ow2V2jn+nDnW1Ajv2ScDURgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789912913; c=relaxed/simple; bh=cF5wHxjOSWTfakHAkX/w43Yrz5dngVmsYamOjtbUaEQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fnbkgEfu7AskqmveVFO88Z1irCoiSgbJFmoWLNWZwDx8sykNc0ru69dsin1lDzyj9wRh4sawGutQhiiyIdpKUvC4BdisTB7+QFlD1EHZqXqBoMmMZWD3F1BfFFj18gD30O3wyxTwSfo5gXLnUbNCpG2vh72XMUaHWKQxPTFxC4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=G1F5ZDHZ; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="G1F5ZDHZ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E4385C5CD5C; Sun, 20 Sep 2026 14:02:35 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2C5A86033F; Sun, 20 Sep 2026 14:01:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 82F3010329079; Sun, 20 Sep 2026 16:01:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789912909; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=x4KPLzsyxbbXLVaskW6BUNFLKsJn4TY1/DtcVZTH5Hc=; b=G1F5ZDHZXTGWuuQbPYDNMDdbyhBYY+30xZZJWBVOpXsPP2jRCsHJGzfhtqm3MrbHLRKcJk 1u7voHPrISQUphuTsh88H4vFFTQsIp7NA/60iwn4Mw0k+g+ExY6D8HvkhFFdSUZ1SigraY m8NPOxdG1SuLe0oTs/UIavDxLc7igiV4xg5br2NMDXCk8k/jfHidC0JkkeCyx4Kqv+jzot QlW1vbcBfSK+/EtmqoBsYV5QNjYWW6k+752HASNjhyl0h3aMDADqpQ5w+sDkj3Fq8lCpW3 ReChKOmGo/T6bVvd/ByluzrbNl35uL1iL7oN7avZNAAULiiCecPWwViMTdqLwA== From: Miquel Raynal Date: Sun, 20 Sep 2026 16:00:34 +0200 Subject: [PATCH v2 25/25] mtd: spi-nor: winbond: Add support for W25Q25PW-M 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-Transfer-Encoding: quoted-printable Message-Id: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-25-ab9c9688d071@bootlin.com> References: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> In-Reply-To: <20260920-winbond-master-spi-nor-jw-cleanup-pw-addition-v2-0-ab9c9688d071@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There is an ID collision with chips of same density from the JW family (which it self conflicted with yet another family). Chips are very similar in practice, it is mostly a matter of electrical differences (mostly power consumption being lower) as well as the addition of inline ECC capability. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. Another significant difference is that PW chips identify themselves as supporting the new SFDP (rev F) QER field which forces an alternate write SR2 opcode (0x31). Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef8019 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0101ff00080117800000ff84010102e00000ffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520fbffffffff0f44eb086b083b42bbfeffffffffff 0000ffff44eb0c200f5210d80000142a010186e114c4e96376337a757a75 f7a4d55c39f66dffe970f9a50000000000002c0000000000f7f5ffff0f00 0000060d44bd27ed080dffffffffff8a00fe21ffdcff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 3361f4e84529b23aacc3cc1d41bcb36b2c3a0e42be019d71b586c952e03e6098 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 80 19 00 00 00 size 32.0 MiB write size 16 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_SR_TB_BIT6 | HAS= _4BIT_BP | SOFT_RESET | ECC | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xec dummy cycles 6 erase 0xdc program 0x34 8D extension repeat protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] dc (64.0 KiB) [3] c7 (32.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-01ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | unlocked | 512 + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 7.216017] random: crng init done 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 9.225266] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 12.783730] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_read 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_test + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 17.878349] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NANDFLASH mtd.size =3D 33554432 (32M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 16 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x2000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 22.062778] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_read 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | unlocked | 512 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x2000000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read [ 23.733210] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_read 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 [ 26.172756] spi_nor_read [1882] [ret: 0] SR3 0x4 @ offset 0x0 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_read 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_read2 51acf03d440fea3017e99b0dfd9711173044c57be0e2699221e969b6c02a2133 spi_test c17d6a0ddfc0f437e7729e42b91b5bd776f2eff4634a7f55c2e88e0774e43ab7 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01ffffff | locked | 512 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D33554432 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D512 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 33423360 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01fdffff | unlocked | 510 01fe0000-01ffffff | locked | 2 + flash_lock -u /dev/mtd0 33423360 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01feffff | unlocked | 511 01ff0000-01ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 25165824 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-017fffff | unlocked | 384 01800000-01ffffff | locked | 128 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-01ffffff | unlocked | 510 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-01ffffff | unlocked | 511 + all_but_one=3D511 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 511 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-01ffffff | locked | 511 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-01ffffff | locked | 510 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 511 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01feffff | locked | 511 01ff0000-01ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 33423360 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-01fdffff | locked | 510 01fe0000-01ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 86e043cb20e4..51f6bcd3f8e5 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -489,7 +489,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q256JW-M */ + /* W25Q256JW-M, W25Q25PW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x19), .name =3D "w25q256jwm", .size =3D SZ_32M, --=20 2.54.0