From patchwork Fri Oct 2 02:21:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QB6lAtCX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=T+wVkA72; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FJ0Xyhz20GG for ; Fri, 02 Oct 2026 22:21:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6aG6BGGeyExRryGxtH5fzd8qLV2YxfBjDukvbNiRXw8=; b=QB6lAtCXlXlViO Uys1JG7K0Q4RevcTYQoCHK4o72eUNNSySVRX0RcuSEXnzdakC5Zn5X6ubE30b964WWBGTsp5TwXms r9i3g/4XSjYMV3tkBvuGxn7kR7YHoox+QRkALGIxSF2BcBE/sp8b4qOe3K2w4r3bfsWp6Jk3rjNNM fY1SAh2VYSoFP3DlSKgzPnA3fuVEB8bPgxSfqBkZtKVWlvjBIdaZuTre4pE/Jsw1bg5WZPem3LkmN OoSDcAjVpIwDhg2MZ8JZRRYZ3DnCuvH7nHoh9oVASgya+tspjscnpi6vJZ2MXJrBCviH/Q2gevJMG cgAKUINAc40uOr8SjjAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGh-0000000BYW2-15HR; Fri, 02 Oct 2026 12:21:39 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGe-0000000BYUy-0Lxj for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:37 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 9A22B4E4110F; Fri, 2 Oct 2026 12:21:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6DC06603DC; Fri, 2 Oct 2026 12:21:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4FE59103281E6; Fri, 2 Oct 2026 14:21:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943689; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=0yk1JOJZFoVMiBC15xlQjxajHbRrIJKa+K6axnf23aY=; b=T+wVkA72I5GbOceICvrba5oseecfJq+7FXlmLhT8jtKNCUiWMbTVA7fiaQyCPq6NYJ2tXH /PUg6TWy+RPBFCKx3G5LVf51XF0/ZPaX/9ufuHLDN68U/7+gHg2jBkDeXKUv8AHRCrWEyj LwRg5qVzFTdD2o7WrmkPqqoj5k89Nn5N7bHF6w4RxsRZnl9SCvWQQ/OL21U53hxr1PEUuP qs4aBkYjrWTkY5H68ogTobTh0rDZfWiUdYiHjqX254PuntNLnboi0esIO5QuBnCRDti+7S IdM2PBXi2iXjdFBkUMMctoaQGZ8s8suT9v6QPCKvCauVzzwao+bSKLuRoMC7wA== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:14 +0200 Subject: [PATCH 01/15] mtd: spi-nor: Only switch to ODTR if the chip has a callback for it MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-1-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052136_267299_A37181C7 X-CRM114-Status: GOOD ( 15.11 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Every manufacturer has its own way of entering ODTR mode. This is typically implemented by the nor->params->set_octal_dtr() callback. Without this callback the core cannot switch to ODTR. If it actual [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Every manufacturer has its own way of entering ODTR mode. This is typically implemented by the nor->params->set_octal_dtr() callback. Without this callback the core cannot switch to ODTR. If it actually does, the chip will stay in SDR mode and none of the subsequent operations will succeed. As of today, any chip not listed in any manufacturer/fixups table will get parsed through SFDP and operated based on the best compromise the core can find. A chip advertizing ODTR support in its SFDP content, will therefore be operated in ODTR mode, leading to a 100% failure rate in operating the chip out of the box. Make sure ODTR page reads and page programs are not enabled for chips without a ->set_octal_dtr() callback. If they support it, they will anyway work in octal mode, but with an SDR bus interface. Signed-off-by: Miquel Raynal --- I faced this problem while operating a Winbond W35T01NW SPI NOR chip which supports ODTR and properly advertizes it in its SFDP data. However it was not expected that it would not be usable at all without a vendor fixup. This commit allows to use all the features available through SFDP without the IDs being listed. Basic SPI NOR tests then passed and speed was obviously better than when constraining the I/O lines in DT: Before: + 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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 After: + 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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 + flash_speed /dev/mtd0 -dc10 not NAND flash, assume page size is 512 bytes. scanning for bad eraseblocks scanned 10 eraseblocks, 0 are bad testing eraseblock write speed eraseblock write speed is 802 KiB/s testing eraseblock read speed eraseblock read speed is 20000 KiB/s testing page write speed page write speed is 796 KiB/s testing page read speed page read speed is 9696 KiB/s testing 2 page write speed 2 page write speed is 799 KiB/s testing 2 page read speed 2 page read speed is 13333 KiB/s Testing erase speed erase speed is 445 KiB/s --- drivers/mtd/spi-nor/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index e2b6efafdd8d..9c61ff4b93c3 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2991,15 +2991,21 @@ static int spi_nor_set_octal_dtr(struct spi_nor *nor, bool enable) { int ret; - if (!nor->params->set_octal_dtr) - return 0; - if (!(nor->read_proto == SNOR_PROTO_8_8_8_DTR && nor->write_proto == SNOR_PROTO_8_8_8_DTR)) return 0; - if (!(nor->params->flags & SNOR_F_IO_MODE_EN_VOLATILE)) - return 0; + if (enable && + (!nor->params->set_octal_dtr || + !(nor->params->flags & SNOR_F_IO_MODE_EN_VOLATILE))) { + struct spi_nor_hwcaps hwcaps = { .mask = SNOR_HWCAPS_ALL }; + + dev_err(nor->dev, "Cannot enter octal DTR mode\n"); + hwcaps.mask &= ~(SNOR_HWCAPS_READ_8_8_8_DTR | + SNOR_HWCAPS_PP_8_8_8_DTR); + + return spi_nor_setup(nor, &hwcaps); + } ret = nor->params->set_octal_dtr(nor, enable); if (ret) From patchwork Fri Oct 2 02:21:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=TVp3y+RY; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=xeyxf4iX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FF5SSGz1yGJ for ; Fri, 02 Oct 2026 22:21:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e/7yCxbK2z0UxOIFiyUHXg6eWHnGmRApq7soW5vTIYI=; b=TVp3y+RYYdvNye ILg4taCMLCecdR5f6B1LvYFJdGjUHyLjMz8GZphvgntr7TQzlGVJ7BVT2Ry1fDuLGrtccMVCHa2f+ ZJJN/ejiEP50BZJ5hgzH8TnkgBtUul2QoPHhpCEaDWX47e+6foyFZWJjVhmU/cTlqUXuLa3+dVL60 HKBvbiBY/o94/tJKTnoZ4bqYwADc4UyGZntkiic8Dw7VPMV1zuxoyS0UHx53Lx6wG946s1Q7h/j3Z fgcIBITGYtS9j7vXVRfUXV0MAlFRREBLEy0bK0b1sI0CNPIuDkERhWi9q0d6iAasjKjPAQ1/2kMU5 URWoaZnHH39bb30sB+zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGi-0000000BYWh-1v5P; Fri, 02 Oct 2026 12:21:40 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGf-0000000BYVF-2e5M for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:38 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 198F04E41110; Fri, 2 Oct 2026 12:21:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E1E6C603DC; Fri, 2 Oct 2026 12:21:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0F70B103281D0; Fri, 2 Oct 2026 14:21:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943695; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=3rH+xtaEE72c/dMWl13TrWCqgtJCjAS6ZGNblkbLQAU=; b=xeyxf4iXt3nbfBRYOCbX/iRVRaF/v7G6Bxr2i5BWBr3kzeJ5/Ung5uhGWmtg8PWpKr8DHF T6t146fG/nQJTpQrzNJ4BdNhf0UGZNSFhxsA90ipGhzewvBBGk5FbGhoW9nKDaP6vc71W6 8M0FECULZp+y7+eTYeORGeZXFId/U6d987BHFIY7d6OjnJitcBz/9ZydkA4b1uy/wnAx97 3CzIog4kf5JYQ+LU4bUEVspjPoobIXie2g4EmaAJ7DBBRjQGIHbmFs9qRWuMKLlntLhJmb UJVFX4pWgOY+sJDEsVc3qHYug4iFR8SvK55dZ4sm7BP3pH8t4cMSJIR5LZHwYQ== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:15 +0200 Subject: [PATCH 02/15] mtd: spi-nor: Fix spacing between arguments MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-2-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052137_838428_6E273E20 X-CRM114-Status: UNSURE ( 8.02 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: A spurious tab got inserted there. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 9c61ff4b93c3..4b9e0410f2f5 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -773,7 +773,7 @@ int s [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A spurious tab got inserted there. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 9c61ff4b93c3..4b9e0410f2f5 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -773,7 +773,7 @@ int spi_nor_read_sr_ll(struct spi_nor *nor, u8 opcode, u8 *sr, * * Return: 0 on success, -errno otherwise. */ -static int spi_nor_write_sr_ll(struct spi_nor *nor, u8 opcode, const u8 *sr, +static int spi_nor_write_sr_ll(struct spi_nor *nor, u8 opcode, const u8 *sr, unsigned int len) { int ret, i; From patchwork Fri Oct 2 02:21:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lba6QfjQ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=k9wVgl8y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FF6nLBz1yVW for ; Fri, 02 Oct 2026 22:21:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FaGxNAD3tgMLzqrAq/NYqflCa65bChfbt6Ercdaav34=; b=lba6QfjQeh99JQ p8Yd74thJZwkz5knwG6zdocSOvL7cEZeCF/FtAKMbqEKTOhezf4y6w5vOLBGoMFBEZQeQGg4nz6eW FAQ5WM4DKJ2/5ezzATHvYEibCAF70QsLJy2Ty5TQJzYsSloTC6ZlJ0eFjcy+u2uLWF/jDQBK9nFUJ AP6vqE8gShqyKGp87FY79nsDUQa3gWACLgWudxdEtw38Y62L9fXcxNAlME1Uu0Fi7k7GGwGO/VJWd jOHLlI2lcOJ3wl4FE6a/12mnNbs3Mi+d22FYzhRVEewLEd1LntM9F5f8CspHhuDEIv3PbHMx1KOit zLgYw4os3TFXPHcfc29g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGj-0000000BYXI-2Oqb; Fri, 02 Oct 2026 12:21:41 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGg-0000000BYVS-47wY for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:40 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7E0684E4110E; Fri, 2 Oct 2026 12:21:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3DCF0603DC; Fri, 2 Oct 2026 12:21:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7EE56103281D8; Fri, 2 Oct 2026 14:21:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943696; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ear8Ahh2j2AUiHu3vy3cVps1i5/MTD54IMpodJAajE0=; b=k9wVgl8y+pvQ06Abp8F13fp5ySSaNJqx3wsPDx61Egl7y6FMNuK6k5AMvHFNn19q8Kjp11 SFwWznuxuV6f8yoYP8ctOyR6Fq9nF7dHsw1Dv8VPaSAIAA4VQ4onqRagxevbDD/L7sx5Ut odVAa9m7i2y9Y3uVR05f/5XUGyXe8HH7SuvVsv6YBs/ZqatqjZo10Y9A47l9ZqcmqnPs72 Hnytw4ExJo3rhTl/MNBdOAukq6e/FtUumCRMVrqThkuiz3rZVUnFFMeFz/zSD9sRv7ZWmX a4+3EaIPRW7++fxt/9loKB+C8Tp0N/JNWHJUD5G5sH9Ly4F1fRgFD3vU3tXHtA== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:16 +0200 Subject: [PATCH 03/15] mtd: spi-nor: Fix comment indentation to clarify the intent MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-3-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052139_187585_564C9717 X-CRM114-Status: UNSURE ( 8.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The comment is misaligned with the content it describes and this kind of bothered me when I first read that code. Move it to the correct indentation level for the sake of clarity. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The comment is misaligned with the content it describes and this kind of bothered me when I first read that code. Move it to the correct indentation level for the sake of clarity. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 4b9e0410f2f5..2bbec3feda39 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2459,7 +2459,8 @@ spi_nor_select_uniform_erase(struct spi_nor_erase_map *map) */ if (!erase && tested_erase->size) erase = tested_erase; - /* keep iterating to find the wanted_size */ + + /* keep iterating to find the wanted_size */ } if (!erase) From patchwork Fri Oct 2 02:21:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3hDHSUoC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=e6KGYanl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FF6CK6z1yGY for ; Fri, 02 Oct 2026 22:21:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RVthADAOi/Ks56LhhQ/gkJJxHQJ8x+whHyYvR54XSYo=; b=3hDHSUoCpZhfos //+2FJDsx/sb11pqZPmKgLMfEtt/krZM6StRTzlzH284pjy+uTa+C5HmcNMDDN7ZIYdGYVW1jNAli NTTQy2fk334X2iAQNzD26QUMAiqqV8veREQV6qd3q+0c9DuWMTpkd5elIrnX318ttEZpgZHBYjTz1 P/jE48TrCm2RmQ/vFO5HKSG75qVZ8A+zq2ZSBSoA3QTWuFZnyHdavR2sNMsjJK0EvLHxaqG3Nx4Wl aP0mB1QtMsXqNZQC/gTcsMiR7RvpytOOn/zNS6I8SXzt3JiYqZvN7TMPqfw/oEMu/goY1Hy+/eSqT CcjYSu8C3D15s5tD5SaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGl-0000000BYYU-2sqt; Fri, 02 Oct 2026 12:21:43 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGi-0000000BYWC-29HW for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:41 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 149BD4E4110F; Fri, 2 Oct 2026 12:21:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DCEFC603DC; Fri, 2 Oct 2026 12:21:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BDCFA103281E3; Fri, 2 Oct 2026 14:21:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943698; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=lKU3bfFA3TBWByBniXLhckIqiCwee1j7ncswMHgAQeQ=; b=e6KGYanlIDFTY8WB/bUgBsQWMbLQfreIEBpim5uy9g2NcG9kpHip1tY2P1qFomYC/vdqTR utOpzqekHybyv3pmxD+zZ+vPCopUGqdFKA3e7ZkT/TGEKj0ZhAPzPcgVPAf7ntLokJdfnL kL6l35PXvQIPzfQsubb1HufFkylYyPppae4pZ2UUWLb50YpDHGCyhPskXaDpS5vymTc1Hy bkgvsfCnNuJtEC5n7TEkXOjY7aQNml8uZdYfbqHthDkw0SiTVdLKnJpCV0843xek3t8fkJ igFRb/oAvcDYBLow2AO1TqA4bv2vfe9NoaBRjdGXCbNoU0PVP+w66odMX872wA== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:17 +0200 Subject: [PATCH 04/15] mtd: spi-nor: sfdp: Enhance a comment MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-4-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052140_735135_6742DD1C X-CRM114-Status: GOOD ( 11.03 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: While working in spi_nor_parse_sccr_mc(), the actual meaning of the comment was not obvious to me. Not sure my proposal greatly improves it, but at a first glane it feels clearer to me. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/sfdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org While working in spi_nor_parse_sccr_mc(), the actual meaning of the comment was not obvious to me. Not sure my proposal greatly improves it, but at a first glane it feels clearer to me. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/sfdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index c21a6953db96..9d5c0bbb53ae 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -1417,8 +1417,8 @@ static int spi_nor_parse_sccr_mc(struct spi_nor *nor, le32_to_cpu_array(dwords, sccr_mc_header->length); /* - * Pair of DOWRDs (volatile and non-volatile register offsets) per - * additional die. Hence, length = 2 * (number of additional dice). + * There is a pair of DWORDs (volatile and non-volatile register offsets) + * per additional die. Hence, length = 2 * (number of additional dice). */ n_dice = 1 + sccr_mc_header->length / 2; From patchwork Fri Oct 2 02:21:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=owdvTTjv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=fL2fj/g1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FJ0Tt3z20GF for ; Fri, 02 Oct 2026 22:21:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tRtzF0vuOLxdoLxYD6KY8OV+PsAggMkNlJ75vAnlUeo=; b=owdvTTjvaziG1F FuGDJpmnMjjZHZklTfe+iBCJRIcgOfTib7WJ5R4aLPx36o5+RoCSTVA74GDgTUdlC3QR8+Xdd1aYV 04rOcZhIuIJKvjSS2CTkOMIYm0Jj8gnPD4Yg8PFUbKq3xT8aQvnIPrBAbL2Ss94vn3pCkvBFjX5/O +wmOz/FYBWNngddhp2vqvN2Lx4JYN0CjxZXRlRHe/SXSipR9qRrzSze1g491AE0j2H3yanU3T+bl/ 7jwb9glkzNUv9m5+7s33msIrbjr5hTk524C10Flz8DAD22Fvw7WUtnxJZTlqM8lE0BpxVFKJeKeNw nokWhkaEWQVqkiYtE0LQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGn-0000000BYZn-3PDh; Fri, 02 Oct 2026 12:21:45 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGj-0000000BYWr-3gXE for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:43 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 60AA64E4110E; Fri, 2 Oct 2026 12:21:40 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 343B4603DC; Fri, 2 Oct 2026 12:21:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8E383103281EC; Fri, 2 Oct 2026 14:21:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943699; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vOHz17WNePLEEE9OMB3edY/QK4xTISPUZ92W5KwmCK0=; b=fL2fj/g1CyEa8LiaAYYCKkHqQZ2AhkLho0RfRr7ceXNAS70OR0s9yiVp9vrDa87/QujGMb nMb3sUeUoBv1gebsz5ihjmRB3jrHwuN32YQXf6+3U58MEGxS+ePHXcANtjdW1ZLMyzBs/c YSWoHITqO4pXubQdc3fuG2SdNWe79MUqZ38waFU5eED0KWoAm8HNeZB+MaVnuGKbYsVj8S O0G1kGq81ktsZp4Zq+h2B3LFWysSr+NryYEs66TAZavEp2DWRw2YBg2bMkpQ3/ttjtHXId 09M/BVbI2D5sDmr/Iccy1dXqswAT68c+Nbpu2paGu0s5fJc72He4zK/RRjBaYw== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:18 +0200 Subject: [PATCH 05/15] mtd: spi-nor: Drop stale values MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-5-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052142_083470_9BB8FE62 X-CRM114-Status: UNSURE ( 8.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: These apparently Micron-specific flash opcodes are used nowhere. They are not exposed by a UAPI header either, so just drop them, they are stale definitions. I discovered them while working on Winbond VCR registers. For a moment I thought VCR registers were wide spread (but, no). Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org These apparently Micron-specific flash opcodes are used nowhere. They are not exposed by a UAPI header either, so just drop them, they are stale definitions. I discovered them while working on Winbond VCR registers. For a moment I thought VCR registers were wide spread (but, no). Signed-off-by: Miquel Raynal --- include/linux/mtd/spi-nor.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index b3e3c6b10186..1a2f15d8426a 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -89,10 +89,6 @@ /* Used for Spansion flashes only. */ #define SPINOR_OP_BRWR 0x17 /* Bank register write */ -/* Used for Micron flashes only. */ -#define SPINOR_OP_RD_EVCR 0x65 /* Read EVCR register */ -#define SPINOR_OP_WD_EVCR 0x61 /* Write EVCR register */ - /* Used for GigaDevices and Winbond flashes. */ #define SPINOR_OP_ESECR 0x44 /* Erase Security registers */ #define SPINOR_OP_PSECR 0x42 /* Program Security registers */ From patchwork Fri Oct 2 02:21:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=dqnfmD5j; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=EwbizyCm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FD6FJKz1xvt for ; Fri, 02 Oct 2026 22:21:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8l+Iv5OsQHh+MHzLDtRstEjERzLvA6AyJMz94nGrGS0=; b=dqnfmD5jekRbU4 0dHZ6sPi+h7yaUKjzM80jW4jlQP1bSE2FU70khFdu/IIM0AQwqr3/qzC/Uc0T8hXpImxsP6HjGm/Z aniyV95mjO4LBoEl1aysOgP5y/schWfIGsvS42c2cj49R31QiCl084pggWyHIkZiZmgoUF1DgonJz wo7uP9nIPQqD1Maq0+lK2ywdZtzGTM04247qUyDv/1LX1wqiMMvBMp7QEpRqf29+cdfuIZ8x7oPvp IVk9qWkF/RxHou1AGOVHniSnCOIqkkGgaOD1surgp+8eJhodYqpa/y6ax3jbAofcubk+rRvkKGoTc CgPnUO/UIgo2kRDnjLnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGo-0000000BYao-3pXW; Fri, 02 Oct 2026 12:21:46 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGm-0000000BYXh-1dxY for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:45 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E3B4D1A10E3; Fri, 2 Oct 2026 12:21:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B7E3E603DC; Fri, 2 Oct 2026 12:21:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E0462103281F4; Fri, 2 Oct 2026 14:21:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943700; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=+2pH0Z17Ub41pMWE4R8R4Z0EeQ0P/zy8pfaxz32ykdg=; b=EwbizyCmlOqkJoU8IePStuE+wdUZCplb8VZbR9wj2UpE+Ny5J9onfyUWYA3CUnhopHCjrx 2yxfzzb4C9H4D8XeGXaLK72U5vUyQXGNzCeXmhEcL/dUe++fo/r4HJQyoHPcRrlJk0zyom TtyCFC8JQSZ49ROX7JuJBb0lFkWPtl5b7tR4Hc2o2l9la8XRFymNe2sZxbSxPqoZgr9Egd +2FkS7ktdFIvxq9DY10mpvTUWpwMU4U+OtlrWyL34S606WQdQt7L9EGYAaiJZJJnsQFctr 49DwPNTvdoMd4Az1L1FAHjqdwyVzgNFKWwNA9U5eG2vrzgy2NMtfPdcoDUCJjg== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:19 +0200 Subject: [PATCH 06/15] mtd: spi-nor: Fix WRSR with ODTR chips MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-6-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052144_579686_A9CBACA0 X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The ODTR interface requires an even number of bytes in each section of the operation. spi_nor_spimem_setup_op() takes care of the opcode phase, but we have to adapt the rest of the operation ourself. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The ODTR interface requires an even number of bytes in each section of the operation. spi_nor_spimem_setup_op() takes care of the opcode phase, but we have to adapt the rest of the operation ourself. Inspiration comes from the spi_nor_read_sr_ll() helper which faces a similar case. Fixes: 63489002d397 ("mtd: spi-nor: Refactor Read Status/Write Status support") Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 2bbec3feda39..6e22342361c3 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -791,6 +791,17 @@ static int spi_nor_write_sr_ll(struct spi_nor *nor, u8 opcode, const u8 *sr, if (nor->spimem) { struct spi_mem_op op = SPI_NOR_WRSR_OP(opcode, nor->bouncebuf, len); + if (nor->reg_proto == SNOR_PROTO_8_8_8_DTR) { + if (len != 1) + return -EOPNOTSUPP; + + /* + * We don't want to write only one byte in DTR mode. So, + * duplicate the buffer and write 2. + */ + op.data.nbytes = 2; + nor->bouncebuf[1] = nor->bouncebuf[0]; + } spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); From patchwork Fri Oct 2 02:21:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=N8i6MzVK; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=Gwd9QoEi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FK06SHz1xvt for ; Fri, 02 Oct 2026 22:21:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=28gy5dwz7IpQUvKMMiY6Ie5O2kz9PDL1id7YLAP8jYg=; b=N8i6MzVKgUYNG8 DedXmkGVf3Hb1l6GAqP13Evm9Ri7s4Vo7tcpP0F448btO7bkaaJRszjL3jeX5hkqStXACN7p123Ce XEE6x+EChcd573/410uj6VGBsK7W/52hBhYL7BTiVX5yK9cmMbQ4Aa1S4w+y1qLl2gv/xHfBBTnZr fjMgvJX2GmcVxeVViYIgGJ2zUB9JFB5zMjWiTKBNuqsTlPqLBb0WfwKDiMpxowYNvjoV4TvhDc7nq 1G+P+EcJDCKa19t2uVRYWeZjjAPhgr7CYWvWNUrYE7cjIktf5NBPcn9EbMr88EceWfNId284UhzLI FnUQZ335m8Y5j4UJE0Wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGr-0000000BYd7-08RY; Fri, 02 Oct 2026 12:21:49 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGn-0000000BYYc-1h5S for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:46 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D5BE64E41111; Fri, 2 Oct 2026 12:21:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A93A0603DC; Fri, 2 Oct 2026 12:21:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5A05410328202; Fri, 2 Oct 2026 14:21:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943702; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=F8+VMoBjhGxFp/mfYKvgpqrWwYN/RkzKCtwvFsghv/g=; b=Gwd9QoEiWi/DLuC6TdElzWMrlgBHKwbOMKCLV4qysf/HWdAR9Nnm4X0atyotrJ9NWaOx+Q OccTtP5MubVlm/Rg6TWn21k5hNGYHl+ROgFd7FiRo9qBo9XQmzfaD7tGil2QbTbe6KhTtd 9ErJ5UBYTthT2n3SkLyFMQ6M4W23tHkW3z4fYw2qgmBmIEsQ233+bpwFRaJj89ZUO45Vb9 f9ByQ42wxwv9RwKsMUDppftCb+ooI83TchM6K3BJcz/2YDcv1U96gMHk2fX49Oo1d/0m8t EMtQv5vO7H1Y8GjsFxxgWFpw/14K3upzWPn8Ybd031/d1PRQWyC9f397CJjn+Q== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:20 +0200 Subject: [PATCH 07/15] mtd: spi-nor: Allow configuring the actual number of dummy cycles MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-7-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052145_589750_09A87348 X-CRM114-Status: GOOD ( 15.03 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The SPI NOR core selects the fastest read variant advertised by the SFDP tables. This may or may not be a wise choice but at least it is simpler as any bus frequency will just work. There is however a [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The SPI NOR core selects the fastest read variant advertised by the SFDP tables. This may or may not be a wise choice but at least it is simpler as any bus frequency will just work. There is however a downside: the number of dummy cycles is maximized (in case the bus frequency is really fast, this is how the chip enforces a sufficient delay). Maximizing the number of dummy cycles means that, if the amount of cycles is configurable in the chip, we might not take its default value. When this happens, we need to make sure that the chip is configured accordingly. Crete a callback to configure the chip for expecting a specific number of dummy cycles. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 12 +++++++++++- drivers/mtd/spi-nor/core.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 6e22342361c3..152add3834fc 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2627,7 +2627,17 @@ static int spi_nor_setup(struct spi_nor *nor, return err; } - return spi_nor_set_addr_nbytes(nor); + err = spi_nor_set_addr_nbytes(nor); + if (err) + return err; + + if (nor->params->set_dummy) { + err = nor->params->set_dummy(nor, nor->read_dummy); + if (err) + return err; + } + + return 0; } bool spi_nor_fixup_match(const struct spi_nor *nor, diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 670182b3c2ad..b64f26b69c05 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -377,6 +377,7 @@ struct spi_nor_opcodes { * Table. * @otp: SPI NOR OTP info. * @set_octal_dtr: enables or disables SPI NOR octal DTR mode. + * @set_dummy: configure the number of read dummy cycles. * @quad_enable: enables SPI NOR quad mode. * @qe_mask: two bytes mask used to set/clear the QE bit * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode. @@ -410,6 +411,7 @@ struct spi_nor_flash_parameter { struct spi_nor_otp otp; int (*set_octal_dtr)(struct spi_nor *nor, bool enable); + int (*set_dummy)(struct spi_nor *nor, u8 dummy_cycles); int (*quad_enable)(struct spi_nor *nor); u8 qe_mask[2]; int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable); From patchwork Fri Oct 2 02:21:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WLjqUYVx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=Tb5cmBEF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FL0d8tz1yGJ for ; Fri, 02 Oct 2026 22:21:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VRgCfD/J/4IL+VfzhclGWUfhdNOOlQokj0XqWIn9Ygw=; b=WLjqUYVxZcl7qt 2cE+K6fRfdxA/bVkEB4++VYb/MQks1kGNrkFZIBlKiQJZH7xqMdG8V8Iw2YroX6jOln0Yy7cyfRlJ lDrT5dSmVTF7dszC7ZsCtx38X+yWtvrWzxgmxzBzRSag5kuwBUi2RgSUtvwu7fgLHI2B5Jwy9HSD6 h6y9uzy2iZDqoR/c7jhgHzt86eLrPh+BCpQD8kt9xJLi9KxjGmEge1/cusIZN+C0WP8CrwRDlvIhB e/pgzw/e0k+N3of4qTk194YG3yQSx5UhK8Tjy0y/uxCVkzyXKmIJWVSw3G3r88DE10l3dWE5sOkG0 JWx5463v+acqpQQEt+NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGs-0000000BYeX-16Sz; Fri, 02 Oct 2026 12:21:50 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGo-0000000BYZl-3UrO for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:48 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 5CAE11A10DF; Fri, 2 Oct 2026 12:21:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 31FF0603DC; Fri, 2 Oct 2026 12:21:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 12A461032820F; Fri, 2 Oct 2026 14:21:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943704; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=g5E971noNfwmosMia1C8bd4DCKd1mlhJxpuuFYZH8pA=; b=Tb5cmBEFBOBxx+HWlBjz1xSY4WqML7yrFnb5F2iNT/ALLaYRJNbzlvGtFmx98IJJNbaKvo pxlsGOBaQXmaQ7uLYo5pCodUa+uvfmRiY7UJRn0Bq/W/Hpuibs1fdbG9Oqis5yFKrrlcO/ uar4EtxMwQQeJIsx+aM7tWLNx9K1oF7LgKFN7/sglyN8PbSz7FxMF35bbEA8qHI6Z23lAt lqYKj9ur9Xr2q2VZfw3RxcK+7ogiZXNLP61ncjw9fgtOGtBoS3AVp6C6+N8G22pfqHMgav 58Gen73z6iyXXbVnkcb6qrD+YIjD7lazw6qBxBKNnVoeDcjfS2pMlBLuAlA6qA== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:21 +0200 Subject: [PATCH 08/15] mtd: spi-nor: Fix SWP for octal DTR chips MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-8-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052147_025875_B3CE499D X-CRM114-Status: GOOD ( 13.14 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: During the recent rework of status registers handling, we mostly focused on quad capable devices, partially skipping ODTR devices in our mental model. It seems that many (if not all?) ODTR devices hav [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org During the recent rework of status registers handling, we mostly focused on quad capable devices, partially skipping ODTR devices in our mental model. It seems that many (if not all?) ODTR devices have no SR2 read opcode and have other control mechanisms. Because of that, the current support in swp.c is broken, because reading back the written value may or may not lead to the expected result. Let's extend the _careful() suffix to the helper reading back the values and comparing them. Maybe this "carfulness" will have to be moved back to the core, it is a bit early to state it. For now, let's just make sure that we read back 0s without errors when virtually accessing SR2 on those chips. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 2 +- drivers/mtd/spi-nor/core.h | 1 + drivers/mtd/spi-nor/swp.c | 23 +++++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 152add3834fc..4926a3193891 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -927,7 +927,7 @@ int spi_nor_write_sr2(struct spi_nor *nor, const u8 *sr2) * * Return 0 or errno. */ -static int spi_nor_write_sr1_and_sr2(struct spi_nor *nor, const u8 *sr) +int spi_nor_write_sr1_and_sr2(struct spi_nor *nor, const u8 *sr) { struct spi_nor_flash_parameter *params = nor->params; int ret; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index b64f26b69c05..cee33ca18b04 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -664,6 +664,7 @@ int spi_nor_read_sr2(struct spi_nor *nor, u8 *sr2); int spi_nor_read_sr1_and_sr2(struct spi_nor *nor, u8 *sr); int spi_nor_write_sr1(struct spi_nor *nor, const u8 *sr1); int spi_nor_write_sr2(struct spi_nor *nor, const u8 *sr2); +int spi_nor_write_sr1_and_sr2(struct spi_nor *nor, const u8 *sr); int spi_nor_write_sr1_and_sr2_and_check(struct spi_nor *nor, const u8 *sr); ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len, diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c index 7e667e4ca84d..e9cf2ca23234 100644 --- a/drivers/mtd/spi-nor/swp.c +++ b/drivers/mtd/spi-nor/swp.c @@ -240,6 +240,25 @@ static int spi_nor_read_sr1_and_sr2_careful(struct spi_nor *nor, u8 *sr) return spi_nor_read_sr2_careful(nor, &sr[1]); } +static int spi_nor_write_sr1_and_sr2_and_check_careful(struct spi_nor *nor, const u8 *sr) +{ + u8 tmp[2]; + int ret; + + ret = spi_nor_write_sr1_and_sr2(nor, sr); + if (ret) + return ret; + + ret = spi_nor_read_sr1_and_sr2_careful(nor, tmp); + if (ret) + return ret; + + if (sr[0] != tmp[0] || sr[1] != tmp[1]) + return -EIO; + + return 0; +} + /* * Keep a local cache containing all lock-related bits for debugfs use only. * This way, debugfs never needs to access the flash directly. @@ -407,7 +426,7 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len) (ofs_old < ofs_new || (ofs_new + len_new) < (ofs_old + len_old))) return -EINVAL; - ret = spi_nor_write_sr1_and_sr2_and_check(nor, best_status_new); + ret = spi_nor_write_sr1_and_sr2_and_check_careful(nor, best_status_new); if (ret) return ret; @@ -529,7 +548,7 @@ static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len) (ofs_new < ofs_old || (ofs_old + len_old) < (ofs_new + len_new))) return -EINVAL; - ret = spi_nor_write_sr1_and_sr2_and_check(nor, best_status_new); + ret = spi_nor_write_sr1_and_sr2_and_check_careful(nor, best_status_new); if (ret) return ret; From patchwork Fri Oct 2 02:21:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YC0TdqVA; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=jWUZVb7l; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FN3q17z1xvt for ; Fri, 02 Oct 2026 22:22:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1KOmV5Sjpvz7X+QSOBVDmB4+9Yk0GHJTLHpeTc98JO4=; b=YC0TdqVAuizYu6 HQWZcd5npoZxFMki8zGvXb3l/LeyR66Waw+7iKxCniay4wCglM/7/VVfs3h2SApCy8iBWsMw41Jkx TKxapEbTPOzAr4wJvh4ZD7mseaAor8Ut0NbEn1pRLWk51sVGSlvX6uuSsxYm+lyHxkTTnvJVXoj7l QQBJTnVGwNHyVogVhpPDsgDYu+x2FWmVWtN4PJqgcVWXJRM8zZ645pyVdO+W7Jv28fIG2dsLPTjXp RkWvTD7xzpwGqo0Lh4u810d+eYOPusWzCrhOSGMp6GRNbBNwagTwgAMcr9JrPGfCcZO87BavKIVuH C7btkeleLd+QbuBXzPag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGu-0000000BYfw-0Ox3; Fri, 02 Oct 2026 12:21:52 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGq-0000000BYbQ-1NkJ for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:49 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id DE7C01A10E4; Fri, 2 Oct 2026 12:21:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B4072603DC; Fri, 2 Oct 2026 12:21:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 935E310328212; Fri, 2 Oct 2026 14:21:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943705; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=AaT3znXFijVQd6HLc4m25AzjKoF9zvFnQ5DPUBLXFCY=; b=jWUZVb7ls+1smZO0srM+pT7lLVZnjNdO7SD5j7UZPnK+OfspDJFjnqZpnzP8pU/EQ7FQn9 Gj0XnDTAoN+Z/su6bABron0p/bxy2+cflklL8GViebGh46WgQD6JcV/UUDFkI7JXAvOtDw cp3aE2aWMONWeBO2ZzGoDKhKl7LNCN1Z2y0xDxGAsLXM1Wg+r14Tc1ushoF+IE1RYqgfrz JrhAk8uan/b58oT9ld6/bjWcgSSp6LgG0HZK4zq781VYIEBRv6cAnBx7diBx0MqlPIwBt7 BjPwMsoMeqTZC/KvQHBqVMbnf/D6l6sXQSpccKfehfIrYYPOoOj2bFXkHZrb4g== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:22 +0200 Subject: [PATCH 09/15] mtd: spi-nor: winbond: Prepare the introduction of W35TxxNW parts MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-9-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052148_521341_FD2F1E68 X-CRM114-Status: GOOD ( 14.09 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This is a new octal DTR family, they require: - a callback for enter octal DTR modes, - a callback to configure the number of dummy cycles (since the spi-nor core picks up a variant for which the numb [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This is a new octal DTR family, they require: - a callback for enter octal DTR modes, - a callback to configure the number of dummy cycles (since the spi-nor core picks up a variant for which the number of duty cycles does not match the hardware default). These chips have a flag regiter, but no SR2. They also feature automatic error correction (SECDEC). Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 96 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index f2daab39ea57..d33e693ed711 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -11,6 +11,13 @@ #define WINBOND_NOR_OP_RDEAR 0xc8 /* Read Extended Address Register */ #define WINBOND_NOR_OP_WREAR 0xc5 /* Write Extended Address Register */ #define WINBOND_NOR_OP_SELDIE 0xc2 /* Select active die */ +#define WINBOND_NOR_OP_WR_VCR 0x81 /* Write VCR registers */ +#define WINBOND_NOR_VCR_IO_MODE_CFG_REG 0x00 /* IO mode configuration address (VCR) */ +#define WINBOND_NOR_VCR_IO_MODE_SSDR 0xFF +#define WINBOND_NOR_VCR_IO_MODE_ODDR 0xE7 +#define WINBOND_NOR_VCR_DUMMY_CFG_REG 0x01 /* Dummy cycle configuration address (VCR) */ +#define WINBOND_NOR_OP_RD_FR 0x70 /* Read Flag registers */ +#define WINBOND_NOR_OP_CL_FR 0x50 /* Clear Flag registers */ #define WINBOND_NOR_WREAR_OP(buf) \ SPI_MEM_OP(SPI_MEM_OP_CMD(WINBOND_NOR_OP_WREAR, 0), \ @@ -24,6 +31,12 @@ SPI_MEM_OP_NO_DUMMY, \ SPI_MEM_OP_DATA_OUT(1, buf, 0)) +#define WINBOND_NOR_WR_VCR_OP(addr, buf) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(WINBOND_NOR_OP_WR_VCR, 0), \ + SPI_MEM_OP_ADDR(3, addr, 0), \ + SPI_MEM_OP_NO_DUMMY, \ + SPI_MEM_OP_DATA_OUT(1, buf, 0)) + static bool is_w25qxxrv(const struct spi_nor *nor) { struct sfdp_header *sfdp_h = spi_nor_sfdp_get_header(nor); @@ -252,6 +265,87 @@ static const struct spi_nor_fixups winbond_nor_ecc_configuration_fixups = { .post_sfdp = winbond_nor_ecc_configuration_post_sfdp_fixups, }; +static int winbond_w35txxnw_nor_write_vcr(struct spi_nor *nor, u8 addr, u8 val) +{ + u8 *buf = nor->bouncebuf; + struct spi_mem_op op; + int ret; + + if (!nor->spimem) + return -EOPNOTSUPP; + + ret = spi_nor_write_enable(nor); + if (ret) + return ret; + + buf[0] = val; + buf[1] = val; + op = (struct spi_mem_op)WINBOND_NOR_WR_VCR_OP(addr, buf); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); + if (nor->reg_proto == SNOR_PROTO_8_8_8_DTR) { + op.addr.nbytes = 4; + op.data.nbytes = 2; + } + + return spi_mem_exec_op(nor->spimem, &op); +} + +static int winbond_w35txxnw_nor_set_dummy(struct spi_nor *nor, u8 dummy_cycles) +{ + return winbond_w35txxnw_nor_write_vcr(nor, WINBOND_NOR_VCR_DUMMY_CFG_REG, + dummy_cycles); +} + +static int winbond_w35txxnw_nor_set_octal_dtr(struct spi_nor *nor, bool enable) +{ + enum spi_nor_protocol proto_aft; + u8 *buf = nor->bouncebuf; + u8 rdid_dummy_aft, val; + int ret; + + if (enable) { + val = WINBOND_NOR_VCR_IO_MODE_ODDR; + proto_aft = SNOR_PROTO_8_8_8_DTR; + rdid_dummy_aft = 16; + } else { + val = WINBOND_NOR_VCR_IO_MODE_SSDR; + proto_aft = SNOR_PROTO_1_1_1; + rdid_dummy_aft = 0; + } + + ret = winbond_w35txxnw_nor_write_vcr(nor, WINBOND_NOR_VCR_IO_MODE_CFG_REG, val); + if (ret) + return ret; + + /* Read flash ID to make sure the switch was successful */ + ret = spi_nor_read_id(nor, 0, rdid_dummy_aft, buf, proto_aft); + if (ret) { + dev_err(nor->dev, "Cannot read JEDEC ID after %s 8D-8D-8D mode (%d)\n", + enable ? "enabling" : "disabling", ret); + return ret; + } + + if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) + return -EINVAL; + + return 0; +} + +static int winbond_w35txxnw_nor_late_init(struct spi_nor *nor) +{ + nor->params->set_octal_dtr = winbond_w35txxnw_nor_set_octal_dtr; + nor->params->set_dummy = winbond_w35txxnw_nor_set_dummy; + nor->params->opcodes.read_sr2 = 0; + nor->params->opcodes.write_sr1_and_sr2 = 0; + + return 0; +} + +static const struct spi_nor_fixups winbond_w35txxnw_nor_fixups = { + .post_sfdp = winbond_nor_ecc_configuration_post_sfdp_fixups, + .late_init = winbond_w35txxnw_nor_late_init, +}; + static const struct flash_info winbond_nor_parts[] = { { .id = SNOR_ID(0xef, 0x30, 0x10), @@ -673,6 +767,8 @@ static const struct spi_nor_fixup winbond_fixups[] = { .fixups = &winbond_nor_multi_die_fixups }, { .id = SNOR_ID(0xef, 0x40, 0x22), .match = winbond_jv_match, .fixups = &winbond_nor_multi_die_fixups }, + { .id = SNOR_ID(0xef, 0x5b), .fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE, + .fixups = &winbond_w35txxnw_nor_fixups }, { .id = SNOR_ID(0xef, 0x60), .match = winbond_pw_with_ecc_match, .fixups = &winbond_nor_ecc_configuration_fixups }, { .id = SNOR_ID(0xef, 0x60), .match = winbond_pw_match, From patchwork Fri Oct 2 02:21:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=c0iIHhE2; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=chpMdz0S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FP3SxCz1yGJ for ; Fri, 02 Oct 2026 22:22:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MfEQOf8YVW2JqSM5Qky1x9+pY1mn84LfXhh55lbYMdE=; b=c0iIHhE2DL/Mz6 aG1DnJZGIehKJg8az1BM09vqbq9eLSCXyPECTgEnl4BRtlqxOkWgykYx8Z8XjTo83mqbWb84FJesF 9yMC+kTNzfCVQr+0u8XQ3qsdG3ol7diNSTbBjOrKjmTyk212IXpo06LMVECkH3pfiSYTWI0uyxPWh PUTUoIZq15fo13bmxrTbL2oJUrb3iFQpgSpkIgrS/FjyrGVnEm4ILyHzU4nDaYZWq25TSc5IypYSS l9qFu8AMo/NNIs9oot1JvppL71vvPnRu27UpDCmnoO5FTo3xDMXjldtUugEZInDoDqJyu6q83gxBu mXNi0l6M7uDGqgvhHQ9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGx-0000000BYkc-3NFs; Fri, 02 Oct 2026 12:21:55 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGr-0000000BYct-3iYd for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:52 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 68F3D1A10E3; Fri, 2 Oct 2026 12:21:48 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3EB21603DC; Fri, 2 Oct 2026 12:21:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4B26B10328213; Fri, 2 Oct 2026 14:21:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943707; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=1CaMz+GYV+vFo66ZFyt/IaTpTAxRHfvphmB989Lsjds=; b=chpMdz0S8nbtIhslQwHzHEa4VKWZw3yL8tmDNWFPOc66xo2hIMm+0cfjXoXP3hg0qa5grX B5sr/ATlUkbfqZCkbEY1lxPs5+zAZY0/Zw6yuFyHoTjC9heRvsIMP3AK126ZtRKU+QYahe HOTpFV6XW9ddIzp2rfajkqhT7d/Apk/n3nM8rtenzfAIPyu7rQrXUqAqNPTPe6prm6Cp/F oNYedfRJX/IsU5YbBsDo8UHxqrRrhXDUhHgJVsNj0iOaFgPQIgypjG6AZPJpPqC+492eth ynu6odOv4UF/P77hBbs7SSwG7RDCR/VlIDJAkaEdj2V719L2Fw9EwDldNBq95A== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:23 +0200 Subject: [PATCH 10/15] mtd: spi-nor: winbond: Add support for W35T64NW-C MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-10-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052150_101762_D7C81308 X-CRM114-Status: GOOD ( 12.56 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b17 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff030000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31444e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 30be7c3bf1f6a00ea4e56585dc9c929026555f2e2c16ab5f6fdfbc3819fc0d21 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 17 02 00 00 size 8.00 MiB write size 16 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_SR_TB_BIT6 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 24.901260] 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 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 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_read 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 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 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 8388608 (8M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_read 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 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 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_read 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_read 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_read2 1f43b7c8eba44e56b616e12b515ff61c3d31307e3f9cedab13d3de08c15fb0b8 spi_test 731475d3e8b53d9a8c4e86ef609a765a590ac6a325ed450eeec725531ce6734a 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=8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=64 + ss=131072 + bps=2 + 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 + 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 -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 --- 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 d33e693ed711..e1a93f27f24c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -620,6 +620,10 @@ static const struct flash_info winbond_nor_parts[] = { .id = SNOR_ID(0xef, 0xa0, 0x22), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, + }, { + /* W35T64NW-C */ + .id = SNOR_ID(0xef, 0x5b, 0x17), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6, }, { /* * Catch all entry to make sure all chips solely relying From patchwork Fri Oct 2 02:21:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fa9fatJc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=mPUS3Bug; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FR5f92z1xvt for ; Fri, 02 Oct 2026 22:22:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JgS0JqMRovQzPpSdH8OQ1gvrg4c0sR0PHy3+iao2dJc=; b=fa9fatJcYFMieu 006foIhNFKj4hjW0iTHEpfE5ign+IzpOGURWs+oP0rcCczOmN4ItEtbA9mRw9tADxIgrJR7u9xcJC 3oAtKx5hGFapkKik3EbNIXek14aGj1BbCfNK+7JlahjXDjMLK0FEzXiAJJ/j7zZZxAL6wBn8uB4D6 UbgqES0bOSSAA/klIuXA+f/lZxO/Xue8NGPzEQzDTVe+4q0Hyq5MVbYiw04pqbpE3Noy5GqtdD+fA OS7+FGylaktYBrudeyyoh1Yv5lNmjHQ+vWX7Q6UFrO1yr+n0uX88I0aKsa6bM/auJH0b/x/66hXMK T5sbRvuWQpjeURtQCtug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH0-0000000BYoW-0Ru3; Fri, 02 Oct 2026 12:21:58 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGt-0000000BYf1-3WRk for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:55 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 590891A10E5; Fri, 2 Oct 2026 12:21:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2E417603DC; Fri, 2 Oct 2026 12:21:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D72421032824A; Fri, 2 Oct 2026 14:21:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943709; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=cXsEnk/dbwmtVaIOdikrVjWORDEewHwu7lKNpD/pipk=; b=mPUS3Bug7+OB4MVaGA5dC9cONGhwYF6lTMnXd6s5KqEgay5mnB7dtfHRVQcm59ru/aVqxy V1z/OtRDvku1crxmP2Oegjj17GWCHJZFJpEy2oVs5oY9cO9J1c7AvsT+Vg12Fyi0EFa8t5 VNX+sR1hFBXFpMJKo2gEbTM1GH+VE0s7m/08JA9gLbLgoB3YOLgA/Twa+qOT6/mqLs6jb/ fAbgt6GT4L/wsgkZujFmaw1+Czbr19OVqRimB0fopGp0EaXIRtvEcsjIEGZUvZaEbnHuoz 2Bod1kv+JcJ88TGNFawXYXMjmSd/sSUpnQDTEj1e++VwbI17xmcm39aUZ43+EQ== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:24 +0200 Subject: [PATCH 11/15] mtd: spi-nor: winbond: Add support for W35T12NW-C MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-11-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052154_516190_D67FE8FD X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b18 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff070000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31447e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 128f9dde70c802230cf6171d8f00f00c4088f72cfde19f7ebf8f85f56aa900a6 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 18 02 00 00 size 16.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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 16777216 (16M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read2 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test f3623e31ffb383dba8eb6ca97cf24de7450c0872dc49b851c7ff9eed559369eb 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=16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=64 + ss=262144 + bps=4 + 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 -16777216 512 flash_lock: invalid option -- '1' Utility to lock, unlock, or check the lock status of the flash. Default action: lock Usage: flash_lock [options] [--] [offset [block count]] Options: -h --help Display this help and exit -V --version Display version information and exit -i --islocked Check if flash region is locked -l --lock Lock a region of flash -u --unlock Unlock a region of flash MTD device node or 'mtd:' If offset is not specified, it defaults to 0. If block count is not specified, it defaults to all blocks. A block count of -1 means all blocks. + 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 -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 + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b18 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff070000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31447e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 128f9dde70c802230cf6171d8f00f00c4088f72cfde19f7ebf8f85f56aa900a6 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 18 02 00 00 size 16.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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 16777216 (16M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_read2 9b28460593b87e540ca650cc9d82034f94de1a91ca68690d23a23b3aae37d53d spi_test f3623e31ffb383dba8eb6ca97cf24de7450c0872dc49b851c7ff9eed559369eb 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=16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=64 + ss=262144 + bps=4 + 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 --- 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 e1a93f27f24c..0bb8e5a8c7c3 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -624,6 +624,10 @@ static const struct flash_info winbond_nor_parts[] = { /* W35T64NW-C */ .id = SNOR_ID(0xef, 0x5b, 0x17), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6, + }, { + /* W35T12NW-C */ + .id = SNOR_ID(0xef, 0x5b, 0x18), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6, }, { /* * Catch all entry to make sure all chips solely relying From patchwork Fri Oct 2 02:21:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GD1Xe7LI; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=HkHP42VZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=HiwZqxhy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FZ173lz1xvt for ; Fri, 02 Oct 2026 22:22:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2jUWeHurLtbirD0iQnwMh5WdM9wIRHLflVMgvJpEcOY=; b=GD1Xe7LIpmcE+E yOa9hUaGdm3a/JK2SP0fTDCanmg5jzmNQF2LDVab/knyZG/5sk23znnYmy9XbTqwT0z7CA+RL6Fsn mx3XZ87sI5JQcCxrCE+swzcbwIFcAopCEUMRpt3a2RIvzZR4QZRKN5DE6hDY13JY1P3/hVW5BM/Ny DOYBR3rlhWhxVKGZihT+m1A3syLN9ToYbU0OlkB1tM/1t9N2eTJCRXinnbRJgrK3Mrtm/2uHHDWVg Iw26dKNhxf+aq4UNNt5XJvdg9F9MrqFBbNScvYjEd7xIRIYTV5D+M5sPi7sjFqRd+WhwEf3KLb4Gd QBqm5ERTGNt/ygNSHYSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH4-0000000BYur-1dEv; Fri, 02 Oct 2026 12:22:02 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH2-0000000BYr1-1rvQ for linux-mtd@bombadil.infradead.org; Fri, 02 Oct 2026 12:22:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=fOH5M/Ez/kcxfrY188W+V0yQdPVjG4nCdXhKisxL0mI=; b=HkHP42VZbPWnmFFBPvpMzi9a0G O9Rlu/LXbeBalxsqbrvQBe2nMtes2zsqSEOofCZr9Lw4+jy7iUTGZ/w9z7VOtGjns3d11jTmLe3PW z2SnJxLmmRV0fcK6w4OjqiCvt+XGLUIAeIqSuxy7nwxWm9+gdLRSlW9S4+6l0DBrO7pJ8DmBHPfcj NEfVqwMkQ8smf2bgZK8YVOyhOCMk3Lz3kgt0u7TvVLGMLFYJUxuMnd1zt0XMInUD2MDhtkOfK1V/o v5FYDOqLX9VL/ewWKXhP5fN7Z+L2AaLKML0iGcNrU8SnE9qCmopEn1akNETStiATU8J7Aliv8fVTM /rtqcXdQ==; Received: from smtpout-02.galae.net ([185.246.84.56]) by desiato.infradead.org with esmtps (Exim 4.99.2 #2 (Red Hat Linux)) id 1xCcGw-00000005vkm-12LN for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:58 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 062621A10DF; Fri, 2 Oct 2026 12:21:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id CD5CA603DC; Fri, 2 Oct 2026 12:21:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E2DBA10328262; Fri, 2 Oct 2026 14:21:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943710; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fOH5M/Ez/kcxfrY188W+V0yQdPVjG4nCdXhKisxL0mI=; b=HiwZqxhyhc+weBLoMJ0K5dYMI3QorqEDvqf/yicTlsnfnV8UWO+aUeI/rl5fkca09RZWYj TPK4L5F426XoRukj/VY+i4HNaoY2masXUXkxDqLQRIjcQ1maMqVJNDatuPWp7a0YbfmMnr yWQA40jaNJ947wA4qTXpxb2w07jPKAttHE6Zzpa4nZPR+GOyFIk5daee6EMPAjXr0CM8Rn v+A/bueLhzhhjjE6JyVxXAp7PxgRuE8quelFndThVq5Pmgh/KJcDZu78MnEnGQzP2yTJFu Ovg2PRmFW//KHnhI+bzO5ryvWKLMQnZ+yYY+rzF5f/bTUjKsa1es/JejgwG15w== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:25 +0200 Subject: [PATCH 12/15] mtd: spi-nor: winbond: Add support for W35T25NW-C/E MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-12-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_132157_302973_D7D3E643 X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Signed-off-by: Miquel Raynal --- Logs for W35T25NW-C: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b19 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff0f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e3144ce96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 7dc00a62e47b0203b6adb38450098d68cecace4884e825796f884b0c4fcce121 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 19 02 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] 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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' 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 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_read 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 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 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 33554432 (32M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_read 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 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 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_read 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_read 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_read2 8d3ebdc5576a51d5f2e6d9f132622ae9cc00919227e4fbce7c18fa2525392921 spi_test f999d2e58cf596a1357e3337b36766bdb402cae729f224d8b952dbea6e46eee4 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=33554432 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=512 + ss=65536 + bps=1 + 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 Logs for W35T25NW-E: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b19 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0102ff00080117800000ff84010102e00000ff05010106e800 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff0f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e3144ce96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b00003807e19c10000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp bcb73821a779a8a28f58a3c2e231894142037f04f90e22c7a0527081badeda43 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 19 02 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] 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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 15.836899] 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 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 de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_read de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 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 de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 33554432 (32M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_read de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 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 Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_read de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_read de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_read2 de381056136f8b252a3379e234ed001de3a44ab1bf4e1f7ac715197fbeea75d1 spi_test 4753383c1bb538600660c0d666594f8c9d821565994882212d463ffa46d08185 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=33554432 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=512 + ss=65536 + bps=1 + 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 --- drivers/mtd/spi-nor/winbond.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 0bb8e5a8c7c3..55b27bc7e467 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -628,6 +628,11 @@ static const struct flash_info winbond_nor_parts[] = { /* W35T12NW-C */ .id = SNOR_ID(0xef, 0x5b, 0x18), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6, + }, { + /* W35T25NW-C/E */ + .id = SNOR_ID(0xef, 0x5b, 0x19), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP, }, { /* * Catch all entry to make sure all chips solely relying From patchwork Fri Oct 2 02:21:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=n88YsmWC; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=iOWreDew; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=EPvSsySZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FY62GYz1yGY for ; Fri, 02 Oct 2026 22:22:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vY3fIglAfBrLEN6lI5u5lIBxUcZLcpBd2yKt3qE3aCs=; b=n88YsmWCCkvo3d EEKxexJ687R6y4CkRE6tlpnSoJChCRRoMbLC4U8WDZhOYUwm27EWaKiDdCgd9rLCFpDyvZuTDPyjv Lfs6HFuJUng2J9VM2TM1jDs9QoXGHHhNM+eCKwMoPvRD0iY0EVphvKw9VaHYmHMhbzzthgvQGGGcL VBYLXIpBwepTAbtwMn7rfnGj3rLxVfFzyOoCk5BDTCKLNoIC7lAH/PYDCp5Lk4ryaEoYyWRjebMNC RViHFBRjGmJppLbkCUUAZ3mxQ9AVeQtkfkGHbMr0Chbj4o3IJG4g9p8Uw5BTrQEVCY7scfbw94nhW brfufhbfxzoX8UMoLbhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH4-0000000BYuV-0zo9; Fri, 02 Oct 2026 12:22:02 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH2-0000000BYr3-1pSb for linux-mtd@bombadil.infradead.org; Fri, 02 Oct 2026 12:22:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=vKr0WLdVeb/J8plYIr12nURhtOI2tu4K7NWOuJDWCQw=; b=iOWreDewaTPh0j3PylkKk6afDx dOz5Ouw8NFgkGtyyVhxlCfUp8MUuWroMUGst8QKX54HvBSsxhYsewPecir+FEwhH4Ewd9ZBLzgrL5 tLdplaCXWna4ia5vTDayBYFx+F8a//zev2UPjJ2oR5jW64P2Euq7+QnRnw5zCM1Zr+k/ONiGFOeMv j9Htu/T1dlcg5ozN9R1j/S168IqyQsMk8UijjMFnXl1naX2eH4sD+/WAHS5OYWIyMhSev9k0WxfGl StmwWiG/+5hFQeGUgU/U6LUF+HFhQ+iRLKxqiBFnGxhbLY3FgQhRJ1v9YLGqpFtxBpg9qK4P8BUT6 n2oDrNNA==; Received: from smtpout-03.galae.net ([185.246.85.4]) by desiato.infradead.org with esmtps (Exim 4.99.2 #2 (Red Hat Linux)) id 1xCcGw-00000005vks-3SO9 for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:59 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C12534E41110; Fri, 2 Oct 2026 12:21:53 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 96D81603DC; Fri, 2 Oct 2026 12:21:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6975610328226; Fri, 2 Oct 2026 14:21:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943712; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vKr0WLdVeb/J8plYIr12nURhtOI2tu4K7NWOuJDWCQw=; b=EPvSsySZR1gzFOANoLQH84CatLGSxMSQR1UJPJXUHI/qb2qbKEe/HEgaGkPNu1G1lZY+95 zzUlERF8r9ghrnqP11fwOENCUkRK2vthW3GoRzZ9Uil5U/pFKzkxMSTP/YT5T55+U6tiMc 3MZu7nlBefEDg7rf1qFdMhQnouX5Mrr90QlW8dx58R7tUCRI6DGRo7xFQ88tmWaTqJ03i3 FhUkrWXicZghcx9NFTsHJrBxKk37tyiGL7I0D89iFoSRvgB1pQTWuEAeerXYIqbxSYK3g/ b5gms2uSlFATY/TZyv4pSvlQh9/bq6vjJsdF8OHEj8/yadlCUguixlSF69TQbA== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:26 +0200 Subject: [PATCH 13/15] mtd: spi-nor: winbond: Add support for W35T51NW-C/E MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-13-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_132157_282321_81CC5052 X-CRM114-Status: UNSURE ( 9.24 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Signed-off-by: Miquel Raynal --- Logs for W35T51NW-C: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1a + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff1f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp a290fdc72785300e3b6efb4964a0a41524707263735ec4a23009b97324aad7ce /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 1a 02 00 00 size 64.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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (64.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-03ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | unlocked | 1024 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 14.761055] 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 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 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_read 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 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 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 67108864 (64M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x4000000 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 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_read 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | unlocked | 1024 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x4000000 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 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_read 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_read 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_read2 199319e974b9cb046bac51c1cb64a6843c4851127fbf072a4240063d47727177 spi_test 8ff4795e570cf12e4257adf7e9c761c516f0b1d5e1a2a2af68542add3025fc34 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | locked | 1024 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=67108864 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=1024 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 66977792 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03fdffff | unlocked | 1022 03fe0000-03ffffff | locked | 2 + flash_lock -u /dev/mtd0 66977792 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03feffff | unlocked | 1023 03ff0000-03ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 58720256 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-037fffff | unlocked | 896 03800000-03ffffff | 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-03ffffff | unlocked | 1022 + 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-03ffffff | unlocked | 1023 Logs for W35T51NW-E: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1a + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0102ff00080117800000ff84010102e00000ff05010106e800 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff1f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 4e27c223863fa0982fa54d0b74b0bbfbf370c105f94bc0e49d0d02d8db79cbed /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/[ 54.436903] random: crng init done debug/spi-nor/spi0.0/params name (null) id ef 5b 1a 02 00 00 size 64.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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (64.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-03ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | unlocked | 1024 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' 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 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_read a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 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 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 67108864 (64M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x4000000 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 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_read a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | unlocked | 1024 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x4000000 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 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_read a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_read a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_read2 a4a0c6780d8568c36179c019fcb621ac2b59e98127a16996b3264e6be64cf746 spi_test 496fde2866968c0c852f11ffcd7d1fc9e79f88256bf6f0ebf700d795483eecef spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | locked | 1024 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=67108864 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=1024 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 66977792 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03fdffff | unlocked | 1022 03fe0000-03ffffff | locked | 2 + flash_lock -u /dev/mtd0 66977792 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03feffff | unlocked | 1023 03ff0000-03ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 58720256 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-037fffff | unlocked | 896 03800000-03ffffff | 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-03ffffff | unlocked | 1022 + 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-03ffffff | unlocked | 1023 --- drivers/mtd/spi-nor/winbond.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 55b27bc7e467..a830cad64c1c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -633,6 +633,11 @@ static const struct flash_info winbond_nor_parts[] = { .id = SNOR_ID(0xef, 0x5b, 0x19), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP, + }, { + /* W35T51NW-C/E */ + .id = SNOR_ID(0xef, 0x5b, 0x1a), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP, }, { /* * Catch all entry to make sure all chips solely relying From patchwork Fri Oct 2 02:21:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=118ivs84; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=F4kTi2yn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FV3FfXz1xvt for ; Fri, 02 Oct 2026 22:22:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LJ+7795td2HWZExqzGiwiYu3o7PoFHfJzJqWOTIevCs=; b=118ivs84DhZHzF Gotf0C72kUWPQqs2Dfba0bVpZvd0FExbqgfTE9Qcm1hzuV7Xc6Mk22ZENjF9/TKuuFQQkASNKxOFq 9y1SE6G8FQaPTrQq4ZeMuGnogwJ7Z34VG8RpQXFZ8czEf8XktjATxPNe+sues3Zry0jqomoN/+GAz VIjl/h4Tsh0pQ1MY/USPIcvciJAG2INKKiEwThrxAQdJMxlvvYkaCcw+xU+Vdy8UhjwiOX2wNN/WM oO5fJAZT0lgeRumcGIORIRiSyDtB0m/N3MIYhsP9m06GXALhodHEJOt4oDfSEY3rOwy5q3G9mnc4N sifPDbYkALKc4g4mSxwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH2-0000000BYrZ-1DmY; Fri, 02 Oct 2026 12:22:00 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcGz-0000000BYkz-0wtp for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:21:58 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 9B0AD4E4110E; Fri, 2 Oct 2026 12:21:55 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 69D26603DC; Fri, 2 Oct 2026 12:21:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2A39310328255; Fri, 2 Oct 2026 14:21:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943714; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=pH1+1/lMmmSMYISfb7sTntap9kyfXa8JbL+ThgWmCqw=; b=F4kTi2ynMk2vHaWdMtJBZ81WhEnI6qmRsqMvSTsfzoDjUGFN1FvFNNyplIgwyVqvJxQBbK +98IjPhzwowfurXk+2S54LAxLjVGwUmpY6QgfU8xEl49s2o0q8QqpFFKD1F6Py5padkQ+T Q9buBbEUOxmMTtfB38MNamVOCscfhAPKllc6ia0DVuAGROI6JaUSsty6Gb73P7abP+xkCq wI7Hm5KN9XKn46Qokm028OWmYw8666IME1h4MIkCToMr4/CX0XRvucuEvRz0Y3sbhZ4J5U QmnKEAVuZraZJBTfW1wx/200C7SDyU4X46117DItvUkQFevrD5JzbE4XdDTLkQ== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:27 +0200 Subject: [PATCH 14/15] mtd: spi-nor: winbond: Add support for W35T01NW-C/E MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-14-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052157_577388_D99E10C1 X-CRM114-Status: UNSURE ( 7.96 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Parts suffixed -C and -E are very similar: the -C variant comes with additional JESD216F SFDP tables. Signed-off-by: Miquel Raynal --- Logs for W35T01NW-C: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1b + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff3f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 0f951707aa460006d0e534d524464a6a0d2adca6eeab522c59497868e6828542 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 1b 02 00 00 size 128 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (128 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-07ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | unlocked | 2048 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 20.788989] 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 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 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_read c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a 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 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 134217728 (128M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x8000000 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 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_read c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | unlocked | 2048 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x8000000 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 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_read c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_read c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_read2 c8b5315b436f2f21d320704b5cae5349aa5f8c4bf245cfc7a7b55b26d139442a spi_test 2cc891e91c0aefad43e9bee4348aeddb34a2040c83e3fa3e920aaca7b4790203 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | locked | 2048 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=134217728 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=2048 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 134086656 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07fdffff | unlocked | 2046 07fe0000-07ffffff | locked | 2 + flash_lock -u /dev/mtd0 134086656 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07feffff | unlocked | 2047 07ff0000-07ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 125829120 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-077fffff | unlocked | 1920 07800000-07ffffff | 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-07ffffff | unlocked | 2046 + 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-07ffffff | unlocked | 2047 Logs for W35T01NW-E: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1b + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0102ff00080117800000ff84010102e00000ff05010106e800 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff3f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 0fee35c2e84c7f280fe44e3249695f6075ab26716936deb21d4297dbafa39221 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/[ 41.869223] random: crng init done debug/spi-nor/spi0.0/params name (null) id ef 5b 1b 02 00 00 size 128 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (128 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-07ffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | unlocked | 2048 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' 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 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_read 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c 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 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 134217728 (128M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x8000000 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 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_read 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | unlocked | 2048 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x8000000 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 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_read 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_read 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_read2 7997c21fcdcafb94f39c027a6f5e6df4dd92307a6e4e099b26b6a7038bfe479c spi_test a273339ca03dac990920b5ce3f664c784b7c427bfc9fff36904ba220f4d78a4e spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | locked | 2048 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=134217728 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=2048 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 134086656 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07fdffff | unlocked | 2046 07fe0000-07ffffff | locked | 2 + flash_lock -u /dev/mtd0 134086656 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07feffff | unlocked | 2047 07ff0000-07ffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 125829120 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-077fffff | unlocked | 1920 07800000-07ffffff | 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-07ffffff | unlocked | 2046 + 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-07ffffff | unlocked | 2047 --- drivers/mtd/spi-nor/winbond.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index a830cad64c1c..b86b9ca1fbc6 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -638,6 +638,11 @@ static const struct flash_info winbond_nor_parts[] = { .id = SNOR_ID(0xef, 0x5b, 0x1a), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP, + }, { + /* W35T01NW-C/E */ + .id = SNOR_ID(0xef, 0x5b, 0x1b), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP, }, { /* * Catch all entry to make sure all chips solely relying From patchwork Fri Oct 2 02:21:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 2315075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=V8rfIx8f; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=HGlNHgDS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx7FX6GDzz1xvt for ; Fri, 02 Oct 2026 22:22:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NBGav69e0dAmD1m/afmL++fc8oPB59iwo83iCsKN6S8=; b=V8rfIx8fAL9tOi hNqndNnfvjimt4I7rbKOgwmghNXgLFEs/le4KwvOvK84Voy1WjKuCRm46TMwmMxgYpmxfD88mI5oj zPta4EN1GRI2ei2rWH3o9iVEiLbXy5tohdaQhrL+IByRsfejTC0vC5r7pkAhW/QB2ntIwMVc1iB7g gCfDw7935CXD1x9DJ6o7PiInv8vm2tX2IA/sMeztyYcsD3X1dIAklTFHTcUbjZ6QReVGNgbrbQTGt erN+W9hcgVuwEMuLGiXQmIB4zl8GSBRAsj/Dvf7C38UAOJB6Hmf7T1RLiZDtT7Eu9q1+z473BOS/Z GT4Zv1++ToX+gWjZwu+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH4-0000000BYu6-0Qwp; Fri, 02 Oct 2026 12:22:02 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCcH0-0000000BYnV-3Xh0 for linux-mtd@lists.infradead.org; Fri, 02 Oct 2026 12:22:00 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4F7154E41111; Fri, 2 Oct 2026 12:21:57 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 245C9603DC; Fri, 2 Oct 2026 12:21:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D1A75103281D0; Fri, 2 Oct 2026 14:21:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790943716; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=v1e2rUCc6nSN836Bm1lQHnn8UO/n/0RRd25rY1w6Qto=; b=HGlNHgDSEcNoa10QAP07e1kHTtHiGIPoFLDy/LOVr9oIuQeDEcrQKD1zjQ80zvARP1lITQ b7/xa+b17LMSn0H0BLze1dAGaoXkN3oVLiA+ORy+g5ONrGqGpxnsnY9I4GMz5sI0xKKQ+d uxGMdYr8lZkvzgFz/1PDilAZh3YyF1YyXmWlEVg42Ti4Lfkb+Psp53PlxQNmO95t1Q+ohJ avh0MnqbPc/e3nafmodZATn0uFvpCr4M1F3qFAKfXCP1VXaJUdY1HxkvuRWZGiM/I4WvMm 8LzRzy5Z/iXyqyEdJsDIocv5Gy83aiqy0N1Zijao+Mzh+c/ndnXttng+lPzBGw== From: Miquel Raynal Date: Fri, 02 Oct 2026 14:21:28 +0200 Subject: [PATCH 15/15] mtd: spi-nor: winbond: Add support for W35T02NW-C/E MIME-Version: 1.0 Message-Id: <20261002-winbond-master-spi-nor-w35t-v1-15-a22a2f95c26e@bootlin.com> References: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@bootlin.com> In-Reply-To: <20261002-winbond-master-spi-nor-w35t-v1-0-a22a2f95c26e@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261002_052159_225584_9A82FC61 X-CRM114-Status: UNSURE ( 7.48 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DMARC_PASS DMARC pass policy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org W35T devices are Winbond new octal DTR capable SPI-NORs. 16 bytes chunks are protected against single errors. In case a non-aligned write happens, ECC is locally disabled until the next erase. These chips may leverage lock CMP support, by using a Winbond specific register instead of SR2 which is gone. This feature is therefore not supported nor flagged. Parts suffixed -C and -E are very similar: the -C variant comes with additional JESD216F SFDP tables. Signed-off-by: Miquel Raynal --- Logs for W35T02NW-C: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1c + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0104ff00080117800000ff84010102e00000ff05010106e800 00ff8701011c000100ff0a000108700100ffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff7f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000000000000000000000feffe300fe ffe300058880060588a10070888400708885818501f0b1b501f0d8b8cefb b02e2cd388a489aa00000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000081850310 b1b503100000000000000601000000000000b1050000e700000000000000 00000000000000000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 26f67ccb92a7569acbe700c8592f109a9391698fc3efea5336bdbf3fa9884c7c /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 1c 02 00 00 size 256 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (256 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-0fffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | unlocked | 4096 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 22.593225] 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 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 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_read c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae 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 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 268435456 (256M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x10000000 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 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_read c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | unlocked | 4096 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x10000000 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 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_read c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_read c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_read2 c35c5b4833cf3c08ce055b3c2ec7a687059ecbe3c97eeee79a918869e7fdf2ae spi_test 187b09308be122170581bb64e59b5e65d6eaa01c1ade0f55232f757a96c819d0 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | locked | 4096 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=268435456 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=4096 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 268304384 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0ffdffff | unlocked | 4094 0ffe0000-0fffffff | locked | 2 + flash_lock -u /dev/mtd0 268304384 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0ffeffff | unlocked | 4095 0fff0000-0fffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 260046848 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0f7fffff | unlocked | 3968 0f800000-0fffffff | 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-0fffffff | unlocked | 4094 + 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-0fffffff | unlocked | 4095 Logs for W35T02NW-E: ******************** + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef5b1c + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 534644500a0102ff00080117800000ff84010102e00000ff05010106e800 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe5208affffffff7f0000000000000000eeffffffffff 0000ffff00000c200f5210d800003452b50082e31458e96376337a757a75 ffc3d55c008070ffe950f8a110cb088b0000ac0000000000ffffff860000 00000000000000000000ffffffff430ef0ff215cdcff000b0016b181b585 00d87b9d580b000030f6de9c10000000 + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp afd9273978f29205307fae0a666613a304b67dfdddc2f6450a197623fd9b76b3 /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-8S opcode 0x7c mode cycles 0 dummy cycles 8 1S-8S-8S opcode 0xcc mode cycles 0 dummy cycles 16 8D-8D-8D opcode 0x0b mode cycles 0 dummy cycles 22 Supported page program modes by the flash 1S-1S-1S opcode 0x12 8D-8D-8D opcode 0x12 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 5b 1c 02 00 00 size 256 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 | IO_MODE_EN_VOLATILE | SOFT_RESET | ECC | NO_WP opcodes read 0x0b dummy cycles 22 erase 0xdc program 0x12 SR1 read 0x05 SR1 write 0x01 8D extension repeat protocols read 8D-8D-8D write 8D-8D-8D register 8D-8D-8D erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (256 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-0fffffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | unlocked | 4096 + dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2' [ 19.188920] 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 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 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_read c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 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 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_test + mtd_debug info /dev/mtd0 mtd.type = MTD_NORFLASH mtd.flags = MTD_CAP_NANDFLASH mtd.size = 268435456 (256M) mtd.erasesize = 65536 (64K) mtd.writesize = 16 mtd.oobsize = 0 regions = 0 + alias 'show_sectors=grep -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: 0x10000000 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 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_read c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | unlocked | 4096 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x10000000 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 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_read c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_test + dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2' 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 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_read c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_read2 c989d1f44e0786ffa833ee3566bf5bed4fee67ade0b27b23568306e17876e393 spi_test 89425399a935397bb5560d889cc8f534a21e5fbfadd18053b8e0cc2edd164f3a spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0fffffff | locked | 4096 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=268435456 + cat /sys/class/mtd/mtd0/erasesize + bs=65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=4096 + ss=65536 + bps=1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 268304384 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0ffdffff | unlocked | 4094 0ffe0000-0fffffff | locked | 2 + flash_lock -u /dev/mtd0 268304384 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0ffeffff | unlocked | 4095 0fff0000-0fffffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 260046848 128 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0f7fffff | unlocked | 3968 0f800000-0fffffff | 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-0fffffff | unlocked | 4094 + 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-0fffffff | unlocked | 4095 --- drivers/mtd/spi-nor/winbond.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index b86b9ca1fbc6..9f144f2795d0 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -643,6 +643,11 @@ static const struct flash_info winbond_nor_parts[] = { .id = SNOR_ID(0xef, 0x5b, 0x1b), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP, + }, { + /* W35T02NW-C/E */ + .id = SNOR_ID(0xef, 0x5b, 0x1c), + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP, }, { /* * Catch all entry to make sure all chips solely relying