From nobody Fri Oct 2 04:46:44 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 314B63E5A18 for ; Wed, 5 Aug 2026 08:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916956; cv=none; b=l46bouh2ucbV7Wf+RAOHywn8Ou6r2gy/SDGbmyuseDHrSTDnOjk5IYbyKAJbAB82dcWHOLHE3Qbw4l7oS+7Gny9wPkWkfXVc4qLwL2J1l5vGW9eMOi5gx3jhdOuOd6/sRM3LyXGvokkRCyytk59o29vtKieQOGH/v2hM7GQAw38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916956; c=relaxed/simple; bh=ZZJxymRsy6UJAb618lXXlKoWGJPLCBlAOO6FZl+zA9M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qceZ5188kb89bw7shGUxyZ+EEJls6Sur01kjeAjVw0zi9dckKWtU+dkWQsPb2dJGNU1s03TGyqNcbXaBvFkXSxGSSMgwFSx/8LhDHsuxqlE0gvSe9oCeRHo11mvZECsGxYJRksmSaUx6nfWOETGeuLDYkCWBhzDkXZeAZqGfMOw= 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=yN8Mtbrz; 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="yN8Mtbrz" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 317161A1436; Wed, 5 Aug 2026 08:02:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F1C23602AB; Wed, 5 Aug 2026 08:02:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E0AC611C3435D; Wed, 5 Aug 2026 10:02:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916951; 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=yN8MtbrzgAtDIea1DJY/rtXX5gdHuy2erTtotLHSAPEHNcKP8CwEvu3136GaIMVk9rlAY5 kLnRCoxsGsjsgkLomPDgSD5lwTEJqUlcMF+4xjMyVFh0KHN9fqHYCVkSudlCEgvSmo5l8i 6jY6NIQyc4LsDSMQoMwVHzWlMQAP3OV9d/d8BsizpCVkrrLcBteFjBc+XtpbZBx7+AvfRY 7p1pPKIJJGUXx8Cl6BsWhiW6oqA6CX6EjRrjd5ZoP+hyjti4LzL44QW9rY+gxAXDVUWiq5 mPQOpcxCuPf9YRq52HeRKJZTxs6L3RkPofrx2PUqkLJTizsLpml+YLhhAXKqKQ== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:26 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-1-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 5CFC93E5A35 for ; Wed, 5 Aug 2026 08:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916961; cv=none; b=oiH6PA0aTEpPPtL/ORctDQ78WjuguuY5IdOA5FTAdF4KeOZ9bq3O/2+09G5CXrsX5ngi44625gV3l3qTpqynVnzjWBHfhbxfEx99UKJAmUf/2OAA7eKLROOqDL4B56UdpwX2UUzJp2zmwLSwlFMsh0g7sbWgFOzttpUInX9wgjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916961; c=relaxed/simple; bh=qdX6AQj91TgcbEq1dwUzcV8XEo6qcLeUq3Q7u39vQFg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DJlQ6pGX+dbUR0zgyr3rTHKr/j+jtCbVw6QM0BMNsxjJWYyJ/Q+Y7aTOVpJ2WlM8pcm1gMuGM6iiwypQZFyYcnC4Ydb2ZAzDT60M0kcd5rO6iQQXo54TewnN1B2GZj0pDCCmNR9R6Z2Kc2cXXlBrX0b/LyyaeRCxAkBPkiQlTXw= 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=J1nGLcBN; 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="J1nGLcBN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 9BD0B1A143D; Wed, 5 Aug 2026 08:02:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 67FFD602AB; Wed, 5 Aug 2026 08:02:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 693CD11C34364; Wed, 5 Aug 2026 10:02:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916952; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=iTQYlBDs/bVQ9FRAwNXdzhTcN1NpJA7o3fDKZXJzBbg=; b=J1nGLcBN9JGGqLrxyodG3tkVNn4cGbxv6hfTVzqzlEWpjorlwm3VkwyyLx4292XWT5ZT50 6fzPz2QxZIGcQiYIlcQuG0ZMpR9MY83shS27TCdKsAMxoJU44R8em1DAonzQ+UHsTDQsu3 vzlchA/N5dUNslvib7RXuxJnrgyXcCRZLDFOSB+GhsMCj/VxINuCIsvKCoeh/vW4xkt4nB +mstiHrHc9W7HY/FrQi0gOuTdEJGN5P2jfBUiUetDNhxo22Ujt8uNbopuW6sNBKWQuJRwG 3C+TO5VgKrh9m+wdSUyImFgvXqzp8LV0EizCGt1Ir8s+e1WaGPtz5JdR5moWkw== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:27 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-2-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 DBB653E5EC7 for ; Wed, 5 Aug 2026 08:02: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=1785916967; cv=none; b=AKbgLr7Tbt2zY78mZ0+SM/TuhL0Y1fNu6YaAq1rB4YTDGG85CoZrmVCJiGkOjHQqbk0dU9YdxRR6pO1sd6uJc65d1yCOyQ+YYyxA44TuFr+eRhZn6dPL5VEocT7DA9FT76P/ftUaLcJzLoOAeJoR4dww7GSwwwrPP7VrDmiYuBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916967; c=relaxed/simple; bh=L5L2m+KKnR00YDtwSKK1HjBq2QIFPknRwBBAbYuRE9Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZHP1V1t1Va8aHumfy8w3dUucEan8ugXzxAZSUKfkI0idsHzyrpx1rwwaiIiVBThs9NauL48OCPqcpKh30aHuaKmfudO3tX+Ez9iyEPPrmgVnimqmDhwel/++WypSrGuDaOSyF27mDjI7GCpYkUtA0fKtRF/cp7DVnbPeaufadXA= 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=lxH0psmG; 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="lxH0psmG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id CC8DC1A1424; Wed, 5 Aug 2026 08:02:42 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A06B0602AB; Wed, 5 Aug 2026 08:02:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E2C3311C3435D; Wed, 5 Aug 2026 10:02:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916958; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=9DNb6i4S1xGO8QjzjZy24Q/YYS7+OL5/82YUT/XdHLw=; b=lxH0psmG1wHe3EvMnsezMi8wZc7yGywF7Ev9PFDmbkuB9FM9MEIxYzhnt/b2k7h0VdsZXr MljywUlBcidvNDR1yTB259eTqF3wH9XyzPy/2Ls66hEiG1XPuiLmrdUEt1XFZsbpfsj5RY IhAkBs7peTeU/EMMcwz3kvOpLuYX1NVEUBB5Su4uHlvwGINM9Bd3pXBItKku2vQZVp0NG+ LBsnGTfoni1hZndCsxnTUzjrJkFJxoyQlQZXOwXEFjxwUTb/bg6ulFJCXapyqvlhMnSrDs 1xXpf7xVJspGlMgB6R4OVsbsPXvk3gZoZNl1NbUhUaKqcncEzMSGHItVhE7PZw== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:28 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-3-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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..cf0e2dc7c120 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: + nor->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 04:46:44 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 82B363E5A18 for ; Wed, 5 Aug 2026 08:02:50 +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=1785916973; cv=none; b=SQqjcURtKo9ucXUwlq6LuZkx8suTN5fqCjX6+w9xc2uZKojUb149RKZ8OXDusxfKuUn5oFPevLzZzj4B7coixXfD2s6iPMM1hW5+rEI2sqMq3lrme5B/Hh+ZgT4AiLOxB0ScgMbjAlsp1JzGqj9mjoSdJhjb5YpwICSIs3R4eNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916973; c=relaxed/simple; bh=JYzBvE3OLPqJk9VkwP65TEuR1VCqW0soGcMuZ+4tQvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hUGs3DCNEH9iE+C7uYeyEGtxHfLweIsRGh5IoBaNvZqP9OlxlEhez9vosuEsYH9IfJW7fyBm0cFn52wSuHp8JgU43nl4pQki8YRhcE6owVj9O+WyuF8waKz34C2Gw69vP1LLxeIDFh1jBPn8es6NcCYuHUolfyoHklzqxxBL/zA= 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=nu9tVs5Z; 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="nu9tVs5Z" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 752A54E4104C; Wed, 5 Aug 2026 08:02:48 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4A8E9602AB; Wed, 5 Aug 2026 08:02:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 38E2A11C34366; Wed, 5 Aug 2026 10:02:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916963; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=KTpdBpooTlaJoC3pVHrNhYgn1PsBKEuxZ3T9jd/iHn4=; b=nu9tVs5ZYg0RydXRYFUjuSYI96NgFTOQXNPWpKeiUXEutGnfZKJcRCnBMJCt7i7qiNTZCh WbpozjQ/V1HyUaRcRP1IUYQ0hwdFwjNBYon4dQJKBfstQxUNRjKEfKNQxsTL4vN4dXVity t2Mhyz4UMAA8qXGGeqUsiy0zQiEtXbTh+3hf09MWDX/IYUpSLacCLo3u5TJ6c1jX3PKp63 NDYF+YrcA0JzAftuDHhd7A1aYlYblY3o6FIMtAHbgtGbr4+iZ9StOnT7eZ/eWqo+aS3K/r jizzmPU+TFjCHKaYXk7vUqELZEwJL2/Kl3PsxzEo5wkHVYThCHsVuvc2cep2sA== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:29 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-4-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 593323E5EC4 for ; Wed, 5 Aug 2026 08:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916974; cv=none; b=RZ4x5DRqAQQiwSsEBiKaHmkOF74BBHU4Tk/cVELtRYnZV5Tkc7OrLOKkaXQWpYKINjkslzV6fIX/nnoT6zQOXF/pdR2z3wTtB9BBFDZf9Hql1/Xq+FVCvkBCHZOusXkntynNlK/bpgBgCDZIVX4B4c8Z3i9x4WZvTFARsZWCd5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916974; c=relaxed/simple; bh=F94q0jZkp2QjubrrsY5QqiZP3LmVSNNkHrEw6t5EoAM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HfhUvc8UPhhgwNuAoHW3oEfyWkJTQdzuykjaGFTNCEDWChKYToMEC9y9mAzlc04opRkVCXYo90HLLVdCVnFqo4tAjquTklFnSO/e6cDe0Kztx/pr+DkvRkNRNZsfsPn7y53L9JqteFKUjvSEewkBKU9QCvP2Cts7umVtWkFHigg= 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=Hol8OfC5; 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="Hol8OfC5" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id DB3F64E410C9; Wed, 5 Aug 2026 08:02:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B01AB602AB; Wed, 5 Aug 2026 08:02:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AC3EB11C33817; Wed, 5 Aug 2026 10:02:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916968; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fd/aDjeEfnnm6kU3tUkNFm0RI2r2lxwNzxa4rFpwOJA=; b=Hol8OfC5t9QQ0PpkwKiPvg13M7dIIAWu19Ic4oObTR63F4b4DhNsx0wE9FgqCA4cFb/xZC MnjmG2dJrWG7mXvJTGPF0ywa6gbun0K76IW4vxFX2oT1Pkh/pkYbsMI5RgALfLUv1hwPa1 wi/arq2HKR3bHDa2OBfvURByvLPUW8gGbTN0Qbaau0fz1Cpyigu8FUUjzUjqZLyuq7P6eJ 0T9c4TElPjiyoal59j3VTQBOf6hEqUfKvG7CBit5nWtIeipofqacdQa9RX3/LJtvSlfzDy LtXBCRFwe3+V4B6idFDygOafviM7nWFAhbIVCpXZnrJacuFfpslouwfgbvP52Q== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:30 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-5-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 1FC333E63AC for ; Wed, 5 Aug 2026 08:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916976; cv=none; b=eT1wN0C+Y42UlgOViNh71HVTANL6sBfSmSKC6I7GOCOkYoO9jx9AimvwNdRq2EjEbhz/ZMGOAbvPPaATe2Zi1eXj1sjosUdu3ISxiRLd2WOGYlbeQI2WECntd+3vp1IkFo5a40AZ/9zqqwqShRQTYLFX28/TS6ntuVrVL7otyJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916976; c=relaxed/simple; bh=7nvOauSH7cuQ+z8eYYbj6DeuXAptmJin+2La7ZgAOOs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NeI6k/OGk5AhMKEMjY+JksEdURzV7rbrHpWEdIEXGRBX/C2hyOoADCCGe7y9QVa7DkGnISEyGqH0uIQ6JmDs3htahlabJxij9hIjDl3nLECBkWHWzCl8+WViIKpXVe5PidRfRoBfVxMISNFQJEJidMZMKFHOv57stJKx0WljHzY= 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=dwDCAszx; 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="dwDCAszx" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4C0CA4E410F0; Wed, 5 Aug 2026 08:02:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 207CD602AB; Wed, 5 Aug 2026 08:02:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3882811C34363; Wed, 5 Aug 2026 10:02:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916970; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=EU9odphLDJ7Sp0A8jGyVHZpCPe8+Os6UWy7g5Vv1TYw=; b=dwDCAszxW4cEBbLvW/PNAtZI8tpvzuHaRn9vYtVMd1swT8o3o8qfl0sWl9VFobi+cEVo6c 9OOpFerzvjXq/ESPETh94cs8X67BEYJFgAT5GctvDMKvu9EiV4o40l9vsoo7FRQV/j1ese 00usYHPzwVUhuV0Fcn2WPiFRtecu2sNFvSI+dzsktxSt0A5nHvN4qT1m+LuDpnFyI+sW7o 2ghDoSaRnDwhp7v/qXebMTyTONXAdf10CEEZsLTIVia2A/2TI+pdzxRL+8SCPMJ9OH5SJ3 pwdq2+KVbRZrMgdbtsw3MWKSA+nrEa16Dp8Pu/7wX27JjTXARMhPHeMof825aA== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:31 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-6-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 DC0FC3E5EC2 for ; Wed, 5 Aug 2026 08:02:55 +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=1785916978; cv=none; b=Fbd4J9pT6Sm4ZmMVuMaqV0EcEnYK23ZMMsHwqnGdVn431NX9fL3SK3r+ubkkziGtAqcczuWEtxetaiv7VJ7Wivn5FlneId9j8lTUgUOKXmkh9W+o/O1qb2PYa6C8Fd24duVqfIldvVWBs+T7TaZkl19odmE3LLbaAD/9bslBkPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916978; c=relaxed/simple; bh=G7C0RpuGOz2d4Nq1PEWQTIQUHhtNe53rFmxu0pv6IH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qp8VEb4WD7Gw6hPiWVOwuy0Upy71e2Md3x0es5mk7YFrr+z7u2daRRRTAYlDBmOzZkINMRzzYF07LViP9/EK5RW2MFGD7shour6ToBBJM2a/0avaEFX+cphLY3tnRZs+tA1eoWLRmiYcVTyma/63reKLx/OJBLVaqnZ48E4wpIk= 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=O6U/KS7y; 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="O6U/KS7y" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id EA1524E410F1; Wed, 5 Aug 2026 08:02:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BFC6B602AB; Wed, 5 Aug 2026 08:02:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A028E11C34364; Wed, 5 Aug 2026 10:02:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916971; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=bAWtw3CGgsPilxjcNtR1KkWLKZETIaXM85za6nTJbqw=; b=O6U/KS7ylWduv1J9llG9tXbK3RqI/Z3uYST3LrO0+IDu413mvO0mEvIbdS2elHnY1tCR7x K7Y3B2IYJb+ALsR68IHfdoUnQHT8fikx8BXQnfw6SLpjh3nrA9AC17Al/i7oR8AUJSo+Vl fMXkerhhGaBrP5FJMP9dGdi808R8dqbDHWmhGfgDdfKdf8grrqusfUbpqbPbVgNkU+d9L/ ilmHCMm0ZCsiTeaG+l29VadL/V7B09ukNQBDJ6v8I82RtHdr+Ebzlgwl/jSB9Lj0bZRzlg trEQ/+fiBMA4CFoG8ZZWwc7z0iNCqs/5BBwOrV6RuXP/9vUGxCM8dhANiChK7w== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:32 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-7-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 A9CE83E5EDB for ; Wed, 5 Aug 2026 08:02: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=1785916981; cv=none; b=UI9K5EcX3AV+GN+lS4Md1wcJTHduXdOWNHP2/4QGelreaDLR5qhuz0fUFP5VDlZ/rkBEdLxaPcVKupfEy/nXjByukQTSBLgvWKrSsW3iFAlZAo/WRNFAweDU79UkF2/CyLA5vw02WphtN4m4hv3pSpTVRccCW/ObfINuqG/nzik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916981; c=relaxed/simple; bh=g5ZoaAkVcvw5Wqlxb79j2f7XOzQMlm74mdf2RorwCFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SvzmdUARSf5yAlzFbOIw9nmyk8g6PQc6yUH4b5RjFwiKsCn/eJVDarfEJ+E+Tj4/JXa23ws32eGIE6AjPq2SA89opm/GisoAbLLfdfoIly9DciOYVr/ifwCIyKkHTrwZx+Xcbj0irqqy+E7AatXl8Se1/KzhGOldWiJH9nCqXw0= 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=f9ODyrxc; 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="f9ODyrxc" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 59BCD4E4104C; Wed, 5 Aug 2026 08:02:54 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2D7CB602AB; Wed, 5 Aug 2026 08:02:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 408DA11C34366; Wed, 5 Aug 2026 10:02:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916973; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2Qe3cx3iq4V3ikZYQZ4mJh9N7Thq/K8jIFdv7GwKTfM=; b=f9ODyrxcNsyPV6su5Ycvt3KiemRUyzEwm3ShNP7Vh3kDtmjvhLgAtVLyGUCGjtr78oaQz2 4z8d9lc655yTDF06xUgcZ8yZAvM3FRcSx0X/qOX1i2GeE3uvme5ksDTRXpSt04TMSNJ8bK 9G8iYR1zxpTVx3A9lhnKV4cFZdCTQVyEc+QfoY2EfBVY0N8VIEhVNU/38iBls70ov24/Qf wZNVhtuCaj+AoOJVXQhWTOBt/ucTpvKcZw7f2mXLkjtjx3E3qG87LRcWJYqTuOnRjoIWJC eC0biwLD+aChX+BWcodba25nUkUAuu8nZmJyXVClkOv9phcIv84oep/jdYySjg== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:33 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-8-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 CE1753E559C for ; Wed, 5 Aug 2026 08:02:58 +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=1785916982; cv=none; b=YyI8WdsDnsCrYLOVZ898yRg13Mh1l3000y5vrKckqtU7q8bjHufpIFm8gJSKDx7zZvz6LEwCBgPFIkelLMeCxJ30teI8LdkSf4TltKUlY3p3Cu5inVT//joIj1kBUKKguhGNtWZ1lcftxHczfDZy81o4JEVVVRVOyvnUOnWXppY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916982; c=relaxed/simple; bh=ibTMuQfGAaZc1E89749M2JULY1OtAYogls5aYU9qIPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QB2DSvSvZ7SzrU0LsrfFFKSLqcJSo58OH5GcpRzFqhHbkQyss9KwdwXJ+SEyGH0cucHdFfW06FdUXlTosyfXR0EaJexJRRS8Ak4YMCrxEdYlBlu98i+P462zICxrTgWaiNW4WvjDGjrZ0nriUA8mp9OKvkp8x7Aro09Yr2SRrgU= 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=RESdRQTj; 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="RESdRQTj" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C0F511A1436; Wed, 5 Aug 2026 08:02:55 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8FE52602AB; Wed, 5 Aug 2026 08:02:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AE4DF11C33817; Wed, 5 Aug 2026 10:02:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916974; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=L9X7UsI7IpXNBceZj9vA3jt5/zF98CUIbSi7P/uESNM=; b=RESdRQTjs15BWEHymk5K4qhtplGCaNh5pvzc4wGMExFl5bY/x/RsDvz4Pvs+rTh/13CKUT ZQMgC2zpFL/lso/I1lTZnDdtScwyDxCfn9EQbCb5hdByWyDd9u5gQ8YSzCXp1E//9zgthN ECu/kPnOUlp1fHUoM95cpYMMLHUvVQ8Via069tlgAqy/kvzno90Rey+KyCINJN7hgHX8Nq 6/iXT41aB+zxZaPC1ZJN7Pkd6NAZ7fMFGYh70wDlsVuncCT8aktTj932tQB4SAEh+0s5VT vUYRbUk39NPcMqbiqQCKCvwyKVPGHyFL3a1cOcPaeWNVBSs72w1hLb5q3D0pow== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:34 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-9-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 50FC63E7BCB for ; Wed, 5 Aug 2026 08:03: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=1785916986; cv=none; b=I12/3BomOpbqKLlAoL3Fr7Ynd7E0SCaB/MaAvszcl6HspkWAZgt3CMLmbeJeJ1CbjQUOgDuV+073b9XYXmbU/NoFlV4tzOv7eecmWsFFiwqELTrNX33aAJqJBkvOu4gC4m7XkfUs4NTBeTwR/y86q1+IYpD7ZBliLqocPhDenV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916986; c=relaxed/simple; bh=Nyxn58Nyf5yQxIQZ1mENxNl+d5x8jB/YTg4p11OUba0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W4dC15Nx2fv7KhbgVWHg3DKLbYgWg+2aruJq+xnBXnmnyBI2TQf+Un1JtkpfoV9Sb4EcPCZvyDkc/F2UbVqtCmhcwsvMNHM+Jnr1H+WpQiMpAv2+iHDWesunJwCEkWbfpszTosBjkC+/Gkre6naQIJNT8IEevS8UJ4LHTKDouyI= 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=D7DZiOHn; 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="D7DZiOHn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 23F964E410C9; Wed, 5 Aug 2026 08:03:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E6E0E602AB; Wed, 5 Aug 2026 08:03:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1823611C34363; Wed, 5 Aug 2026 10:02:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916976; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PWG7dcXykTf/QNQURaBjc2iIchYoAomro/OqlQDcSt8=; b=D7DZiOHnYvVXwkONMMf5hZrvjPoCeBPcNt7LXIaUnRx2p5yUVxVF3VgF0VYqdqyuap0RVw XP86M6/v+OPNoWmN2bI7VaPmhjn+Qu1JzIWEsXqe2PO434xCo0T6ICCL07z7fldflV74pT FvySqd77TDT4DuM4gT3sPjTkOaLukU46eYXu1+cpvg+yJKfhmaz3282EWSFoa0lsOiUQEn aBpxLgesmNbkXn5oztNUZO0/pJapU3VoKGZOqmjo0WBZrZ9qZVfMtq0dIIiaP1VPRevuYg xyM2erKFf4lGZa7hEDoNBYqFv146ZmAD1ahfMhDiXcGvJVSk1OdVT7u4WADv4w== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:35 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-10-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 1489C3E5A2B for ; Wed, 5 Aug 2026 08:03:07 +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=1785916989; cv=none; b=DWkigLcVHgnpKm9+iV3IoPan2qSSC4j2acIuAICc8qew7xC03AqdRcOSSiXcVqeFcU+DXpIRk5zCn50JXZUAYArrtU98XXAdOAeLdMoIfFDhhC8IcJh50Z1WJXFaUyoI6U/BoO/hXySwoGocrr9paefltvwrg1ZP1ZY0cn9K+zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916989; c=relaxed/simple; bh=0DnyRNnR4THLXYLXsOuICVYhv3PYhTXZY6s4oyPufi8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i21oMp67xdWp8S/KLPp3KRTEkN0FMHQkAVdaCXV2LqLrzYPrzJLfyuJKEFTG5WElo5l5tiOHOvJt15+QkzLOwDsLpQAuJRsEQtDqCqCUDp3+bDhJwGhOExKCi6GtB1t0oRZg5RQxaYj12YdNP1Q7EkMGhEmejQgHdYEAFKX010Q= 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=zvk1+6l0; 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="zvk1+6l0" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 779941A1424; Wed, 5 Aug 2026 08:03:06 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4C820602AB; Wed, 5 Aug 2026 08:03:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8708C11C34367; Wed, 5 Aug 2026 10:03:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916981; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=oT9UsdMBoSCH8EdPRd3AtilnbGSrgQJAdMC909jiPHE=; b=zvk1+6l0R9xovBZOykn/spy73RrKwlP8fHpbDFATVjpvX4cZ8GAUmDfdFlbqfR4gNwCVsw jn0V8GZW51Ud5uTmzCUHPrPrux9R5iJetKw7omZ4cj0yl/xmiUwjFHhdL0Aq4dgv3CZDPs eY3vwmCmZN+Juq0n2uRRV2xp3HIGs90tbHgRdBeWTHU8SiX/YKKqim6TCoUov02M/M8yZl Z1aB/ddT/Fr1DHG2NnVfUX7DEIPtsMNOQBLaZRetOTtsOoqHmkjZZeGb5Sx814ceEn4qb1 aF86qI0q0q56axhcwzUoAhOtPrQEnCmOiH5ZV2PZKI6xgNHx8uCq6+TUw/Zjdg== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:36 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-11-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 46A403EB0ED for ; Wed, 5 Aug 2026 08:03:13 +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=1785916994; cv=none; b=hB7BRCK2eWA/NCIQ9n31DDAeFcik6mXXu2R34HNjOgfo9vyT9R6TNslJAtss6rgqJ974umeyy5wluJ5Aed5fYEFtofKh497I1rbeTKWXyJWwkR7sz6X84bNFhWr7VnmfcE/Ji7IJiy3rKfTFEbohhmkwvkvtKnjRBYZVuqZNxf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916994; c=relaxed/simple; bh=1ymCF7wmdtYnW2yuyWaxc7/fLpyFAIFNzHqYRQyWhsU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hb8ZmJEDr6pTcz/7/QXNYfNDIzVOvZSCuQXfV9UzOK6qdXteVFuNU3hp7UXt2QMQEuqDMDvLektBAjH07jb0P6wiXyLTPPrdtPZcFZCqRo66ll2wqbfCfayB1JcxdudF4+OD+J+0E3sTx8oc2zepJJEANv1cK+jfepsKUtwAmDM= 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=Ymn2SGc/; 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="Ymn2SGc/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BEBFB4E410C9; Wed, 5 Aug 2026 08:03:11 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8CECE602AB; Wed, 5 Aug 2026 08:03:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E8BB111C3436B; Wed, 5 Aug 2026 10:03:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916986; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2efJBaCayTywqP4Hq/HYu2FRsCV5fb1DWh4ZIBYfC1k=; b=Ymn2SGc/u2V2Q0JzNXjkGnVcodmo5QMZUikR2jJnKPmOX59zZLFbHqY7T8rWPmH7DTNu49 I/TlhP6+cJUV4AHk103ynZ7LEBe1H4SN7+Nas728hQnBm5gFK7Oqm55Y1uRIBeCj9IItkd R0Z9oFTSxqnoZPeIcrcdXc9RYjmMd7NuBJnquCR/XT1TT9v1TEJ/zxOFt25pH3i0HLB8kH R9jnkFEoKz9U/HIghCTboTfWprm+Eh6InKdF4vwEDE3kU787exE7dxPRFxT5sFe6VGhPZd 8mZx7im4IlXvCf4PXnJCZD78I8qqYxw/zaOafRAtj6u1ZqQist598GQihzdezA== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:37 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-12-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 5BDD53E6DEB for ; Wed, 5 Aug 2026 08:03:14 +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=1785916995; cv=none; b=lawzHnO5c1cGHiVUP1ESrFDCvHR7CK6W9iJlt214zt4iwD4arfZctbILe/ZHvQGiDrdBMKMo+zE9tytQ36+VkWqyhqoZ3dCoczAQTm41nEpsQMBR/m4guVLA7WYnF1poiz1iOxnE6FXmlixlRhXh5D7PvZVX3CjLDFSsMk4PhL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916995; c=relaxed/simple; bh=ZvcIAHvdiDa87FEhIbw/pwv5gcWoySnOm9i3uKKmMcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=odjzQ+qiQNbNQg11uwlQb9FafGkSEZE9kWnTL0bwW+jEHNlAK0p30k0Xrho3iWRmNwbA/hxZXyfMoemIrH4hdlE7Ostwj1SdNLAjI5aXjTdcydgExnp40TnF9yTkmLq4PprsyaRszevxWvJTA2CEhJeaIyjxudJ/w1d+xNJ64Sk= 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=0n//tW5u; 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="0n//tW5u" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id EDA634E4104C; Wed, 5 Aug 2026 08:03:12 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C28E8602AB; Wed, 5 Aug 2026 08:03:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 36BB111C34367; Wed, 5 Aug 2026 10:03:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916992; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=c72GfLvgeyfX5tlbGion+ZPSbnfinCz5XlvBLoX4LVw=; b=0n//tW5uH/A4sb/8UqsLtS5Su7vj6IG+ViV/pikKhwMQw7OOY4suHs1KKvUVcKlZUC1Asz t7rHfXw7l/Pnnu+p/qiMJJs5es2R+jtD8P0LZfs+nP7dkGnntIdsZ91icbssI9aLeQxcJR CPZey/nzGwlVquhxlzCzyZfzk/fTe2gkLMpAkhEse4yE2x0tQ7POl1odd1TMcUxXu0ThKl otjM3ov4PMD3js4nyURSl3t6Gdrk0vF0PC5jn91tb5G7gQOJTohoNrbDRMBK7NeaT6gP0C EwMswLipDpe3WvCvACgjQDXldAAVMyIJZ12pDJOQSqol6GZA5soezaKzW2y34Q== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:38 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-13-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 B0C2D3E6DC3 for ; Wed, 5 Aug 2026 08:03:15 +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=1785916997; cv=none; b=GeXHFzCPK0A/bJSyREpc37LN0TBoElCRrZJXp2mSGNa8k1IKVXVWHX/WEhyEKZg8dv8VTKd+ndTAndMKVErKG0O5bh8QScN/n14+soM2XOf+xs3AIBjE4zKmJHjnfCt+/+uYtQ2G0LkBmYo0ZHwTOrSjAsy5+5AltXJ/zjKbxz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916997; c=relaxed/simple; bh=GUINGEJrI5qC2VPqARoOJCWulzSrrxQO8AogdbFA60Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JuAJy1YHObASN2758tFF85WvaKzDJeyXEW+HPvl0Ri8dR6JOIYV+K0Dz6wXwkLhxwsVStCZJjQL+QqJ2EwqJ6DlLcquBE5UWjs/NSnS5OWRbOYZ1IFH77bI2vmo9nVZRAeQwmzoXbuHAcesZnK56VQfIZqzjhqaa2oQzyD9atjY= 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=jtsO6hCT; 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="jtsO6hCT" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 32C4A4E410F0; Wed, 5 Aug 2026 08:03:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0745C602AB; Wed, 5 Aug 2026 08:03:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 593EC11C3436D; Wed, 5 Aug 2026 10:03:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916993; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=S+wC41kvzTH9dgkFMWSsDPvSa0vzDzUt0dds5q/ib9g=; b=jtsO6hCTxpex1phCA6zpjOSLlEB0DZ74SPBhOEu0K9na+9DbBIyjhqfuiNIn8ScVVeBvCM bGgGenQmtyh/NIZX/3XzytTgKibINZrhj0SE5LP89gg3U/+L/pnSPV25vw0QXPACE4lOu4 NqC390NQ12Xe+yRRVg86JOzcQeZ1c34wO96rl/IJ9RE9DdyaDTrWSYO0ENRMT9Cgt2hFWP dXvXelsOJ0fHtSc49pb4v9gmbWk+36pJMip4L7AdAhzQ4hL1LM2QPTk3TCxMVrP5UlYKhf 9puDajVgnsSN5NqMIjgV7uC4jOG2x6WfdVeHFeeF1WnjlXDmif2a+hP8IKF04w== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:39 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-14-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 3E8EE3E5EC7 for ; Wed, 5 Aug 2026 08:03:17 +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=1785916998; cv=none; b=NIm2sQF8M2QQZsl4ry/bj1QEg2yceu1pSSf//M+Wud7JP3nfQWhSaEUJT+msoGjDXxwFi+qS74UMZwIMoBYEzFLGvHotJYiiI3NILlZPx4dfZwQeO3GsciUQaVEuxS0NTS1JfW945WqD0q7zZM1J1+hDpfmTNq1/Ovj1zY8EQc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785916998; c=relaxed/simple; bh=oKyMMDPin/NuypJnP20ErL8P4GPafcZxDpVv3it+/tk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gCstkTCAP4gKJYGLf9WRSDWMg3B8Mr2/5pGOgpVPb0G409AVjUgubfPdebYvDArKQn5CT32MVdNqDDHrI8KFJScfn4D49bfkT9r9itrLnnhG2U3iU2XxIF78jW7AQ2cl3JqHiuwSFYQD3hyteoAQH8bWq8QV6w96XpGUP1kn04Y= 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=wKuMdi5r; 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="wKuMdi5r" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A9F161A1424; Wed, 5 Aug 2026 08:03:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7E372602AB; Wed, 5 Aug 2026 08:03:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8DAD511C3436A; Wed, 5 Aug 2026 10:03:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916994; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=E5QPse2lkWC/wOtvK0UJ5oLsVwxAuCt35ua4zancMaA=; b=wKuMdi5rBDdIZ0WyXkXu/TApYLU/VVVZgmV1wHdk4ClOjRybZ+CPnAk3EdXJvgj0q7uKw8 lUuOtaEZ9JZD3F2AGdPoh0rblY7RPn1dwqbOVUcBaJPKqA1KPthuTXPS451IblNLyh1DnD tRcor7L3eE2Tl0cSP2yF1HiQWahfoo6SKuhFOEbAEeGrnNatGM8ojv6RoVBWWY2jWCOEMa CRwThmQl3Zqk5kCP9FLhbE665jmzcPfAFIxvO/NHT/izqY0xsfD7Vj1NvBm8DLGAaFUDw5 EUhph4QrOfKQeOa9MdI60p4nigqBGCpLBBProJiJDkJug1jQE/bWojy3Jf2fxw== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:40 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-15-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 71E833EC687 for ; Wed, 5 Aug 2026 08:03: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=1785917000; cv=none; b=PSJJdbyteY1Be4Hw+f0bXUKFHjAnz18GHb5jd/xXzVc6exzDiF0slbbj/LMBhOgiu8xTZSvQvm3295bqXmB4PAGpik3bTD3k8DsbegTP/6mKvoieLVe35lkaIySGfOtW1T3qBo3fzO64KQ2ypajMmGC2C/QnDJm+w1FBV5gFN24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917000; c=relaxed/simple; bh=cxs7szcn0aWn+J9MsSH3R5eRLcmvysjEwi+HrUVSzI8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Rjg6xzYCE6l4LcfX1uewWtTHUjs/twzp9QBuSenv17+XyVib5E17OYkgTGo/NlwIP4BrSnZI9iPKkTuf+i+l6nUrb650pR+cmY57b93pHZZ0t5XnalwUpYTgL0djTQ7rFqOZ44aHjF9fCVS0uFggvOFFsYkaQyU5zvZ+mU/rGTI= 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=xDi9PLFK; 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="xDi9PLFK" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 253E04E410F2; Wed, 5 Aug 2026 08:03:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E8C15602AB; Wed, 5 Aug 2026 08:03:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 25D5911C34363; Wed, 5 Aug 2026 10:03:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916996; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=xFCGZoKQiD9TzzTrzW2O97nG3CHuVvL+BWagyTusTuQ=; b=xDi9PLFKb5f51a2LN75IICi3w/oZZl069EutgYZosqKUbFkamXB3m1/A7BXnrQFXLYIjaF 9ZMNB8QogHDcVuNYBsgl9nHK4blg6whoc9koo6k9j7qpzN07yaZZffijKThoE/3Aj32DtC 2iWkUfITEqjfzbrsFs+mqRcPppW6TxWqq4bjZ4Mj+S5S3FNvXzTHKCxLyGpbPQ1Krngllc 5Hw8hQGu5lA6ae3Xv26Cv5wZPnZvDMomB6ozNm2ln3zsFm/gTeUuY07TVZoEd90NIWfBU4 9M4m/i/PPcmTmcU++RHxFeXMAbPgs1ZtA8RXh8PmaJiJ+PJ4Y/yFXT4Hn+XNvQ== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:41 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-16-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 DED433EC6BD for ; Wed, 5 Aug 2026 08:03:19 +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=1785917001; cv=none; b=MA4KL/dcSqPg3gCVUYVXSq1ioj8j58ItwPWY9kBrF3y03j+Bu8VV2jb55XyZzKHfXP8YQhynvMk3MhsGFEidrp+RcbImZdMOhGJLxi1PUOjp3l7ZcC1WH8m01rMh9isz9a9gjaKo1d9eqHnvkitSJXIYyTvrDxXYoTbSsU6RpdA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917001; c=relaxed/simple; bh=Mlx0WVCRmdhCDtuNJdvU79tDkO/5qtB6v0uOJVe5JJ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N7eJAiysigv5DIPiG+1x5DlLcTe4zTa1aeS+lBcFnruL3YxmbsrgxZ11eA13yCki3g9mJdYaLglyDHe8m26HOVhRDHnu1ArQm9iAffyRyo/T5+lbza3ELiQOqoMplU3UtYvQQRAFxekzHyFBt/wfzbXAsa4U4wDWQCLeuhhSKbo= 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=IgGU/dzB; 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="IgGU/dzB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 786D51A143E; Wed, 5 Aug 2026 08:03:18 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 46940602AB; Wed, 5 Aug 2026 08:03:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 939B411C34364; Wed, 5 Aug 2026 10:03:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916997; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=v96X6gM4o5yMWfEIBxxO9VRwA8Y2VAK+kKp6k/DC5H4=; b=IgGU/dzB5Gv3vop/KVuY878HE3IdEd/Gqp/4aembnK8YQfYyRyKaqhk3vSlvhTVrNQ66eD DjTd1ZOvTmPmxhUrwtVrxYLUgwM3cbt5rvfEtWwt+4DdtVjnRE/qoteOmUgaGbijqmuLwB KcYrEKjpjjsJLhF5HUFPlL2SYLDS7jlvFqnTfFzI45C9ZE6nLolF7oxXg6GnQB8y+MaozN JEv9ORxXDLpM352ZB6Viovxvu+bkJZHczPJ+5OcX4u76D+C4+jj/sJ/RCktKXQ8/mWZyoA xoHQEafaxMfzdqvKhlDrxz0gIA+f3BqmYxepx3eSioLPR00rF62ydmTD7hNZ7g== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:42 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-17-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 79F2B3ED3AF for ; Wed, 5 Aug 2026 08:03: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=1785917003; cv=none; b=rlKi22ttzaMd3HRVmm5eEZjp2Pfg/vdFsseFwJqyAVgUy8JkM0Fx1+WsXAcotLJmM9KoCYaGX4EFqdIFrFUw3TPA1pO30VxfBdv+OI95/BijluqHqD0/TDu2e93M5Eg85U4X7XQvkFTbkiQ6VG04/U/A00FZRy2YR0d/3TSoc3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917003; c=relaxed/simple; bh=fBEId85PUbTg3RGVSRCjgX8h1fVnOnDEgp8sYHjfmCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vt/J8qeCTtPbvBz7CqaASv3qYmyP9BRBZszbzEL1sJjzW27oTpkmVJN/fiowDeQ5oLmTIC1neyl0JEoyNmheUVM5b/6WSe2eVZ3UodFEdJb8OvMJRBaTsejUxkiXMRIria8IrgRTT8pj+6e4k2ai4FIgBZzeOlNNOVDmIScXVn4= 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=ZiReAfZf; 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="ZiReAfZf" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id E6EC24E4104C; Wed, 5 Aug 2026 08:03:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BBC0C602AB; Wed, 5 Aug 2026 08:03:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D570C11C34366; Wed, 5 Aug 2026 10:03:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785916998; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=W7pk4Auxm/5bUhH9wIW6ij2MAvWsWCv5nTmHQIduU5c=; b=ZiReAfZfQTpeyInJZNQ5YpstU/h+sBWjDVqmirQYuZsPUuVpoEdyXXom0Y0FZYDYsxU12E 6dnuclQVmSyaQDCeL2CVGlNwlJFq4/sZ8P+m7eJJF1GnwBBBJK/k+5bunOYfdOoCJJnMZn Q6WhLp3aB2Llb6SxoPXutGTocslS410sJbyLPbDJwt4/M53hGqohYIl/EvyffXItFq4PMD /2hSBwJ9LBa3FvXnhqldUd3WhEfzhWfd6KdXWj0Z02PQcYsiyV1ptx5OfGEGuXR5wQF3dE eT2IHU1cyoH85OZWqdFDp6ziHeLbVH8d0rU1fLX4Ccf7Xbk7BOJ9eN4AAQ7+WQ== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:43 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-18-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 98D9A3ED5C5 for ; Wed, 5 Aug 2026 08:03: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=1785917004; cv=none; b=Pjz1LyYRcHGgbIRr5weQgxoa5RDZL/4FNsV4piFvL3dIwAGD7nHNYDQWF9o7mqFNSp7tNnyCQjJ5X2Hz3eLICtG8xZI/oJkEFCIs6v3UfR26CCVIZr6qD/B/IAmQvOqbEAYqRaVGyKSLqXrI3FxBviwIUtX/3x6vr3fy/Crrc0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917004; c=relaxed/simple; bh=JDmyK69cO7VEO42tPqSoZbR4pC7Ij4HSJq/eqBtnC68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Lj+jSjfpEC8sJpbKI6R6Nx/4k10bRr3q3hYR1Ta+055l0nkl3numcwEhUWxfm+7A52wWOfgY9kxgcoI/mK/ZI+bp6CkKh4IZm8Uo9sX0XYV1kEmhIw+XN2Ia/Vxzddkq9BIUKqOYhwGf+i0KGQXrEEwhG/IapjWRKTct2VDW5rk= 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=CBkSP3Ma; 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="CBkSP3Ma" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5207C4E410F0 for ; Wed, 5 Aug 2026 08:03:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 28964602AB; Wed, 5 Aug 2026 08:03:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4CA8711C3436A; Wed, 5 Aug 2026 10:03:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917000; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IECokdCzBsVUak0E3TMA6f5ekz6V8zS7sl+yPDFgG5g=; b=CBkSP3MaOgqtSPeEhYawTqh4tzdcTgRtHPQ9GKIwWSHSzQtqnUFdYg/w3Wdeo2hNnawLqE 33AhZqo1s3OAiyuXxdf8SFIWKIl/MhIPIk8Neqz2bL1qq3AgFfiuDzy1MTPXXH4qFWKQMc nBWv9wCLMBZkv+oirwVeiE00ZBfwbAlwknKav+RmuvQolrv7pdSFjwqgASJR+P99ZSY+sl wBIIjuAhseeqdXaEy+hg8ismkhdbzZsk7xKq3KIPOecIjlQN465nNIBxck5dvNJ3grcCYa hyfc4bDSk4b14rCcY7qEczY+0bjhYPA0pmrDi7dXrv2EDqSCvD2Yfmi5IfkpjQ== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:44 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-19-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 E81B33EDAC6 for ; Wed, 5 Aug 2026 08:03:23 +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=1785917005; cv=none; b=oUX5DaR0aKgnIatgkO+il9411XSD6alcPkk2bFlxGXoI8TbCXm4R1pmOUk8wodQeUHy03ildtlFAe0JuehlSw2wbEj+nrln8k1OUTIG3Df/h3FASd6SgAFTXGrO/YvhBa0GYMTAbJ7nfb360aLnKklRgrnL7DujVqqCP2MmVNlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917005; c=relaxed/simple; bh=gdTDCfx4zSMiqmDuenq3tMnKa7itP4EVyrmu3le8/7I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uHKTLvhNxJ86uLxpGk2Uolki3YOcfjOsbpU+g71YP3l+56d8bpibjyUNTXICEmGyKOWSphWOiqsWgr4z9FfvDM/BIsexMEbQ2bti2JLiVWlWvBzw2Tv9Qb8VGafGiNftQzlorFODQOtnrWRM49LpOrwwDrr6YAj409gEDqEhnh8= 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=JDE7+M96; 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="JDE7+M96" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7AE3B4E410F1; Wed, 5 Aug 2026 08:03:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4F50B602AB; Wed, 5 Aug 2026 08:03:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C229B11C34363; Wed, 5 Aug 2026 10:03:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917001; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MwRHSkZqo8RDzaixPWGU7fjpYYgKsWfR2NmlW/uZHK8=; b=JDE7+M96h/WLcmMFNrxbr7LymMQ3kDs1fDXZNM67UeTFaxtbTzmt8IUDXGVUg5cy6CG4Y1 MYhsZ5L9b85PUbgh1Xp/kYCVUfEXqi/LRZ5hEA/T700XF6RIL9j0JKZs0hKenleFm7ai9u iWg/FICTfKUt5U0DDkPwRSTO0unW8a5MieEREnUhQwQWzK8KKBWSuHdQh/vIIjqSYqv4Zf udbYO/so69/5AbLoAg32gMF/hGRm3mpAIV4ZiS2sRJAsPiGWkOuG8s0l5IdB6aDnp5g2FM YgqkZ+cx0ONiEGrGJ4CvdkSDXYr3aVTSI4JPG3PdIAAlY1ZZ/icbSQ3FXMGfcA== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:45 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-20-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 6A8F83EDE64 for ; Wed, 5 Aug 2026 08:03: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=1785917007; cv=none; b=AlLWF17h8cVcu4YpkwlWz09z904L+rCn7sKg26i7SStmWEpPQ5YoYA2oMjuw4OoAg7K+2UexESAPFIY2ItsxteAG0bK0shFs1Afng66rICDbqCJDxdLM7OOBR4OifXSlgk6wdBz6zvLBlJcgQUn9VPxGkBRqnodwKjTd1vidz2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917007; c=relaxed/simple; bh=dXIo5UAj7dWaF6namcLDaEHsOeA6ZlZYcLEvuLVQ85c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a6p5vaKqkWa0mABJ0qKAOiolSm3ZcW6L/qG8k4lS59swMC2jpfM+0UWbJkaUsDHSYmAJzR5lxM0REbqf9lzoUfDnvWyU3+w8I9qyS5yowe2028wmmQBs2dX/v/F9woRdGx1Y1ExCrYKg6+I+Sb+cI8Z+g2CRikCNf7aQ1n5ZbzA= 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=eyD8f0lt; 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="eyD8f0lt" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C75B54E410F3; Wed, 5 Aug 2026 08:03:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9C915602AB; Wed, 5 Aug 2026 08:03:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E625111C34364; Wed, 5 Aug 2026 10:03:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917002; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=X8aYxMlLfJq5PE2QjM0slAjtAnVX/GkZT4hxi09Jwi0=; b=eyD8f0ltqwi0/66x6YXWJwPIdAKTFe1KQLXY/0auqo0cecYdlXe4VeIDT4ei6DRl87uMjo c0Bz4RyeHf/aZFCASPSeCHF9ZJ8Ytn6kT+BQyt/XHro7Y4hge66HxxC6qdv27cX9lhs2DS oJAKnhJNQHS0SCZmy1kDtA+R6XuKvX9Y9DCjq6D48mW40To1JS7k+9jwHj3JOU93MTeuCX Rl+fcpHAQlA+SD1SvUJGshm4qlnBU6ezwlCU/+v1ofSw5dcAOSAWj7s5Xi9yyfi8zAXTDb BJVdugnqLMahDv/OBLpmUGrm+LONAV6PBZ96MnwhuH2cgxOdAstaClQad+d90g== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:46 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-21-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 CEE243E9589 for ; Wed, 5 Aug 2026 08:03:26 +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=1785917008; cv=none; b=G9WjFR5Z29Y3dsCe+A8cGCwriH+I3R1qh8Ee5tMlj8h3CkrbcBnKF4porxm6Zd1tJR5r38CPehkqx0kxBWxxWxCibjaHbPRGIrFUElusAlk7MCX4DUhbOc3fTnuiaWvq9S36TYslKfFv8uFvXubB+Tog2w/4PFr3QeZOsddfKGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917008; c=relaxed/simple; bh=L+AZoGvigvpQ52oJ4oa1GVOFbhJv2qWUBxquQagasWQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KswGOSfo6sG/bDhHBox3X1JXDx8y9l4qXdjORhD4lh1vjZqoWdD4RTpu/H4wUh+XS/g8Y9RbKGDfa3yfUJ4f8PLyzTELKSRHvsVME0zXff3kKgTQsXFnCx0WdnvjqIbOiF1tzofU5mpVxVcgNYbbV7GSrBisC8qIl9KfoEVRq3k= 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=U7bksnAp; 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="U7bksnAp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 591E31A1424; Wed, 5 Aug 2026 08:03:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2C2C4602AB; Wed, 5 Aug 2026 08:03:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2FA9B11C34367; Wed, 5 Aug 2026 10:03:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917004; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=a8JXb5k+mM9U89vEfltmq+tzKFBPYOhOc9XoqlLiwTs=; b=U7bksnApXFZVuZERJAC8b92pJwHiluQRr2DsPNU3D0jFq01go5OImL3uB4d+e4aCPiReQR 06Nsewq2lIrlvBkr43WkDJpdf7+1uZI1BwLqjb/pRgcQTdnrE7pPG7EDZXJImpEpQ+CRDf +Uo6fDnTPzLvQ+jpEF1YwB0xUnvs0JW8bECBlMcSJVLyhjRspvvycn6VusQFBYNxJiq2gT IimGSZ6J1Fz7PB4eM6fnHCHDdozO8YzNkTM0PDh1QQ/JkZX3wfUgbRoKW7U/dj9iKfrFF4 51C0wxySjLdO1ap/CHaYm1jxbMfY2FfunPx2gvODpIkYdKz6cypGRnBImVg2vg== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:47 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-22-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 3C5BC3EFFC4 for ; Wed, 5 Aug 2026 08:03: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=1785917009; cv=none; b=eHVYmZiPm3kI5HaPLaA3IDW/sjGUuCniSJZry/oKv8ILygEbnkz7G8716i0bYhYeMefPv3Awz0bN8vV93p/eBIRDChIwXvAG2udBMMAjAX7MDSRA4A2kaM0y19M5ElXW2FfggcVtwk2nPGnx/ZZJgiTU61PcpK5JO/Kn3LLzS+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917009; c=relaxed/simple; bh=dMbReLDsx6KDHiXhfV+PMcrwvvXhmlLRsH0hbBm7nSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=grdc1tbmb0/OA2ijShkGSy5SdCvSCZE/tCES4+uRqB+Z6LUvYDY03MmQdoWoG1+gz75PhU+pZuQbsoKk+1PNVhHTH+V+JuicTgpE9hBpTDPaBQMu4v+iX0CMkdwap3YBNKWebsfBcgg6HoHKwC0W6vatHsgDLmZbtP6Ae+ytHiI= 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=pWOJ4dxS; 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="pWOJ4dxS" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BC3954E4104C; Wed, 5 Aug 2026 08:03:26 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 91DC8602AB; Wed, 5 Aug 2026 08:03:26 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id ADC7411C3436D; Wed, 5 Aug 2026 10:03:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917005; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=AjcuW/NO8dJaFXmf1wZpixWH89tdyW/baQsp5Bw6utw=; b=pWOJ4dxSvY65RzwS1WCPV/APQvZyRL4PNohMlK9g9RCHdXLYm1+2GDDkPgKrkJBw/tCjXT pQIE2oJ0nClUnSMxW7yTZmk2sxauCHf9ykrRpnTwZuDhyhjEYNRoyaS3RH45E4xiWS6FHU EwSJWoW5SZAEtyt/JE5ZhiwYEehqVhDg1acw6bXDvWsh7N3yEQ1AbUvjszdPpSbEWErF1e rIX4DWexQZAZxttsVooAZagxTnQT0KcfzoEYrKBPgomhj9PsXC9ns9xRHLdjKs5ybPKh3+ BN6l/mT/z094VKWhFGWp0bubF5eAiVQLadHRJ/JXmCdhnnaYenzJl/W12ti4/A== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:48 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-23-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 528263F075E for ; Wed, 5 Aug 2026 08:03:29 +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=1785917011; cv=none; b=aJvFNqsGE3wYf62oJnFNUOafZ3oED8kjcKC/2J9P8uH2kNSusjDTfzzj/gcY8O407RsX/Fg1ogO6EWsDdLgPgyr3SUBX61qEdR4JHRl8jNDCGbyX+mRIFYDwe+zOiwkOtkh7aJijCCeQYeRk0emqJxtLrZF4qQ+HsYI5llGozHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917011; c=relaxed/simple; bh=ivTErfrAWNm5ToV1m8ZiDzA70gvehG6fP9eNPr83Sek=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R9J4V2wJBCBkmDe6SxWpNe+ZdWE00l6rhijatRWr8UE96fYulq4m7W1A2MfFmuWO4o+7HxpYgvDbE/PDddKAKLKi10pLmyiYapDPgVYaA3J8FnDJqJ8OzUSJv/c2PHspTtyE2aIdVGoDkIURv0Auk9ulsibwWHnbrFBCNxmKTkg= 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=zV8R9rZG; 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="zV8R9rZG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D5C484E410C9; Wed, 5 Aug 2026 08:03:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AA42E602AB; Wed, 5 Aug 2026 08:03:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1B64011C34363; Wed, 5 Aug 2026 10:03:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917007; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OcUj0SZ0gIrix7eQ3lwdXWvT0MZvxCYOxoYsD44t2S8=; b=zV8R9rZG1P2cZ/WM2TpEJnxXiJkkiwFrQ+1/C8AXetklAge+g+lWjbsi1Cse09pJ/NVabE NDw9jan2bhMZ7VnMt34tD2bVEK0/SdfUQAwVxeRDhdI249hKgxi6LgQJhVe56UdLEgwU0n HP1c7zdkQc+rqqhEDIZmOfAnKlwy/w9gzTibcq9D8t72gL0iwW0I11Z1rIu9YizJ7VSgIw U5xTLoEFDs0vrdVOw3oYwRPY8bHt/PyQ+8LYvCgI+8o0TX3cJWbzcBFsHWA03mhUvIGqF7 M3hfWRRJXzlhNbNWhhG0WoW+a5Bi9ZUwdlQF1KQ3FCCEkuBJEdBDDqUUQsTN1Q== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:49 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-24-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 9B7793F12F0 for ; Wed, 5 Aug 2026 08:03:30 +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=1785917012; cv=none; b=QQPSBRE97L7WlrrUF1qm8qE7zpT3qDrxmH7gVBy/MdqX+h6SKFSVnDz8PAh18RbVKOyTcdEKiR8Ty2QjFyDGgvE3k02sVpukukUJFe+D35puwox95qmzde5gGi0JSEXAVLFb+6sQVGjrQgCGDJn8NPbIdKNtD4wmjL29mqIvzF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917012; c=relaxed/simple; bh=JZ9kRn93v3+4z9LzMQDI2u+olZesoijZYdW5e9L7mEM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YcgfZPxGRtzlxIxwHDWVZj1cbZ0uFWYlcVvWn82Zpx5b+4ffe2BAQGA8GWJ708fN6FS8tL6asiugYl6w5b22TWPErmQQmlitHMxMmJIQJToD4pRk4M/Iex9hkd5NMHc+uCZ6j/wIPhkUWt+L4wEjaBjFX5E9SZlUXkdIeWylaAA= 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=QYvu/Jrz; 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="QYvu/Jrz" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 3DF264E410F0; Wed, 5 Aug 2026 08:03:29 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 13E38602AB; Wed, 5 Aug 2026 08:03:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4A9C111C34364; Wed, 5 Aug 2026 10:03:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917008; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JW3b8XXz4Bw4R1k8SoRfIjGrPceIGZOMq1bbgRE4mI0=; b=QYvu/JrzrrbAYWEemoSuTjEIio74oCV8mMeZ8XDxYcEdf3KHOtKNt93BgG8vTcuxdiIFhm b1Ljrd4/VD6c2w/616C3z6+hcYt9sTEGqKgkMxu8lC0c/pNUzowrInzT9YmE1ZOJCoiFzr FiPop+2rtQt1gW1QocEqquK3etCBp5uHxsK64SeUpC4hSp94WSL9aBPdt326e4ryVwB9s+ 9VbayTe/I0QLv0cJkN/K9jiDBlBfaaP077wq69O5MYo+jjylUIffuh8F0Mj2BH3VFLqKdj nMwZglZfk9fMk6IIi7habLcqh1lobN1SdX9DRYDehzsSUqyWibeP5v5TrNADLA== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:50 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-25-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 293503E9C2F for ; Wed, 5 Aug 2026 08:03:32 +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=1785917013; cv=none; b=YqCyah7xFKv2KcsI5T+F7UZ0GVPElqTk7/OeLrTHk439RX3iGv1VRlzJKbJutyZ6pILZSw28GhRcNfoikRhyyqQpy1DdSOxZY95A/S2fakbaeNoh5fcwR8DAK95b2bw06OpCGbOMB4EDBGixZTEsTLVaqin8Wva9VgV8tiFhrNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917013; c=relaxed/simple; bh=07agENAIn7mZ5JMaaeaSK/GF3adiba3TkF8peMQwcx8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=idOG7aeyu64KbccAOOvbUo+FcnqiT2387jnydV68jULgVjyDG0jhdoMrFPqX0r+njrwlMgDDWzl5HVev84WhqXTQ/yZU8Ps/KsM9yaHekUz3o2X873LMaPHSpZdkTp8m7XxGiBGY+Ubbty8uxPFa/EOoyDkD/6e3y65kLL3FblM= 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=Voe8Ya9r; 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="Voe8Ya9r" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id CEA484E410F2; Wed, 5 Aug 2026 08:03:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A4685602AB; Wed, 5 Aug 2026 08:03:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A4CC711C3436A; Wed, 5 Aug 2026 10:03:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917010; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=5Z2fZ1HsvRf2oJCPhM7cvSNUBhizZXIjDtniecho4UM=; b=Voe8Ya9rV47vJLZ2K165htFSEJC1v+DBfWxXugGWZzT9JilrRJ8+kBrUNYp4F6lDnRiaHx XoSiWW9446IBxn8Lf85YmGJebENJW4cFVoQVe9ArdXluPBIRukxwVuoBaX3vXwtjjMG3UB RvnltSuu9uP/R5HVUo3W+i/2jhM4dRQPBUjMoF6KO0Cu8A6ZGggCydf+LOPx8RYYIZJUHT BBtSjjaSAkc/YoITwcCJkRnu+Wt6hWf6Pnst9INKpxEo0RfZNONsJpFl3EtWJoBYJsIg6E LrrOLu4h1TgN+mPsU71lnd3nA9zXnVgNMoNFAiLq8rlpEc99OO6NNV5Iweg3aw== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:51 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-26-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 A051A3F3269 for ; Wed, 5 Aug 2026 08:03: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=1785917015; cv=none; b=uIASWL8Oa2Up+96NnLBeXjlQZejS8yXEYDQFquC0p/iYxlwv5o5uG4+yJSYQJLpAM/dlrZ9WtS8jSvBTJEcT78SkXZ9tLqy0dUX2N3UtM5fcOErU6DlGMtLW2+nU8eBYVhSazqCiHza93tQbKVvLQuYn8CQD3qn7TDbuKxD7DuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917015; c=relaxed/simple; bh=czVe+GPhR/HcoZmoKbiBAnQhI0A1MOV5dePMjZiDFEI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SyoORInoz7HM1CYHLtZRBInbeI2ojIydqkknC+q3clO5nk34xMTAq9VdWDdLQCDpAkGF7B0tCWFilpxQGbyMSUlVvpIkiD7XWWK1m385i3GSaZeaiSBIgKt4Zx1fNFipgYHuc1Jp9TsnpRPXD62EbB8wvY3PqraaW1Wg4l9dNDo= 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=Vnqm86il; 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="Vnqm86il" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 359224E410F4; Wed, 5 Aug 2026 08:03:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 04318602AB; Wed, 5 Aug 2026 08:03:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4EF6B11C34363; Wed, 5 Aug 2026 10:03:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917011; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=hzGiCJaRp391t6EBI/8hziqp4TPU24QahmGmlRZFapI=; b=Vnqm86ilvIP1kpGUPLJ3FpG4uvdjrh466TgadaCrEUIL2n5GwoG3eYlF0naz1lc8FR7+SA IrMsbj+7+2JzLiwe4vFYw+r6LZwGjGTzTLBcLHf1A/N4PcK4lMOJ92jSze8cCh9NPY/yYC EuKRj+vXwoM6xSVcjeLcYOTGC4bsGpWhnZiAcFkCAazzacdA1U02ktEDcbXEv6KZ1EzVIS SSMMwb92mw7HU0Uo8zDbgkAK09vVw+U2KQBBDujCcdEefUiJzlHEnR8DxHpI9MIfvoS/2N FJp5EMJ86OGhIPS4wr8EjCech/valaI5PQc+RHZDotNMKzLDwN7PZ6AOSqT4Eg== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:52 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-27-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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 04:46:44 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 DF5B03F3297 for ; Wed, 5 Aug 2026 08:03: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=1785917018; cv=none; b=Px4tHaWIVtY96Fpshj9B9yUh0BAny+wnmPyA3bK0/NJVtUCITKr114kBa0P64SboU5yLMzxudEJauB4hcETcr1vmPpb3psm9Z+XAdth4jF982wm6v8UjRQeIMl+WQqEwV3SRFK3X47QWyr44gEz7k15uCbvzl2RslIBfxDp7iF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785917018; c=relaxed/simple; bh=otEVbZOqSwEqiYFOpVsjqDPR6CfMvTI3Exa0mJ3aWIo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pv8MVl/6bf++TtnfF645EYIixBXDpATEKWA0EJNvm/EIXQFcwKHqlHzibSTQvqI2jTFyecXwQ330fRSeSCh51k1r/cAybHNKX4OOZJ2cks1h5A53OjjHYoYEpQUSclwLFHyuewgF3jIr9vCuraihrJpqd5aqINU2L0qg1j1Jzxg= 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=c5QPIFT6; 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="c5QPIFT6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 718E41A143D; Wed, 5 Aug 2026 08:03:33 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3EDA9602AB; Wed, 5 Aug 2026 08:03:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 85CFA11C34364; Wed, 5 Aug 2026 10:03:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785917012; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7JHafHTIJ4+v0Y9U3QInzBYlh6J1H1SJ56p1M69Y3zc=; b=c5QPIFT68zUxviZr6Bvu9/YIiz++icHPXa/fu9wHYBCdLeaAAzXrq9VapNNLL25qjH7cJZ Ue0cg2Kj74iSa64RaV2BUTTqkeagA69mk9FxcafRsiUeMPeeBvAW/BlKGU5pC16aEfldPr cob6pgTvIJYIpMGHKIfAOtC1nvsqu1dbfQSichvz0xp/Tau7O8wt0hw25QHVwsshUjNSOg yEnR8RMa3OTt5QjheJe40lcKm38h2cooJ4rKLNW1NPpE3H6JpxAMaNg4r03MDhOar0PPxp m8GI2oGXASULalmQYaODeF0BbptLmPULZj9XiTw8bsMKtlPtRBGSPZm5kXnk+Q== From: Miquel Raynal Date: Wed, 05 Aug 2026 10:02:53 +0200 Subject: [PATCH v5 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: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-28-87238e577794@bootlin.com> References: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@bootlin.com> In-Reply-To: <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-0-87238e577794@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