From nobody Fri Oct 2 13:18:35 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 BEC0D408612 for ; Fri, 31 Jul 2026 12:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499355; cv=none; b=a/9XvZcTrrAWRHxqcrTyaUj2GI2uwJMWntNW3FZRHXyHghCGzR8qwkN3iYLIsj7jlOxr56AQ2HMwFQukVcrtfH0XSpJ/pXE8CvoZniYW+5ANUPRGaRmfL77F+sOrzIz+ppQOXxp1tWwFXZl7+fAxUYKbqUJrD04Vr8mxMU6vTF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499355; c=relaxed/simple; bh=7nvOauSH7cuQ+z8eYYbj6DeuXAptmJin+2La7ZgAOOs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qwPv3CRNYkg8S8wE+YclycSBqDamIWOH7fVPfp/6it4MUA6BjFTQHNzyF/9WkDEVhFubDggNHTo6M5NxctrjdZgEAGtIXKwae1j0Oidp3DLgBQiAiQOQJCb4tNjCcOPZUfl9LQjH2GlQfZ7fKkv0b/SfesHYHY3FfFx/umfyTiA= 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=SsvhmE5g; 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="SsvhmE5g" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id EC2B41A135B; Fri, 31 Jul 2026 12:02:29 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B9EAD6039A; Fri, 31 Jul 2026 12:02:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 28CA611C167A6; Fri, 31 Jul 2026 14:02:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499345; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=EU9odphLDJ7Sp0A8jGyVHZpCPe8+Os6UWy7g5Vv1TYw=; b=SsvhmE5gW590hY+CSl8arfsVg/llBnAl9HE4PKxoiuOP+5/1KxyzAMHXRV15LiWdnylkG5 mGLhYjCzc9HTdzEYIS9+xB8tr3n/Xgm5wGA0/eLUgQXiOdakD3pTajj0rHpVDfgWrhb3oJ 4ScTkMqNPBkSGDg8rVPep0ANp15uyTEyOFuoyZlgnRpRhPEqNA9aC3Djx+AQDt5jg4eSug ynbfntjjXoTQ6aGxt2gJdLtRPuA1SOsI/3h70vBCAA3iIyGH1z1YR3m3P1x+eUc5zLrft1 gJYzghiC81SAZ6fplZvZfG4PH1QSNqYqtCpo1bhqZksvSci7LmoLlSlSm3k+0Q== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:54 +0200 Subject: [PATCH v2 01/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-1-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 13:18:35 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 30BE93314C2 for ; Fri, 31 Jul 2026 12:02:40 +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=1785499362; cv=none; b=qgBP7IopCo0gwAMfu40ikevfiG2VDlT8ZoW0VRZYVpi4694l73ceDb9VEh4WB6QDZIpo/j1iLr30zWbgN9RHhk84SneTulNK20b/6VHvESWuCp1VXSuZrIeXNXgcCldM8fiApqqH1SwSTVUz/8CaTzagPMnoDCEqvLNd6CuBGfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499362; c=relaxed/simple; bh=G7C0RpuGOz2d4Nq1PEWQTIQUHhtNe53rFmxu0pv6IH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H6jS+wcWD9i2CQBrO83WOVW/9obarwhSsRmhXLZ4wQFairMETyipYyKQ3vXWaBoqGRq16l8uSGAX/RK4+GXnfUsdjdahLKWmTx5bKyFwCu3TMCFYwedU+UZhGv0KowZ9Va0Shrv/pE7XLwGGmQjz0R7XpKs86bzhJXqKKZVb1Yo= 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=eLorBom/; 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="eLorBom/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 853451A135B; Fri, 31 Jul 2026 12:02:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 599EF6039A; Fri, 31 Jul 2026 12:02:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7D35011C16798; Fri, 31 Jul 2026 14:02:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499354; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=bAWtw3CGgsPilxjcNtR1KkWLKZETIaXM85za6nTJbqw=; b=eLorBom/59DGzXzWKLCmdS/TF0bXE5jcZJrpG5/5YqahfFYNn110PPot/r1MKv/Jh69PVY vnefu3GEMv/DOVGpVVsm6oYRPaUsgcxJpPNqncPL4glDEA3B+N3rNLgtsQExYU6TGzj8R9 qSF/psR6+f/4z8R6Ydk9gvs2vgkNYJYMeN4qUk/uNMc+wsbjupzqtxxslwQQ5t7x8CnO6y PB4Gory16k5fTVoBDLXsQ7UYzD+DOBKB3fXcuE+Nz8eS5J3lkM6NLs+imuODmJuOB+jstB mB9HvOjHRwbdUFyKecwmKNoBxDdUrWOMSMbjMNbrYPvIvKXY+Wth9u4GIJoPSQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:55 +0200 Subject: [PATCH v2 02/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-2-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 13:18:35 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 E94CA3264F1 for ; Fri, 31 Jul 2026 12:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499368; cv=none; b=AUiDIF83eqO5F406cIcCazIZuDrh6jaNIu0DQQbbRGnB4xIOjJv8pcpeiR2E4UGJotjt9sN6WKTUrXuzpFKMBD4N0Q7EPs/YiGjAWkHdDo4BHgiCYYTuMOini3nXY/ogZBaziAK1oqQsBEJEww+LCjeF9cdxRQE8GAEmw4H6IGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499368; c=relaxed/simple; bh=g5ZoaAkVcvw5Wqlxb79j2f7XOzQMlm74mdf2RorwCFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Agt3VdxgD1rSuBiSjx9+TTrdDhnQjwWkzSuhZEAsyNhc9TAVQLc7UIkjQvYzzi2aVsWL8SVR7ajuFSyqtsfUn3Weu4FhDvEIH9NH0j39Avn/03BPpUkJs//zlpPB/E5SYi/JbRlLqXuFmRLvvzVVAm0sRqHy1Ah9zhGIUoXce8g= 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=01RmkSY2; 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="01RmkSY2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 158AA4E4104F; Fri, 31 Jul 2026 12:02:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DEE8B6039A; Fri, 31 Jul 2026 12:02:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 23A8C11C167A5; Fri, 31 Jul 2026 14:02:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499360; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2Qe3cx3iq4V3ikZYQZ4mJh9N7Thq/K8jIFdv7GwKTfM=; b=01RmkSY2gcSXCWH6fjSN+o4LwBcKG/8eOZNLM4lVISvxiPtUbGfqDShSmUVP18BHkuWgr3 Oyyy3jPuGSTgGAPNdBllW1h6ia66VREOtSp+5uhFFdEHk0dItreB9AoaDjrmnpOuWP6YmS RiSjSJxNRWdCC/a5Fb/DyNmZeCan/UVXb81eR2Dz/GRGI7NBynYmRmhoqghaqbGpM7jtPf 9jIBJcPT5emrlNVS3rbTi66wpP77GIg8ILASpULLmacJWntMFH/C4sBs/HFlEqqZ1TU8pk kdcv9kbMg08FbnFvP0TxhPCMuD43YB0SRzlsvKlCGiTOMmB1F1m5ck3mJZe0HQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:56 +0200 Subject: [PATCH v2 03/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-3-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 13:18:35 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 68D063264F1 for ; Fri, 31 Jul 2026 12:02:54 +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=1785499377; cv=none; b=Hv/STfu5+BS4ig2FgZJx1GYhZTRoHMo5skjjRqBTMK463apl1rpRayvNzgzXqgGJXyEf3pP81Sfn+BVz8oO9UjTKG8JWWF+we+m5y6n9pDbauBoxrJ0qZ4NCKUhw+8C68ciMxJD4cOMYGBoezPXzHn+Nq35r5R8b4LvilD1vViY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499377; c=relaxed/simple; bh=bAOF4SgQBwCMcGqNlov8ZJLK4uN3/R6+Q4DWTjRMUok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j2+JTZkyYH2ElWEY7Ytu4eSHwtEtUiMn0GaxbBxgNtl9UC5XM6jcggDXSlJC68t3006Fnb8pXDoHZRMkzEq/RCTShuZeBasS/VOiqB322e9L7ts2rQJkoV8UXiOpmhArh182G/NwBrZQE9Fw3TDEUIce3e528Sf2b4pZiEGPH2M= 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=2mhWkPjU; 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="2mhWkPjU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id A794A4E4104F; Fri, 31 Jul 2026 12: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 767966039A; Fri, 31 Jul 2026 12:02:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DA6A311C16798; Fri, 31 Jul 2026 14:02:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499366; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=CKO2PZMylQrnAnMqKHVRBBgvl6ZJrB+C8xyWAcgkO7A=; b=2mhWkPjUp36FWsISyxaKLX3rgfcAtYuloB4q/WSJWYvgBnLb4Otpuy/l4EGE/TBytsk9C2 3FrRI2Wg6uyCAI0Woduxa5Wq/MISD0Abrio85tPpauUabZWqWqLm5k2d/uln36DrNuM9So 4TpwyMQ9oaPc4A+4VRpibQg+dCztoUUjka+OkOF4zh2InIF9WcE+8uaUfPIdDPt+aiyYxr RxKNWMOxSYFyFRARNlwXZEgav5Sy1YMkFX0IE+XsAeeg138iTisXVcMtr74IrMeZ8c1yuM 3OwhWWdc5ulZ3z9p4kvpijmr8KDb5KirYcT4YZO/ang5YVcfoB6oWnkMzQAYBg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:57 +0200 Subject: [PATCH v2 04/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-4-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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..b3ff99116335 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->info->id->bytes[1] > 0x30) + nor->flags &=3D ~SNOR_F_NO_READ_CR; + return 0; } =20 --=20 2.54.0 From nobody Fri Oct 2 13:18:35 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 68E113FF886 for ; Fri, 31 Jul 2026 12:02:54 +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=1785499376; cv=none; b=Qqjc8oo+Pp/FIUdwPNSK7H7CsP+Up1WWSuznKCQHroYIlIoU33AYwrns299EFwJiharw4DkWJ7IKk2n0m5bb/r5LCgFft8fEE3B5TDK+bXX62Q/e/wWi+cjkoCwR6kktURRb5TCrTkxf2m60RNcvsjnYfhkwW+jJthuxIkMAXFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499376; c=relaxed/simple; bh=NhHv40xe21NugYxYoIoEYvD/YATWCEFXY84aYbneWeY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SFvLITwFJGj7u4HSWaULt6+p1WZWShGMx6tfLlKx5x5sqQYH+lPcLRdKxUNl7+IGmpo1kWfGtVOkZ4ZkYGneuaPt9JhTLB+1kutupts/BNGRkvQVY6vRU50XZiQcqalia4q0jDBhhJq21HDbkR9H9HifgpUmMK1lJ/zlkgl2z4s= 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=yvo+14sN; 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="yvo+14sN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D7E304E41050; Fri, 31 Jul 2026 12: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 AD1D36039A; Fri, 31 Jul 2026 12:02:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4196C11C167A2; Fri, 31 Jul 2026 14:02:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499372; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=stKyW8eUQlcsmRBlkVE21GPe5QWe6/xHz3keMLC63vY=; b=yvo+14sN2paJLiE0lhyfjXQD810/nYrTH2zCaHarWA2KQa2iHSpfr3a78YlBxUuQVgcyfm lpSe4TnbxsgIceRgKWBox2IykFJVa7fmlZWIkvvb1Qm6RxhN7yY0dxFhUeb4Ac/azKQGDC wwh0NUsuIoK2CUK+rfgltoPrN4N3pfVbfC0pko+4olYzrnD3J3s+cY1hC7m0InrkZtu/78 CTkVFn4dJ6VVFwNKIozbfqbj37Dv4/nKQLl2HFIal9zs5fUR/37+NvlhRIECzPkJ3gETee GnYV/8g5Kx7LmmhgsFcomylPVzlrjdsQqe4TXRy5/sQmBIGXQXdKXpVuNml9VA== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:58 +0200 Subject: [PATCH v2 05/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-5-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 b3ff99116335..a391efb926ab 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->info->id->bytes[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 13:18:35 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 056573314C2 for ; Fri, 31 Jul 2026 12:02:55 +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=1785499377; cv=none; b=m2/8YfjumBH3VJPFdLqeyQ4jMKIXzJCRENPT7V8t92lEdv3tfoNx5RreLMUeaCXeZe+pSFcHkJ0j2ance37CbKW9u+3AWf29E5Afk6TJMz9dM8yULgVi+0HYuJbMrNMUZF/DOeEKF392NZQ0jRBqJLgl8evNHHP+tryCJgprrEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499377; c=relaxed/simple; bh=acsV+UvCcjY2q14xkKjLfmeLRoNu8cIklEo+7esrQi0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HeeppUvoHvYNbLnMdaEOA7fm231BnLKMHQuj3nEAzYDVW2wNHToXSRAypEGjX8rVFB6xN3mb1oSIfD0YhMYmOAuEeGoG2T6qK70J9+TshQuSZA6ogDuhmL6mPForuho9YIrFvXfhXzP9Hw//DOxWjCHKIBViKcu7scjLqLZXOYo= 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=W8XH/naJ; 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="W8XH/naJ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 650B01A135B; Fri, 31 Jul 2026 12: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 39F446039A; Fri, 31 Jul 2026 12:02:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 78F7811C167A4; Fri, 31 Jul 2026 14:02:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499373; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=h1XyQBzqcsTgQhxjDV5LHt4WXEapx17bKUFuzVktxDA=; b=W8XH/naJOFYcWekaY7JiJtRD/84YXdEItNIonhq3cHkJf3Cme0XnXYjBNyrcmd6taBI98T mszuLQgQS1LURT8z9Qm+JwyNJBnPQTzTHhHxV2Oh4fJ9+3jIrhRR/AqUqCqOjjJssa85GM rndko1xX2tuSb7fqhbh709R+i8kT30D6Qr8Mz17oDylTWLiYfGkGFoPtmn9ThOY/iRnE+Z itHUB/QA7jdJsClfYa2OuqaqeQ/IjouN4gcSBHoWNm/97NPTkITCFaaOnLeosL3Hc4brTf /wP5ta/9BIY0uHRua89XhtKFfJR/e1cUDXtRyI8Veg8epxYv+LYBDBKgZcx5yQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:01:59 +0200 Subject: [PATCH v2 06/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-6-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 a391efb926ab..2114674de3dc 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 13:18:35 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 AEBD840F740 for ; Fri, 31 Jul 2026 12:02:57 +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=1785499382; cv=none; b=P/8VOj1zkieAbc8L08Oi1Bv3Vp6DDTl+N+rd3DBT+yXqfKZsNuW2tyXr6D9pD7SIJR4+UOoGG6KGf0QpDTOhR0P8k6yHX6xlmDDzEC6fBi8eLbvJjnGkYIG7PprYT9W87oMi3qqFhga7HkCauqHDvuVtvDCZ3W0tYlMON0d2j4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499382; c=relaxed/simple; bh=IfNDQpPCfAc/boDW3gNyZLigBVa9T/TYo2YpXlGlX+g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EUGkI463lSMrGNlu2bKwKsKl8IPXOt8JmEReHwOojs3/PNPSwyEuIxl6Ro6h8sROyXddd4cG06PGjOTm8t7IVXNrAzothkl8s4KYAvhZoNDOe14KVL2jahVSr5QjU4VR+92TycW2sHauh9viAGuJXd+tJMl74hhHcjCcTGJUdbU= 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=b8GH2Z/B; 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="b8GH2Z/B" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 48F8E1A135C; Fri, 31 Jul 2026 12:02:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1EBDF6039A; Fri, 31 Jul 2026 12:02:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1313E11C167A6; Fri, 31 Jul 2026 14:02:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499375; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZKnHae8q/MB37jPLKU2TYSgO62bWyRUd8OjynSgoxqE=; b=b8GH2Z/Bcb5s4UpkviCXLGZ/gBGcViLB/1zjectfch9eQNpTkfyGsvR7TnR6cjk6FoUdWu nNXdaPJ/MTIzoe0fhBubF9IQ5OMlLNkCwZojUV+PdUTLzGBI9aPnPLjq6/V/2rpBnkCPvr /CeZd1mlPCYiQk6iM9gU3iF96t+jFO49OKWFr/kfqpeinGiE+D3jWUFnBrNDD6OZ5BrbkE Hpe530cu6Z1WGfOStijcl80zT6ZGnIx19nNiDT5uM4AOLq4wx/byK5hz0nBc0/X5x43K4C l8JLyQGEFwHH8tihZ3oCjAAeMKZgULx9r6Ar/weNdDX48RNs7I+zeYhNCtkbOQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:00 +0200 Subject: [PATCH v2 07/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-7-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 2114674de3dc..be8cc67eb72f 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 13:18:35 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 944BF3264F1 for ; Fri, 31 Jul 2026 12:02:59 +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=1785499382; cv=none; b=oqHC9E4i38nNmVDNOdEbd3YFMXGlBvABkXQS0rS05YXZ6neg+0/0BGsgWCoDjpVBoATehNgE8VBZkc9fAZuB7uj75kGrJgngLAi/qb7R+pEReCI7PL+s0yTpVfkQmkS4tfZkdCGUTYgE8ID1FsyAnffYYi4WPVj4jpVeRc3eHrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499382; c=relaxed/simple; bh=y2xY2rM49Z/4SpuvNsWp5OhpgOrQWZWd0Q6k14N7UBk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FzGGCfLQ2Lgax8aVcubYZ9Ynvfjvu1g8Qbo9HgGxE8Wf/k/rodzUWytMByXDMYdvPxTV7j0vP2mDDBGq1HwemFpECj5pmwwp/QbFZvosEnG65Ok3tqnxALTL5Xa9TIO3EhUksncq1K4QEGsjDPXKGADdcsMFvKYJBvjGBKzvCr0= 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=C/bIax7v; 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="C/bIax7v" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 20F954E4104F; Fri, 31 Jul 2026 12:02:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E2F4B6039A; Fri, 31 Jul 2026 12:02:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EDC7211C167A5; Fri, 31 Jul 2026 14:02:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499376; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=XRms+hYES57u6Us9x2O3s2QZInrDYJog55FBiHONdBA=; b=C/bIax7vbpKXAEZjP5pSae9vvNg8jrTWW0gb4Ea+izxC6YFm8qt5EF5fdrwEYAraJ6r1Yg zJ47J55dNM4DZ+Qr8mvvS8jmf3T+gdsbxk8nmf7lEU8HeAoyg7yMp/UQQ+EWWkGIvtdUB3 xFQSsS1E+iL129OtDH+nhcC2YK8gL9XjS4KgGibTXB2LqnLq+69tWn1sNVavxmKqnFcPMe KnspWCVVLqCfPhMPhjYiZ63HyRWCtLTjxOJw38lJNnVD6yFcP1ixsGREvr9jWTxtMaBfk/ L6pmli5w6QMSs4PgAdiW3s3afCkwqHQBcOpbKBtd0BZQZsixjDNPm2Om2GedGg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:01 +0200 Subject: [PATCH v2 08/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-8-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 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 compatiblity 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 be8cc67eb72f..239944d8a37d 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 13:18:35 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 D17793F1AC4 for ; Fri, 31 Jul 2026 12: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=1785499384; cv=none; b=AkaZu2mwKxFHzbgRhFQP9s2VZZ2pKQfC8DH4COxOu3kQvJgl0uGpFfeU4mZP9q7rAMFATh2Dp+0awyFvs+D2oX15oKgrcFLQR5MFBEr1WnH+ygP27telhSgu7wEuf2V+ggT9u0PLiQrioNYCX2OvTU3fttQrhfEOTxppEq55+R4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499384; c=relaxed/simple; bh=udJjF+YQ+yk0OXQMwWryYDJeVv8oSn11ky/ZklywPZ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dh5WCUNLff1Kj+pDjGJ3W/77ZJXZxFk3FrK3eUWahimWV6UZNAc8vmCdHPVSrPB9fiLFCWEsACZHYxKu9qSF22iEs6Thhs186ckmiEl8uQK1XFa5VExw/WFRLa8fViMc1WkGC1IenGgmAn2LlLOwcwFYlrni+Kda7N6+pg/8VbI= 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=jETybSx6; 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="jETybSx6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 81C664E41050; Fri, 31 Jul 2026 12:02:59 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 573AD6039A; Fri, 31 Jul 2026 12:02:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A4D6611C167A8; Fri, 31 Jul 2026 14:02:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499378; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=D+OaTAUm+dC8084RxdETx80XO9EyEqJLkneGX70kL7w=; b=jETybSx63G0BadEfW4ijvl7t0a7bNVcgnsTMfQo8DFXTgYE9BcNNCwo6rkY7XI23ds6yiE hEpoz2sY/FICULitBczaUYqHdSy4AsbLJbvZMOYCaFfyuAFFoXvAvZFK15+Euv8lIiOzgF vS6dxcQdemp428eLjv4boX2vRlO9SwzSwnaVdT447AtdNvieWAMBf8FjHyCGekvhS8/fOg Ip8fw4SLOTS7yXXTsc2+DmMfLsQQ1MTVYaSj5JQmo4mwLHuVdeMEGkrUBDwKSWmKKSETtu nq+VCYnwgGQf8j+wj0QXJyz51+Iuwj7qDil2xAzqhrsA0x3zSuM7Qg7BpzGSFQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:02 +0200 Subject: [PATCH v2 09/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-9-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 239944d8a37d..ee55cf9c1549 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 13:18:35 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 6645F366052 for ; Fri, 31 Jul 2026 12:03:02 +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=1785499383; cv=none; b=C4jzcdnHL1D2vf44Rryjt+Njr/yJbSRF60kCPFCQYG7OS4ts4D85n08HvWi7LSYNW+Eb521lD0AwSUwBpbCBmk4OlVR5aHQeYoketVTj9Efkhw0cS1d3EmRz13VpxtfX1fgmyx8VDEjQAx1Q79nU5lpDkI096NV5mqPhMJG9NfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499383; c=relaxed/simple; bh=aHZgHzq9hQ8FL+1GkM0w22G1SMTr/KZV0R4bELB/Rmg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mmS4k0VXbb03Zvsd3Xww70KrxPOwUTxg2ckNy4zGo086yDBt/FzthGeOOBmCC6NCSq26+oy8n80ReOGg0f/cA3J+1x+k8D+HG0RChiSsuLNELjgMkSqNaz6RuvAuAyvzH25rys0Q4UM4cH1Zp99JJe0jY2UF0cwrX9D7PYKq7T0= 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=dYzvFUm4; 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="dYzvFUm4" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 11D6F1A135B; Fri, 31 Jul 2026 12: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 D44EF6039A; Fri, 31 Jul 2026 12:03:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 30C2711C1679E; Fri, 31 Jul 2026 14:02:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499380; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=gnJl1m2DC1SamZSxmGCb0Eyn/Yj39OdLbAJd0EFCZWg=; b=dYzvFUm4Twn+Hb00zbAJ+TXfeKVjRTA7sqMYq5v3r1E9iKMf1g227XmOZUYlLxVtlI3BC8 Gvie/3BZYqikAtyHrLnkp3h/vxVhDj0zfgu998yAfkXs2AlW/jE9XcPuDNTF3rn1phK1L7 E9SYY4OxWbaFnyJsSyxW/tYyoaTjzhutfVauoaj8U+1SwgF53BnbzMLVaYrBpzQBuYYtNL Xa4LO6OatbjhQVc7wNwwuJGXHwKuUvQEIkMswawq3oVF/bYjo9o9BGjwmO5huY18xx+2wI i0/W3I4N14FbrVnNyG0L5rEc+5v4j8td+5iz6xa+ZSEz5rxP+1LBbyILpbyKMQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:03 +0200 Subject: [PATCH v2 10/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-10-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 ee55cf9c1549..dc1a76d443fc 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 13:18:35 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 58ED3416D1A for ; Fri, 31 Jul 2026 12:03:04 +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=1785499386; cv=none; b=mlpnNjN76TgTZxUKX/ssbjD1ctCksx7MMI7aRiqCd5mq63d94Tancq12MhB09ahWS5CRHe2rkukUeMc/peL7AkrA2mMPwTU8jTRjlmCMqlusdjA3NhOOkgySLOfPRe5tfXdhuj3v+iIGpV5VOnNl2a6OWvl5/d4hS67D0A7QYrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499386; c=relaxed/simple; bh=nvG3FAIWk706984/t4qwBUHPPL6Q590ki1dm+Y0djBo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mvP0Tlyp0xEH+h76fWE4KmEgvnd/yU2/vDXX6VqGQW5Ssn1f+6gl4UoJ06g5j3aa+ew9kjF803jI609KZG0iwatosRoccboMMeao2aPTdbdUZPzv9uRVmFTQcRAnFv4Coz2VIS3IiitmnW39wgvuByYUuAYdBNF2dchXbXB2xTQ= 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=BvEYhTzA; 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="BvEYhTzA" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id B13674E41052; Fri, 31 Jul 2026 12:03:02 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7F40D6039A; Fri, 31 Jul 2026 12:03:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D2B0D11C167A9; Fri, 31 Jul 2026 14:03:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499381; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=V4WdXjwZilSiNncmCro5NSlVLTb5DQm2ydvZh6UpOKQ=; b=BvEYhTzA/kUJ1fmKGF/Fe/Brj1IgAIPXR16SmaW6v/aH4A813yQVhFZ9nzGfoLRE820eS6 I+muhuXfEoociWJpwsw7gVtW8G2pVGWdCMnCwKbax71NmD0CcQgOJHN+wDbTJ/PXKJVwA+ 2Te8aHS2tOQ3/K2yAheHHZbpAL6VM+coZwqbNv0OHxxIzDpanFSyBTV93x18N/+qsVJzzF mQel3hrUx1GaumLxGmIYzkzeU83h/p6J59Oh6MHk67XcI7X/UkXroauN7UJh+53v57mO9P qQTZczjO/Pe52macZF6iNa7YS9ZE+FEAlf2p6dbIEQY4lReCCAc1IWgCO3XgLQ== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:04 +0200 Subject: [PATCH v2 11/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-11-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 dc1a76d443fc..3ae56059cbd9 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 13:18:35 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 C8C42412C1D for ; Fri, 31 Jul 2026 12:03:05 +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=1785499387; cv=none; b=W9+2cvHVGGQy+OooWKjexyKAkyW+B2p6zaIF7lEvjFwrelvpgN9rQhuZmNtv/ItikCOEL7khfXNzOnF8n6SVqWJ0y9LgRy+j372xjeZP79sWLXFLDcbbgCV4M/28qtlIA0jTNOi5CifU4kpw3sYVCsxbhVWjdbPFhkfZrtiGSDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499387; c=relaxed/simple; bh=A0kPP4qAWdAigTfPxZU6eaIZGoILD0nI6+ANpsAcHwc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bJ8LzJBVPIQ7YBYUD2VMgKAY+MY2VhpkZlib0MIsxxRmiEZO8IZSly0hMGX7kBxBNXdczcImDj+mgZMenrbMCjVvYa8aZZiFzIhDoT+G2lgZ8QD95Vc+WDHQxEjVBPf4sBfP1r4MZmYjRD8pS4bmEOzRpJLHOJNGKNGlgtmP6F8= 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=aVk0eoI/; 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="aVk0eoI/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 6B39F1A135C; Fri, 31 Jul 2026 12:03:04 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 40D586039A; Fri, 31 Jul 2026 12:03:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7ACA311C167AA; Fri, 31 Jul 2026 14:03:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499383; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=i+fkG8Iouz4MKe2twD7vyz/FOVQCviNr4gofRpFU7RQ=; b=aVk0eoI/lpDjiAEZ4Cck0anEiEvvF/A8ISf0a+dDVC5seyDO9bGCqjzOAOktRbXngti2/Y 2x8KQJatNZW+OtOTKG/x6eoQ/9+tAQGXyzhvKiFZ8O5p9AdlW9mfnY/KLqu4AQptc4lDil AM2pekU/Jv8wfSXp+nOad5+px+3/YOqHKcs9zLWrKzmMcoArZ4I6zNKTMDdyh3UxxAYlKR Zd2JSklXkm9QxwHB2KGk3lDBd+rrZ/Rdq72rvQgd+nVOzRyvkfIJnp7ZwW3thDHgdm0Pv9 7MhYC+tordgsFR5SBOWftZc96z35c3NHlWEFIgMd2954G/c8yPgh4HOiV4kFUg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:05 +0200 Subject: [PATCH v2 12/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-12-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 3ae56059cbd9..d522f4869c94 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 13:18:35 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 8C88D426EBB for ; Fri, 31 Jul 2026 12: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=1785499389; cv=none; b=pRjSymuwAtBfs9pL06TyZD2hDcXb/QLodonvA36qQRb0ko5plA0mnkwn1sAUmFrtoAlXU0Oi/dlaBOw9c7by4ItUEp8n2aqhkTzDIXkQrtRfVkuCqGnmGnghaFZ5FKaHG5Jm+Vf4kf1rWryzu/UaKdftTbPnvosK678BaXpJw4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499389; c=relaxed/simple; bh=1b9CzbFo9ojE5GWmosZSXdDlAiByOSHboDhXQqcHyRY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P/h6IeREZ4mL5oTM+7tYsZyoxBI89ccUC8gpMPKePNxUjD1r4PfwrXa95LE4Btk7xiu2Q7pf3l7CYbVBQWoRMm+Fuu60L0p47zFgw8V+KbAzAweYQ2p/TNq1/7g7aLQC8lFPbovvi+W1RIlmaS1o46snz3AD9Iea3p2iHO/+BxE= 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=OC11cdw2; 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="OC11cdw2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 1BE0C1A135D; Fri, 31 Jul 2026 12: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 DE0736039A; Fri, 31 Jul 2026 12:03:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1603711C167AB; Fri, 31 Jul 2026 14:03:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499385; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7yww4D5PYfEEZHHwspTSXG4zYEHvJ8Px/i/eU5E/4BY=; b=OC11cdw2TJCTgbJbNVMwLLNPUdt6NCavxvMKXMPM9h/UwR01zQ5IEC2GrXrKDUxOLvmQdU Ex+2+KlDvA7R3wtYICBiowugld6swUWeLlWKbPY2JXH/3v+5dFZNYa2SoYarLh9f1J+YYi qi+kFkDPEc3W5uNPjkaZbqyRFPEwjysqFJp8ckuM5lAmjtmivTGlc5W/Cs8bBs2Vba0/9R OR2Zd7UlHM9a4qu5WW6nfczF5H3cF6QUs7lnqvInL9EIzsW3FS5GjLU0W3N25hY9nMRI5Q P0J6vJm6/7msZRFifxpfTakjOvSy++0kgFG6NvfnbWlCWjfnEEMLl2h2S+lLVg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:06 +0200 Subject: [PATCH v2 13/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-13-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 d522f4869c94..fa61f62c1c93 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 13:18:35 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 5B0364279EA for ; Fri, 31 Jul 2026 12:03:09 +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=1785499393; cv=none; b=tMQHyoUCfDEZGsttc7K7AU6KH/F20fKwFkIafYpb2TwVW7BuJQxZEwrhzwBm6SZS9FybC/mWsgisAJm9K6pGZJ1CGj2OC8fFI4KKwj15Ji4iJSAJVYkrzn0Fy4Ovt3FVpMGVxn0jg+u8X26w3id6cQ2ZG+EZULb/5jyMNZZTqvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499393; c=relaxed/simple; bh=J82Yy0J0MwhrcPgaiQ2RcU3mCVNIUtEEuBKIf18Z6sY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XNt/+Nf05JtvD773Z9bJnLF5hXc0V6sEbiAcxN5mjWoDva2bimrkWPv9Bt7v7Mgo9hxlgJjM6zVrBX5DeZCJ9wGrv1LUk9+fqGjP5joVZWpzwdeQScQfiPkiC7+2FAU2iqM26MGu1UB5VpAjLwgQIscWvJsgys7wQHIDrI6ZoLU= 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=azNSYY9h; 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="azNSYY9h" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id CF7A84E4104F; Fri, 31 Jul 2026 12:03:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9DC316039A; Fri, 31 Jul 2026 12:03:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C2AD911C167AC; Fri, 31 Jul 2026 14:03:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499386; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PRNXUGVx7EeToOpKDpJI9gf5EX1tAUlkNnDOTszGe3c=; b=azNSYY9hPhPxNSBPzcQVWIvJ8AAzlur4UIzRy7fHu8gGsQiYesOJTjrHQooygp8Tcq8sYB 8z00a1VbxImbu61odQynHA71XU5XMHEpF475e/XH8CWFXNm6gn93iN4khlWlpNm5kkxlKN PRukt9GsIU8/OtQ0AtwEGrYqnjzk9nTOFJpc8Ut66vRuq6qu7UFTU83/Zyp7saoODWedHz D8P0f1kHT13ZgVlqWzSzJNvulsdJTHgBuP/br/sMqOlMeOSBa5/wh1pHZR4tPhVoYFGa6b ywCD14U0FvjmDNggYYMqXgpdW0AdVuX+Dpo09op9rMu8of+Q/MpM9/RKzI4amg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:07 +0200 Subject: [PATCH v2 14/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-14-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 fa61f62c1c93..7c31d1e58e04 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 13:18:35 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 C4E1841A4EB for ; Fri, 31 Jul 2026 12:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499394; cv=none; b=Wzz9YLTti4or/vGrDwiDINolSBn4/cJ43CGnEMPTBIkzvsE9s3dGAX4+iKK1f5rXt+2GUy99SUAOkcVx7SCptynKTkIgh9NWsZsY2rIY5uDJdVkkTI0SVRFKdUz8Q3l5NXTsS1u7PsX5yn2stEGeY885HXprQ0defBGOK/c09Lk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499394; c=relaxed/simple; bh=705Sjyd3rqsPlIAKMESYTnkxSSnWq3DGvElU4IdrY20=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kVBygfSM3dsk9AfcpslsCKJUHZXejRBUxo3cjbNhpPi9pXbFVUI2DS58oKNVa3JlqN6plxZv1NvACQscOOWciO4jPlFQhMX/3zfPGSic5IrCceh4Ptwhj8IashzLR7N39V9FnJfVxr9o5g5ANcrwP8ynCTGpQYW1scUvV1phx4c= 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=LPTIz2gd; 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="LPTIz2gd" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id DE41D4E41050; Fri, 31 Jul 2026 12:03:09 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B404D6039A; Fri, 31 Jul 2026 12:03:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 78F2511C167AF; Fri, 31 Jul 2026 14:03:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499388; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=e9ZTD+RnVly1gTVJ/GwnYIz2PYw72b8WE2ojPbqKrt0=; b=LPTIz2gdr97Ua31zIDNpiRDMrBnZjOXaVYMVkWCBzLMwy6F8nfHxmsnUhEQ0rWJNE5HHLK Sz3IocbrJu30bfz9AUXc2BgoUmFZDzlkTf0347Gwr1ppZTq2M652sjRQbBq4/AHKhPyot8 IFwmNXkEbP6pnPusA+eHJKFL1+SMP9KLMFhjD2IB126x9aXqAO2NnrIcAB4BxOapo/iikl e7A+PLfF9OfzSDzLK70kfNZlRtAU88DJEZtbp7W4rPMJEGf4gs6hsSKYes70hNJCI5nzz+ OSc9xsxWb0oyYkFJDU9VxqTHcgwxy+zP+M2hj9x/mEeTwpoeYA/rbg+gDeWPCw== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:08 +0200 Subject: [PATCH v2 15/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-15-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 7c31d1e58e04..75d12b068b61 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 13:18:35 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 A484A42C4FF for ; Fri, 31 Jul 2026 12:03:13 +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=1785499398; cv=none; b=TXw4Pn6AB7SM0UHJEGUhsmuyZuEOtwLVzUEVc5S075DNgSCjcIzROKdFLbVb2O/n07GNytl+mYQb0sQjU2kYIWi5iQZfsY4WUCT08kg52tsRvPUEOybuWjqKWFsJgVdJkJd9xhflnju/fNFT1ojcaOmmxjqC0/9ij9b470CYwFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499398; c=relaxed/simple; bh=oZ5oPwbk8KLa6ubTPZguw5rZ3F5+k6EYytaFuY6lfvY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s5p1n590oo/hGc0GO0ry+xMq7dcEwKcn8pmxQlyHt+LeUf3LnvJPXtaMEMospGS3tEAc251jBAI2sOj5o3juR8mESrSHrXSYRq2u+jMGCngXtEu4VWlNt15LHNO6HkVoFJPTPyYolqarUdwO6kh0lG4ukxjrRhSdtEMSk5XyzZQ= 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=MAl8hcWV; 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="MAl8hcWV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 883C41A135B; Fri, 31 Jul 2026 12: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 5E0A46039A; Fri, 31 Jul 2026 12:03:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 810DC11C16798; Fri, 31 Jul 2026 14:03:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499390; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=tCzt7YFDH3JsORWxV1APobLr/lAoK2YibuRX4cWsFKM=; b=MAl8hcWV9+tVHRtG1Lyuzb6u3WsrM5tDZkAcnea2NH0SfWWR2vvNMU5STO1MEFbyzoTxKk D5rhxVFwjD/K5CWkFjGiUR16z6MD2RO+16IvsGSHXTSLvjkFiquwaQJQEKxarM9XgZELFY ZW3q46hSSaPbV/3I+ZqTQYO9CLqwodhhfwZISLBRBUKmO6d19Q7kVICed1godhVan5HriZ rBBTKfK2PZLt5+Vij7puq7jrPSkW0tsZKJ0XsEYz0IyvqcXg2OOpN1a6s+lrBpTZUKkd4i t7hokAZdEy7cpCEh1GpCUv6cq6cpImSki2XERk07C8YahBtMjb/qYuzW9C1+Zw== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:09 +0200 Subject: [PATCH v2 16/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-16-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 75d12b068b61..d7deddaee670 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 13:18:35 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 5493342C515 for ; Fri, 31 Jul 2026 12: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=1785499399; cv=none; b=AtXSHReROVfAk2vHb5msnOubxou6o6P2XggtyE7EBv0dQMd9rDEkJrWIgd6QZ82Bo1nbgeHOKSa18UYV8N055jR51GCdhsaejblzbmN89oveOYK2OItOB1JBJHxcXQjK91fzg1NBSOX2HStr8dX1R4yRKa+fwJvUh5c3lPnH334= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499399; c=relaxed/simple; bh=+295kyDFRlEmXcUM1kIWBMIetTWdfBK23giVd/Sni+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aegsAMaH2Hq7LIx9O7dF+X81HyAqtAkix/SSktx2Kbb/UwDpEpZl8Vqjyk35vJoeKC1CeWx1baBgb2PIPnl34N1nH8F7ZITl0LNEyfIPyUiTdnKitKY2Mb5Uo1pkwJIJYko9eG97iYCDo5mA8u4BB2gxAlw4iLE2OFLL6xtQwIc= 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=s5scTSw6; 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="s5scTSw6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 1B2684E41053; Fri, 31 Jul 2026 12:03:13 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DEDDE6039A; Fri, 31 Jul 2026 12:03:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 43F0C11C167A2; Fri, 31 Jul 2026 14:03:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499392; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=LnXs9mkhUNjLNu7rd9LLP2CMK0zMHHm3J2A95VXY3bQ=; b=s5scTSw6HyPb3h3wzIpPbQ/6kL6EVI++tSySiMCDSa1y+5pIyIq4eVpEPwXD1f9tr3gGvG KfXBFRVuzj+e98o7rkk4VmkjORmvRJ6Hd79KUuzxWGcQ/43ZQaNZF6WiEvYzp7Nn1Z71pT 6f2LYXD41T9ff5ciUHN3Uf2kovRKUJBMnC2EJFLXftpbbpty7zm5hfHVO1vl6IYhTujRpF 10Xmdy1KXTFDEG9HRvJlsZ1EnnBqVKqhCFvyRwymZIiESzuMqwNiKDIyNvg292KE8DX+5t W8CDYbkG0dzgEEnpWy1TADeUZssO3Hlnfgd09rKMTcx3ecOdMJvokw7xOXTvdw== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:10 +0200 Subject: [PATCH v2 17/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-17-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 d7deddaee670..556a56a799b5 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 13:18:35 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 8C92A42B300 for ; Fri, 31 Jul 2026 12: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=1785499400; cv=none; b=rLvbDNQ+roVWJ7l0mxAmjHFjTORapVIpzLMz59bzV4TLf9rKX6/1ntfI81BuYxgwsBAuSnYWTl8fOs3lJifhdQli9AA0tcETEYCfMtxr3ev03yFRFE0hSXSxsxkZPp3U9WWY7TEQErvtxDz9V/EAZBqPd9/bxQfcbLueNqYSH6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499400; c=relaxed/simple; bh=x7V92p9ASj6J+Z7U3trVTIKPCWFB4UIR6sotlGmpC24=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CySCn4MM3iHKta9/0mvtZppzh4LMWjTwgJbmEyUdNJFAlT3R5MJp5eBms+7MBoVpzaG2DtVwnSxKCoZVRDpVH5z9yrd+3KGabgVinl9RuHJ/fVc3+41bQLiHVHRf3H+3Yh0Mj8ej42ZS3ha61C87HgMxJr1/HF44HDrI1R/4MMw= 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=GYFoOTg9; 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="GYFoOTg9" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C94361A135D; Fri, 31 Jul 2026 12: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 9E8846039A; Fri, 31 Jul 2026 12:03:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C4CDC11C167A5; Fri, 31 Jul 2026 14:03:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499393; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=dwT5Xj6WuzEJQtSSuhD85+z6AHHKqKy/XXFjEzGiyfI=; b=GYFoOTg9Y4TZSUeT16xi7snA8fXMU1pl7qfDJ4VJ+DmdRiv9n4zJErun2KuBdrG5oCx1tZ AX0Uz4mP8DtjdwBVQPQcw6gN6RYyyTd7S/VxuFIss3a91/WZTPs6N/5hx9Fs6RoodEZbFI jM3LslWZA7P5PgLV1PyaB/fvsxp5ZXX1Klcnq6Mwam5BFDr/dyvYla2NHGXgyNm1OqTNGX p0/0pQ57YYpWJmkT9w2gCPQe2ng6he08H8OaexMj/8+0APCAYOn3vpMAXEKnvGxYduKQzb DuiVoysXP7FL3KYY+NOEh/kRzLU/QPrn3w8Z7/GT4JtodtZWNVTP8ftxf6eerA== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:11 +0200 Subject: [PATCH v2 18/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-18-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 556a56a799b5..55b396c9a2d6 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 13:18:35 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 CB7B240A92C for ; Fri, 31 Jul 2026 12:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499403; cv=none; b=YwXWcym7TeUwUmgYtqbX2I7HsP8gWmcNTumFRQEcmxHResvB+RHo7yU3EnMKUtp+DroBOBd4jdgp2ubR8oGpNea/kO5kCwTqlNR1+54dydtVeDxWUH0OHFyNtMv3xaNZ1fCzK3IcqTjxEs+N8AEuufASqwV/qzlHBqHCODw+Lpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499403; c=relaxed/simple; bh=Xvt+9JgXF52cBmiOLHyRkpKGVs97G0Oh80vgXm+bMKc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VHUA67cA2uQKVzF9MTrXc6lGkIVTLRA0YHFrztqVpxfscgFZ/IGDCMMtSohkAiM4TBxCEZidTjz/RhlqfDMdbVB8yvgnxv57mTu24+6MSudwyBZgKYgBsVJgCqAJW1O49q4FJHJ2lkuYJ2cw6u7Ssv/GnSpOR0XqA6YL1la+3Wk= 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=I2mGfq0o; 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="I2mGfq0o" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5843E4E41050; Fri, 31 Jul 2026 12:03:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2F20A6039A; Fri, 31 Jul 2026 12:03:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 80AA211C167AD; Fri, 31 Jul 2026 14:03:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499395; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=5Gh/iBkvMfvGFhzY2NR2EK2wYZyaZiHi461/fBbj2ck=; b=I2mGfq0oVJdV3gko/xcbgm37+zZ/TcDVzYFXrk4BpoTTtfyQBJCC2TGSlBBfDM4vftjwUV wNM3exNKBjzAavWf5ao+uDvnp9d3KoLwpbbN8v2P3UygB1qjg7E8+xZhKSfurW9oMO5TQm lSs8LWgsJ3a5NWyH68ngUrFHTarv00Z7CuWpn/W5nMP7/T/g3CP0NdV2laHoI+d/w1B2KA LbAbPbHkqLA6fLEKy2CUDIk4VqfwSlgfwv6vYaWUTgRTqrjnNwT+44ujVTdHz9waW+n0Co HE7mLKo+BLP/WMJXWW5PEr4dS6k7Abois5DBCLMYbCa16AFhwaPf7GdzHbRLyw== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:12 +0200 Subject: [PATCH v2 19/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-19-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 55b396c9a2d6..02d599fa392c 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 13:18:35 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 3AC80412C1D for ; Fri, 31 Jul 2026 12:03:20 +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=1785499405; cv=none; b=Uqltc8m9/+if2vKEQVqeU53CUroTgPpGmGfRJzR6Hbfl5VM9nwJojJwbVxV0zDYNzUio/6HJg8GoFCsBUO6RL9aawoe14JOn8FNrmOESTV+HKcJYz3u6h7eIu7Jvscvf2WN0JrmsYvDRxWDJRDjDpKIpc9hmkqQFkVe8wcug9fA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499405; c=relaxed/simple; bh=5KRvsDBcd1QBGGNcLgLVNDlzaeKr49X9PRWXftiU05k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nJlCzGlusJL3flNbmGZeF75WPq0MNA4fQP0BdqsYcXnCVsbGb0zvCoY0qzMBO8mh/fqEB966BiPqEThn+Wd/PWZVh0YIeNeZVv5NQAlZVSAdRiybzS+5NjoFcbNETkP/rmdvgegFr8Sm1gosWWF7vFO9hpq7ddD+id5DGe7mNMo= 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=eKYVaA7q; 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="eKYVaA7q" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 1C74C1A1360; Fri, 31 Jul 2026 12: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 E2CF86039A; Fri, 31 Jul 2026 12:03:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 14EDE11C167A4; Fri, 31 Jul 2026 14:03:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499397; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZSwBRKSeEJLmPRZqDrouIl1j9KCipSpF16hLIOCCLWc=; b=eKYVaA7qavNWCELayaw6GUqrKie4tUtV+6Pm2qXzUKzTBeDIZUVNMrP3/z2VuSfucf1jNv Fl13FAwN4NEAbr+Yt5QuZOiMzVB9oRVNAVPQatjvOTjUfVXXXDEGCRRExdj1zzJjjhCLoY 8AHXhbbTr8cQl8EYl5hbVeJo8sGB6eRYKN2CciInkemCteaAGXAoi4J48grCvD8YHsHuth jYZPiIAq7iZhV5q+q+o1irRMRGSuHIE6wvSbp950kzPpthozKspkSguuMa0QpppSpLVxaA PAdP1dRKAyLZh8BfUBfGQrsJX3BG/9NKoX6wRaxKJyn0UUOKX+PBYWr9nU+5eg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:13 +0200 Subject: [PATCH v2 20/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-20-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 02d599fa392c..73f6c26f81d7 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 13:18:35 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 CDF5042E8FF for ; Fri, 31 Jul 2026 12: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=1785499405; cv=none; b=FgCcx8WIx1qXpDD2ZKgoZ8Fn9NZiEBw+KcQQp+rIZwWWyJ7STf/U/omdLnWBOtN2xG355LHDlDsmxvgQgFBwBkKhgRgoL5vjnXkd6vCJ369MQwq4EMudmM+gdS8+BnLxqo4dGCqduy4zukOP2q88bwFe2NEqQUi+r5Zri08vtA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499405; c=relaxed/simple; bh=RkHerGEaMS21xJvTp5snRpofw5VRieBW1gQX4RLq+NY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q3/U701Pk2U7s3igrXuL8jjwtQ9dV1tPVgeZgvAQdR+9cR6vC1l5OrTICLz0UtCiPodJ78yVu9xEzHi0FkKDL8XcmVwzu4bJo09mzb9i0GHvUkMJioni0DHO0DS+tm9AggROY2PenIMxaoDS+Qgrm5xAOqqO+cddQh+AMXPkw/0= 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=UzL/79FE; 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="UzL/79FE" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 33D5D4E41052; Fri, 31 Jul 2026 12:03:20 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 033C46039A; Fri, 31 Jul 2026 12:03:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CB25711C167A6; Fri, 31 Jul 2026 14:03:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499399; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JM1R7ASx3L+nNtBQQ0JAlnIStLMKyGGuZzojRmGSwPQ=; b=UzL/79FEfokh/qhWUsnutqpjyxCaKfw2f9gVBKfe3kubisOA7DU/3TC/0R4fkGOCJwScGR F//FiWayItHg+x5jjce50cCYft0SVfccbfLBH8e433Y7/1195l3Zo0La+wwuSpve9aOFR1 wOup3o1+h+1yypWnCotWpW3V4eW8Fjj4kgehn9UH84IBKBp0e1xERd84jCxdg2qQ3MXv51 RicCCFJeIRn/E2mbUFQRjzWLa/PWf4nLudiWH9AFomqeRaOMpcY1fEtN7DJcgsE5dL19vK lO4AibWRjN3YasbH40dnT9sA5D3JX0xAVm3xzEwlNZe6KbrYQaNH44jNzn3Tlg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:14 +0200 Subject: [PATCH v2 21/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-21-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 compatiblity 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 73f6c26f81d7..ebe5c2474234 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 13:18:35 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 BDF5B41DEEB for ; Fri, 31 Jul 2026 12: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=1785499407; cv=none; b=JVM8/3jXfFfnWZ9SXmEZ90KjmjGkfebx4ZYHZvfWvo8UkyUS5keBZn2aMqcZUU/5p1rNXN9iKK0s+ZyYBgjrFcDHo6s9jii+6zFtXRubtV9wpjCiJmJ19ipPvVXRYcqlijgD/jjGSQZNUNrzv2xvXts1kOdxEVDtrgoGjq2oReI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499407; c=relaxed/simple; bh=yJ8V+WP0T/4vsAuLkddEEGPOa4QAGvrhtG7IsbrMnbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XAyg+IOywCxKCoxmEI9tPksoTDfchlG5+W18Irp4sxMHPkspJOfqZeKSOChAopSJigW+m8mQE0Nf5DyJniopjM/ctDqZyKiHZYLDozrsuL4rPYvOz0E+0cS/pg4R4MGnmd0MNYkcRL8fwUYRNI+5+fX7+h+vr/gJKGMQzDujVnU= 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=M6bfRc1S; 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="M6bfRc1S" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 1260A4E41053; Fri, 31 Jul 2026 12: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 D44B26039A; Fri, 31 Jul 2026 12:03:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DE07411C167B2; Fri, 31 Jul 2026 14:03:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499401; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=oB6mdTU9BlEY7P+wosH2fHvlGfLsbWN++3ndCO6CvoM=; b=M6bfRc1SQ1wwm400QTOfM3XPo3V/lCj/B4CRtA8OUugo0nXGUoa6oLOquojNT1v+PLiEjn zjRHqK+geQ3HcwOXNmAGCubThSRd9vwpqcrglOa76VRBsTZMiBKgIIy+uC89z5k/IKrHYP ZwRqDf9623HzbNkVU8YXZrda4GYdXFbJm44bTJJ0Vc8bfgsZKZdgII/8HJJiPjLeq8faEP rUbnhGX5iQ20Iuak2rmzvXNao82oS84GqMdFhUC4VOj6C9sLPUeGAngzpRHNUQ3rQF+sbS nOqJBL/k6/lZ5GS9W0zH+3ARjfao5VaUqSoNl6c3+GFIRViQIAcYyHVpxR89jg== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:15 +0200 Subject: [PATCH v2 22/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-22-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 ebe5c2474234..29cf8dca4693 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 13:18:35 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 64707430CEE for ; Fri, 31 Jul 2026 12:03:25 +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=1785499408; cv=none; b=LBTrO4b9chiuizvLZFGHwVqZNmuRJtsrGnjooN4kDFALcnq/9PHc7tsFCOmNtvvuzw+BhIDgMYpLiVZVLJnJI0hod0fkZTBysm5kabRAkX99dVzlwfkG40tePvvjOynv28t9e1UVhLTM0F6w1Wxw58a/FGfrzoAYd7Hs9HvSJHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785499408; c=relaxed/simple; bh=npwt4Y2t/7GUCHBOAJZTd3RWkmiOL8nGb9m4G4O9zns=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I4cIuFFyYUGy7hzOUAEpGWkTttfzdmky/+oNJvJ1iaS2UlFeMAifW5ytI2Rtc3FZ7fuiSUOVLW/Eba0LvluaeRlBkpHDRJQwiKRUsk4Gqat84p+nxzTcurGxzWpV3SVrsNHc0uQ7n8E1fZSMcaGf/qD0DMXhDJBlKJCXXVs4Jz0= 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=lTIXA6nP; 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="lTIXA6nP" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7D55A1A1361; Fri, 31 Jul 2026 12: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 4B7B06039A; Fri, 31 Jul 2026 12:03:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BF2F311C167B1; Fri, 31 Jul 2026 14:03:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785499402; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OX8EZy1APjBtKHLNfghqjdhU8PylOf6MHcYFTyN1/1Y=; b=lTIXA6nPxjK7k6ZlBKJfhG3ieq/br/Lpvt8U6+u2x/w4c2fqLtiu7sao32/Ck1dP0+p6jQ u+wrDWj4a7F3bgZTlCpUWoz2fsteT+qKkeU0oqSkbz+SfpzHfECK7uqGOID61NLi69G3GA 9KfkHGb9muPqJ6qIXSo75x2dSrsXH+oC2vC7JXblip0J7kxF/gM8VPZ4ki2tIqd1Mwcf+N cwQChCDgp2JXD23SGBnjSBnyG+YV/Nw07TSWjB2ViusZqGDpy0atsLPhFwF0IoOfZjHSim C+EEH0C6ZtV1+wGHTTD/vM9NIKZM2e8vruMQkxe2otyZQroGWin3GmNVbPRDQw== From: Miquel Raynal Date: Fri, 31 Jul 2026 14:02:16 +0200 Subject: [PATCH v2 23/23] 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: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-23-2549ef1b1af8@bootlin.com> References: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@bootlin.com> In-Reply-To: <20260731-winbond-v7-1-spi-nor-jv-cleanup-v2-0-2549ef1b1af8@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 29cf8dca4693..5a0f30ccf171 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