From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D9C346C857 for ; Tue, 4 Aug 2026 14:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852275; cv=none; b=ly063CHGUWntz0fAWF4Ou+9v9WBmWGm2e7E/JQag5C2qFipt7qMDzKKqqy+Xn9myw78nwbGKr9xaheI+DQgJq1goIILmHf5OK6iQ9QCqrH050duaDCZ3w2qEEFIgS/Zi/Hv9Ty+fmUnIhByyKHEYFyJUqBo0Xk1FM0OdaHwipgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852275; c=relaxed/simple; bh=ZZJxymRsy6UJAb618lXXlKoWGJPLCBlAOO6FZl+zA9M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NrtR4UwMlrDIWPXqpHR1iLGzqPaw3zhImLZRwKahZ1PpKGBuyIpy4zK1e/3mvLm8kf6OoMISpPhXHXiZwmiUCyPEvPLhKatOEJHlVaFd+n2Gr7DsLE4nZP1wxYYZpkLrve+BO4c6jR/+YDbLqm/0iY3jlR1uBDDhEPaaDYHz+bQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=MFZVDyXT; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MFZVDyXT" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 9D6F84E410DC; Tue, 4 Aug 2026 14:04:31 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 67B8B6029E; Tue, 4 Aug 2026 14:04:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C017511C32D27; Tue, 4 Aug 2026 16:04:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852270; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=yvQfAQ6ul/Yz+2+1gG0R0lXCRBcilkGM4EtQVFdD13c=; b=MFZVDyXTjNdDCj0p2+ckrsv9zV1HYCd795fpgEz+Sm1Sti1OnsRsCe1MVgtejuL2tvrzj5 ayx45NJboNOx8ylom3vNe8udhdWKOko+MGPHMg9T7+rn6gKoA8cyPA5YQyl8eO5KCIH1vt wkM9DndQpr6N5ZIevfMcWJdUUFhaMDuFsyndjnLYOX3AtMaNZdLQ0wCuBSPgw4SupHwnYu 32EOklEIt3qBT9mGj/rHfX2/8N3Bkz2PSOP2EeiUWox7HgBK5bLirhG/Lm21vZP7RpAiMj x5U1TumvxwgLdtCfFFqf/QIMHO9jNOdcc2PsLIjfEyzpb26S47njDLslQMWzpQ== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:23 +0200 Subject: [PATCH v4 01/28] mtd: spi-nor: Fix spacing in function call Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-1-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Remove the double space. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/sfdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index 4600983cb579..6a571d8d822c 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -453,7 +453,7 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor, bfpt_header->length * sizeof(u32)); addr =3D SFDP_PARAM_HEADER_PTP(bfpt_header); memset(&bfpt, 0, sizeof(bfpt)); - err =3D spi_nor_read_sfdp_dma_unsafe(nor, addr, len, &bfpt); + err =3D spi_nor_read_sfdp_dma_unsafe(nor, addr, len, &bfpt); if (err < 0) return err; =20 --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB90C46C85C for ; Tue, 4 Aug 2026 14:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852276; cv=none; b=iYCxyvMZ8rm1LQv9BT5HqgiNlVDng9BtOfiUIkbnHJkgO0w3oJ/LHr1NjmuKXa+ooKbgI8DFy+inFPbNVyIoUIpeL5tego4Qu3orH/CjPzsLgJWpRkd5K9Hob9C3vEj2En23rhKEfVhJqN1HhHQhNL6zKecazi6XebB9TjaGtu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852276; c=relaxed/simple; bh=qdX6AQj91TgcbEq1dwUzcV8XEo6qcLeUq3Q7u39vQFg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cNSRjEu1yHy86l4ZZydR7jlrNDPPrFUw38FIWx+NM3ixpwAtowXObMrtu99Mk2B7ZO/b/dkV1yWCBa5rYKa9dO3XwhjisW5J0LNwNbDlmxWNZx2fEqvDiiD/Vx+71CTqk4ZY/jHCSppFoJn7+3YuTIArlmwfnlIQovBNmPz0jLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=RgSu9o8Y; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RgSu9o8Y" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 245761A13F9; Tue, 4 Aug 2026 14:04:33 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id EBA5B6029E; Tue, 4 Aug 2026 14:04:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DBA6011C32D2A; Tue, 4 Aug 2026 16:04:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852272; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=iTQYlBDs/bVQ9FRAwNXdzhTcN1NpJA7o3fDKZXJzBbg=; b=RgSu9o8YcsqOfjk4eadI6smICgXAdRvY3cWwAXe+RdndfKOqtn18s5ScmJzqZsYtVZfz9Z JB/M8Mbvc33kurZeiw4mObreJvC2QktDBtkrqm6V8JhUalpHoBp1YUCJTTHT5WBh5zuseY ApkXx3RVuXHSUryEDeZxmeDxG4dslvlZ7vmi6PPNKPkdLAjdLS8xTwgAWzqEtLpVSw4Hc4 3H2P5wm3XDUoc7cv8JmBW9QbcNHNjCAu0gt+qlFw5SoyXh8wIZvpQSjD9mNlOzvrWxBWfU YM2NOw2flon9xEFIi1qxhrmN+Sxk09OqR/4d1wtgV2nYRqP6ojKi6VmBQ9svvw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:24 +0200 Subject: [PATCH v4 02/28] mtd: spi-nor: Complete error rollback on sfdp parsing failure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-2-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Make sure to rollback all changes induced by SFDP parsing in case of failure, which means also resetting nor->flags and nor->cmd_ext_type. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index ccf4396cdcd0..c39c6833c9a4 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3063,12 +3063,17 @@ static int spi_nor_late_init_params(struct spi_nor = *nor) static void spi_nor_sfdp_init_params_deprecated(struct spi_nor *nor) { struct spi_nor_flash_parameter sfdp_params; + enum spi_nor_cmd_ext cmd_ext_type; + u32 flags; =20 memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); + cmd_ext_type =3D nor->cmd_ext_type; + flags =3D nor->flags; =20 if (spi_nor_parse_sfdp(nor)) { memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); - nor->flags &=3D ~SNOR_F_4B_OPCODES; + nor->cmd_ext_type =3D cmd_ext_type; + nor->flags =3D flags; } } =20 --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1238746F497 for ; Tue, 4 Aug 2026 14:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852277; cv=none; b=IDf2UMUZcmP6xBQwPnWkjoDBMZgXxAn0WdxcmMRy54zJmrImqK8i8FlSrmR92igs7QODhZEHtc8afofoV8brEms4tBLFx3trkjLUwrTguDhDytlLP8aZpEbbOoPvjc8V/I4nTkkqSZkDuHl/FjmdcpFKEQn97iXPHl7dxIlrqqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852277; c=relaxed/simple; bh=17dj18e74TOwMBsRsTM2rkcT69B9vOyK7YqTQVNJto0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wjfw8AWxC6MMmtK4gqrkpiGLeNpDvrUHYxfJ9pbVFttEJewVQ9wxZ1chCJOQSQO2vVhcNgd0uJ3CTXmPdMlKnt5+FTObLpAONyBvuP0li/V66bb+ZX9haJd7S5azM/9df1tCI+Qpe3T2xJzdR6/jz7ZmxrE/7KTph7MSgfLs5wA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Beu4J5Y/; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Beu4J5Y/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5A7924E410DB; Tue, 4 Aug 2026 14:04:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2C2DB6029E; Tue, 4 Aug 2026 14:04:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6363B11C32D2B; Tue, 4 Aug 2026 16:04:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852273; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=kSHTHakWB9sMpL10cTG7tAj/z2+lZNrpc2kx9hk5pFY=; b=Beu4J5Y/Jnu3A9bEq5ZKYzKjEHz4Dsm89IKColPLlFQivl4/ECejTplb2Pau19c7sV68Cr /+sOdevqx8Ukuzj66jaB/ZCPGxfHpJ1AgFfo07T66qX+TbNCNC/snKAm+PJ53DwrosQcr7 sNefCvG6vUj1sY2APvGPiwuhMa9AD+ZMkHasaY47XXI/j2wcpxNvAfy37ZsEyEj79NeeMX 8Sxfkk0KWiOtxabakDqCucL+VlnKHpJ21l3LDONzpYZypjif/zfx20WNOrQHNNzFyRo1h6 h0jyzlV+Bn65/PdQ65jclEBdPpSJ4ISqmDInsLlA+t3fOT+cZbl67Av9Fo43ew== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:25 +0200 Subject: [PATCH v4 03/28] mtd: spi-nor: Garbage collection during sfdp parsing Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-3-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 SFDP parsing works as follows: 1- The header is read then parsed 2- If correct, the sfdp structure and the sfdp content table are allocated then filled 3- The mandatory BFPT table is parsed 4- The optional tables are then parsed as well Any failure in steps 1-3 leads to an error and an early return. The failure is not always fatal though, since the deprecated will fallback to the non SFDP definition (in the ID table, for legacy chips). In this case, the devm_ memory allocations for the SFDP table structure and table will remain in memory for the lifetime of the device but will never ever be accessed anymore (since they are incorrect). In this case, we shall free the memory manually since the device is not going out of scope anytime soon. The assignation of nor->sfdp is also cleared in case of failure, to avoid carrying a dangling pointer upon partial failure. This is particularly important since the presence of valid SFDP support is checked using the following condition: `if (!nor->sfdp)`. Signed-off-by: Miquel Raynal --- This change is particularly useful for the next patches which generalize the fact that SFDP parsing will be attempted on legacy chips not manually advertizing dual/quad/octal capabilities. I don't think it is relevant to backport it. --- drivers/mtd/spi-nor/sfdp.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index 6a571d8d822c..754c9379f89f 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -1490,7 +1490,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) psize, param_headers); if (err < 0) { dev_dbg(dev, "failed to read SFDP parameter headers\n"); - goto exit; + goto free_param_headers; } } =20 @@ -1518,7 +1518,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) sfdp =3D devm_kzalloc(dev, sizeof(*sfdp), GFP_KERNEL); if (!sfdp) { err =3D -ENOMEM; - goto exit; + goto free_param_headers; } =20 /* @@ -1532,16 +1532,13 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) sizeof(*sfdp->dwords), GFP_KERNEL); if (!sfdp->dwords) { err =3D -ENOMEM; - devm_kfree(dev, sfdp); - goto exit; + goto free_sfdp; } =20 err =3D spi_nor_read_sfdp(nor, 0, sfdp_size, sfdp->dwords); if (err < 0) { dev_dbg(dev, "failed to read SFDP data\n"); - devm_kfree(dev, sfdp->dwords); - devm_kfree(dev, sfdp); - goto exit; + goto free_dwords; } =20 nor->sfdp =3D sfdp; @@ -1563,7 +1560,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) =20 err =3D spi_nor_parse_bfpt(nor, bfpt_header); if (err) - goto exit; + goto clear_sfdp_ptr; =20 /* Parse optional parameter tables. */ for (i =3D 0; i < header.nph; i++) { @@ -1608,7 +1605,20 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) } =20 err =3D spi_nor_post_sfdp_fixups(nor); -exit: + if (err) + goto clear_sfdp_ptr; + + kfree(param_headers); + + return 0; + +clear_sfdp_ptr: + sfdp =3D NULL; +free_dwords: + devm_kfree(dev, sfdp->dwords); +free_sfdp: + devm_kfree(dev, sfdp); +free_param_headers: kfree(param_headers); return err; } --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F15EC47010C for ; Tue, 4 Aug 2026 14:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852278; cv=none; b=BfvO0nEAabNMH5hLkvevLsCXaLQrPcdwTEOY9JfN8JAOlizcgF6eSVF5b+p3exnLUbabK71ev646ty+i8uA7zwcoqVkLuGDGnOvINFw0+o8fmMJ2Q86g9SyrNTX04x5iI1I34ncHDCb2mSCklfp2/ThruU3cKrvF3050v26vr4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852278; c=relaxed/simple; bh=JYzBvE3OLPqJk9VkwP65TEuR1VCqW0soGcMuZ+4tQvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r2b3Jo4yRUHReWpu7D08Bj14bbIuqBVAlFFic4H4VsWThPxz4rkjdJRXvQxUH90u+UCN00xlOgRjBDyS8ll9C17VrV99Vs4Co1PEiUs7zVukHCQqVulRalv18+Dm0Wrmkw4hGm8kZy85juTKsfU9kSebtjDACjSoK6ofV9oLbhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=v5D4UbEg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="v5D4UbEg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 8FA711A13FC; Tue, 4 Aug 2026 14:04:35 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 61FA26029E; Tue, 4 Aug 2026 14:04:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A2A9C11C32D27; Tue, 4 Aug 2026 16:04:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852274; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=KTpdBpooTlaJoC3pVHrNhYgn1PsBKEuxZ3T9jd/iHn4=; b=v5D4UbEgo0hzrDTelNaD0j0CYYVgUe0nVjGV/M8C+j66kapSRi5KuKU9d96e0u3v9Kdkc3 HjxKVYALHrv8UA8CuuTeC+sZFAFTNFUzVAgzDyUG7woS55Df3OgnhptggXPPT7ZDe/2MU3 CZV+gZvo5IlolOgPhB1lL7ukyOh8qZEuovOFayB/GbOYT5dyyyo1f7HwuRJIRP1Qlwkm1f TXrPt0Sw41BtOWxVNeU7swOQK50afTYrZ2z4AmLkpU1sXm33QoeJEBAqvIzNpYzQ3UvV91 7G05Qg7Sg98KGeWCaSWj+JbINlB73qVNn8/vyxFFQaBZNqUlipRwIGOdkoxryA== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:26 +0200 Subject: [PATCH v4 04/28] mtd: spi-nor: Unconditionally parse SFDP in the deprecated path Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-4-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 As of today, the deprecated initialization path only attempts to parse the SFDP tables when the flash entry advertised a dual, quad or octal read capability in ->no_sfdp_flags. This was initially a surprise to me since the documentation and commit logs I read while searching the history do not clearly explain why. It seems that this is some kind of (double) legacy behavior since a change made it clear in 2021 that in order to skip trying to parse SFDP in the deprecated path, chips should be marked with SPI_NOR_SKIP_SFDP (in which case the deprecated path mentioned in the title will not be attempted). As a result of this situation, Winbond W25Q32JV-Q/N and W25Q64JV-M chips, which feature good SFDP support, are using only the stale flags in the ID table because of ID reuse. I tried to remove the stale entries but this change got refused because it would break support for legacy chips without SFDP support (until ~2016). Parsing SFDP unconditionally seems safe: spi_nor_sfdp_init_params_deprecated() already restores the legacy parameters whenever parsing fails, so non-SFDP chips simply fall back to their previous behavior. As stated above, anybody bisecting a SPI NOR boot issue and getting to this commit should add (and contribute) the SPI_NOR_SKIP_SFDP flag in their no_sfdp_flags field. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index c39c6833c9a4..b4d09f14fff7 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3092,11 +3092,7 @@ static void spi_nor_init_params_deprecated(struct sp= i_nor *nor) =20 spi_nor_manufacturer_init_params(nor); =20 - if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | - SPI_NOR_OCTAL_READ | - SPI_NOR_OCTAL_DTR_READ)) - spi_nor_sfdp_init_params_deprecated(nor); + spi_nor_sfdp_init_params_deprecated(nor); } =20 /** --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6264647013A for ; Tue, 4 Aug 2026 14:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852280; cv=none; b=esnXGzobyEGyG0rtBYvwRUFOswx989qF8RdfmpaFccrM+Dr2XKiZ7N/pZwXrsqYDuwSCteq17DiFgp2VLHml2bgcAqEfSY7WY99ZFNIBOwdFXwGI1ibrd/OX2x/yeSfZArAjVavgwialaPdVPP4/B0DIQ2+MwWFHhMNSSEg+kaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852280; c=relaxed/simple; bh=F94q0jZkp2QjubrrsY5QqiZP3LmVSNNkHrEw6t5EoAM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uXwSYX3Rh+VZc5U59j26A0xkvfxZLCGEDudwMH1a/R/61U3688SrcvlpwcCvXveEWt6hN5tRbQpKW8WAIdyzn1eZ872+pfvOEFn7SxRfP9lIAuD86XDZlbj86k+mCzk0kBO7oMv0JzJcSfQ59mZWftWyzxLebsBiIALNFIqxKMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=zfGX8Zo7; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="zfGX8Zo7" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D23274E410DC; Tue, 4 Aug 2026 14:04:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A43F26029E; Tue, 4 Aug 2026 14:04:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DB06611C32D29; Tue, 4 Aug 2026 16:04:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852275; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fd/aDjeEfnnm6kU3tUkNFm0RI2r2lxwNzxa4rFpwOJA=; b=zfGX8Zo7I2K/WNX8PJgLWx+xGKLZxUQBwnFZyOrwGdRnKae3y84epLirnGsEL6NOyZtFpj oltsKn4R3vtsjGB/g1KWgx0KejeIUqxYa1znXSeneSPSYkjPKBac43LgPv0iypY6DVKhXf gwMO9XBDP119LIOHyWr/NYpaK+4pbD2O9E8NuVk6kKnu/IfN4IxSzdn/fuOeFOpHfP0g7m qwXvxjHYUouxBMYfBnzihW7jL7I0IP6sKBKjIEnck0m0kI8/Og0Bv/K+1Z4cwohTKvpBRK UVHMOY2gOLeeBPXjaFyviphFq0BCtWgVoifnpvvFyMz7enzlAjBBqTDhuWQvBw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:27 +0200 Subject: [PATCH v4 05/28] mtd: spi-nor: Init flags before manufacturer late_init() hooks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-5-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Current init order is: - The manufacturer-wide late_init() hook is called. - The core initializes some chip flags - The chip specific late_init() hook is called. This does not seem very consistent since both late_init() may need to touch flags, which is then not working as expected since the order is a bit inconsistent. Moving spi_nor_init_flags() earlier, right before the manufacturer late_init() call, ensures the hook sees the flags after their initialization, and can therefore apply changes to them. Since spi_nor_init_flags() only reads ->info->flags and DT properties, it does not depend on anything a late_init() hook produces. On the other hand, no manufacturer late_init() hook currently touches any output of spi_nor_init_flags() either. Reordering seems safe=E2=84=A2. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index b4d09f14fff7..fef7f426a3a2 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3014,6 +3014,9 @@ static int spi_nor_late_init_params(struct spi_nor *n= or) struct spi_nor_flash_parameter *params =3D nor->params; int ret; =20 + /* Needed by some late_init hooks */ + spi_nor_init_flags(nor); + if (nor->manufacturer && nor->manufacturer->fixups && nor->manufacturer->fixups->late_init) { ret =3D nor->manufacturer->fixups->late_init(nor); @@ -3021,9 +3024,6 @@ static int spi_nor_late_init_params(struct spi_nor *n= or) return ret; } =20 - /* Needed by some flashes late_init hooks. */ - spi_nor_init_flags(nor); - if (nor->info->fixups && nor->info->fixups->late_init) { ret =3D nor->info->fixups->late_init(nor); if (ret) --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 758FC47043C for ; Tue, 4 Aug 2026 14:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852280; cv=none; b=SnhaTxJeYW5M9NddGjt5BUlpU3htHq8l32y2PIIzbz+Okj4aEY/5aZA6wdWOxWfPiTSdIZPOxyiaPny49N0nQNzFOQ+r0RAyRPHnVvkALp3RFAZXIAzFejB8CXtiB5V28BmHH6g8z+SF1bHPe+ISced+yrdXpyoCVO5QUUa8ynA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852280; c=relaxed/simple; bh=7nvOauSH7cuQ+z8eYYbj6DeuXAptmJin+2La7ZgAOOs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mG/hANE2bnrZ5qJgBr82mNxM/RmKukhKnE+L5lJMuDumxf8h9cDTuGZBfS4h1O6iXji8hbE9XL5cVtjPdpJuX2qsU8r6ghrIh2BOEkeU4/HzJAGlsHjsRx87f9EkAnsO2TroZ8q7ZpzKSU58Cb7O1KfFn5VID3wPY8g42Auq4AY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=CgsmI73A; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="CgsmI73A" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 1BEDE4E410DD; Tue, 4 Aug 2026 14:04:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E0DF36029E; Tue, 4 Aug 2026 14:04:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4750811C32D2A; Tue, 4 Aug 2026 16:04:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852277; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=EU9odphLDJ7Sp0A8jGyVHZpCPe8+Os6UWy7g5Vv1TYw=; b=CgsmI73ApkzSUNBXqQ9kwy4hto0SZJ3r/HOcXlcBijmeZ+WKqIT2nSS4hGCwsDbJIm2dgL cc8HuAvrbfSGSZe5AHtQdROBwuVo4xCLD2bSXTfN7p3/1DTnmnSaC+D0RuahAfqioCnROT 8VRUc1ktJZX1ObBL+RCoqLH10gmWUm/jeOnwsQzSnewDGvEvkYs1NnzVvda9dvIU+nLbgY g89fDRa5JPqwRw9visUmDhxVtogdPpad7PwFhykyZFuC4OzI4r8xnLhlpCqguN0POK6Pv5 6nXJtI27YRuQpoM94P2ig6AnSt9CMiIecKsLc7XbMRAfymaPJpHZK+/cXE+1EQ== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:28 +0200 Subject: [PATCH v4 06/28] mtd: spi-nor: winbond: Move W25Q01NW to its right place Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-6-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Chips are sorted by families, and inside the families, by density. The second ID byte indicates the family, the third indicates the density. Move W25Q01NW to the right place. Signed-off-by: Miquel Raynal Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/winbond.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 8ebdbcec0b3f..662a022d36e7 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -300,6 +300,12 @@ static const struct flash_info winbond_nor_parts[] =3D= { .id =3D SNOR_ID(0xef, 0x60, 0x20), .name =3D "w25q512nwq", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), + }, { + /* W25Q01NWxxIQ */ + .id =3D SNOR_ID(0xef, 0x60, 0x21), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, + .fixups =3D &winbond_rdcr_fixup, }, { .id =3D SNOR_ID(0xef, 0x70, 0x15), .name =3D "w25q16jv-im/jm", @@ -365,12 +371,6 @@ static const struct flash_info winbond_nor_parts[] =3D= { .id =3D SNOR_ID(0xef, 0x80, 0x20), .name =3D "w25q512nwm", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), - }, { - /* W25Q01NWxxIQ */ - .id =3D SNOR_ID(0xef, 0x60, 0x21), - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | - SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, - .fixups =3D &winbond_rdcr_fixup, }, { /* W25Q01NWxxIM */ .id =3D SNOR_ID(0xef, 0x80, 0x21), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B30E46C83E for ; Tue, 4 Aug 2026 14:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852282; cv=none; b=cGU1Vo/A6Wu/q5TYKmUKbXrm9RE+mlk1P2X3R/XwL1Gwz4o1pKiaYLwzuc3hli7q2Fv2uV1gNWYkB2n2a6Z39dv1+CX/qQSZSColSXXHKPXtGU4X+Uu2mfYMxNNNLb/vX+iW0J2cqf2C8/Ug8MONEDiWvgzFFYlKF6RODu7z2cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852282; c=relaxed/simple; bh=G7C0RpuGOz2d4Nq1PEWQTIQUHhtNe53rFmxu0pv6IH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fuPpi1Y6s8lndWv4XOUHRiglhGHwTa+vuzz9HyTBP1kFmEQfw2u8JwG8saIzN/0/cN6zjACH/WAmwbxEIFciKIU8RR/Ho4SOO6YA4o7jdu9iLoiope9Yhh0NpNTY5/RP+GP+1aMCVVf9kxJsNwWIL3rsOLh9RZ02YGLHG6qGA6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=S9oeOPqq; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="S9oeOPqq" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C1E801A138B; Tue, 4 Aug 2026 14:04:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 93EDF6029E; Tue, 4 Aug 2026 14:04:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 84BDD11C32D2B; Tue, 4 Aug 2026 16:04:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852278; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=bAWtw3CGgsPilxjcNtR1KkWLKZETIaXM85za6nTJbqw=; b=S9oeOPqq+qQLLj4W1H6tHSHQGUtn+ayG0RM6Vil9iUnRzH7Urrs4AEIpCt/K6TVJvYZGE/ st1rdLXBt21UnF+e54ZlNxglEMrX2ZnqnEIzS5QQQ+OtOKgsFmnFSALXZWge/xhseiz57O OJuxQeTD9YuG8pIdH/nXmAD4Gw77bH4ouOBpImLHN28esjybl/4QGbHU+6VMGtcjKcQziy rwWgjBCtjS5E3TnV7JgT3zGzwSJES39qn1JgkD4YDKsUE7X8nRarSmftoPYdloS5gNFfid uDyNz1RBw6ITAbv21B+QCS7QNNYFysuEBEsuNTnkSy2wvEdLUhmg/tGospwU/g== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:29 +0200 Subject: [PATCH v4 07/28] mtd: spi-nor: winbond: Normalize names Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-7-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Winbond chips cannot just be named eg. "W25Q02JV". There are always more letters after that name, some of them matter. - W is the Winbond prefix - 25Q is the type of device -> 25Q indicates a quad capable SPI NOR -> 25H indicates an automotive grade chip - 02J is the density -> in this case 2Gib - V is the voltage -> V means 3.3V -> W means 1.8V - The next letters (either 2 or 3 letters) are completely irrelevant for the software and purely indicate the hardware package. - The penultimate letter is the temperature grade -> I for Industrial grade -> J means "above" industrial - Q, N or M indicate factory states (like QE=3D1) and also the DTR capability. -> Q and N typically have the same IDs -> M chips typically have a different ID As a result, W25Q01NWxxIQ is irrelevant and would better be named W25Q01NW-Q, W25Q02JV is irrelevant and would better be named W25Q02JV-M, etc. Make that list uniform before adding more IDs/names. Signed-off-by: Miquel Raynal Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/winbond.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 662a022d36e7..03e59ff3228f 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -301,7 +301,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q512nwq", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { - /* W25Q01NWxxIQ */ + /* W25Q01NW-Q */ .id =3D SNOR_ID(0xef, 0x60, 0x21), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, @@ -334,7 +334,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x19), .name =3D "w25q256jvm", }, { - /* W25Q02JV */ + /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), .fixups =3D &winbond_nor_multi_die_fixups, }, { @@ -372,28 +372,28 @@ static const struct flash_info winbond_nor_parts[] = =3D { .name =3D "w25q512nwm", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { - /* W25Q01NWxxIM */ + /* W25Q01NW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x21), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { - /* W25Q02NWxxIM */ + /* W25Q02NW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x22), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .fixups =3D &winbond_rdcr_fixup, }, { - /* W25H512NWxxAM */ + /* W25H512NW-M */ .id =3D SNOR_ID(0xef, 0xa0, 0x20), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { - /* W25H01NWxxAM */ + /* W25H01NW-M */ .id =3D SNOR_ID(0xef, 0xa0, 0x21), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { - /* W25H02NWxxAM */ + /* W25H02NW-M */ .id =3D SNOR_ID(0xef, 0xa0, 0x22), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBA0146AA99 for ; Tue, 4 Aug 2026 14:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852284; cv=none; b=gw4B83eJPw/hP1Sf+nglie14R/oKt23WZ7B2kUNvCMkCXFjDU0f0ICgotBU7IdOYOVw2W762LTTmlDzkMuPnFxYN/DaJQqe21cG7RKXDFkJTh6vR09jlXGXeScey71yG7w5Z1oIKCzVYiLZgWVmqRv5e2zN+cpHUdMRwa3Wa/Ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852284; c=relaxed/simple; bh=g5ZoaAkVcvw5Wqlxb79j2f7XOzQMlm74mdf2RorwCFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NgRki1aFZEWYh5nZ51hTYmzxK8SEtYDnmTOubwvsHZdCgHcQQWblTUyRVjxtOnSDv2dqf0zdjNin3E6II6RU9pRyYxQM3cd+X6fKqeRE+RQhKSjDnP0QnVTjRIjyyyv5IbOCfSKO2abj4pCBGs1YN/qaU4yxsZ9ODs2UfpDWnUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ZBy2AiVP; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZBy2AiVP" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4EB0C4E410DC; Tue, 4 Aug 2026 14:04:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 209ED6029E; Tue, 4 Aug 2026 14:04:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1CF1C11C32D31; Tue, 4 Aug 2026 16:04:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852280; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2Qe3cx3iq4V3ikZYQZ4mJh9N7Thq/K8jIFdv7GwKTfM=; b=ZBy2AiVPp0JTN7La1BKS0KWWkluQTI4tRsLls9aohpehYapIAd5sXnMB1lhjNOsFOVxWD0 cO0EJ+AJsco99D0RTOTgwPplvre+5HbQG76waVH5IK/m3tc5WvIo6gnP+l2vYUxlLzhcFA ntwAiRWO9zQCixhJdiuEkY8ftlQRLRbzRAKI7XB4M1OmamrqOTiLu0FwNFMYC82ocz1O0+ 0YtssMc5M7AQzx7hneNXPKUNbQE4B9XPVnxPpIWYt41wsw9s7dDAmurgCijNxgwjLxNsB1 7ChmI/zhUJwkwIvSKM7Bbvsfj3OXrHazsfawwJOBqycMf9XjWw9DW/QhGUIZoA== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:30 +0200 Subject: [PATCH v4 08/28] mtd: spi-nor: winbond: Properly document the chip names Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-8-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 While the .name entry is a legacy field, is highly imprecise, and even wrong sometimes due to ID reuse, it is part of the sysfs ABI, we cannot remove it for existing chips. However, we can double the entry with the now usual comment with the newly instated naming scheme to indicate what chips are covered by each entry. Signed-off-by: Miquel Raynal --- I've been focusing on several chip families, but not all of them. I do not have enough information about the oldest chips at the moment to cleanup *all* IDs, but I am nevertheless trying to make a major cleaning step here. --- drivers/mtd/spi-nor/winbond.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 03e59ff3228f..3e8e89058b8c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -218,16 +218,19 @@ static const struct flash_info winbond_nor_parts[] = =3D { .size =3D SZ_1M, .no_sfdp_flags =3D SECT_4K, }, { + /* W25Q32JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x16), .name =3D "w25q32", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, }, { + /* W25Q64JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x17), .name =3D "w25q64", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q128JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x18), /* Flavors w/ and w/o SFDP. */ .name =3D "w25q128", @@ -236,18 +239,20 @@ static const struct flash_info winbond_nor_parts[] = =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixups =3D &w25q128_fixups, }, { + /* W25Q256JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x19), .name =3D "w25q256", .size =3D SZ_32M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixups =3D &w25q256_fixups, }, { + /* W25Q512JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x20), .name =3D "w25q512jvq", .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { - /* W25Q01JV */ + /* W25Q01JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x21), .fixups =3D &winbond_nor_multi_die_fixups, }, { @@ -285,52 +290,60 @@ static const struct flash_info winbond_nor_parts[] = =3D { .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q128FW-G/Q, W25Q128JW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x18), .name =3D "w25q128fw", .size =3D SZ_16M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q256JW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x19), .name =3D "w25q256jw", .size =3D SZ_32M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_= NOR_4BIT_BP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q512NW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x20), .name =3D "w25q512nwq", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { - /* W25Q01NW-Q */ + /* W25Q01NW-Q/N */ .id =3D SNOR_ID(0xef, 0x60, 0x21), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .fixups =3D &winbond_rdcr_fixup, }, { + /* W25Q16JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x15), .name =3D "w25q16jv-im/jm", .size =3D SZ_2M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q32JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x16), .name =3D "w25q32jv", .size =3D SZ_4M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q64JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x17), .name =3D "w25q64jvm", .size =3D SZ_8M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K, }, { + /* W25Q128JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x18), .name =3D "w25q128jv", .size =3D SZ_16M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q256JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x19), .name =3D "w25q256jvm", }, { @@ -343,6 +356,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q32JW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x16), .name =3D "w25q32jwm", .size =3D SZ_4M, @@ -350,24 +364,28 @@ static const struct flash_info winbond_nor_parts[] = =3D { .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), }, { + /* W25Q64JW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x17), .name =3D "w25q64jwm", .size =3D SZ_8M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q128JW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x18), .name =3D "w25q128jwm", .size =3D SZ_16M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q256JW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x19), .name =3D "w25q256jwm", .size =3D SZ_32M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_= NOR_4BIT_BP, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, }, { + /* W25Q512NW-M */ .id =3D SNOR_ID(0xef, 0x80, 0x20), .name =3D "w25q512nwm", .otp =3D SNOR_OTP(256, 3, 0x1000, 0x1000), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D0B447043C for ; Tue, 4 Aug 2026 14:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852285; cv=none; b=Tg4HmeXXkyvtEzsy+efz6SbB0yMTW5/HN9+JbyrCY8oUPBMHL4pC51jIcCMJQd9BpyW1EObljSUELPPskGVOXcApZ0Yvn/frS7UiMdm55vqcpSfU2K02A3nDCfiy785eCQEs0dV3d0UGyZaXIQHpXNJWg+PWUkD9pbxsfaAiDhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852285; c=relaxed/simple; bh=ibTMuQfGAaZc1E89749M2JULY1OtAYogls5aYU9qIPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RKBZP/Y2piUSbZ51HXH9SpjqCA7KfyT0jcin7XAi00ufrPJ4VkgfrfgLvxKbbFLCZ2R8hmyV+hwqNAhbBTvFTH9l7/HCzhZUs6TkCED7bhFEbaDB/7KMZxcY3uKADPNklFLayH2YwgnGLWbfdCVmcWoh/l5nu2m5e58fzkfI+FY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=NkZIlBMD; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="NkZIlBMD" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B505B1A13FC; Tue, 4 Aug 2026 14:04:42 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8725F6029E; Tue, 4 Aug 2026 14:04:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A474B11C32D2D; Tue, 4 Aug 2026 16:04:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852281; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=L9X7UsI7IpXNBceZj9vA3jt5/zF98CUIbSi7P/uESNM=; b=NkZIlBMD/l/vOTXxgLaTeZ1eq6YTMaI40LLd7VjKKJgSDg8NrIVefHa5zWyI14QY6q61AH HjGHBq78VPoKYB0b6MOieYUtxZUslw761Q4kJysPGgtQaTnuXHff1qzMRpaAuj+hMoY5UN 5VePKYDxiBRSHqnCt5Oe2iZKNiyIWejDZWes+G7W/3VAoV6r50eTzDR9ZmlIX9UnQzicfp S7JBNKVrC/bRa8Rpl7fa5hSA/uWOEy710m1gZBuYFBN0lV4pbpjsSLULC6XPgnphtU1aP1 RzMknrptWE6F63PXTogkuXROVhjTf7oxZgN1z/+gaOWcB1Qd9HeDTsSq2Empug== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:31 +0200 Subject: [PATCH v4 09/28] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-9-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The top level paragraph of the QER field in the JESD216B mentions: "In this standard, [...] Status register 2 refers to the byte read using instruction 35h. Status register 2 is the second byte transferred in a Write Status (01h) command. [...]" Value 100b, named in Linux BFPT_DWORD15_QER_SR2_BIT1_NO_RD, does not mention anything about reads and only brings details about writes. This has been interpreted in the spi-nor core by the absence of read capability, but there is no explicit reason for that, except that there were probably some very old chips which didn't support command 35h. All quad capable Winbond chips carry a CMP SWP bit in SR2. SR2 is readable with command 35h. In practice, all Winbond families but the W25X family have support for this feature, so re-enable it Winbond-wide in a late vendor fixup, except for the {EF, 30, xx} family. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 44 ++++++++++++++++++++-------------------= ---- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 3e8e89058b8c..04713ab04d01 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -73,26 +73,6 @@ static const struct spi_nor_fixups w25q256_fixups =3D { .post_bfpt =3D w25q256_post_bfpt_fixups, }; =20 -static int -winbond_rdcr_post_bfpt_fixup(struct spi_nor *nor, - const struct sfdp_parameter_header *bfpt_header, - const struct sfdp_bfpt *bfpt) -{ - /* - * W25H02NW, unlike its W25H512NW nor W25H01NW cousins, improperly sets - * the QE BFPT configuration bits, indicating a non readable CR. This is - * both incorrect and impractical, as the chip features a CMP bit for its - * locking scheme that lays in the Control Register, and needs to be read. - */ - nor->flags &=3D ~SNOR_F_NO_READ_CR; - - return 0; -} - -static const struct spi_nor_fixups winbond_rdcr_fixup =3D { - .post_bfpt =3D winbond_rdcr_post_bfpt_fixup, -}; - /** * winbond_nor_select_die() - Set active die. * @nor: pointer to 'struct spi_nor'. @@ -313,7 +293,6 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x60, 0x21), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, - .fixups =3D &winbond_rdcr_fixup, }, { /* W25Q16JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x15), @@ -399,7 +378,6 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x80, 0x22), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, - .fixups =3D &winbond_rdcr_fixup, }, { /* W25H512NW-M */ .id =3D SNOR_ID(0xef, 0xa0, 0x20), @@ -415,8 +393,13 @@ static const struct flash_info winbond_nor_parts[] =3D= { .id =3D SNOR_ID(0xef, 0xa0, 0x22), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, - .fixups =3D &winbond_rdcr_fixup, - }, + }, { + /* + * Catch all entry to make sure all chips solely relying + * on SFDP still go through the manufacturer hooks. + */ + .id =3D SNOR_ID(0xef), + } }; =20 /** @@ -508,6 +491,19 @@ static int winbond_nor_late_init(struct spi_nor *nor) */ params->set_4byte_addr_mode =3D winbond_nor_set_4byte_addr_mode; =20 + /* + * All W25Q/W25H chips do set the BFPT_DWORD15_QER_SR2_BIT1_NO_RD bit in + * their SFDP tables. The historical spi-nor assumption in this case has + * been to declare CR reads as unsupported, whereas the Jedec + * specification doesn't clearly state that. In practice, all these + * chips do support reading back the CR, which is needed for SWP support, + * so make sure that capability remains enabled (needed for SWP). + * In practice, only exclude the old W25X family (JEDEC ID: EF 30 xx) + * which actually does not support this feature. + */ + if (nor->id[1] > 0x30) + nor->flags &=3D ~SNOR_F_NO_READ_CR; + return 0; } =20 --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5D6E471247 for ; Tue, 4 Aug 2026 14:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852287; cv=none; b=tfqF5WdTK4+85uaroAiZ1FUWfmLwoDc/DFyTVTDSX6oPcdDOQ8BJKmY8QpoKGVhLjfLuQrPtQ9rXtUZpa+YB23QdEUVqvMp9BYI3SN0EtaBoUJrBdAXbvrxd7QyoZ+ZP2p76KkiH+CGtnnOdlLdmOq4u/SqbOfijMePop91xtCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852287; c=relaxed/simple; bh=Nyxn58Nyf5yQxIQZ1mENxNl+d5x8jB/YTg4p11OUba0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HtF8VPOyKpgN0c//JK6vQ0UuTRj6L7N4ceMIUY2hd+bEFg7aqt0BXm14hlfkKvW+pNSlAV3WvUmGpsTcUEdeaSoDFqqcrJgA29WJ0016Bb16WWR45Imr5mqnrwWz4qGsNxSjO7vHIEoJOYjqMiGLfbBQlbVYmxcHEmV7GKq5W4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=qeEv+zUd; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="qeEv+zUd" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 157304E410DD; Tue, 4 Aug 2026 14:04:44 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D44966029E; Tue, 4 Aug 2026 14:04:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1587311C32D2F; Tue, 4 Aug 2026 16:04:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852283; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PWG7dcXykTf/QNQURaBjc2iIchYoAomro/OqlQDcSt8=; b=qeEv+zUdxMx40qxWCwFYgPdMX+wYfkQ4N9l/LIHdP4fsN2Deh7VinUpo0jL0h6lq5o3ti/ 1sNvyT79DtKpdi2pYVNVH+lvhn/aHO8sW9GjZ/UsnJqmgD8zXVpAF/m15SvMGEkZteiD3D mXa+e27eUuIA0W4b6S+kSYmV+7bbKmnWSZszJrEyBIaM586CSckTamLxSItK0KmdCKV5tK UvWkM6oqgwh0fkLUpuBswCKWKGENSo/D07K+OW0ffRJmGt076pDcfsoLYr2aFzK7pODFTY kNaxvDrOT3UlYTjZP1Qm/ts70sav5h1H9scbsvapDCIRo+oXtmr7JpKDM4maJQ== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:32 +0200 Subject: [PATCH v4 10/28] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-10-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn that little 1% write throughput. Before: $ flash_speed /dev/mtd0 -d -c10 eraseblock write speed is 560 KiB/s page write speed is 540 KiB/s 2 page write speed is 550 KiB/s After: eraseblock write speed is 578 KiB/s page write speed is 557 KiB/s 2 page write speed is 567 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook is added to make sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 $ dd if=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read $ hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 $ sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read $ mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read $ sha256sum spi* 83e7d587bce3b2031c82939839cc1fbcf62b8939b35882d176f207b0722d0dba spi_read 83e7d587bce3b2031c82939839cc1fbcf62b8939b35882d176f207b0722d0dba 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* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 83e7d587bce3b2031c82939839cc1fbcf62b8939b35882d176f207b0722d0dba spi_test --- drivers/mtd/spi-nor/winbond.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 04713ab04d01..2e53f16a9f93 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -203,6 +203,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q32", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, + .flags =3D SPI_NOR_QUAD_PP, }, { /* W25Q64JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x17), @@ -504,6 +505,22 @@ static int winbond_nor_late_init(struct spi_nor *nor) if (nor->id[1] > 0x30) nor->flags &=3D ~SNOR_F_NO_READ_CR; =20 + /* + * Winbond has reused many IDs, up to four times at this + * stage. In general, most of the chips with SFDP support are + * correctly described by the ID table, but the non-SFDP chips, + * however, are known to not feature as many capabilities. Make + * sure we filter out those capabilities to keep backward + * compatibility with these devices manufactured until ~2016. + */ + if (!nor->sfdp) { + struct spi_nor_flash_parameter *p =3D nor->params; + + /* SPI_NOR_QUAD_PP was unsupported */ + p->hwcaps.mask &=3D ~SNOR_HWCAPS_PP_1_1_4; + spi_nor_set_pp_settings(&p->page_programs[SNOR_CMD_PP_1_1_4], 0, 0); + } + return 0; } =20 --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFEA9471258 for ; Tue, 4 Aug 2026 14:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852288; cv=none; b=dI6JHLkaP0ZG+Lo5yCu2Ln0y7vAss7eAXvA+Aas6h4j2qP3INQcZDgOP+mOPJwo5J37NwvJ1oc2pbhc0FZBm6Dq1YKU9pOl8wgGWlKNjXOyL5OruZ7L6G/PNwgaH142/yahRP4FX/7AcUZ+UWHzYQMQuA1BrrC0aOVW71m4rAoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852288; c=relaxed/simple; bh=0DnyRNnR4THLXYLXsOuICVYhv3PYhTXZY6s4oyPufi8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pgsUR1Py8k55k/9EVmtzyZs/ZtzcDMLuOJA2Ve1TPE8fwHa1WHXIQMUaG5OVZPkGfCfTfGIUnNM2PBao2SwjYXl2aPXFXGzhpsmJ/cT/czGD+tXBOlYt8hbHDM+c5yH3MyYWc5aRUBIYRNwFMTByy/xpZT+kt4Qr7WLhC9oE0aE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Ey0NFeIE; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ey0NFeIE" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 701D61A138B; Tue, 4 Aug 2026 14:04:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3D0676029E; Tue, 4 Aug 2026 14:04:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6008C11C32D2E; Tue, 4 Aug 2026 16:04:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852284; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=oT9UsdMBoSCH8EdPRd3AtilnbGSrgQJAdMC909jiPHE=; b=Ey0NFeIEL+or/0k1mZDFpP+J5lcaoI9HPULB+zP9gY+NFZbh2jYHmFRMRnUf7E1KGiISQp BwyKr8pQAbvx1nm31Za1Zpz6qp+HXy+LHZicai39ydftbW1aab2Bg/6XRp/7oAPz/nhzgV bO7yKyMzheSiv98+TMx6Q4lLjhweP4toFRbcMXDOaSHukrTXac8GaVUGB2P82G1H3xJpus jFpvmImLQjc5aI2rVlykiXnGLf6diTZV7zFtqr030Muz6ooLcnq0u1ONI9ZCsRhqTPljGc rOuHoNdqcKzkPTroZXyrM3uDag/JLitvXfWlY3ZkLrQwVQ5a9YhogTszFYLNtw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:33 +0200 Subject: [PATCH v4 11/28] mtd: spi-nor: winbond: W25Q64JV-Q/N: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-11-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet it is a supported feature of the chip which is already handled by a flag, so let's enable it and earn that little 1% write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 539 KiB/s page write speed is 535 KiB/s 2 page write speed is 536 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 556 KiB/s page write speed is 549 KiB/s 2 page write speed is 552 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 40 17 00 00 00 size 8.00 MiB write size 1 page size 256 address nbytes 3 flags HAS_16BIT_SR | SOFT_RESET | NO_WP opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-007fffff | [ 3] | no $ dd if=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug erase /dev/mtd0 0 2097152 mtd_debug read /dev/mtd0 0 2097152 spi_readErased 2097152 bytes from addres= s 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* 36667197a637b731cc2068022138e6963a9499ce9b0ddda1a1585f7f5ebe66ff spi_read 36667197a637b731cc2068022138e6963a9499ce9b0ddda1a1585f7f5ebe66ff 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* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 36667197a637b731cc2068022138e6963a9499ce9b0ddda1a1585f7f5ebe66ff spi_test --- drivers/mtd/spi-nor/winbond.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 2e53f16a9f93..15df3cc26fbc 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -210,6 +210,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q64", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP, }, { /* W25Q128JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x18), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA0747142F for ; Tue, 4 Aug 2026 14:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852293; cv=none; b=YrVaxDUnlOcsnUvPr/vjFaoRtwk3Ojq9KHoNExN0egej+bMts2H1SH+rDh58D8L363RiN/KSkqnyui43zRd60N8QEIcxzo9IN2lU26E23GJ81T9xLHbBhoJAiGf2becot542aWKps5U2Wwtu7gdBQOPWBYM+PqjNFOMHpEgRw3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852293; c=relaxed/simple; bh=1ymCF7wmdtYnW2yuyWaxc7/fLpyFAIFNzHqYRQyWhsU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WhcOyb0TiyY83rbMH+1vEpemInOxIgU/pB8A4pDv0HE/yGfHhMpmrxzxC/Fo7o3nqKuvGZeP6i9h8k2QnPvooU5YaUgnZvMYlzL9lihTr3eRZLCCkUUoF4BXC5DM8Ovvk6ReFfAoweskTEUNULOTcDBYRSxbJxKQDCyqkTPNdmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=lsUKPXJc; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lsUKPXJc" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D60671A138B; Tue, 4 Aug 2026 14:04:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A84736029E; Tue, 4 Aug 2026 14:04:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B20AA11C32D32; Tue, 4 Aug 2026 16:04:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852285; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2efJBaCayTywqP4Hq/HYu2FRsCV5fb1DWh4ZIBYfC1k=; b=lsUKPXJclC9JoiIZNE/F+qnPpVDSdXOkUaKoidVBYmQ2hAOeHsuDaygE+4Q/eF/BiKJckG MpjvIFN2MUlSCs+sOPLTQ0iJWsLaTo0zMxU+ODO05XHVSFT5zsYTWf+QRgiuZmN6lbzOBu QpdX5UqSyVlyhaOOzbRkVv9QMbNWEiB2PYL1/a2+MbwKRkYpSu7CCBBOHKW8Mftek8nwMu iewz2ij0s8CllthBXr36LSizgr7DVdqJFLq9s+AVjjLqv4O/uv5FpcuEd9UOX6a1+WOIDL PtmOE5vA9SRSOj1NMbi5oDuxFa6c1YuJEQCgPAexkYkc/GEfqv8/YR3zhkq/Zw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:34 +0200 Subject: [PATCH v4 12/28] mtd: spi-nor: winbond: W25Q128JV-Q/N: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-12-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is not massive @25MHz, yet this feature is not advertized because these chips do not implement the 4BAIT table. Flag the quad page program capability manually and earn a few % of write throughput. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 536 KiB/s page write speed is 532 KiB/s 2 page write speed is 532 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 552 KiB/s page write speed is 547 KiB/s 2 page write speed is 549 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test c2712b5617a588f8bba4b8fc7af62f6ca5e2356577681b23544d1a93540ecd1d spi_read c2712b5617a588f8bba4b8fc7af62f6ca5e2356577681b23544d1a93540ecd1d 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 c2712b5617a588f8bba4b8fc7af62f6ca5e2356577681b23544d1a93540ecd1d spi_test --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 15df3cc26fbc..f7cdbf1a56a5 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -217,7 +217,7 @@ static const struct flash_info winbond_nor_parts[] =3D { /* Flavors w/ and w/o SFDP. */ .name =3D "w25q128", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, .fixups =3D &w25q128_fixups, }, { --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8726946D0BE for ; Tue, 4 Aug 2026 14:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852299; cv=none; b=ZzadprB4eKj2yGw8utze7ptM5yb+cloqPxiTUGq82JasvXBwc5kv8D3V6BPthZlwkJzy4F892OvpUJ4QJjk2tKgAHKispQFHkLAJy3HvEu5lObTqoQpMeqB3Hoh+FiDDfnNjVfd86LWqM6+4cw3Xn1GfF5+vtAIKdWBNt+/JLiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852299; c=relaxed/simple; bh=ZvcIAHvdiDa87FEhIbw/pwv5gcWoySnOm9i3uKKmMcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TThLnywnY2KNp3gt1SSYPz1uF3L3VyY140ExrJMumpkgemW16mP8b14orbj9e+T8CsXqDzhjJ4/W8JTZLMa1l/5+FBmxoFDsUtFXa9QOgkskxBPTxvRs94/sNYUqimE1gfZF5Iu53q+1nxeDOEmzXcQpwLEhJwmnBnXyfe9fXBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kHJ8Ua8C; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kHJ8Ua8C" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 197EA4E410DB; Tue, 4 Aug 2026 14:04:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E0FAA6029E; Tue, 4 Aug 2026 14:04:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 45FD411C32D37; Tue, 4 Aug 2026 16:04:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852291; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=c72GfLvgeyfX5tlbGion+ZPSbnfinCz5XlvBLoX4LVw=; b=kHJ8Ua8C+ZZ3zjuVp7VuStFb9FTeT/8iERyK8o/UqodxDcxjFlZZY71NC4mbYKeSq88I3g te2CHNjvPCwHzibNQ2Ee9s947dUIlOS9HeJc3VQotk37kIIgsmvbNp2EhXkN7VTNdpfK+Z mR7lI4klX+AlrfgAPZorv8B/SKlBqhi55yAurinkE2kqSkqvpgoKLqMGmJ0ovnRMgO2CwJ nMx8mwNphEEZsrMreMjnrarKg14m5MWPbje+9O5gVdp/SwHDYgFxH6qK4y2cmmM1n1hhTA pgSM/ItBq7evbtdWygquLrgkedPN3gVx9xaME+K6uqhu9J+klMFHu+OPkzVKJg== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:35 +0200 Subject: [PATCH v4 13/28] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-13-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 This chip does not advertise it correctly but it supports 1-1-4 page programs. Before: $ flash_speed /dev/mtd0 -d -c10 eraseblock write speed is 2612 KiB/s page write speed is 2509 KiB/s 2 page write speed is 2560 KiB/s After: $ flash_speed /dev/mtd0 -c10 -d eraseblock write speed is 3033 KiB/s page write speed is 2895 KiB/s 2 page write speed is 2976 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index f7cdbf1a56a5..456050fdd251 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -307,8 +307,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x16), .name =3D "w25q32jv", .size =3D SZ_4M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, }, { /* W25Q64JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x17), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C964246D2B1 for ; Tue, 4 Aug 2026 14:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852304; cv=none; b=EZBaOR6fsPXIK8M/f5tGxhhs49RGuuCsFLW2BiN87EIxvIpBilorzp6/39DwjJigzMuSA5VuRDGRqUnEJJ7a9oiBJz8V3vjoMGVTn/mex8SsiJXcp9OtNEUukRQzY5Zfv2MaEIWRSu4Cyk0pkE9HZmnylVW3qM4PIHTR7IB8uNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852304; c=relaxed/simple; bh=GUINGEJrI5qC2VPqARoOJCWulzSrrxQO8AogdbFA60Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ehe5dnakZSLWmsSm5cD2iSKhPT4xuKlFkvTgYfANmbpeXRjuzS0rinfO+FV/n930GEA/lRfDfXWEC4Z740AB2oYLSjNbC628tDqvCen4hK3k6VOBmkMiqi97KBFmbo+wNV9ZVTz6edph6GSi0blqc/SIxuczAASS3nUfK2Gba4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=aFSbSRgN; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="aFSbSRgN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 450D24E410DC; Tue, 4 Aug 2026 14:05:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0FF806029E; Tue, 4 Aug 2026 14:05:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6FB2211C32D3C; Tue, 4 Aug 2026 16:04:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852296; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=S+wC41kvzTH9dgkFMWSsDPvSa0vzDzUt0dds5q/ib9g=; b=aFSbSRgN/qKc+rHnnkGnLQGQ205NLdUO9igX+sXNECskpTOSiUv9kjXwCo6zg7JCcd4O8O Tj2s0REYV7CRvW9XXT0z3PitTDPTJcyuuOuM+f8OuBFhmyrL/OiNNLACA4sQhLOtnAJmV6 nocKOdLYrl1B8XuBjpG9Gbrd7MA6388SOUjsKINTn8lTTnIt5d25Jk+ImUiONMvWVHO4R3 ig9c/S3f1do51K0IUsTtWL9lkUV/B7nB/ZmnFAL2qTEaOK/1vQc3lcOmOShOlquabt8ViN MWdeQWjT+ntqUsCwegjYWJCq/+gc0jLJrtXuE8s9ohA7acMxkfTVXw8zD19wGw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:36 +0200 Subject: [PATCH v4 14/28] mtd: spi-nor: winbond: W25Q64JV-M: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-14-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The benefit is massive @25MHz, but the chip does not implement the 4BAIT table to advertize this capability, so enable it manually:. Before: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 558 KiB/s page write speed is 553 KiB/s 2 page write speed is 555 KiB/s After: $ flash_speed /dev/mtd0 -dc10 eraseblock write speed is 3047 KiB/s page write speed is 2909 KiB/s 2 page write speed is 2976 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 70 17 00 00 00 size 8.00 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP opcodes read 0xeb dummy cycles 6 erase 0xd8 program 0x32 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+--------- 00000000-007fffff | [ 3] | no locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | unlocked | 64 $ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 1S-1S-4S opcode 0x32 $ dd if=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read $ hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 $ sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read $ mtd_debug write /dev/mtd0 0 2097152 spi_test mtd_debug read /dev/mtd0 0 2097152 spi_read 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* d79c3f7b40646d437eff15309c5250e8ee203f805b9d13d8ad8a7019f0dd69f8 spi_read d79c3f7b40646d437eff15309c5250e8ee203f805b9d13d8ad8a7019f0dd69f8 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* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read d79c3f7b40646d437eff15309c5250e8ee203f805b9d13d8ad8a7019f0dd69f8 spi_test --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 456050fdd251..41c9b620f26b 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -314,8 +314,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x17), .name =3D "w25q64jvm", .size =3D SZ_8M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, }, { /* W25Q128JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x18), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E886244C4F5 for ; Tue, 4 Aug 2026 14:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852313; cv=none; b=ohw2C5OgFlAwQfSUyouLmuhywtGBlfGM9X2llKWaCvKeMqfzt5Ts3SeFFtc/CsoVdMZmVFe5g45fcJMkA5zZpmT84/7IGqi14LT9D2GvcCHVHxWbkMoowSQlzbYqp+PmkA/WySYnPRI4pNL0DQbS7+LDoZUrmn6EwTFw22WaKy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852313; c=relaxed/simple; bh=oKyMMDPin/NuypJnP20ErL8P4GPafcZxDpVv3it+/tk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gXil+8Tb8gxUHsNoxM/rgFwQlNUz/uuicaUvSrjRfmYWd9I1bIVUrtcqU5WoLWziwKyD1Du2RjNfNLfhx/LYMc/XEBcF06IBtGXgJm4HXYFAwB/3XIXiWBlW8mqu0dkxG1RpQsI/opRzxnxzD3ZRSMIl+5Pp2eWMwtJRZBndOMw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=0B0gFeDw; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="0B0gFeDw" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 5F9811A13FA; Tue, 4 Aug 2026 14:05:10 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2B6B86029E; Tue, 4 Aug 2026 14:05:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 997CD11C32D27; Tue, 4 Aug 2026 16:05:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852305; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=E5QPse2lkWC/wOtvK0UJ5oLsVwxAuCt35ua4zancMaA=; b=0B0gFeDwq/7mP0o9F+R9pf4aYH+hhjnuu2EEu/WwdUSeX/x3wGyA3nwjGQ4Zg2p1RqlIQI aaWxR1D97YE3WrCSdM4LDLTuhApyqNny4BWD7PYIBENzC/Lyb+Gzh5r8qmf9NdPKpAV75i RGN2MYAlONdJMIIovmwgBb9iinStB6kPBE30Lu4pWr+Ez0WFUdKNsad+uHu2e7Fmnaa5Ok 9yPKrE2U/AuM8rACbI+fGJFgN6NWTT7Jc6pSXgCp4G2dnxCBZMzpExEk1t88qThJ67S1SG sx/8EHj6YGN2+fvHu9OHoH1G5dDiDf6qJi3WhevSFxODomilFKaPwjAr0dlLSA== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:37 +0200 Subject: [PATCH v4 15/28] mtd: spi-nor: winbond: W25Q128JV-M: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-15-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 This chip does not advertise it correctly but it supports 1-1-4 page programs, add the flag manually: Before: $ flash_speed /dev/mtd0 -d -c10 eraseblock write speed is 553 KiB/s page write speed is 548 KiB/s 2 page write speed is 550 KiB/s After: $ flash_speed /dev/mtd0 -c10 -d eraseblock write speed is 1628 KiB/s page write speed is 1600 KiB/s 2 page write speed is 1612 KiB/s The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the capability remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_read e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 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 e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_test --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 41c9b620f26b..2cdb4acd9ecf 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -321,8 +321,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x18), .name =3D "w25q128jv", .size =3D SZ_16M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, }, { /* W25Q256JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x19), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2808546D2C8 for ; Tue, 4 Aug 2026 14:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852318; cv=none; b=BMXE25f77IrpPJxluQYHHrINVvk25d8ZEw724wjZHPp4j/sE5eZqq/2WJXLjwwjzrRTHGhadg+xKkwuJ06HtIAtchDrbaWk074+v3WfhTisjuE1CcfX569bHcplc6Vc1Tijh7kmHDzoifaAwIye+urvnRGc7QkkdFhde51GMV3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852318; c=relaxed/simple; bh=cxs7szcn0aWn+J9MsSH3R5eRLcmvysjEwi+HrUVSzI8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jdc4gkxnSDoXoUXJcBpCHLoJq4KJ8SAp04Th3WRrh8RUy3tVsG2UUcssE5BFgmU1gHy8ZUfbgLgqRI0FY46CKJ67xYCQoos1kZm5A6F/YUhqYy/ve92XsMixsH+O0kLO/o3lF0b5iGkmeVRrQESLrvvq8YN4bwEngau17GKBXuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=izhEkB3H; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="izhEkB3H" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id B330E4E410DB; Tue, 4 Aug 2026 14:05:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8513A6029E; Tue, 4 Aug 2026 14:05:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C3A7B11C32D2F; Tue, 4 Aug 2026 16:05:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852310; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=xFCGZoKQiD9TzzTrzW2O97nG3CHuVvL+BWagyTusTuQ=; b=izhEkB3HFIc6tm+r/07gk+8AYM+RhYtecVUDMOpYW8b3lfpd0OM1Nshl7irzltgQCIRCqI Y+PNw5MOQKH122iw/pboaB0tAHJt6vwq/80BCAfJdselOPC47YSnxjD/HR1J50a99jG7Nd ebHExlh1cM1zOHHSY3x7ZPPM1wGYsCLA/Zahddvek9qNyrumC/wQVDDyiCgY8uNlBdj0ll V2Cyngg8loCgUQpT+Y8Rm1svyB3SvV1borubTVAuJ6qGSGb8nVNfifwmisZOwrnXFLc7U2 hM8pmb9qrAVBFKwli58zCCiGyP/QYqbWwdRosxaL5XYXyRxmjVkGD52Y5sfYxg== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:38 +0200 Subject: [PATCH v4 16/28] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-16-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 I do not have any W25Q256JV-Q/N/M nor any W25Q16JV-M chips in hand, but all the chips with a density <=3D 256Mib are older revisions of the JV chips which do not yet implement the 4BAIT extension table, as such, they cannot advertise their quad page program capability. We can reasonably expect that these chips follow the exact same rules, so add the missing flag. The QUAD_PP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 2cdb4acd9ecf..b250a43ad4e1 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -226,6 +226,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q256", .size =3D SZ_32M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP, .fixups =3D &w25q256_fixups, }, { /* W25Q512JV-Q/N */ @@ -300,8 +301,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x15), .name =3D "w25q16jv-im/jm", .size =3D SZ_2M, - .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, }, { /* W25Q32JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x16), @@ -327,6 +328,7 @@ static const struct flash_info winbond_nor_parts[] =3D { /* W25Q256JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x19), .name =3D "w25q256jvm", + .flags =3D SPI_NOR_QUAD_PP, }, { /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A00A6472762 for ; Tue, 4 Aug 2026 14:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852320; cv=none; b=K8H7YH156iXgFdSBVGYGZ4rHqKROwg/I3Gr6L01JvPYlEf6/44TXr72yUQVbkff9zimxImOabcOfyTko4aDp8bwh2XTD4c6SbQ6gTg6rLH6J2nFg08+h8rQ4MmyU45CdGCk76e9oV1Q/pJnboGiozCtU8FT5nxIib1kYFGAAJ4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852320; c=relaxed/simple; bh=Mlx0WVCRmdhCDtuNJdvU79tDkO/5qtB6v0uOJVe5JJ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SrYOzirrl0ZpOVV3IYmCQS8aGImapBynjznNpOjmlra703lzk3YHL5RviHlqBadz/VmkH2jxd1bkbXze5Nw/sx7xFFb+p4ULf7gAncuaiht65oFbU+MJV5N7nn0cHofMIMhTowsrLhj0DalKzn+XZmXxg9LXTlsWYifQLioMowY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EGxoEe6E; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EGxoEe6E" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 3CB9F4E410DC; Tue, 4 Aug 2026 14:05:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0F3736029E; Tue, 4 Aug 2026 14:05:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2CB6E11C32D2A; Tue, 4 Aug 2026 16:05:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852316; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=v96X6gM4o5yMWfEIBxxO9VRwA8Y2VAK+kKp6k/DC5H4=; b=EGxoEe6E1L49CQmKbpwArnQZK3wolQGWb4mvuosvAovkHTJaDcoUz5PR1lcuUcuju7bYoY 1GjYcMW0VbR6Ar6qNq9yPhmZM4XnPsRlK3g4hgEEQCK8IIv+xwzfmvo3EJmcpUOjPNF0qZ flcYcfo2Hn2bEM7cAdeF1sgpztl98N8QPWl83inzdPZQV+gm/vRQzZpa7enwBp9E2LEAVW tf6VlLAPiWQiKqnvWZMcsK/i6IecI9bM5nYtCO8v5JZC8c3vCIubc2qLQSkudXFzsAZGah zaeq1rgREtM9ro8M/CNiUPXgl6zYlDDbWwX9Z3WuMaQqi9w0aRrGTce+nKVgcg== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:39 +0200 Subject: [PATCH v4 17/28] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-17-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so let's make sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ alias show_sectors=3D'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: 0x400000 Lock status: unlocked Return code: 0 $ mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash $ mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read $ sha256sum spi* 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 $ flash_lock -l /dev/mtd0 $ flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 $ mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read $ sha256sum spi* 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test $ dd if=3D/dev/urandom of=3D./spi_test2 bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 $ sha256sum spi* 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read2 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test 5b69b16c88c3ae48213c359d2f9fd7f0583e513dabb224b3404bc93a5e173253 spi_test2 $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 $ flash_lock -u /dev/mtd0 $ size=3D$(cat /sys/class/mtd/mtd0/size) $ nblocks=3D$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -= e 's/.* unlocked | //') $ $ bs=3D$(($size / $nblocks)) $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 $(($size - (2 * $bs))) 2 # last two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # last one $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 $ flash_lock -u /dev/mtd0 $ all_but_one=3D$((($size / $bs) - 1)) $ flash_lock -l /dev/mtd0 $bs $all_but_one # all but the first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 $ flash_lock -u /dev/mtd0 $bs 1 # all but the two first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # all but two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index b250a43ad4e1..64bf98ffc25b 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -203,7 +203,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q32", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K, - .flags =3D SPI_NOR_QUAD_PP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q64JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x17), @@ -522,6 +522,9 @@ static int winbond_nor_late_init(struct spi_nor *nor) /* SPI_NOR_QUAD_PP was unsupported */ p->hwcaps.mask &=3D ~SNOR_HWCAPS_PP_1_1_4; spi_nor_set_pp_settings(&p->page_programs[SNOR_CMD_PP_1_1_4], 0, 0); + + /* SPI_NOR_HAS_CMP was unsupported */ + nor->flags &=3D ~SNOR_F_HAS_SR2_CMP_BIT6; } =20 return 0; --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE45472F61 for ; Tue, 4 Aug 2026 14:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852321; cv=none; b=EwC0GWX+VtXWysIGofvYa3aIzK6WcbT+4TePqea4ZB+qt/HQ9Ahjxq1LgKA9zxYR6uAunnFqlYy/HBQCWpwYlr/QsKWdDu2Jcx37Eig5Fcz3Pt1/7BbMM7D2ysi7j/IthWbz7Z1dZkp8Zwf6w3VlpxPBudeG4TkmkttcOLjJlnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852321; c=relaxed/simple; bh=fBEId85PUbTg3RGVSRCjgX8h1fVnOnDEgp8sYHjfmCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jxRESnKQHkVqCvSw+iqyPEWXHjCXhTyEUO5a2QVcKCiAMFyrSqeII7yio+jtWn9CTSkIsrhd76pBiZgBLP7Zsn8Ov4V9Y4Wuenj+6cu6CtSKdhqZVnfClyQip8GeXYbiGBkRGfs/Fgp5GKasB8zDurz2xynxAvkmmUOiHaJEpN0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=UpCJBvcq; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UpCJBvcq" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7C29D4E410DD; Tue, 4 Aug 2026 14:05:18 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4D9156029E; Tue, 4 Aug 2026 14:05:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A969511C32D2E; Tue, 4 Aug 2026 16:05:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852317; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=W7pk4Auxm/5bUhH9wIW6ij2MAvWsWCv5nTmHQIduU5c=; b=UpCJBvcqdQsrDdhlslg8E58LTtmDSgfcahvsBuZOtIrnwC89Pz3TL/H5pYnL8VZ9h4CyBo QCK+d5gv/OGETTAMyAfpLNEHtxuZG00FwWqO8v9rYdoF3+FXTFhgsJIqNqUPBQ4aMB/TMp rVrz1QH2ThymEi1vn15eBZSznsLSXUDWpWtLCWMaz6ZKVUl0A7NmdElzDiSc8NFfBtSoX4 QsV6dzhiw8oIHSZT0amBzBF2fVezezyIheJJkhXn8dnRt2WO3OxQI5IfqfUrfam2dAxSpG Cwj9VbR1p8z9pWdsFJUirC4mnmkglL66dsz1jBlfgBEh7vu1EFHkn8Wm+XMymA== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:40 +0200 Subject: [PATCH v4 18/28] mtd: spi-nor: winbond: W25Q64JV-Q/N: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-18-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_read a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce 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 a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_read a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_read a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_read2 a4ad2c0352f71d61f64ed9cabb705edc84ac1f1be079619550cd18c70db707ce spi_test b12f8258bf0374eb5c55e659fc430df7a6016d3c0dca2dc04ef1fe82f61d7f67 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 -8388608 256 flash_lock: invalid option -- '8' 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-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 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 64bf98ffc25b..8fab520627bf 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -210,7 +210,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q64", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .flags =3D SPI_NOR_QUAD_PP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q128JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x18), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 594FD472F76 for ; Tue, 4 Aug 2026 14:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852322; cv=none; b=MbcTv9wjyaSpfkEh0/ziiW7ndjfb1BKLvspURBDaSGUWIt1dGamvP5AwGmw9osMjSu9YTWf5yhlK+SU8orfVdaEfj+l/r9jHt1nNXMs8aShg+CBj2Uyulbq1An6UHrhga7tsD45Mfr6KtKp5LSXbOT2VPqqB7lCOYQ7BrdSOVw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852322; c=relaxed/simple; bh=JDmyK69cO7VEO42tPqSoZbR4pC7Ij4HSJq/eqBtnC68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=snG9UfFL684hRNVgwo/PeztpN7v1S5MOkpmGe9mtGoHkgjhcHre/KoTNIxDfAmGHvOLtBI0SEl0WadDmF/sj2joVRlwmhi9HhzcrREHXN1CKzoOadIdMwLzztdgdWUnRRbN0XlryPHUneZlPVtMBM2KjLI8bNI47udR0HEC81Fs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ykbvUZ/r; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ykbvUZ/r" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BF5524E410DE; Tue, 4 Aug 2026 14:05:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 91E3B6029E; Tue, 4 Aug 2026 14:05:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EFAF511C32D27; Tue, 4 Aug 2026 16:05:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852318; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IECokdCzBsVUak0E3TMA6f5ekz6V8zS7sl+yPDFgG5g=; b=ykbvUZ/rpFAu2/15YY6cK9kbZQ3q0Iy50OjCSnKxxY0YXi0fpp4w9Q9blrgZqVHaspkFSo uICXuG6EvISD6Qq8G6E5OroIw/NtlVOPnarqn780DVcgmvuCYoMUA0x+2CsnGte4/qB7w1 HvLZsr7hjN4IooAiayThRLV1DuVY2JQpNI3RTaLRnxU5vTjAlWYpnmhXTadelIOXGrqip/ wkN0mnNSYZeDfvsaohJfI7MwOodpQ1Ei7uw7jayy3UqrmeRfLHPA+INOLm37sT1+xSD1sP YCKIFDnKl1vRRiE3iCoYXpboaZ50fXY+xz69Vvy3XL0RaX6kyTGDmi2fm8Ciag== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:41 +0200 Subject: [PATCH v4 19/28] mtd: spi-nor: winbond: W25Q128JV-Q/N: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-19-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the CMP locking capabilities of the device, flag it. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 $ss $all_but_one # all but the first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 $ flash_lock -u /dev/mtd0 $ss $(($ss / $bs)) # all but the two first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 $ flash_lock -u /dev/mtd0 $(($size - (2 * $ss))) $(($ss / $bs)) # all but t= wo $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 8fab520627bf..5a80de959768 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -217,8 +217,8 @@ static const struct flash_info winbond_nor_parts[] =3D { /* Flavors w/ and w/o SFDP. */ .name =3D "w25q128", .size =3D SZ_16M, - .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, .fixups =3D &w25q128_fixups, }, { /* W25Q256JV-Q/N */ --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A64472F94 for ; Tue, 4 Aug 2026 14:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852324; cv=none; b=cIn97r4dHy6fM+LBMA3N/0qB9114+iPkmiJHeamM4/iR7LENPwRzaBaAqENGbqWlKkIHIW7NeVKkOSFp6kK4fjbiPh8zjVj/mWlEmQNsxKRyUrJC1vE3RO8e5MG2sizHVqEzb+Xh6vZjVKBJWJhcfMV1G2Qj69neRRTOivNCaOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852324; c=relaxed/simple; bh=gdTDCfx4zSMiqmDuenq3tMnKa7itP4EVyrmu3le8/7I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tHfjeLrPJxrr501uI7zi7N9tEcqWL9OWudOMSuqjM7WJ/b/IoOCSY+anssZBD/VhwX/OpyJ/wjRqkYuH5lcUD88zI3cjVzoAzjz/rSOvZWCot1TBvSWXHfu3+dxTHIRE3B1803xLHKztlLazvWzDZjn1Wotq1LLwlMMllbSjlKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=MLdprPbi; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MLdprPbi" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4C47E4E410DB; Tue, 4 Aug 2026 14:05:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 14D086029E; Tue, 4 Aug 2026 14:05:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1EB5311C32D2A; Tue, 4 Aug 2026 16:05:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852320; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MwRHSkZqo8RDzaixPWGU7fjpYYgKsWfR2NmlW/uZHK8=; b=MLdprPbiPHgfOSvUEP6op7tnUE/Z8kCbCyIhVqXTNyt8vAYYvMi43mCMlOrPQOSFGMMDNI c2RiHwlkrtYVvkaupU8pIWtIdpJoFnUVwXdzQ2SZ7cOi6vEr14QiZK+iLZQNywz2bxGzRl Mug9Jb1jLBgE4IHTVwu+K9CevmRAC8yT+tE96b/4ukp4okSPYPsNFH2njywJrcBe8c90/L Z/BLOhtgNz2SmqA45p2PX1owaAwBdUXh4Y05YC0Q2I+ZA09aMH5IV+55KT70C5LagzOzLS HFAzaczo0grDDj5pk3W1M3ixK26/Ver+Tp3ed03joIFMr0RLV/f8Dns0Gfnr4A== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:42 +0200 Subject: [PATCH v4 20/28] mtd: spi-nor: winbond: W25Q512JV-Q/N: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-20-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ dd if=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out $ sha256sum spi_test 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_test $ 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* 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_read 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_test $ show_sectors 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* 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_read 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_test $ dd if=3D/dev/urandom of=3D./spi_test2 bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 $ sha256sum spi* 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_read 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_read2 090febbfd471d60250b2c6166939335012ad84207ab29b6657fcf62e8fc21fa4 spi_test 0236e30ff05676c4bcc80b55aa0ebf4747630e0ae3360e025c9e0c2509402a6b spi_test2 $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03ffffff | locked | 1024 $ flash_lock -u /dev/mtd0 $ $ size=3D$(cat /sys/class/mtd/mtd0/size) $ nblocks=3D$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -= e 's/.* unlocked | //') $ $ bs=3D$(($size / $nblocks)) $ $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 $(($size - (2 * $bs))) 2 # last two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03fdffff | unlocked | 1022 03fe0000-03ffffff | locked | 2 $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # last one $ show_sectors 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 $(($size - (2**7 * $bs))) $((2**7)) $ show_sectors 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 # first two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-03ffffff | unlocked | 1022 $ flash_lock -u /dev/mtd0 $bs 1 # first one $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-03ffffff | unlocked | 1023 $ all_but_one=3D$((($size / $bs) - 1)) $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 $bs $all_but_one # all but the first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-03ffffff | locked | 1023 $ flash_lock -u /dev/mtd0 $bs 1 # all but the two first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-03ffffff | locked | 1022 $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03feffff | locked | 1023 03ff0000-03ffffff | unlocked | 1 $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # all but two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03fdffff | locked | 1022 03fe0000-03ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 5a80de959768..1ac0177aeb44 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -234,6 +234,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q512jvq", .size =3D SZ_64M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { /* W25Q01JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x21), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB7954734EA for ; Tue, 4 Aug 2026 14:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852325; cv=none; b=fsSNp0aQAHJSw+CXhcpbfAHbKzIJrq3I65lXJX0EMOj/ZP+PNtmmq+WB8uJ/jY9f0WXSCm+gx9z8XOzyOaA+fTsRms0mtNwmNK+1Vav5TfQ9+0vsF1eJkE7r/klqgKJFmYh+EgmV+b4P/m2SfMipWCAhnRCR9SfCiDiKJzWaSsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852325; c=relaxed/simple; bh=dXIo5UAj7dWaF6namcLDaEHsOeA6ZlZYcLEvuLVQ85c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dLoQJw99SMr1A0FiQs6Gz9YlSWS7fxJoXALdi4BcMwNsBEM7UxBdKvuPkFGXoMx6ltHysILqYFEhTYFdPHNJEv6u2rmrfdvp5tJr5HZJKDNTV3IbhtigUvEKJlXBD1uoF6kdozYNwmzM7n42k5Mhvag278pfJ3vgbZ4zfXN0Ibw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cbM8/4lY; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cbM8/4lY" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 75D8A1A138B; Tue, 4 Aug 2026 14:05:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 42B036029E; Tue, 4 Aug 2026 14:05:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AE77011C32D2E; Tue, 4 Aug 2026 16:05:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852321; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=X8aYxMlLfJq5PE2QjM0slAjtAnVX/GkZT4hxi09Jwi0=; b=cbM8/4lYdt2x7Srofz2aaZDSCoy8Th7IfYun8tiCu3YZGdEKo3NLVu5SDZ5iuOsYzWnZ0w Zvb1ylleAVMHKi2p0z+P7KzLRt/ured03SSsDh5dkOMvx+PIZsTrmY5UvRRcWRg3Kym4a0 RCf0GH0sdy8iAdABEFMsnvL6k5ME4kYrr4mCVZX4TeCQVOQt8eYP49IVFu7jaHjZtvOwNk HuZcwr4fWNzhXFCNauw2A1xs+OAdRKVwikD5X5AABVkYotE2qpao8WcdLhbcyNq4k3KsGU c1O9kRH5dUK65QY1veXZ1n+f9qtCXrVqsGygvvEAEvHdgXb0G6imOhR8B5acYQ== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:43 +0200 Subject: [PATCH v4 21/28] mtd: spi-nor: winbond: W25Q01JV-Q/N: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-21-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- $ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond $ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef4021 $ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450060101ff00060110800000ff84000102d00000ff03000102f000 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520fbffffffff3f44eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14e2e96376337a757a75 f7a2d55c19f74dffe970f9a5ffffffffffffffffffffffffffffffffff0a f0ff21ffdcff $ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp c733cf105c5f05ed23ad3a32c2a72c1a09d4b895c628db52e645a8a457dfc7d6 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp $ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/ jedec_id manufacturer sfdp $ sha256sum /sys/kernel/debug/spi-nor/spi0.0/capabilities 6204c70963ab07f9865d051b888679ce34ad3a9f167fbbd4a2a6e0c3d0ce4cdf /sys/kern= el/debug/spi-nor/spi0.0/capabilities $ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 $ cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 40 21 00 00 00 size 128 MiB write size 1 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | NO_RE= AD_CR | HAS_SR_TB_BIT6 | HAS_4BIT_BP | SOFT_RESET | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xec dummy cycles 6 erase 0xdc program 0x34 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] dc (64.0 KiB) [3] c7 (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=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out $ 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* 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_read 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_test $ show_sectors 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* 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_read 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_test $ dd if=3D/dev/urandom of=3D./spi_test2 bs=3D1M count=3D2 2+0 records in 2+0 records out $ mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash $ mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 $ sha256sum spi* 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_read 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_read2 3fa6e836be5a072bd2d4ae538559dce20b14c5827ccc0cf6df783c0c35a4a83f spi_test 367809dbdff878d023d3a1a8526a6382759a3ec78aa6289d18577d15f013d44f spi_test2 $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07ffffff | locked | 2048 $ flash_lock -u /dev/mtd0 $ nsectors=3D$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed = -e 's/. *unlocked | //') $ ss=3D$(($size / $nsectors)) $ bps=3D$(($ss / $bs)) $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 $(($size - (2 * $ss))) $((2 * $bps)) # last two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07fdffff | unlocked | 2046 07fe0000-07ffffff | locked | 2 $ flash_lock -u /dev/mtd0 $(($size - (2 * $ss))) $((1 * $bps)) # last one $ show_sectors 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 $(($size - (2**7 * $ss))) $((2**7 * $bps)) $ show_sectors 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 * $bps)) # first two $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-07ffffff | unlocked | 2046 $ flash_lock -u /dev/mtd0 $ss $((1 * $bps)) # first one $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-07ffffff | unlocked | 2047 $ flash_lock -l /dev/mtd0 $ss $all_but_one # all but the first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-07ffffff | locked | 2047 $ flash_lock -u /dev/mtd0 $ss $(($ss / $bs)) # all but the two first $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-07ffffff | locked | 2046 $ flash_lock -u /dev/mtd0 $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07feffff | locked | 2047 07ff0000-07ffffff | unlocked | 1 $ flash_lock -u /dev/mtd0 $(($size - (2 * $ss))) $(($ss / $bs)) # all but t= wo $ show_sectors locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07fdffff | locked | 2046 07fe0000-07ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 1ac0177aeb44..59d5be14a73c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -239,6 +239,8 @@ static const struct flash_info winbond_nor_parts[] =3D { }, { /* W25Q01JV-Q/N */ .id =3D SNOR_ID(0xef, 0x40, 0x21), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .fixups =3D &winbond_nor_multi_die_fixups, }, { .id =3D SNOR_ID(0xef, 0x50, 0x12), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D47473C73 for ; Tue, 4 Aug 2026 14:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852327; cv=none; b=elQw3pX0+weGSO+joGviIY+eNqDDveyLdn/45K1VaBqIFjslpcwsAQzSvC9HOS+SxyeIJWGiwlsRXzh5nJlmj5HxQfeLmve/6L5M1OmJNYXjsAeJyDVYTmlW6x03mQP4aHtqCeNAsh+3yNwfYNtL6arKPSBF+DZA8FxHSd/5KT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852327; c=relaxed/simple; bh=L+AZoGvigvpQ52oJ4oa1GVOFbhJv2qWUBxquQagasWQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jv/zI4z9ISiiCHY1Ge07JBWt/ewf17lJhncGtyq7Q3ymC8SNo06KsRNdiZaKTMW8snXM9THMDiFM8LgIw2P1BlAW+KvttUIWgHu8JIBY738pf8amhkNOjWFN4UY1TerzTlZ6wQS6nS/QG/nCyQpmnchysDzsygmw4ZQDPcYr+xU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kG09q25J; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kG09q25J" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id EE2254E410DF; Tue, 4 Aug 2026 14:05:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BFB4C6029E; Tue, 4 Aug 2026 14:05:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E066B11C32D29; Tue, 4 Aug 2026 16:05:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852322; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=a8JXb5k+mM9U89vEfltmq+tzKFBPYOhOc9XoqlLiwTs=; b=kG09q25JSCy2Ya8KNfMmcLs94VGa7u95lTSXCNTmTHS8WHAxCXMP2QzR3LyP0OPZBpwIej 7en7sO5BKJUVdQ7XaiLkVK9nbEd1/IUpKMBppOlb0DBmJux9klZa2W/O8qVPyA8k7cCixb dI3HEcqc7TBJ9yP0/HUnp+7nQkj83MxXhVZNtj3r7/AfN4edw0YIpaexu18aORLWCj+9n8 hyQoDLdIZ9rxOjeIXou3MJ/7ZsYPwMoFzLJk9o2wLKCrTGRvnwzKQkVU4mHX5MnG5/we5R EhUS4TA/zBq4Zaq0c93nKiLirZM9G0ItfzpsvzQ5H7A3KDQKlMv2u4fIhq6Eew== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:44 +0200 Subject: [PATCH v4 22/28] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-22-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag the missing CMP capability. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 34.621251] random: crng init done 2+0 records in 2+0 records out + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_read a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_test + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | unlocked | 64 + flash_lock -l /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: locked Return code: 1 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_read a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_read a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_read2 a3d9042b2e8085f39ebdefbabee5d3bc8baed5217f2a51510bd523db1b147395 spi_test bcf94096d25ce535e4b920f876d53420e6d8d917d0d14dd766b5f8c3d6f40475 spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D4194304 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D65536 + bps=3D1 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 4063232 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | unlocked | 62 003e0000-003fffff | locked | 2 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | unlocked | 63 003f0000-003fffff | locked | 1 /* Skipping BP3 test */ + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 2 00020000-003fffff | unlocked | 62 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | locked | 1 00010000-003fffff | unlocked | 63 + all_but_one=3D63 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-003fffff | locked | 63 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-003fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 63 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003effff | locked | 63 003f0000-003fffff | unlocked | 1 + flash_lock -u /dev/mtd0 4063232 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-003dffff | locked | 62 003e0000-003fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 59d5be14a73c..3f9f2257ac91 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -313,7 +313,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q32jv", .size =3D SZ_4M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q64JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x17), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5CCA473C84 for ; Tue, 4 Aug 2026 14:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852328; cv=none; b=bQFo3oIKuE6GzH/+GOnFJMQJzkWV4yJCRR3IHUlAFsU0Z8y0BiGESlAzOP7mCSIzceZz/zTtrKzao0cp1xi3KgQ/DKCSZTvMQ2mEfnxaWaMpKPMOKV8rUkugkn0ffedpvD0orEw/8F10xfaVy5ET8abGVg+3/RWBefFDv2Ht1XU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852328; c=relaxed/simple; bh=dMbReLDsx6KDHiXhfV+PMcrwvvXhmlLRsH0hbBm7nSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V0DTOSOm/lya62NK5qrfPMe9eyBR697hw1ebmy/zyA2nRkelylASsyAVdPA9+9It8WEYjytkr+UrrykDCTAiWZnuNeYwwBknzqhk0mg6xRr7WdUXfaFYb8en+3kKlP3/IAkvp7627O7PK6id7/B9grdKkx9BggmMv7a0yCi9vDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=WA570TFt; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="WA570TFt" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7EB914E410DC; Tue, 4 Aug 2026 14:05:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 519A06029E; Tue, 4 Aug 2026 14:05:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4135D11C32D2D; Tue, 4 Aug 2026 16:05:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852324; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=AjcuW/NO8dJaFXmf1wZpixWH89tdyW/baQsp5Bw6utw=; b=WA570TFtllXIi4Mlj4vSeOb5NpdHEWrUP9RDj2nTaaDoVfaAvc0Web5NcPVvmnUSmAefbg Ee7U8/dF2BVApMsd/13vSek989VBntKcTsFCtm+qcr9qtySuFNPuvYjVFUACvM+mCLgLAz 2twfAuJNANNBlk3DGVpphRGbYPXQI4icOVAAmc7b/q9TevC/qOMOvYnZ9XZlHs1JQuddgN 0Pr2FMgT0276iarK+b3e/+PyrbgbGxAPMfsbCE1KoOkH0ENcuF7nYHMgTkvLk1dwLJwmbT Var88XVPUQzoEt2+Y2ePBalUec+DUaPsVaSGimf+oC+qGS8NcdOxNgFE3dVQ1A== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:45 +0200 Subject: [PATCH v4 23/28] mtd: spi-nor: winbond: W25Q64JV-M: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-23-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + dd 'if=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x800000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_read f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 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 f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_read f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_read f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_read2 f358338956920defcf811679166ade6f25eeee00abe29dda49932536591fb4d1 spi_test 6ba881af6f5901f7ca55322d45a7cee2ec69900cfdfc348141c3c5b1e51f676b spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007fffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D8388608 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D131072 + bps=3D2 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 8126464 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | unlocked | 62 007c0000-007fffff | locked | 2 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | unlocked | 63 007e0000-007fffff | locked | 1 /* Skipping BP3 test */ + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 2 00040000-007fffff | unlocked | 62 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | locked | 1 00020000-007fffff | unlocked | 63 + all_but_one=3D126 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 131072 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 1 00020000-007fffff | locked | 63 + flash_lock -u /dev/mtd0 131072 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 2 00040000-007fffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 126 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007dffff | locked | 63 007e0000-007fffff | unlocked | 1 + flash_lock -u /dev/mtd0 8126464 2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-007bffff | locked | 62 007c0000-007fffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 3f9f2257ac91..41b8733c4c85 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -320,7 +320,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q64jvm", .size =3D SZ_8M, .no_sfdp_flags =3D SECT_4K, - .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q128JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x18), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60170474243 for ; Tue, 4 Aug 2026 14:05:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852330; cv=none; b=JT1jnyLl4Enrmo/ctfSM2YrVcOjHTR3L0gUYH8NvTeNTsNUMHtD9WwSKUdxQbBY0rsUpJ7R1J5fdsMLksG5uH/H/CmGJ1Atdcxs8rVsJ09NEjKws4l1BLlVpzInASaqLLt5ojz1JDIoUFjHLjkbERiLxzIb/ITUpqkDrLsenZOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852330; c=relaxed/simple; bh=ivTErfrAWNm5ToV1m8ZiDzA70gvehG6fP9eNPr83Sek=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AnJ5+c1fsQFEuy3E9Wfj7uvBWPuSeIbCzueOL5MXu4/bjAJTSj3AQRgCM7fOD/JqzBVHj62fXdAnEfTllIMxetomOOTA8Y4qAFVPuLc2O/N2aiOC3woSkrUFpTEr3kJsimIXprRasVSFxI6Bvfwxq1ompccgdgLU1Od+SV7utrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=h1GlJcrj; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="h1GlJcrj" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id B7F3A4E410E0; Tue, 4 Aug 2026 14:05:26 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 832C26029E; Tue, 4 Aug 2026 14:05:26 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DD72311C32D27; Tue, 4 Aug 2026 16:05:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852325; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OcUj0SZ0gIrix7eQ3lwdXWvT0MZvxCYOxoYsD44t2S8=; b=h1GlJcrjdVNeHVBMJdWa4fTo1StoQ+c862iJ6zouQI5SZWKts9OAqxut1nZ8sbo3Cf9bX9 gm1esBW5J6tZtbE7aYERFoI6hb3kkYc5U8/CQ8pz16lIppCrET98OZ+uzlAIdFiRI0y6r7 qCywhP6He8+lsrxgivVkIDVrt24yEkYEjeq/SfkUn3tbSydzGCIfDTvhlQ+cSctCbA5Aol Ge1jkv4NRXoObGcCzG6pPkRT2vFb44Ct43mFDPuNX3cpLFIzg3MxEEmzQNWLPm7ep2fMGO wuJGJ7tlkcjV+2E/TuVDCcKggPIJs65uHReExYPdz8QGlwiOGMY9JnUNeiLIpw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:46 +0200 Subject: [PATCH v4 24/28] mtd: spi-nor: winbond: W25Q128JV-M: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-24-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table does not advertize the locking capabilities of the device, flag these capabilities. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x1000000 Lock status: unlocked Return code: 0 + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_read e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 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 e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_read e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_read e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_read2 e30cacd4f9d230b2fc4ae12851797332d9baf8456520872161f79379c80ea2b0 spi_test c9d2a381c868b43a44563b0e36e2556b3095acf94f6dad8f259c85eab536363e spi_test2 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00ffffff | locked | 64 + flash_lock -u /dev/mtd0 + cat /sys/class/mtd/mtd0/size + size=3D16777216 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D64 + ss=3D262144 + bps=3D4 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 16252928 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | unlocked | 62 00f80000-00ffffff | locked | 2 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | unlocked | 63 00fc0000-00ffffff | locked | 1 /* Skipping BP3 */ + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 8 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | locked | 2 00080000-00ffffff | unlocked | 62 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | locked | 1 00040000-00ffffff | unlocked | 63 + all_but_one=3D252 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 262144 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0003ffff | unlocked | 1 00040000-00ffffff | locked | 63 + flash_lock -u /dev/mtd0 262144 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0007ffff | unlocked | 2 00080000-00ffffff | locked | 62 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 252 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00fbffff | locked | 63 00fc0000-00ffffff | unlocked | 1 + flash_lock -u /dev/mtd0 16252928 4 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-00f7ffff | locked | 62 00f80000-00ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 41b8733c4c85..4f26191e1d6d 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -327,7 +327,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q128jv", .size =3D SZ_16M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q256JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x19), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26C67474254 for ; Tue, 4 Aug 2026 14:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852330; cv=none; b=HptmxamV2838TRkc1dgUn4XZNVdTuGtoHpsbMWRSgL/MHGKLZeXImGFzbO966ImdWDj/HQq1LBbM3a+w3Cb3LyujqmgOx7bW6WSGFVXSwQuO4afAa65e4BgAhxCcSwy60Ya+jnFPJOohUtWyhSs3DR17L/xOTXaN3QUwS31WOzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852330; c=relaxed/simple; bh=JZ9kRn93v3+4z9LzMQDI2u+olZesoijZYdW5e9L7mEM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oOLAdLgnAvUwr1xGxJo+Gr3e35GqOBJPDINgXse5yGhjdFmLspMl2TGKux5BK1f4GAs7UEdQn3TjYm0v51W+7aC2BGM/QS3weCyWRPbQ7JWe30N9yzeXUTcCsw8yYe76eykh8d4OiQ/ljQ4LHxmQgpUSlPmgebn0GrO7r7jpmU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=0qYP6HzF; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="0qYP6HzF" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C45D81A1401; Tue, 4 Aug 2026 14:05:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 90F696029E; Tue, 4 Aug 2026 14:05:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2340111C32D2E; Tue, 4 Aug 2026 16:05:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852326; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JW3b8XXz4Bw4R1k8SoRfIjGrPceIGZOMq1bbgRE4mI0=; b=0qYP6HzF/Z7sAAt/jV4Aqwsl8Dfh3wDu4NwuO447dNwpW7+uOwjnTQhOxMktQBpu1Ovmou II9QQ0cczywXLJVlTDQQ/G4IoBrAayksVtsEBv+B0kjJsuFjX3sUXw6EvGwKkemyYcJqhX eyS+/2YNJMKSe3+HTrzHVcVVbrqzuj2XpjrYVBMNl7aH7+W2ufbJnbC+IwDSE2yrbX77f2 dZCasQ21c8jKSMq5AoQi+dNhgiihJJAvUjjcRaFYE3nFLwH0XdA3mdPhseYAYrUMRrG9Zr qJy0wrW7J6X6nBngt3oBG/raQ2OtlVpmaboTUM4QM9Ie1IGN8+2kw42ygkQFWw== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:47 +0200 Subject: [PATCH v4 25/28] mtd: spi-nor: winbond: W25Q02JV-M: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-25-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The SFDP table is pretty complete except for the locking capabilities which must be filled manually. Signed-off-by: Miquel Raynal --- + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 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 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_read 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 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 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_read 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_read 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_read2 8370dfccafceea1f6961d138d3412ce61dca4c7826d4775d3562acef2b10e3c6 spi_test e61267bbd0864dfe7e67a8bfc0875a23308d98c7297fcf5a813830532f48c06f 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=3D268435456 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D4096 + ss=3D65536 + bps=3D1 + 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_lockk uu /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 + all_but_one=3D4095 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 4095 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-0fffffff | locked | 4095 + flassh__llock u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-0fffffff | locked | 4094 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 4095 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0ffeffff | locked | 4095 0fff0000-0fffffff | unlocked | 1 + 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-0ffdffff | locked | 4094 0ffe0000-0fffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 4f26191e1d6d..5ab7f4860295 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -336,6 +336,8 @@ static const struct flash_info winbond_nor_parts[] =3D { }, { /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .fixups =3D &winbond_nor_multi_die_fixups, }, { .id =3D SNOR_ID(0xef, 0x71, 0x19), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A676C47427C for ; Tue, 4 Aug 2026 14:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852332; cv=none; b=Rzbn8QJJFB5ys9SeqdTZJwH8JWpfas2/CzWo8YkfWvkCSScOHh6PlXbgXwsHxXOmn3Fzt8ICKMc6DzpdMwoEQnnxIYWcPKAJiWz42fYHxoAkHx330FHriaK8EwGzZkDvmEBxjrT4Un3V4kChYmEl4DmpSq/o7f8QTdsKOyZZcww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852332; c=relaxed/simple; bh=07agENAIn7mZ5JMaaeaSK/GF3adiba3TkF8peMQwcx8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ge/+qgsziwTh+R2bh7xVD11et5AQLGoMvxtImCLgY/ZbIX9zckli251tlo3HshBJEATuh+jMcme05y8/wslE4GRPVEnuL0JvOCbyWWukY75alxFjCBNcReHww//xjwoRFJ+l9cL9s52yRTMkkKpTDP10P6hzEBvyTm0j+0l640M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=SgLAz7ao; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="SgLAz7ao" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 17DA81A13FA; Tue, 4 Aug 2026 14:05:29 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D81C26029E; Tue, 4 Aug 2026 14:05:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 320D611C32D29; Tue, 4 Aug 2026 16:05:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852328; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=5Z2fZ1HsvRf2oJCPhM7cvSNUBhizZXIjDtniecho4UM=; b=SgLAz7aosK8OZ0MfjbH1t8+PcLHzP6gpraBWLDZFcLGqpHYybGFybE7/f2UubL1kWPJzYE gqj+2GiUaAbzBFXk8QMMxMFcq4lWiFSv4miG0Pp3w6vZxACZ5DTMxcXv+mbz1TWmHeu7j0 vcGihp8ctz0AkoqLBQ3T9lJ3i3Rsz2MYSFK4d5D2zG66B8B26V23ffxq8dyx2PitSHYUEg 48JamaNYMH1/tZQ0a9RcwVtSfP63zPE+X3KFEUL/3g8Rtp6mfCQnjSJN+PfuuNHVtE38YB TTjz53Zs3GDGfvG+cJrpm9MjpunHce7JJ591HsUCcQgsTvlDesLUrdKA9W4a+A== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:48 +0200 Subject: [PATCH v4 26/28] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-26-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra Cc: Thomas Petazzoni , Steam Lin , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 I do not have any W25Q256JV-Q/N/M nor any W25Q16JV-M chips in hand, but all the other chips from this family have the same locking pattern, so we can reasonably expect that these chips follow the exact same rules. The CMP capability was historically not supported by non-SFDP chips, so a Winbond wide late hook already makes sure the bit remains disabled for them, for backward compatibility reasons. Signed-off-by: Miquel Raynal --- drivers/mtd/spi-nor/winbond.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 5ab7f4860295..6b21fed74f4e 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -226,7 +226,8 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q256", .size =3D SZ_32M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .flags =3D SPI_NOR_QUAD_PP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | + SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, .fixups =3D &w25q256_fixups, }, { /* W25Q512JV-Q/N */ @@ -306,7 +307,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .name =3D "w25q16jv-im/jm", .size =3D SZ_2M, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR= _HAS_CMP, }, { /* W25Q32JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x16), @@ -332,7 +333,8 @@ static const struct flash_info winbond_nor_parts[] =3D { /* W25Q256JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x19), .name =3D "w25q256jvm", - .flags =3D SPI_NOR_QUAD_PP, + .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | + SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0D9B4756D3 for ; Tue, 4 Aug 2026 14:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852341; cv=none; b=IGqXQnqaqxWblga7UnbIpnS1ZYPv3wmVrAzlcV4qirSFM8OFrHmIizvs4KvMQ0eSlLwlGlLsKsXCkw7hP1/X1z/AyAro+B0pZCsp5k2aTutBxi52U/62D334RlJZtoMiZr8ZwZOuG9coFFRXdWQnLKzU8AbAmcn86J7yGjI5Geo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852341; c=relaxed/simple; bh=czVe+GPhR/HcoZmoKbiBAnQhI0A1MOV5dePMjZiDFEI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AnRJkbBKF33LnlwvZZwQZeUh7jCcjECd3f/SlCVKpu7uUYaVvbz+G6GlzV/H0N6aKo+OzgmXko16zPz2KtNg1Bv37cdRYRCqKMp6bdSar7AV4bMAol8DoIFp3Nfb910Hpb8Pe1t/6s/fx8g3umszaSpAHYbsbJAkx+OYvRHbANI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=yDBBJMT2; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="yDBBJMT2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7F96F4E410DB; Tue, 4 Aug 2026 14:05:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 51C6A6029E; Tue, 4 Aug 2026 14:05:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A56F411C32D2D; Tue, 4 Aug 2026 16:05:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852337; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=hzGiCJaRp391t6EBI/8hziqp4TPU24QahmGmlRZFapI=; b=yDBBJMT21cm4ngCl++PH4w+WyU2dnGmY9+2bEXJyeWhg82zHSO8T1QJS3xEePxhRZf8Opl sbDREu7u5rEyxVfSxCJmz4bSDVHzr9EMPtvi3Pr4G3rGw9wtD97vU4pktQy9VQmDM/DlGk 2H7an10eiO+WSO0Sqe1RPiGem267PEaWhbqOr3c46uiMlzZBlBgYcWYCGUpLdJdy+qwtDb w1chE4Hs2Gw5070pUOKiDJDVFu/TZJ27AdGuF+Hem7N498XijG3fm9a9lk60W1DRE+XrAJ dgHFh6CrdZP42nKryJY2kavsiNgFParpvOw4th4iOABXwDturyup2p0TcEp2Xg== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:49 +0200 Subject: [PATCH v4 27/28] mtd: spi-nor: winbond: W25Q512JV-M: New chip Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-27-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Add support for W25Q512JV-M. It is a 3.3V chip with usual dual/quad capabilities. The SFDP table is pretty complete except for the locking capabilities which must be filled manually. Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/partname cat: can't open '/sys/bus/spi/devices/spi0.0/spi-nor/partname': No such fil= e or directory + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef7020 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450060101ff00060110800000ff84000102d00000ff03000102f000 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520fbffffffff1f44eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14e2e96376337a757a75 f7a2d55c19f74dffe970f9a5ffffffffffffffffffffffffffffffffff0a f0ff21ffdcff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp f41674a6c3742a42d31d3007d4d4b725c166ddb4e4566d1c347d29ed29855ef0 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 70 20 00 00 00 size 64.0 MiB write size 1 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_S= R_TB_BIT6 | HAS_4BIT_BP | SOFT_RESET | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xec dummy cycles 6 erase 0xdc program 0x34 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] dc (64.0 KiB) [3] c7 (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=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' [ 53.198369] 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 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_read f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 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 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 67108864 (64M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 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 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_read f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 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 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_read f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_read f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_read2 f27c6b54ce92a46104f2fd43fc2d6d1353099a6a125591b47a615d3d61171a86 spi_test 44db7586d798437868d29ea31ac1fa1e64d1b81337721d0d811776dad47110f3 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=3D67108864 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D1024 + ss=3D65536 + bps=3D1 + 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 + all_but_one=3D1023 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 1023 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-03ffffff | locked | 1023 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-03ffffff | locked | 1022 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 1023 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-03feffff | locked | 1023 03ff0000-03ffffff | unlocked | 1 + 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-03fdffff | locked | 1022 03fe0000-03ffffff | unlocked | 2 + 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 437 KiB/s testing eraseblock read speed eraseblock read speed is 1560 KiB/s testing page write speed page write speed is 434 KiB/s testing page read speed page read speed is 1457 KiB/s testing 2 page write speed 2 page write speed is 435 KiB/s testing 2 page read speed 2 page read speed is 1498 KiB/s Testing erase speed erase speed is 257 KiB/s Testing 2x multi-block erase speed 2x multi-block erase speed is 257 KiB/s Testing 4x multi-block erase speed 4x multi-block erase speed is 257 KiB/s Testing 8x multi-block erase speed 8x multi-block erase speed is 254 KiB/s Testing 16x multi-block erase speed 16x multi-block erase speed is 255 KiB/s Testing 32x multi-block erase speed 32x multi-block erase speed is 255 KiB/s Testing 64x multi-block erase speed 64x multi-block erase speed is 253 KiB/s finished --- 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 6b21fed74f4e..980c437f1951 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -335,6 +335,11 @@ static const struct flash_info winbond_nor_parts[] =3D= { .name =3D "w25q256jvm", .flags =3D SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, + }, { + /* W25Q512JV-M */ + .id =3D SNOR_ID(0xef, 0x70, 0x20), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, }, { /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), --=20 2.54.0 From nobody Fri Oct 2 06:19:06 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 426C5476060 for ; Tue, 4 Aug 2026 14:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852347; cv=none; b=eO8HjuwiRBkGB0IRWGGmdYKcuRQrQOsBK97rU/+6n+/ZXdQcBmbDmLyAj2i34d+cW3d49+3YpyZZClbdLPem7bKcw0lF3l3tjwfrzuAlclMeBAmJsqa9d5FbY6K5/pUnysQVuESg2bO4Tpa1rEJIrzL62q2C5/zYbZ6i5zEC64g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785852347; c=relaxed/simple; bh=otEVbZOqSwEqiYFOpVsjqDPR6CfMvTI3Exa0mJ3aWIo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mSPEoKLtRfOQKap0VGNXX8wEnArRguyfal6GokDdBM2sL53KrQ/GwoNJd5/Ovta79+bMbW7wi6AWobT2hDjN3lfV9MM1q/o4HEyG/gM4i3Iz+zxDHv1eXM33Kw4B6JA8V83Sy2KsxHP1+LnlEWAPvUwlqSBB0Pkkd3k8lBWvRQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=v5Et2Kkg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="v5Et2Kkg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A86CC1A13FA; Tue, 4 Aug 2026 14:05:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 738346029E; Tue, 4 Aug 2026 14:05:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E2EB511C32D27; Tue, 4 Aug 2026 16:05:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785852342; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7JHafHTIJ4+v0Y9U3QInzBYlh6J1H1SJ56p1M69Y3zc=; b=v5Et2KkgOi85/Ra0PexP4NplnZs3S412kdgDMTnMz2pjdHC2hL1PO+hLczj5Je5DqBmqIS OM0BOD9zJt6sJ5AGq6/h3VfxXAT40LF0oKKGrdPy/YcIuGGPKdtd8sWqX+lAqFIgE8ylaZ hO/7EQL1PS0rPPf6KZqBNWBdbXJEnzq7c+3en6+5K19gXhs7UbB/5AuR1d2ckb1Tmn250M o0TnenCHwu848wXuxvjo+lj/tyiWhj2h233MpVLyG8/VrbwXDiAugE0AhFvds/ZZR6rryh CthbK2zjI/xevKznypzgi49oJD59xoGq4adD6hqPdAhAOExurVvWbTaDB3udyQ== From: Miquel Raynal Date: Tue, 04 Aug 2026 16:04:50 +0200 Subject: [PATCH v4 28/28] mtd: spi-nor: winbond: W25Q01JV-M: New chip Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-28-ee3445066e4e@bootlin.com> References: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@bootlin.com> In-Reply-To: <20260804-winbond-v7-1-spi-nor-jv-cleanup-v4-0-ee3445066e4e@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 Add support for W25Q01JV-M. It is a 3.3V chip with usual dual/quad capabilities. The SFDP table is pretty complete except for the locking capabilities which must be filled manually. Signed-off-by: Miquel Raynal --- + cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id ef7021 + cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer winbond + xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450060101ff00060110800000ff84000102d00000ff03000102f000 00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520fbffffffff3f44eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14e2e96376337a757a75 f7a2d55c19f74dffe970f9a5ffffffffffffffffffffffffffffffffff0a f0ff21ffdcff + sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp c733cf105c5f05ed23ad3a32c2a72c1a09d4b895c628db52e645a8a457dfc7d6 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp + cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 + cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id ef 70 21 00 00 00 size 128 MiB write size 1 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_S= R_TB_BIT6 | HAS_4BIT_BP | SOFT_RESET | NO_WP | HAS_SR2_CMP_BIT6 opcodes read 0xec dummy cycles 6 erase 0xdc program 0x34 8D extension none protocols read 1S-4S-4S write 1S-1S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] dc (64.0 KiB) [3] c7 (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=3D/dev/urandom' 'of=3D./spi_test' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 + sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read + mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read + sha256sum spi_read spi_test 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_read 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 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 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_test + mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 134217728 (128M) mtd.erasesize =3D 65536 (64K) mtd.writesize =3D 1 mtd.oobsize =3D 0 regions =3D 0 + alias 'show_sectors=3Dgrep -A4 "locked sectors" /sys/kernel/debug/spi-nor= /spi0.0/params' + flash_lock -u /dev/mtd0 + flash_lock -i /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 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 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_read 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 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 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_read 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_test + dd 'if=3D/dev/urandom' 'of=3D./spi_test2' 'bs=3D1M' 'count=3D2' 2+0 records in 2+0 records out + mtd_debug write /dev/mtd0 0 2097152 spi_test2 Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash + mtd_debug read /dev/mtd0 0 2097152 spi_read2 Copied 2097152 bytes from address 0x00000000 in flash to spi_read2 + sha256sum spi_read spi_read2 spi_test spi_test2 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_read 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_read2 7ccac32f903edeaed4e7c6355a91c2e6dfc95dd007069c9f22ea2b9d45f5ce35 spi_test 43870da5d2b9fcb8fe0a6a96350b87da1e9423fe9f9e2f039bf363e68916ae0d 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=3D134217728 + cat /sys/class/mtd/mtd0/erasesize + bs=3D65536 + grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params + sed -e 's/.*unlocked | //' + nsectors=3D2048 + ss=3D65536 + bps=3D1 + 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 + all_but_one=3D2047 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 65536 2047 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0000ffff | unlocked | 1 00010000-07ffffff | locked | 2047 + flash_lock -u /dev/mtd0 65536 1 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-0001ffff | unlocked | 2 00020000-07ffffff | locked | 2046 + flash_lock -u /dev/mtd0 + flash_lock -l /dev/mtd0 0 2047 + grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params locked sectors region (in hex) | status | #sectors ------------------+----------+--------- 00000000-07feffff | locked | 2047 07ff0000-07ffffff | unlocked | 1 + 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-07fdffff | locked | 2046 07fe0000-07ffffff | unlocked | 2 --- drivers/mtd/spi-nor/winbond.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 980c437f1951..593429bd6cdf 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -340,6 +340,12 @@ static const struct flash_info winbond_nor_parts[] =3D= { .id =3D SNOR_ID(0xef, 0x70, 0x20), .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, + }, { + /* W25Q01JV-M */ + .id =3D SNOR_ID(0xef, 0x70, 0x21), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | + SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP, + .fixups =3D &winbond_nor_multi_die_fixups, }, { /* W25Q02JV-M */ .id =3D SNOR_ID(0xef, 0x70, 0x22), --=20 2.54.0