[PATCH v5 04/28] mtd: spi-nor: Unconditionally parse SFDP in the deprecated path

Miquel Raynal <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.drivers.mtd
Message-ID <20260805-winbond-v7-1-spi-nor-jv-cleanup-v5-4-87238e577794@bootlin.com>
As of today, the deprecated initialization path only attempts to parse
the SFDP tables when the flash entry advertised a dual, quad or octal
read capability in ->no_sfdp_flags. This was initially a surprise to me
since the documentation and commit logs I read while searching the
history do not clearly explain why. It seems that this is some kind of
(double) legacy behavior since a change made it clear in 2021 that in
order to skip trying to parse SFDP in the deprecated path, chips should
be marked with SPI_NOR_SKIP_SFDP (in which case the deprecated path
mentioned in the title will not be attempted).

As a result of this situation, Winbond W25Q32JV-Q/N and W25Q64JV-M
chips, which feature good SFDP support, are using only the stale flags
in the ID table because of ID reuse. I tried to remove the stale entries
but this change got refused because it would break support for legacy
chips without SFDP support (until ~2016).

Parsing SFDP unconditionally seems safe:
spi_nor_sfdp_init_params_deprecated() already restores the legacy
parameters whenever parsing fails, so non-SFDP chips simply fall back to
their previous behavior. As stated above, anybody bisecting a SPI NOR
boot issue and getting to this commit should add (and contribute) the
SPI_NOR_SKIP_SFDP flag in their no_sfdp_flags field.

Signed-off-by: Miquel Raynal <[email protected]>
---
 drivers/mtd/spi-nor/core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index c39c6833c9a4..b4d09f14fff7 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3092,11 +3092,7 @@ static void spi_nor_init_params_deprecated(struct spi_nor *nor)
 
 	spi_nor_manufacturer_init_params(nor);
 
-	if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
-					SPI_NOR_QUAD_READ |
-					SPI_NOR_OCTAL_READ |
-					SPI_NOR_OCTAL_DTR_READ))
-		spi_nor_sfdp_init_params_deprecated(nor);
+	spi_nor_sfdp_init_params_deprecated(nor);
 }
 
 /**

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.