* [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family
@ 2026-05-29 15:22 Miquel Raynal
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
` (30 more replies)
0 siblings, 31 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
Thanks to Winbond collaboration, I was able to test almost the entire JV
SPI NOR family. A few chips could not be sourced, I decided to apply the
very same logic than the other chips, all of them behave identically as
shown in all the logs that I am sharing in each and every commit.
This series is pretty straightforward, it is here to cleanup the JV
entries by:
- Removing the useless part names (which are going to become a problem)
- Aligning the comments and "fixing" the chip names in them
- Reordering the chips by density and family
- Testing and showing all the SFDP content and passing all the SPI NOR
tests to ensure a good level of support.
- Describing only what needs to be described, parsing the SFDP tables
otherwise.
- Adding all the locking information when it is missing.
This work is necessary because I am about to propose the addition of the
W25QxxRV family, whose IDs actually collide with the JV chips. The chips
are similar, they have been "improved" (especially the silicon/engraving
smoothness) and we have a way to differentiate them based on their SFDP
content, but that will be for a following series.
NB: There is one collision with a Spansion chip as well (S25FL064K). On
my side I commented out the Spansion entry to make sure the core was
taking the Winbond entry (by alphabetical order) but it is due to an old
joint agreement and is a legitimate ID duplication. We haven't found a
good way to differentiate them so far, so I am keeping this aside for
the moment and just assume we will have a solution later. In all cases,
the colliding Winbond ID exist and is already fulfilled, so let's make
sure the definition is accurate.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Miquel Raynal (30):
mtd: spi-nor: winbond: Move W25Q01NW to its right place
mtd: spi-nor: winbond: Normalize names
mtd: spi-nor: winbond: Stop filling the .name entry
mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide
mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data
mtd: spi-nor: winbond: W25Q64JV-Q/N: Drop redundant data
mtd: spi-nor: winbond: W25Q512JV-Q/N: Drop redundant data
mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability
mtd: spi-nor: winbond: W25Q64JV-Q/N: Add quad page program capability
mtd: spi-nor: winbond: W25Q128JV-Q/N: Add quad page program capability
mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
mtd: spi-nor: winbond: W25Q64JV-Q/N: Fill locking information
mtd: spi-nor: winbond: W25Q128JV-Q/N: Fill locking information
mtd: spi-nor: winbond: W25Q512JV-Q/N: Fill locking information
mtd: spi-nor: winbond: W25Q01JV-Q/N: Fill locking information
mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data
mtd: spi-nor: winbond: W25Q64JV-M: Drop redundant data
mtd: spi-nor: winbond: W25Q128JV-M: Drop redundant data
mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability
mtd: spi-nor: winbond: W25Q64JV-M: Add quad page program capability
mtd: spi-nor: winbond: W25Q128JV-M: Add quad page program capability
mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information
mtd: spi-nor: winbond: W25Q64JV-M: Fill locking information
mtd: spi-nor: winbond: W25Q128JV-M: Fill locking information
mtd: spi-nor: winbond: W25Q02JV-M: Fill locking information
mtd: spi-nor: winbond: W25Q512JV-M: New chip
mtd: spi-nor: winbond: W25Q01JV-M: New chip
mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data
mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability
mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information
drivers/mtd/spi-nor/winbond.c | 147 +++++++++++++++++++++---------------------
1 file changed, 73 insertions(+), 74 deletions(-)
---
base-commit: 361a4eb81d0bb23dd27919f969e14a4a372af6e2
change-id: 20260529-winbond-v7-1-spi-nor-jv-cleanup-817889edd1f7
Best regards,
--
Miquel Raynal <miquel.raynal@bootlin.com>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:54 ` Michael Walle
2026-05-29 15:22 ` [PATCH 02/30] mtd: spi-nor: winbond: Normalize names Miquel Raynal
` (29 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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 <miquel.raynal@bootlin.com>
---
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[] = {
.id = SNOR_ID(0xef, 0x60, 0x20),
.name = "w25q512nwq",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
+ }, {
+ /* W25Q01NWxxIQ */
+ .id = SNOR_ID(0xef, 0x60, 0x21),
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
+ .fixups = &winbond_rdcr_fixup,
}, {
.id = SNOR_ID(0xef, 0x70, 0x15),
.name = "w25q16jv-im/jm",
@@ -365,12 +371,6 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x80, 0x20),
.name = "w25q512nwm",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
- }, {
- /* W25Q01NWxxIQ */
- .id = SNOR_ID(0xef, 0x60, 0x21),
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
- SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
- .fixups = &winbond_rdcr_fixup,
}, {
/* W25Q01NWxxIM */
.id = SNOR_ID(0xef, 0x80, 0x21),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 02/30] mtd: spi-nor: winbond: Normalize names
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:57 ` Michael Walle
2026-05-29 15:22 ` [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry Miquel Raynal
` (28 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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=1) 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 <miquel.raynal@bootlin.com>
---
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[] = {
.name = "w25q512nwq",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
- /* W25Q01NWxxIQ */
+ /* W25Q01NW-Q */
.id = SNOR_ID(0xef, 0x60, 0x21),
.flags = 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[] = {
.id = SNOR_ID(0xef, 0x70, 0x19),
.name = "w25q256jvm",
}, {
- /* W25Q02JV */
+ /* W25Q02JV-M */
.id = SNOR_ID(0xef, 0x70, 0x22),
.fixups = &winbond_nor_multi_die_fixups,
}, {
@@ -372,28 +372,28 @@ static const struct flash_info winbond_nor_parts[] = {
.name = "w25q512nwm",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
- /* W25Q01NWxxIM */
+ /* W25Q01NW-M */
.id = SNOR_ID(0xef, 0x80, 0x21),
.flags = 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 = SNOR_ID(0xef, 0x80, 0x22),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
.fixups = &winbond_rdcr_fixup,
}, {
- /* W25H512NWxxAM */
+ /* W25H512NW-M */
.id = SNOR_ID(0xef, 0xa0, 0x20),
.flags = 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 = SNOR_ID(0xef, 0xa0, 0x21),
.flags = 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 = SNOR_ID(0xef, 0xa0, 0x22),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
2026-05-29 15:22 ` [PATCH 02/30] mtd: spi-nor: winbond: Normalize names Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:59 ` Michael Walle
2026-05-29 15:22 ` [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Miquel Raynal
` (27 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This is a legacy field, it is often incorrectly filled and will soon
become very incorrect due to IDs being reused.
Replace the names with a comment above the entry with the newly instated
naming scheme to indicate what chips are covered by each entry.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
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 | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 03e59ff3228f..b4088fc5fde9 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -218,36 +218,36 @@ static const struct flash_info winbond_nor_parts[] = {
.size = SZ_1M,
.no_sfdp_flags = SECT_4K,
}, {
+ /* W25Q32JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x16),
- .name = "w25q32",
.size = SZ_4M,
.no_sfdp_flags = SECT_4K,
}, {
+ /* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
- .name = "w25q64",
.size = SZ_8M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q128JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x18),
/* Flavors w/ and w/o SFDP. */
- .name = "w25q128",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = &w25q128_fixups,
}, {
+ /* W25Q256JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x19),
- .name = "w25q256",
.size = SZ_32M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = &w25q256_fixups,
}, {
+ /* W25Q512JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x20),
- .name = "w25q512jvq",
.size = SZ_64M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
- /* W25Q01JV */
+ /* W25Q01JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x21),
.fixups = &winbond_nor_multi_die_fixups,
}, {
@@ -285,54 +285,54 @@ static const struct flash_info winbond_nor_parts[] = {
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q128FW-G/Q, W25Q128JW-Q/N */
.id = SNOR_ID(0xef, 0x60, 0x18),
- .name = "w25q128fw",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q256JW-Q/N */
.id = SNOR_ID(0xef, 0x60, 0x19),
- .name = "w25q256jw",
.size = SZ_32M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q512NW-Q/N */
.id = SNOR_ID(0xef, 0x60, 0x20),
- .name = "w25q512nwq",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
- /* W25Q01NW-Q */
+ /* W25Q01NW-Q/N */
.id = SNOR_ID(0xef, 0x60, 0x21),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
.fixups = &winbond_rdcr_fixup,
}, {
+ /* W25Q16JV-M */
.id = SNOR_ID(0xef, 0x70, 0x15),
- .name = "w25q16jv-im/jm",
.size = SZ_2M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
- .name = "w25q32jv",
.size = SZ_4M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
- .name = "w25q64jvm",
.size = SZ_8M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K,
}, {
+ /* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
- .name = "w25q128jv",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
- .name = "w25q256jvm",
}, {
/* W25Q02JV-M */
.id = SNOR_ID(0xef, 0x70, 0x22),
@@ -343,33 +343,33 @@ static const struct flash_info winbond_nor_parts[] = {
.size = SZ_64M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q32JW-M */
.id = SNOR_ID(0xef, 0x80, 0x16),
- .name = "w25q32jwm",
.size = SZ_4M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
+ /* W25Q64JW-M */
.id = SNOR_ID(0xef, 0x80, 0x17),
- .name = "w25q64jwm",
.size = SZ_8M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q128JW-M */
.id = SNOR_ID(0xef, 0x80, 0x18),
- .name = "w25q128jwm",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q256JW-M */
.id = SNOR_ID(0xef, 0x80, 0x19),
- .name = "w25q256jwm",
.size = SZ_32M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
+ /* W25Q512NW-M */
.id = SNOR_ID(0xef, 0x80, 0x20),
- .name = "w25q512nwm",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
/* W25Q01NW-M */
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (2 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:11 ` Michael Walle
2026-05-29 15:22 ` [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data Miquel Raynal
` (26 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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 <miquel.raynal@bootlin.com>
---
drivers/mtd/spi-nor/winbond.c | 37 ++++++++++++++-----------------------
1 file changed, 14 insertions(+), 23 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index b4088fc5fde9..4300f0419f13 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 = {
.post_bfpt = w25q256_post_bfpt_fixups,
};
-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 &= ~SNOR_F_NO_READ_CR;
-
- return 0;
-}
-
-static const struct spi_nor_fixups winbond_rdcr_fixup = {
- .post_bfpt = winbond_rdcr_post_bfpt_fixup,
-};
-
/**
* winbond_nor_select_die() - Set active die.
* @nor: pointer to 'struct spi_nor'.
@@ -305,7 +285,6 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x60, 0x21),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
- .fixups = &winbond_rdcr_fixup,
}, {
/* W25Q16JV-M */
.id = SNOR_ID(0xef, 0x70, 0x15),
@@ -381,7 +360,6 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x80, 0x22),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
- .fixups = &winbond_rdcr_fixup,
}, {
/* W25H512NW-M */
.id = SNOR_ID(0xef, 0xa0, 0x20),
@@ -397,7 +375,6 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0xa0, 0x22),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
- .fixups = &winbond_rdcr_fixup,
},
};
@@ -490,6 +467,20 @@ static int winbond_nor_late_init(struct spi_nor *nor)
*/
params->set_4byte_addr_mode = winbond_nor_set_4byte_addr_mode;
+ /*
+ * 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[0] == 0xef &&
+ nor->info->id->bytes[1] > 0x30)
+ nor->flags &= ~SNOR_F_NO_READ_CR;
+
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (3 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:13 ` Michael Walle
2026-05-29 15:22 ` [PATCH 06/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
` (25 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table:
$ cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id ef 40 16 00 00 00
size 4.00 MiB
write size 1
page size 256
address nbytes 3
flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET | NO_WP | HAS_SR2_CMP_BIT6
[...]
erase commands
20 (4.00 KiB) [1]
52 (32.0 KiB) [2]
d8 (64.0 KiB) [3]
c7 (4.00 MiB)
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
ef4016
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
winbond
$ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450050100ff00050110800000ffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520f9ffffffff0144eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14c2e96376337a757a75
f7a2d55c19f74dffe930f880
$ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
e002d5482ce24cecf678c171745e3e90b7fb6cb588739ca63151ed333b09b35a /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
$ cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id ef 40 16 00 00 00
size 4.00 MiB
write size 1
page size 256
address nbytes 3
flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET | NO_WP | HAS_SR2_CMP_BIT6
opcodes
read 0xeb
dummy cycles 6
erase 0xd8
program 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
register 1S-1S-1S
erase commands
20 (4.00 KiB) [1]
52 (32.0 KiB) [2]
d8 (64.0 KiB) [3]
c7 (4.00 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+---------
00000000-003fffff | [ 3] | no
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-003fffff | unlocked | 64
$ 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
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 4300f0419f13..524c4ae565c2 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -200,8 +200,6 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x16),
- .size = SZ_4M,
- .no_sfdp_flags = SECT_4K,
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 06/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (4 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 07/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
` (24 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table:
$ 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 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
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
$ 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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
ef4017
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
winbond
$ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450050100ff00050110800000ffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14c4e96376337a757a75
f7a2d55c19f74dffe930f880
$ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
ad4c59a94e6205cf237f8734d01ca45d67d34ed35404b364595ff420b6259d32 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
$ 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 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
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
$ 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
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 524c4ae565c2..738303821857 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -203,8 +203,6 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
- .size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
/* W25Q128JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 07/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (5 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 06/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Miquel Raynal
` (23 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table:
name (null)
id ef 40 20 00 00 00
size 64.0 MiB
write size 1
page size 256
address nbytes 4
flags 4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET | NO_WP
[...]
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)
[...]
$ 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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
ef4020
winbond
53464450060101ff00060110800000ff84000102d00000ff03000102f000
00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520fbffffffff1f44eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14e2e96376337a757a75
f7a2d55c19f74dffe970f9a5ffffffffffffffffffffffffffffffffff0a
f0ff21ffdcff
f41674a6c3742a42d31d3007d4d4b725c166ddb4e4566d1c347d29ed29855ef0 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
name (null)
id ef 40 20 00 00 00
size 64.0 MiB
write size 1
page size 256
address nbytes 4
flags 4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET | NO_WP
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
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
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 738303821857..8fc74cba0ee0 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -220,8 +220,6 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q512JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x20),
- .size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
/* W25Q01JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x21),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (6 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 07/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:16 ` Michael Walle
2026-05-29 15:22 ` [PATCH 09/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
` (22 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ 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=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
$ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
$ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
$ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
$ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
$ sha256sum spi*
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 8fc74cba0ee0..7a8e3cbdd6a4 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -200,6 +200,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x16),
+ .flags = SPI_NOR_QUAD_PP,
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 09/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (7 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 10/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
` (21 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ 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=/dev/urandom of=./spi_test bs=1M count=2
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 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*
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 7a8e3cbdd6a4..6f496be03e46 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -204,6 +204,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
+ .flags = SPI_NOR_QUAD_PP,
}, {
/* W25Q128JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 10/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (8 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 09/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Miquel Raynal
` (20 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The benefit is massive @25MHz, yet this feature is not advertized
because these chips do not implement the 4BAIT table. Flag the quad page
program capability manually.
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 3047 KiB/s
page write speed is 2935 KiB/s
2 page write speed is 2962 KiB/s
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
+ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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 6f496be03e46..07ab66a9e6c0 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[] = {
.id = SNOR_ID(0xef, 0x40, 0x18),
/* Flavors w/ and w/o SFDP. */
.size = SZ_16M,
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = &w25q128_fixups,
}, {
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (9 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 10/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:21 ` Michael Walle
2026-05-29 15:22 ` [PATCH 12/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
` (19 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ alias show_sectors='grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0
/params'
$ flash_lock -u /dev/mtd0
$ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 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=/dev/urandom of=./spi_test2 bs=1M count=2
2+0 records in
2+0 records out
$ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
$ sha256sum spi*
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=$(cat /sys/class/mtd/mtd0/size)
$ nblocks=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*
unlocked | //')
$
$ bs=$(($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=$((($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 | 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 07ab66a9e6c0..e6dca2493357 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -200,7 +200,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x16),
- .flags = SPI_NOR_QUAD_PP,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 12/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (10 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 13/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
` (18 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x800000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=8388608
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=64
+ ss=131072
+ bps=2
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 8126464 4
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-007bffff | unlocked | 62
007c0000-007fffff | locked | 2
+ flash_lock -u /dev/mtd0 8126464 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-007dffff | unlocked | 63
007e0000-007fffff | locked | 1
+ flash_lock -u /dev/mtd0
+ 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] [--] <mtd device> [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> MTD device node or 'mtd:<name>'
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=126
+ 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 e6dca2493357..979ad8bacae2 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -204,7 +204,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x17),
- .flags = SPI_NOR_QUAD_PP,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q128JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 13/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (11 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 12/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 14/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
` (17 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the CMP locking capabilities of the
device, flag it.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ 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 two
$ 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 979ad8bacae2..3eb3f32e8b22 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[] = {
.id = SNOR_ID(0xef, 0x40, 0x18),
/* Flavors w/ and w/o SFDP. */
.size = SZ_16M,
- .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = &w25q128_fixups,
}, {
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 14/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (12 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 13/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 15/30] mtd: spi-nor: winbond: W25Q01JV-Q/N: " Miquel Raynal
` (16 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ dd if=/dev/urandom of=./spi_test bs=1M count=2
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=/dev/urandom of=./spi_test2 bs=1M count=2
2+0 records in
2+0 records out
$ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
$ sha256sum spi*
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=$(cat /sys/class/mtd/mtd0/size)
$ nblocks=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*
unlocked | //')
$
$ bs=$(($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=$((($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 3eb3f32e8b22..2e5b488818c8 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -222,6 +222,8 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q512JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x20),
+ .flags = 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 = SNOR_ID(0xef, 0x40, 0x21),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 15/30] mtd: spi-nor: winbond: W25Q01JV-Q/N: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (13 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 14/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data Miquel Raynal
` (15 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ 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/kernel/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_READ_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=/dev/urandom of=./spi_test bs=1M count=2
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=/dev/urandom of=./spi_test2 bs=1M count=2
2+0 records in
2+0 records out
$ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
$ sha256sum spi*
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=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.
*unlocked | //')
$ ss=$(($size / $nsectors))
$ bps=$(($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 two
$ 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 2e5b488818c8..f1c86d4ba216 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -227,6 +227,8 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q01JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x21),
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
.fixups = &winbond_nor_multi_die_fixups,
}, {
.id = SNOR_ID(0xef, 0x50, 0x12),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (14 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 15/30] mtd: spi-nor: winbond: W25Q01JV-Q/N: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:23 ` Michael Walle
2026-05-29 15:22 ` [PATCH 17/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
` (14 subsequent siblings)
30 siblings, 1 reply; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
ef7016
+ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
winbond
+ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450050100ff00050110800000ffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520f9ffffffff0144eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14c2e96376337a757a75
f7a2d55c19f74dffe930f880
+ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
e002d5482ce24cecf678c171745e3e90b7fb6cb588739ca63151ed333b09b35a /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
+ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities
Supported read modes by the flash
1S-1S-1S
opcode 0x03
mode cycles 0
dummy cycles 0
1S-1S-2S
opcode 0x3b
mode cycles 0
dummy cycles 8
1S-2S-2S
opcode 0xbb
mode cycles 2
dummy cycles 2
1S-1S-4S
opcode 0x6b
mode cycles 0
dummy cycles 8
1S-4S-4S
opcode 0xeb
mode cycles 2
dummy cycles 4
4S-4S-4S
opcode 0xeb
mode cycles 2
dummy cycles 0
Supported page program modes by the flash
1S-1S-1S
opcode 0x02
1S-1S-4S
opcode 0x32
+ cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id ef 70 16 00 00 00
size 4.00 MiB
write size 1
page size 256
address nbytes 3
flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | 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 (4.00 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+---------
00000000-003fffff | [ 3] | no
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-003fffff | unlocked | 64
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
+ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_read
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 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
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_test
+ mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 4194304 (4M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 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
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_read
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 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
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_read
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_test
+ dd 'if=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_read
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_read2
2cefe25fab06d6fa7a84391045f015e65b29cd917216a327bf3121b35ca3d450 spi_test
1263fc3dceb68412ef7597acad3415e34ea558070de1d2fe2d78030b75f062d1 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=4194304
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=64
+ ss=65536
+ bps=1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 4063232 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-003dffff | unlocked | 62
003e0000-003fffff | locked | 2
+ flash_lock -u /dev/mtd0 4063232 1
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-003effff | unlocked | 63
003f0000-003fffff | locked | 1
+ flash_lock -u /dev/mtd0
+ 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 -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
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index f1c86d4ba216..51244625b318 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -294,9 +294,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
- .size = SZ_4M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 17/30] mtd: spi-nor: winbond: W25Q64JV-M: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (15 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 18/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
` (13 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table:
$ 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 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
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-003fffff | locked | 32
00400000-007fffff | unlocked | 32
$ 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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
ef7017
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
winbond
$ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450050100ff00050110800000ffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14c4e96376337a757a75
f7a2d55c19f74dffe930f880
$ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
ad4c59a94e6205cf237f8734d01ca45d67d34ed35404b364595ff420b6259d32 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
$ 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 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
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-003fffff | locked | 32
00400000-007fffff | unlocked | 32
$ 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
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 51244625b318..6b996897f419 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -298,9 +298,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
- .size = SZ_8M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
- .no_sfdp_flags = SECT_4K,
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 18/30] mtd: spi-nor: winbond: W25Q128JV-M: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (16 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 17/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 19/30] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability Miquel Raynal
` (12 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
This chip has correct SFDP support, all fields are correctly filled so
we can drop them from the table:
$ cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id ef 70 18 00 00 00
size 16.0 MiB
write size 1
page size 256
address nbytes 3
flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP
opcodes
read 0xeb
dummy cycles 6
erase 0xd8
program 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
register 1S-1S-1S
erase commands
20 (4.00 KiB) [1]
52 (32.0 KiB) [2]
d8 (64.0 KiB) [3]
c7 (16.0 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+---------
00000000-00ffffff | [ 3] | no
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-00ffffff | unlocked | 64
$ 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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
ef7018
+ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
winbond
+ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450050100ff00050110800000ffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffe520f9ffffffff0744eb086b083b42bbfeffffffffff
0000ffff40eb0c200f5210d800003602a60082ea14c9e96376337a757a75
f7a2d55c19f74dffe930f880
+ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
42d15275dcef0dc920342e2c75d7bc2d20b1ba90579a37dd8bdf9e7bc10ffd94 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
+ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities
Supported read modes by the flash
1S-1S-1S
opcode 0x03
mode cycles 0
dummy cycles 0
1S-1S-2S
opcode 0x3b
mode cycles 0
dummy cycles 8
1S-2S-2S
opcode 0xbb
mode cycles 2
dummy cycles 2
1S-1S-4S
opcode 0x6b
mode cycles 0
dummy cycles 8
1S-4S-4S
opcode 0xeb
mode cycles 2
dummy cycles 4
4S-4S-4S
opcode 0xeb
mode cycles 2
dummy cycles 0
Supported page program modes by the flash
1S-1S-1S
opcode 0x02
+ cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id ef 70 18 00 00 00
size 16.0 MiB
write size 1
page size 256
address nbytes 3
flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | NO_WP
opcodes
read 0xeb
dummy cycles 6
erase 0xd8
program 0x02
8D extension none
protocols
read 1S-4S-4S
write 1S-1S-1S
register 1S-1S-1S
erase commands
20 (4.00 KiB) [1]
52 (32.0 KiB) [2]
d8 (64.0 KiB) [3]
c7 (16.0 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+---------
00000000-00ffffff | [ 3] | no
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-00ffffff | unlocked | 64
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
+ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
5ca640e6e1097c52d196add2de1f770834dc6cf9e4b1b660fd3586d6eb2ea0f1 spi_read
5ca640e6e1097c52d196add2de1f770834dc6cf9e4b1b660fd3586d6eb2ea0f1 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
5ca640e6e1097c52d196add2de1f770834dc6cf9e4b1b660fd3586d6eb2ea0f1 spi_test
+ mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 16777216 (16M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
---
drivers/mtd/spi-nor/winbond.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 6b996897f419..78a31e71d3f1 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -302,9 +302,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
- .size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 19/30] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (17 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 18/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 20/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
` (11 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
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 78a31e71d3f1..7286d50b0c53 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -294,7 +294,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 20/30] mtd: spi-nor: winbond: W25Q64JV-M: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (18 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 19/30] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 21/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
` (10 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
$ 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=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
$ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
$ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
$ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
$ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
$ mtd_debug write /dev/mtd0 0 2097152 spi_test
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 7286d50b0c53..3715e269cb7f 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -298,7 +298,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 21/30] mtd: spi-nor: winbond: W25Q128JV-M: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (19 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 20/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 22/30] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information Miquel Raynal
` (9 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
+ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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 3715e269cb7f..695e1b2fddf5 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -302,7 +302,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 22/30] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (20 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 21/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 23/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
` (8 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag the missing CMP capability.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
[ 34.621251] random: crng init done
2+0 records in
2+0 records out
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=4194304
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=64
+ ss=65536
+ bps=1
+ 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=63
+ 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 695e1b2fddf5..524ef7b00257 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -294,7 +294,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
- .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 23/30] mtd: spi-nor: winbond: W25Q64JV-M: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (21 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 22/30] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 24/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
` (7 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x800000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=8388608
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=64
+ ss=131072
+ bps=2
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 8126464 4
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-007bffff | unlocked | 62
007c0000-007fffff | locked | 2
+ flash_lock -u /dev/mtd0 8126464 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-007dffff | unlocked | 63
007e0000-007fffff | locked | 1
/* 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=126
+ 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 524ef7b00257..dc04a3c9d660 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -298,7 +298,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q64JV-M */
.id = SNOR_ID(0xef, 0x70, 0x17),
- .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 24/30] mtd: spi-nor: winbond: W25Q128JV-M: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (22 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 23/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 25/30] mtd: spi-nor: winbond: W25Q02JV-M: " Miquel Raynal
` (6 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table does not advertize the locking capabilities of the
device, flag these capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x1000000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=16777216
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=64
+ ss=262144
+ bps=4
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 16252928 8
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-00f7ffff | unlocked | 62
00f80000-00ffffff | locked | 2
+ flash_lock -u /dev/mtd0 16252928 4
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-00fbffff | unlocked | 63
00fc0000-00ffffff | locked | 1
/* 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=252
+ 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 dc04a3c9d660..e245ac44a5fe 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -302,7 +302,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q128JV-M */
.id = SNOR_ID(0xef, 0x70, 0x18),
- .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 25/30] mtd: spi-nor: winbond: W25Q02JV-M: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (23 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 24/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 26/30] mtd: spi-nor: winbond: W25Q512JV-M: New chip Miquel Raynal
` (5 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
The SFDP table is pretty complete except for the locking capabilities
which must be filled manually.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x10000000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=268435456
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=4096
+ ss=65536
+ bps=1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 268304384 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-0ffdffff | unlocked | 4094
0ffe0000-0fffffff | locked | 2
+ flash_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=4095
+ 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 e245ac44a5fe..ff409fbc2d38 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -309,6 +309,8 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q02JV-M */
.id = SNOR_ID(0xef, 0x70, 0x22),
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
.fixups = &winbond_nor_multi_die_fixups,
}, {
.id = SNOR_ID(0xef, 0x71, 0x19),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 26/30] mtd: spi-nor: winbond: W25Q512JV-M: New chip
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (24 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 25/30] mtd: spi-nor: winbond: W25Q02JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 27/30] mtd: spi-nor: winbond: W25Q01JV-M: " Miquel Raynal
` (4 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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 <miquel.raynal@bootlin.com>
---
+ 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 file 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_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 (64.0 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+---------
00000000-03ffffff | [ 3] | no
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-03ffffff | unlocked | 1024
+ dd 'if=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
[ 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 = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 67108864 (64M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x4000000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=67108864
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=1024
+ ss=65536
+ bps=1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 66977792 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-03fdffff | unlocked | 1022
03fe0000-03ffffff | locked | 2
+ flash_lock -u /dev/mtd0 66977792 1
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-03feffff | unlocked | 1023
03ff0000-03ffffff | locked | 1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 58720256 128
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-037fffff | unlocked | 896
03800000-03ffffff | locked | 128
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 0 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-0001ffff | locked | 2
00020000-03ffffff | unlocked | 1022
+ flash_lock -u /dev/mtd0 65536 1
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-0000ffff | locked | 1
00010000-03ffffff | unlocked | 1023
+ all_but_one=1023
+ 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 ff409fbc2d38..fa842e841804 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -306,6 +306,11 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
+ }, {
+ /* W25Q512JV-M */
+ .id = SNOR_ID(0xef, 0x70, 0x20),
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
}, {
/* W25Q02JV-M */
.id = SNOR_ID(0xef, 0x70, 0x22),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 27/30] mtd: spi-nor: winbond: W25Q01JV-M: New chip
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (25 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 26/30] mtd: spi-nor: winbond: W25Q512JV-M: New chip Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 28/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data Miquel Raynal
` (3 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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 <miquel.raynal@bootlin.com>
---
+ 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_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=/dev/urandom' 'of=./spi_test' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
+ sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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 = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 134217728 (128M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
+ alias 'show_sectors=grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0/params'
+ flash_lock -u /dev/mtd0
+ flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x8000000
Lock status: unlocked
Return code: 0
+ mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
+ mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read
+ sha256sum spi_read spi_test
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=/dev/urandom' 'of=./spi_test2' 'bs=1M' 'count=2'
2+0 records in
2+0 records out
+ mtd_debug write /dev/mtd0 0 2097152 spi_test2
Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
+ mtd_debug read /dev/mtd0 0 2097152 spi_read2
Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
+ sha256sum spi_read spi_read2 spi_test spi_test2
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=134217728
+ cat /sys/class/mtd/mtd0/erasesize
+ bs=65536
+ grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params
+ sed -e 's/.*unlocked | //'
+ nsectors=2048
+ ss=65536
+ bps=1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 134086656 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-07fdffff | unlocked | 2046
07fe0000-07ffffff | locked | 2
+ flash_lock -u /dev/mtd0 134086656 1
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-07feffff | unlocked | 2047
07ff0000-07ffffff | locked | 1
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 125829120 128
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-077fffff | unlocked | 1920
07800000-07ffffff | locked | 128
+ flash_lock -u /dev/mtd0
+ flash_lock -l /dev/mtd0 0 2
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-0001ffff | locked | 2
00020000-07ffffff | unlocked | 2046
+ flash_lock -u /dev/mtd0 65536 1
+ grep -A4 'locked sectors' /sys/kernel/debug/spi-nor/spi0.0/params
locked sectors
region (in hex) | status | #sectors
------------------+----------+---------
00000000-0000ffff | locked | 1
00010000-07ffffff | unlocked | 2047
+ all_but_one=2047
+ 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 fa842e841804..1e5ad4e3ef7a 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -311,6 +311,12 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x70, 0x20),
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
+ }, {
+ /* W25Q01JV-M */
+ .id = SNOR_ID(0xef, 0x70, 0x21),
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
+ SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
+ .fixups = &winbond_nor_multi_die_fixups,
}, {
/* W25Q02JV-M */
.id = SNOR_ID(0xef, 0x70, 0x22),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 28/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (26 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 27/30] mtd: spi-nor: winbond: W25Q01JV-M: " Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 29/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability Miquel Raynal
` (2 subsequent siblings)
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
I do not have any W25Q256JV-Q/N nor any W25Q16JV-M chips in hand, but
all the other chips from the JV family have the same SFDP table,
correctly advertizing the capabilities which are redundantly repeated in
the table. We can reasonably expect that these chips follow the exact same
rules, so drop that extra data.
I am on purpose skipping the W25Q128JV-Q/N because there is also a Zetta
clone that seem to share the same ID, and I have no idea how this chip
works (add a small comment in the table about this).
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
drivers/mtd/spi-nor/winbond.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 1e5ad4e3ef7a..c1dbdf7610fb 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -212,12 +212,11 @@ static const struct flash_info winbond_nor_parts[] = {
.size = SZ_16M,
.flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ /* Zetta clone */
.fixups = &w25q128_fixups,
}, {
/* W25Q256JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x19),
- .size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = &w25q256_fixups,
}, {
/* W25Q512JV-Q/N */
@@ -288,9 +287,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q16JV-M */
.id = SNOR_ID(0xef, 0x70, 0x15),
- .size = SZ_2M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 29/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (27 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 28/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 30/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information Miquel Raynal
2026-07-06 14:27 ` [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Michael Walle
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
I do not have any W25Q256JV-Q/N/M nor any W25Q16JV-M chips in hand, but
all the chips with a density <= 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.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
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 c1dbdf7610fb..08fbbc2b948b 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -217,6 +217,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q256JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x19),
+ .flags = SPI_NOR_QUAD_PP,
.fixups = &w25q256_fixups,
}, {
/* W25Q512JV-Q/N */
@@ -287,7 +288,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q16JV-M */
.id = SNOR_ID(0xef, 0x70, 0x15),
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
@@ -303,6 +304,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
+ .flags = SPI_NOR_QUAD_PP,
}, {
/* W25Q512JV-M */
.id = SNOR_ID(0xef, 0x70, 0x20),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 30/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (28 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 29/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability Miquel Raynal
@ 2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:27 ` [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Michael Walle
30 siblings, 0 replies; 40+ messages in thread
From: Miquel Raynal @ 2026-05-29 15:22 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel,
Miquel Raynal
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.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
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 08fbbc2b948b..60a7bb1f2ce4 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -217,7 +217,8 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q256JV-Q/N */
.id = SNOR_ID(0xef, 0x40, 0x19),
- .flags = SPI_NOR_QUAD_PP,
+ .flags = 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 = &w25q256_fixups,
}, {
/* W25Q512JV-Q/N */
@@ -288,7 +289,7 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q16JV-M */
.id = SNOR_ID(0xef, 0x70, 0x15),
- .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+ .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
}, {
/* W25Q32JV-M */
.id = SNOR_ID(0xef, 0x70, 0x16),
@@ -304,7 +305,8 @@ static const struct flash_info winbond_nor_parts[] = {
}, {
/* W25Q256JV-M */
.id = SNOR_ID(0xef, 0x70, 0x19),
- .flags = SPI_NOR_QUAD_PP,
+ .flags = 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 = SNOR_ID(0xef, 0x70, 0x20),
--
2.53.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
@ 2026-07-06 13:54 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 13:54 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <mwalle@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 02/30] mtd: spi-nor: winbond: Normalize names
2026-05-29 15:22 ` [PATCH 02/30] mtd: spi-nor: winbond: Normalize names Miquel Raynal
@ 2026-07-06 13:57 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 13:57 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> 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=1) 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.
OTOH if you try to search for that name on the internet/datasheets
you don't find anything, while the xx somehow indicates that
something is missing here.
I haven't made my mind up on the naming. But I also don't care too
much.
Reviewed-by: Michael Walle <mwalle@kernel.org>
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry
2026-05-29 15:22 ` [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry Miquel Raynal
@ 2026-07-06 13:59 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 13:59 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> This is a legacy field, it is often incorrectly filled and will soon
> become very incorrect due to IDs being reused.
And I thought winbond is doing better... So if you have a contact
there, please suggest they are putting a table with a unique
identifier per chip there. So we can use that to do fixups.
> Replace the names with a comment above the entry with the newly instated
> naming scheme to indicate what chips are covered by each entry.
This is exported via sysfs, so this could be a regression.
Not sure..
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide
2026-05-29 15:22 ` [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Miquel Raynal
@ 2026-07-06 14:11 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:11 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4498 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> 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.
I agree. But making it a vendor default we always have to have an
entry. So if this is really for all winbond chips, we shall do a
catch all entry (like in macronix.c).
> 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 <miquel.raynal@bootlin.com>
> ---
> drivers/mtd/spi-nor/winbond.c | 37 ++++++++++++++-----------------------
> 1 file changed, 14 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
> index b4088fc5fde9..4300f0419f13 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 = {
> .post_bfpt = w25q256_post_bfpt_fixups,
> };
>
> -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 &= ~SNOR_F_NO_READ_CR;
> -
> - return 0;
> -}
> -
> -static const struct spi_nor_fixups winbond_rdcr_fixup = {
> - .post_bfpt = winbond_rdcr_post_bfpt_fixup,
> -};
> -
> /**
> * winbond_nor_select_die() - Set active die.
> * @nor: pointer to 'struct spi_nor'.
> @@ -305,7 +285,6 @@ static const struct flash_info winbond_nor_parts[] = {
> .id = SNOR_ID(0xef, 0x60, 0x21),
> .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
> SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
> - .fixups = &winbond_rdcr_fixup,
> }, {
> /* W25Q16JV-M */
> .id = SNOR_ID(0xef, 0x70, 0x15),
> @@ -381,7 +360,6 @@ static const struct flash_info winbond_nor_parts[] = {
> .id = SNOR_ID(0xef, 0x80, 0x22),
> .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
> SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
> - .fixups = &winbond_rdcr_fixup,
> }, {
> /* W25H512NW-M */
> .id = SNOR_ID(0xef, 0xa0, 0x20),
> @@ -397,7 +375,6 @@ static const struct flash_info winbond_nor_parts[] = {
> .id = SNOR_ID(0xef, 0xa0, 0x22),
> .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
> SPI_NOR_4BIT_BP | SPI_NOR_HAS_CMP,
> - .fixups = &winbond_rdcr_fixup,
> },
> };
>
> @@ -490,6 +467,20 @@ static int winbond_nor_late_init(struct spi_nor *nor)
> */
> params->set_4byte_addr_mode = winbond_nor_set_4byte_addr_mode;
>
> + /*
> + * 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[0] == 0xef &&
> + nor->info->id->bytes[1] > 0x30)
> + nor->flags &= ~SNOR_F_NO_READ_CR;
This is somewhat hard to read and the byte[0] is redundant here.
Maybe you can come up with some macro magic sugar :)
-michael
> +
> return 0;
> }
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data
2026-05-29 15:22 ` [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data Miquel Raynal
@ 2026-07-06 14:13 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:13 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> This chip has correct SFDP support, all fields are correctly filled so
> we can drop them from the table:
You're forgetting that "this chip" is not only the one mentioned in
the comment. See the original W25Q32, which does not have any SFDP
tables and is using the same id. Effectively, we'd drop 4k support
for that.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability
2026-05-29 15:22 ` [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Miquel Raynal
@ 2026-07-06 14:16 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:16 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> 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.
If we really go the drop any support for non-SFDP flashes and I'm
still not sure about that. I'd argue that the entry should have been
dropped entirely. Cleanup up the that table instead of adding a
feature you already say isn't that useful, nor do I think is often
used, as these tiny nor flashes are mostly used for read-only
storage (or at least not writing that much).
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
2026-05-29 15:22 ` [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Miquel Raynal
@ 2026-07-06 14:21 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:21 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 5077 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> The SFDP table does not advertize the locking capabilities of the
> device, flag these capabilities.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> $ alias show_sectors='grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0
> /params'
> $ flash_lock -u /dev/mtd0
> $ flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 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=/dev/urandom of=./spi_test2 bs=1M count=2
> 2+0 records in
> 2+0 records out
> $ mtd_debug write /dev/mtd0 0 2097152 spi_test2
> Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read2
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
> $ sha256sum spi*
> 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=$(cat /sys/class/mtd/mtd0/size)
> $ nblocks=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*
> unlocked | //')
> $
> $ bs=$(($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=$((($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 | 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 07ab66a9e6c0..e6dca2493357 100644
> --- a/drivers/mtd/spi-nor/winbond.c
> +++ b/drivers/mtd/spi-nor/winbond.c
> @@ -200,7 +200,7 @@ static const struct flash_info winbond_nor_parts[] = {
> }, {
> /* W25Q32JV-Q/N */
> .id = SNOR_ID(0xef, 0x40, 0x16),
> - .flags = SPI_NOR_QUAD_PP,
> + .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
The original W25Q32 doesn't have the CMP bit.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data
2026-05-29 15:22 ` [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data Miquel Raynal
@ 2026-07-06 14:23 ` Michael Walle
0 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:23 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 271 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> This chip has correct SFDP support, all fields are correctly filled so
> we can drop them from the table.
I haven't checked, but there is probably an older chip with this id
and without SFDP.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
` (29 preceding siblings ...)
2026-05-29 15:22 ` [PATCH 30/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information Miquel Raynal
@ 2026-07-06 14:27 ` Michael Walle
30 siblings, 0 replies; 40+ messages in thread
From: Michael Walle @ 2026-07-06 14:27 UTC (permalink / raw)
To: Miquel Raynal, Pratyush Yadav, Takahiro Kuwano,
Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, Steam Lin, linux-mtd, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4633 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> Thanks to Winbond collaboration, I was able to test almost the entire JV
> SPI NOR family. A few chips could not be sourced, I decided to apply the
> very same logic than the other chips, all of them behave identically as
> shown in all the logs that I am sharing in each and every commit.
>
> This series is pretty straightforward, it is here to cleanup the JV
> entries by:
> - Removing the useless part names (which are going to become a problem)
> - Aligning the comments and "fixing" the chip names in them
> - Reordering the chips by density and family
> - Testing and showing all the SFDP content and passing all the SPI NOR
> tests to ensure a good level of support.
> - Describing only what needs to be described, parsing the SFDP tables
> otherwise.
> - Adding all the locking information when it is missing.
>
> This work is necessary because I am about to propose the addition of the
> W25QxxRV family, whose IDs actually collide with the JV chips. The chips
> are similar, they have been "improved" (especially the silicon/engraving
> smoothness) and we have a way to differentiate them based on their SFDP
> content, but that will be for a following series.
Why do you need to remove the no_sfdp_flags? I have only looked at
some of the patches, but overall it seems we'd be dropping support
for older chips - which we don't know if they are in use or not.
So although the comment might only point to one chip, there can be
many more with that very same id. And now.. with the RV family even
more. Ugh.
-michael
> NB: There is one collision with a Spansion chip as well (S25FL064K). On
> my side I commented out the Spansion entry to make sure the core was
> taking the Winbond entry (by alphabetical order) but it is due to an old
> joint agreement and is a legitimate ID duplication. We haven't found a
> good way to differentiate them so far, so I am keeping this aside for
> the moment and just assume we will have a solution later. In all cases,
> the colliding Winbond ID exist and is already fulfilled, so let's make
> sure the definition is accurate.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> Miquel Raynal (30):
> mtd: spi-nor: winbond: Move W25Q01NW to its right place
> mtd: spi-nor: winbond: Normalize names
> mtd: spi-nor: winbond: Stop filling the .name entry
> mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide
> mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data
> mtd: spi-nor: winbond: W25Q64JV-Q/N: Drop redundant data
> mtd: spi-nor: winbond: W25Q512JV-Q/N: Drop redundant data
> mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability
> mtd: spi-nor: winbond: W25Q64JV-Q/N: Add quad page program capability
> mtd: spi-nor: winbond: W25Q128JV-Q/N: Add quad page program capability
> mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
> mtd: spi-nor: winbond: W25Q64JV-Q/N: Fill locking information
> mtd: spi-nor: winbond: W25Q128JV-Q/N: Fill locking information
> mtd: spi-nor: winbond: W25Q512JV-Q/N: Fill locking information
> mtd: spi-nor: winbond: W25Q01JV-Q/N: Fill locking information
> mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data
> mtd: spi-nor: winbond: W25Q64JV-M: Drop redundant data
> mtd: spi-nor: winbond: W25Q128JV-M: Drop redundant data
> mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability
> mtd: spi-nor: winbond: W25Q64JV-M: Add quad page program capability
> mtd: spi-nor: winbond: W25Q128JV-M: Add quad page program capability
> mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information
> mtd: spi-nor: winbond: W25Q64JV-M: Fill locking information
> mtd: spi-nor: winbond: W25Q128JV-M: Fill locking information
> mtd: spi-nor: winbond: W25Q02JV-M: Fill locking information
> mtd: spi-nor: winbond: W25Q512JV-M: New chip
> mtd: spi-nor: winbond: W25Q01JV-M: New chip
> mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data
> mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability
> mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information
>
> drivers/mtd/spi-nor/winbond.c | 147 +++++++++++++++++++++---------------------
> 1 file changed, 73 insertions(+), 74 deletions(-)
> ---
> base-commit: 361a4eb81d0bb23dd27919f969e14a4a372af6e2
> change-id: 20260529-winbond-v7-1-spi-nor-jv-cleanup-817889edd1f7
>
> Best regards,
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
end of thread, other threads:[~2026-07-06 14:27 UTC | newest]
Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
2026-07-06 13:54 ` Michael Walle
2026-05-29 15:22 ` [PATCH 02/30] mtd: spi-nor: winbond: Normalize names Miquel Raynal
2026-07-06 13:57 ` Michael Walle
2026-05-29 15:22 ` [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry Miquel Raynal
2026-07-06 13:59 ` Michael Walle
2026-05-29 15:22 ` [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Miquel Raynal
2026-07-06 14:11 ` Michael Walle
2026-05-29 15:22 ` [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data Miquel Raynal
2026-07-06 14:13 ` Michael Walle
2026-05-29 15:22 ` [PATCH 06/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 07/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Miquel Raynal
2026-07-06 14:16 ` Michael Walle
2026-05-29 15:22 ` [PATCH 09/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 10/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Miquel Raynal
2026-07-06 14:21 ` Michael Walle
2026-05-29 15:22 ` [PATCH 12/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 13/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 14/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 15/30] mtd: spi-nor: winbond: W25Q01JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data Miquel Raynal
2026-07-06 14:23 ` Michael Walle
2026-05-29 15:22 ` [PATCH 17/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 18/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 19/30] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability Miquel Raynal
2026-05-29 15:22 ` [PATCH 20/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 21/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 22/30] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information Miquel Raynal
2026-05-29 15:22 ` [PATCH 23/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 24/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 25/30] mtd: spi-nor: winbond: W25Q02JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 26/30] mtd: spi-nor: winbond: W25Q512JV-M: New chip Miquel Raynal
2026-05-29 15:22 ` [PATCH 27/30] mtd: spi-nor: winbond: W25Q01JV-M: " Miquel Raynal
2026-05-29 15:22 ` [PATCH 28/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data Miquel Raynal
2026-05-29 15:22 ` [PATCH 29/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability Miquel Raynal
2026-05-29 15:22 ` [PATCH 30/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information Miquel Raynal
2026-07-06 14:27 ` [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Michael Walle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox