* [PATCH v3 01/15] mtd: spi-nor: core: add flag for doing optional SFDP parsing
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 02/15] mtd: spi-nor: macronix: enable quad/dual speed for mx25l3205d chips Esben Haabendal
` (15 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This is the first step in replacing the old deprecated mechanism for
initializing flash parameters and settings based on SFDP, with fallback to
static parameters from struct flash_info.
A dedicated SPI_NOR_TRY_SFDP flag is used to request this handling, where
as the deprecated mechanism relies on the setting of either of the
SPI_NOR_DUAL_READ, SPI_NOR_QUAD_READ, SPI_NOR_OCTAL_READ or
SPI_NOR_OCTAL_DTR_READ bits.
Compared to the deprecated mechanism, SPI_NOR_TRY_SFDP flags allow optional
SFDP parsing for flashes where the fallback does not include
dual/quad/octal read.
This kind of mechanism is needed for flashes that reuses flash id from old
non-SFDP flashes for newer flashes with SFDP, with different parameters and
settings required. Macronix is known to reuse flash ids for replacement
parts, so for those lines where the initial part did not have SFDP, this
mechanism is needed.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/core.c | 49 ++++++++++++++--------------------------------
drivers/mtd/spi-nor/core.h | 35 ++++++++++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 35 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 3e1f1913536b..39b28700ce28 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2717,11 +2717,10 @@ static void spi_nor_manufacturer_init_params(struct spi_nor *nor)
/**
* spi_nor_no_sfdp_init_params() - Initialize the flash's parameters and
- * settings based on nor->info->sfdp_flags. This method should be called only by
- * flashes that do not define SFDP tables. If the flash supports SFDP but the
- * information is wrong and the settings from this function can not be retrieved
- * by parsing SFDP, one should instead use the fixup hooks and update the wrong
- * bits.
+ * settings based on nor->info->sfdp_flags. This method is for flashes that do
+ * not define SFDP tables. If the flash supports SFDP but the information is
+ * wrong and the settings from this function can not be retrieved by parsing
+ * SFDP, one should instead use the fixup hooks and update the wrong bits.
* @nor: pointer to a 'struct spi_nor'.
*/
static void spi_nor_no_sfdp_init_params(struct spi_nor *nor)
@@ -2899,14 +2898,15 @@ static int spi_nor_late_init_params(struct spi_nor *nor)
}
/**
- * spi_nor_sfdp_init_params_deprecated() - Deprecated way of initializing flash
- * parameters and settings based on JESD216 SFDP standard.
+ * spi_nor_try_sfdp_init_params() - Try to initialize flash parameters and
+ * settings based on JESD216 SFDP standard, with fallback to pre-initialized
+ * flash parameters and settings if SFP parsing fails.
* @nor: pointer to a 'struct spi_nor'.
*
* The method has a roll-back mechanism: in case the SFDP parsing fails, the
* legacy flash parameters and settings will be restored.
*/
-static void spi_nor_sfdp_init_params_deprecated(struct spi_nor *nor)
+static void spi_nor_try_sfdp_init_params(struct spi_nor *nor)
{
struct spi_nor_flash_parameter sfdp_params;
@@ -2918,28 +2918,6 @@ static void spi_nor_sfdp_init_params_deprecated(struct spi_nor *nor)
}
}
-/**
- * spi_nor_init_params_deprecated() - Deprecated way of initializing flash
- * parameters and settings.
- * @nor: pointer to a 'struct spi_nor'.
- *
- * The method assumes that flash doesn't support SFDP so it initializes flash
- * parameters in spi_nor_no_sfdp_init_params() which later on can be overwritten
- * when parsing SFDP, if supported.
- */
-static void spi_nor_init_params_deprecated(struct spi_nor *nor)
-{
- spi_nor_no_sfdp_init_params(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_init_default_params() - Default initialization of flash parameters
* and settings. Done for all flashes, regardless is they define SFDP tables
@@ -3046,13 +3024,16 @@ static int spi_nor_init_params(struct spi_nor *nor)
if (spi_nor_needs_sfdp(nor)) {
ret = spi_nor_parse_sfdp(nor);
if (ret) {
- dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP when declaring the flash\n");
+ dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP or SPI_NOR_TRY_SFDP when declaring the flash\n");
return ret;
}
- } else if (nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP) {
- spi_nor_no_sfdp_init_params(nor);
} else {
- spi_nor_init_params_deprecated(nor);
+ spi_nor_no_sfdp_init_params(nor);
+ if (!(nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP))
+ spi_nor_manufacturer_init_params(nor);
+
+ if (spi_nor_try_sfdp(nor))
+ spi_nor_try_sfdp_init_params(nor);
}
return spi_nor_late_init_params(nor);
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 442786685515..dfc81716e068 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -485,9 +485,12 @@ struct spi_nor_id {
*
* @no_sfdp_flags: flags that indicate support that can be discovered via SFDP.
* Used when SFDP tables are not defined in the flash. These
- * flags are used together with the SPI_NOR_SKIP_SFDP flag.
+ * flags are used together with the SPI_NOR_SKIP_SFDP or
+ * SPI_NOR_TRY_SFDP flag.
* SPI_NOR_SKIP_SFDP: skip parsing of SFDP tables.
* SECT_4K: SPINOR_OP_BE_4K works uniformly.
+ * SPI_NOR_TRY_SFDP: try parsing SFDP tables before using the
+ * parameters specified in this struct.
* SPI_NOR_DUAL_READ: flash supports Dual Read.
* SPI_NOR_QUAD_READ: flash supports Quad Read.
* SPI_NOR_OCTAL_READ: flash supports Octal Read.
@@ -535,6 +538,7 @@ struct flash_info {
u8 no_sfdp_flags;
#define SPI_NOR_SKIP_SFDP BIT(0)
#define SECT_4K BIT(1)
+#define SPI_NOR_TRY_SFDP BIT(2)
#define SPI_NOR_DUAL_READ BIT(3)
#define SPI_NOR_QUAD_READ BIT(4)
#define SPI_NOR_OCTAL_READ BIT(5)
@@ -706,6 +710,35 @@ static inline bool spi_nor_needs_sfdp(const struct spi_nor *nor)
return !nor->info->size;
}
+/**
+ * spi_nor_try_sfdp() - returns true if optional SFDP parsing should be tried
+ * for this flash, with fallback to static parameters and settings based on
+ * flash ID if SFDP parsing fails.
+ *
+ * Return: true if optional SFDP parsing should be tried
+ */
+static inline bool spi_nor_try_sfdp(const struct spi_nor *nor)
+{
+ if (nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP)
+ return false;
+ if (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
+ return true;
+
+ /* Deprecated/legacy way for triggering optional SFDP parsing.
+ * If one of the no_sfdp_flags indicating dual, quad or octal read is
+ * set, SFDP parsing will be tried.
+ * When all drivers have been converted to set SPI_NOR_TRY_SFDP where
+ * needed, this deprecated mechanism can be removed.
+ */
+ if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
+ SPI_NOR_QUAD_READ |
+ SPI_NOR_OCTAL_READ |
+ SPI_NOR_OCTAL_DTR_READ))
+ return true;
+
+ return false;
+}
+
#ifdef CONFIG_DEBUG_FS
void spi_nor_debugfs_register(struct spi_nor *nor);
void spi_nor_debugfs_shutdown(void);
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 02/15] mtd: spi-nor: macronix: enable quad/dual speed for mx25l3205d chips
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 01/15] mtd: spi-nor: core: add flag for doing optional SFDP parsing Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 03/15] mtd: spi-nor: Align default_init() handling for SPI_NOR_SKIP_SFDP Esben Haabendal
` (14 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
Macronix engineers apparantly do not understand the purpose of having
an ID actually identify the chip and its capabilities. Sigh.
The original Macronix SPI NOR flash that identifies itself as 0xC22016
with RDID was MX25L3205D. This chip does not support SFDP, but does
support the 2READ command (1-2-2).
When Macronix announced EoL for MX25L3205D, the recommended
replacement part was MX25L3206E, which conveniently also identifies
itself as 0xC22016. It does not support 2READ, but supports DREAD
(1-1-2) instead, and supports SFDP for discovering this.
When Macronix announced EoL for MX25L3206E, the recommended
replacement part was MX25L3233F, which also identifies itself as
0xC22016. It supports DREAD, 2READ, and the quad modes QREAD (1-1-4)
and 4READ (1-4-4). This also support SFDP.
So far, all of these chips have been handled the same way by the Linux
driver. The SFDP information have not been read, and no dual and quad
read modes have been enabled.
The trouble begins when we want to enable the faster read modes. The
RDID command only return the same 3 bytes for all 3 chips, so that
doesn't really help.
Instead, we can use the SPI_NOR_TRY_SFDP flag, which forces the spi-nor
system to try using SFDP, but fallback to the parameters specified in
struct flash_info.
This way, boards using MX25L3205D will continue as before this change.
That is without taking advantage of the 1-2-2 that it supports.
For MX25L3206E and MX25L3233F, the SFDP parameters are used, and they will
therefore be using the optimal dual or quad mode supported by the flash
and the SPI controller it is attached to.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/macronix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ea6be95e75a5..090f28e05a5d 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -61,7 +61,7 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x20, 0x16),
.name = "mx25l3205d",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x20, 0x17),
.name = "mx25l6405d",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 03/15] mtd: spi-nor: Align default_init() handling for SPI_NOR_SKIP_SFDP
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 01/15] mtd: spi-nor: core: add flag for doing optional SFDP parsing Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 02/15] mtd: spi-nor: macronix: enable quad/dual speed for mx25l3205d chips Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 04/15] mtd: spi-nor: atmel: Use new SPI_NOR_TRY_SFDP flag Esben Haabendal
` (13 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
Currently, flashes declared with size != 0 in struct flash_info and without
SPI_NOR_SKIP_SFDP in no_sfdp_flags is initialized using struct flash_info.
Flashes declared with size != 0 and SPI_NOR_SKIP_SFDP set is handled
similarly, with the only difference being that the ->default_init() hooks
is ignored.
With the only in-tree user of SPI_NOR_SKIP_SFDP is the Spansion s25fl256s0
flash, which does not have either manufacturer or
flash_info ->default_init() hooks, it should be safe to align this, so that
they are handled in the same way.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 39b28700ce28..d58f107f62ec 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3029,8 +3029,7 @@ static int spi_nor_init_params(struct spi_nor *nor)
}
} else {
spi_nor_no_sfdp_init_params(nor);
- if (!(nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP))
- spi_nor_manufacturer_init_params(nor);
+ spi_nor_manufacturer_init_params(nor);
if (spi_nor_try_sfdp(nor))
spi_nor_try_sfdp_init_params(nor);
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 04/15] mtd: spi-nor: atmel: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (2 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 03/15] mtd: spi-nor: Align default_init() handling for SPI_NOR_SKIP_SFDP Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 05/15] mtd: spi-nor: eon: " Esben Haabendal
` (12 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/atmel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c
index 45d1153a04a0..cfd6a406b33a 100644
--- a/drivers/mtd/spi-nor/atmel.c
+++ b/drivers/mtd/spi-nor/atmel.c
@@ -175,7 +175,7 @@ static const struct flash_info atmel_nor_parts[] = {
.id = SNOR_ID(0x1f, 0x42, 0x16),
.name = "at25sl321",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x1f, 0x44, 0x01),
.name = "at25df041a",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 05/15] mtd: spi-nor: eon: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (3 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 04/15] mtd: spi-nor: atmel: Use new SPI_NOR_TRY_SFDP flag Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 06/15] mtd: spi-nor: gigadevice: " Esben Haabendal
` (11 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/eon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/spi-nor/eon.c b/drivers/mtd/spi-nor/eon.c
index c1ddf662f782..0200e564f087 100644
--- a/drivers/mtd/spi-nor/eon.c
+++ b/drivers/mtd/spi-nor/eon.c
@@ -21,7 +21,7 @@ static const struct flash_info eon_nor_parts[] = {
.id = SNOR_ID(0x1c, 0x30, 0x14),
.name = "en25q80a",
.size = SZ_1M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x1c, 0x30, 0x16),
.name = "en25q32b",
@@ -45,7 +45,7 @@ static const struct flash_info eon_nor_parts[] = {
.id = SNOR_ID(0x1c, 0x70, 0x15),
.name = "en25qh16",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x1c, 0x70, 0x16),
.name = "en25qh32",
@@ -54,7 +54,7 @@ static const struct flash_info eon_nor_parts[] = {
.id = SNOR_ID(0x1c, 0x70, 0x17),
.name = "en25qh64",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x1c, 0x70, 0x18),
.name = "en25qh128",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 06/15] mtd: spi-nor: gigadevice: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (4 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 05/15] mtd: spi-nor: eon: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 07/15] mtd: spi-nor: issi: " Esben Haabendal
` (10 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/gigadevice.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/spi-nor/gigadevice.c b/drivers/mtd/spi-nor/gigadevice.c
index ef1edd0add70..c0f2d74ede01 100644
--- a/drivers/mtd/spi-nor/gigadevice.c
+++ b/drivers/mtd/spi-nor/gigadevice.c
@@ -39,29 +39,29 @@ static const struct flash_info gigadevice_nor_parts[] = {
.name = "gd25q16",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x40, 0x16),
.name = "gd25q32",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x40, 0x17),
.name = "gd25q64",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x40, 0x18),
.name = "gd25q128",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x40, 0x19),
.name = "gd25q256",
- .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6,
+ .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_TRY_SFDP,
.fixups = &gd25q256_fixups,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
@@ -69,19 +69,19 @@ static const struct flash_info gigadevice_nor_parts[] = {
.name = "gd25lq32",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x60, 0x17),
.name = "gd25lq64c",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc8, 0x60, 0x18),
.name = "gd25lq128d",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
},
};
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 07/15] mtd: spi-nor: issi: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (5 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 06/15] mtd: spi-nor: gigadevice: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 08/15] mtd: spi-nor: macronix: " Esben Haabendal
` (9 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/issi.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c
index 18d9a00aa22e..7867489e214a 100644
--- a/drivers/mtd/spi-nor/issi.c
+++ b/drivers/mtd/spi-nor/issi.c
@@ -74,32 +74,32 @@ static const struct flash_info issi_nor_parts[] = {
.id = SNOR_ID(0x9d, 0x40, 0x13),
.name = "is25lq040b",
.size = SZ_512K,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x14),
.name = "is25lp080d",
.size = SZ_1M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x15),
.name = "is25lp016d",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x16),
.name = "is25lp032",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x17),
.name = "is25lp064",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x18),
.name = "is25lp128",
.size = SZ_16M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x60, 0x19),
.name = "is25lp256",
@@ -109,17 +109,17 @@ static const struct flash_info issi_nor_parts[] = {
.id = SNOR_ID(0x9d, 0x70, 0x16),
.name = "is25wp032",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x70, 0x17),
.size = SZ_8M,
.name = "is25wp064",
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x70, 0x18),
.name = "is25wp128",
.size = SZ_16M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x9d, 0x70, 0x19),
.name = "is25wp256",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 08/15] mtd: spi-nor: macronix: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (6 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 07/15] mtd: spi-nor: issi: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 09/15] mtd: spi-nor: micron-st: " Esben Haabendal
` (8 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/macronix.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index 090f28e05a5d..d31abdbe916f 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -77,24 +77,24 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x20, 0x19),
.name = "mx25l25635e",
.size = SZ_32M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixups = &mx25l25635_fixups
}, {
.id = SNOR_ID(0xc2, 0x20, 0x1a),
.name = "mx66l51235f",
.size = SZ_64M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0xc2, 0x20, 0x1b),
.name = "mx66l1g45g",
.size = SZ_128M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x23, 0x14),
.name = "mx25v8035f",
.size = SZ_1M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x32),
.name = "mx25u2033e",
@@ -114,7 +114,7 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x25, 0x36),
.name = "mx25u3235f",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x37),
.name = "mx25u6435f",
@@ -124,7 +124,7 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x25, 0x38),
.name = "mx25u12835f",
.size = SZ_16M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x39),
.name = "mx25u25635f",
@@ -135,19 +135,19 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x25, 0x3a),
.name = "mx25u51245g",
.size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x3a),
.name = "mx66u51235f",
.size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x3c),
.name = "mx66u2g45g",
.size = SZ_256M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0xc2, 0x26, 0x18),
@@ -161,17 +161,17 @@ static const struct flash_info macronix_nor_parts[] = {
.id = SNOR_ID(0xc2, 0x26, 0x1b),
.name = "mx66l1g55g",
.size = SZ_128M,
- .no_sfdp_flags = SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x28, 0x15),
.name = "mx25r1635f",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x28, 0x16),
.name = "mx25r3235f",
.size = SZ_4M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xc2, 0x81, 0x3a),
.name = "mx25uw51245g",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 09/15] mtd: spi-nor: micron-st: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (7 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 08/15] mtd: spi-nor: macronix: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 10/15] mtd: spi-nor: spansion: " Esben Haabendal
` (7 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/micron-st.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 3c6499fdb712..c40e02b4f030 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -166,7 +166,8 @@ static const struct flash_info micron_nor_parts[] = {
.sector_size = SZ_128K,
.size = SZ_64M,
.no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ |
- SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP,
+ SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP |
+ SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE,
.fixups = &mt35xu512aba_fixups,
@@ -175,7 +176,7 @@ static const struct flash_info micron_nor_parts[] = {
.name = "mt35xu02g",
.sector_size = SZ_128K,
.size = SZ_256M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixup_flags = SPI_NOR_4B_OPCODES,
},
@@ -364,38 +365,38 @@ static const struct flash_info st_nor_parts[] = {
.id = SNOR_ID(0x20, 0xba, 0x16),
.name = "n25q032",
.size = SZ_4M,
- .no_sfdp_flags = SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0xba, 0x17),
.name = "n25q064",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0xba, 0x18),
.name = "n25q128a13",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xba, 0x19, 0x10, 0x44, 0x00),
.name = "mt25ql256a",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xba, 0x19),
.name = "n25q256a",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xba, 0x20, 0x10, 0x44, 0x00),
.name = "mt25ql512a",
.size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
.mfr_flags = USE_FSR,
}, {
@@ -404,7 +405,7 @@ static const struct flash_info st_nor_parts[] = {
.size = SZ_64M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xba, 0x21),
@@ -412,38 +413,38 @@ static const struct flash_info st_nor_parts[] = {
.size = SZ_128M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixups = &n25q00_fixups,
}, {
.id = SNOR_ID(0x20, 0xba, 0x22),
.name = "mt25ql02g",
.size = SZ_256M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixups = &mt25q02_fixups,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x15),
.name = "n25q016a",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x16),
.name = "n25q032a",
.size = SZ_4M,
- .no_sfdp_flags = SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x17),
.name = "n25q064a",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x18),
.name = "n25q128a11",
.size = SZ_16M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x19, 0x10, 0x44, 0x00),
@@ -451,14 +452,14 @@ static const struct flash_info st_nor_parts[] = {
.size = SZ_32M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x19),
.name = "n25q256ax1",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00),
@@ -473,7 +474,7 @@ static const struct flash_info st_nor_parts[] = {
.size = SZ_64M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
SPI_NOR_BP3_SR_BIT6,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x21, 0x10, 0x44, 0x00),
@@ -484,14 +485,14 @@ static const struct flash_info st_nor_parts[] = {
.id = SNOR_ID(0x20, 0xbb, 0x21),
.name = "n25q00a",
.size = SZ_128M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixups = &n25q00_fixups,
}, {
.id = SNOR_ID(0x20, 0xbb, 0x22),
.name = "mt25qu02g",
.size = SZ_256M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_FSR,
.fixups = &mt25q02_fixups,
}
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 10/15] mtd: spi-nor: spansion: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (8 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 09/15] mtd: spi-nor: micron-st: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 11/15] mtd: spi-nor: sst: " Esben Haabendal
` (6 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/spansion.c | 44 +++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
index 6cc237c24e07..a58c0229003d 100644
--- a/drivers/mtd/spi-nor/spansion.c
+++ b/drivers/mtd/spi-nor/spansion.c
@@ -774,7 +774,7 @@ static const struct flash_info spansion_nor_parts[] = {
.id = SNOR_ID(0x01, 0x02, 0x15, 0x4d, 0x00),
.name = "s25sl032p",
.size = SZ_4M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x01, 0x02, 0x15),
.name = "s25sl032a",
@@ -783,7 +783,7 @@ static const struct flash_info spansion_nor_parts[] = {
.id = SNOR_ID(0x01, 0x02, 0x16, 0x4d, 0x00),
.name = "s25sl064p",
.size = SZ_8M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x01, 0x02, 0x16),
.name = "s25sl064a",
@@ -800,19 +800,19 @@ static const struct flash_info spansion_nor_parts[] = {
.name = "s25fs256s0",
.size = SZ_32M,
.sector_size = SZ_256K,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x80),
.name = "s25fl256s1",
.size = SZ_32M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x81),
.name = "s25fs256s1",
.size = SZ_32M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x80),
@@ -820,14 +820,14 @@ static const struct flash_info spansion_nor_parts[] = {
.size = SZ_64M,
.sector_size = SZ_256K,
.flags = SPI_NOR_HAS_LOCK,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x81),
.name = "s25fs512s",
.size = SZ_64M,
.sector_size = SZ_256K,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
.fixups = &s25fs_s_nor_fixups,
}, {
@@ -844,49 +844,49 @@ static const struct flash_info spansion_nor_parts[] = {
.name = "s25fl128s0",
.size = SZ_16M,
.sector_size = SZ_256K,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00),
.name = "s25fl129p0",
.size = SZ_16M,
.sector_size = SZ_256K,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x80),
.name = "s25fl128s1",
.size = SZ_16M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x81),
.name = "s25fs128s1",
.size = SZ_16M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
.fixups = &s25fs_s_nor_fixups,
}, {
.id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01),
.name = "s25fl129p1",
.size = SZ_16M,
- .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x40, 0x13),
.name = "s25fl204k",
.size = SZ_512K,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x01, 0x40, 0x14),
.name = "s25fl208k",
.size = SZ_1M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x01, 0x40, 0x15),
.name = "s25fl116k",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x01, 0x40, 0x16),
.name = "s25fl132k",
@@ -901,19 +901,19 @@ static const struct flash_info spansion_nor_parts[] = {
.id = SNOR_ID(0x01, 0x60, 0x17),
.name = "s25fl064l",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0x01, 0x60, 0x18),
.name = "s25fl128l",
.size = SZ_16M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0x01, 0x60, 0x19),
.name = "s25fl256l",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixup_flags = SPI_NOR_4B_OPCODES,
}, {
.id = SNOR_ID(0x04, 0x2c, 0xc2, 0x7f, 0x7f, 0x7f),
@@ -985,22 +985,22 @@ static const struct flash_info spansion_nor_parts[] = {
.id = SNOR_ID(0xef, 0x40, 0x13),
.name = "s25fl004k",
.size = SZ_512K,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x40, 0x14),
.name = "s25fl008k",
.size = SZ_1M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x40, 0x15),
.name = "s25fl016k",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x40, 0x17),
.name = "s25fl064k",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}
};
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 11/15] mtd: spi-nor: sst: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (9 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 10/15] mtd: spi-nor: spansion: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 12/15] mtd: spi-nor: winbond: " Esben Haabendal
` (5 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/sst.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c
index 180b7390690c..bfebef62dd36 100644
--- a/drivers/mtd/spi-nor/sst.c
+++ b/drivers/mtd/spi-nor/sst.c
@@ -146,7 +146,7 @@ static const struct flash_info sst_nor_parts[] = {
.id = SNOR_ID(0xbf, 0x26, 0x41),
.name = "sst26vf016b",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xbf, 0x26, 0x42),
.name = "sst26vf032b",
@@ -157,13 +157,13 @@ static const struct flash_info sst_nor_parts[] = {
.name = "sst26vf064b",
.size = SZ_8M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixups = &sst26vf_nor_fixups,
}, {
.id = SNOR_ID(0xbf, 0x26, 0x51),
.name = "sst26wf016b",
.size = SZ_2M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}
};
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 12/15] mtd: spi-nor: winbond: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (10 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 11/15] mtd: spi-nor: sst: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 13/15] mtd: spi-nor: xmc: " Esben Haabendal
` (4 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/winbond.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 142fb27b2ea9..42160257e270 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -101,7 +101,7 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x40, 0x17),
.name = "w25q64",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x40, 0x18),
.name = "w25q128",
@@ -110,13 +110,13 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x40, 0x19),
.name = "w25q256",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.fixups = &w25q256_fixups,
}, {
.id = SNOR_ID(0xef, 0x40, 0x20),
.name = "w25q512jvq",
.size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x50, 0x12),
.name = "w25q20bw",
@@ -137,31 +137,31 @@ static const struct flash_info winbond_nor_parts[] = {
.name = "w25q16dw",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x60, 0x16),
.name = "w25q32dw",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
.id = SNOR_ID(0xef, 0x60, 0x17),
.name = "w25q64dw",
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x60, 0x19),
.name = "w25q256jw",
.size = SZ_32M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x60, 0x20),
.name = "w25q512nwq",
@@ -171,13 +171,13 @@ static const struct flash_info winbond_nor_parts[] = {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x70, 0x17),
.name = "w25q64jvm",
@@ -188,7 +188,7 @@ static const struct flash_info winbond_nor_parts[] = {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x70, 0x19),
.name = "w25q256jvm",
@@ -196,32 +196,32 @@ static const struct flash_info winbond_nor_parts[] = {
.id = SNOR_ID(0xef, 0x71, 0x19),
.name = "w25m512jv",
.size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
}, {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.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,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x80, 0x19),
.name = "w25q256jwm",
.size = SZ_32M,
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0xef, 0x80, 0x20),
.name = "w25q512nwm",
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 13/15] mtd: spi-nor: xmc: Use new SPI_NOR_TRY_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (11 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 12/15] mtd: spi-nor: winbond: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
` (3 subsequent siblings)
16 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
This converts from the old (deprecated) implicit way of triggering an
optional SFDP parse with fallback to the static configuration in the
matching struct flash_info entry.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/xmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/xmc.c b/drivers/mtd/spi-nor/xmc.c
index d5a06054b0dd..527468630b99 100644
--- a/drivers/mtd/spi-nor/xmc.c
+++ b/drivers/mtd/spi-nor/xmc.c
@@ -13,12 +13,12 @@ static const struct flash_info xmc_nor_parts[] = {
.id = SNOR_ID(0x20, 0x70, 0x17),
.name = "XM25QH64A",
.size = SZ_8M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
}, {
.id = SNOR_ID(0x20, 0x70, 0x18),
.name = "XM25QH128A",
.size = SZ_16M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_TRY_SFDP,
},
};
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (12 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 13/15] mtd: spi-nor: xmc: " Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-12 8:33 ` kernel test robot
` (2 more replies)
2024-07-11 13:00 ` [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag Esben Haabendal
` (2 subsequent siblings)
16 siblings, 3 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
With all drivers converted to the new SPI_NOR_TRY_SFDP flag, we can remove
the old deprecated mechanism for triggering optional SFDP parsing.
New flashes must use SPI_NOR_TRY_SFDP to get this behavior. Hopefully, all
new drivers will be fore pure SFDP flashes, so no or at least very few new
users of this flag is expected.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/core.h | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index dfc81716e068..f4a76f42051a 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -719,24 +719,7 @@ static inline bool spi_nor_needs_sfdp(const struct spi_nor *nor)
*/
static inline bool spi_nor_try_sfdp(const struct spi_nor *nor)
{
- if (nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP)
- return false;
- if (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
- return true;
-
- /* Deprecated/legacy way for triggering optional SFDP parsing.
- * If one of the no_sfdp_flags indicating dual, quad or octal read is
- * set, SFDP parsing will be tried.
- * When all drivers have been converted to set SPI_NOR_TRY_SFDP where
- * needed, this deprecated mechanism can be removed.
- */
- if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
- SPI_NOR_QUAD_READ |
- SPI_NOR_OCTAL_READ |
- SPI_NOR_OCTAL_DTR_READ))
- return true;
-
- return false;
+ return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
}
#ifdef CONFIG_DEBUG_FS
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
@ 2024-07-12 8:33 ` kernel test robot
2024-07-12 9:23 ` Esben Haabendal
2024-07-12 16:04 ` kernel test robot
2 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2024-07-12 8:33 UTC (permalink / raw)
To: Esben Haabendal, Tudor Ambarus, Pratyush Yadav, Michael Walle,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
Cc: llvm, oe-kbuild-all, linux-mtd, linux-kernel, Rasmus Villemoes,
linux-arm-kernel, Esben Haabendal
Hi Esben,
kernel test robot noticed the following build errors:
[auto build test ERROR on a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6]
url: https://github.com/intel-lab-lkp/linux/commits/Esben-Haabendal/mtd-spi-nor-core-add-flag-for-doing-optional-SFDP-parsing/20240711-224454
base: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6
patch link: https://lore.kernel.org/r/20240711-macronix-mx25l3205d-fixups-v3-14-99353461dd2d%40geanix.com
patch subject: [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240712/202407121629.O2ykn94e-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project a0c6b8aef853eedaa0980f07c0a502a5a8a9740e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240712/202407121629.O2ykn94e-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407121629.O2ykn94e-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/mtd/spi-nor/core.c:13:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2210:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/mtd/spi-nor/core.c:17:
In file included from include/linux/mtd/spi-nor.h:11:
In file included from include/linux/spi/spi-mem.h:14:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
In file included from drivers/mtd/spi-nor/core.c:17:
In file included from include/linux/mtd/spi-nor.h:11:
In file included from include/linux/spi/spi-mem.h:14:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
In file included from drivers/mtd/spi-nor/core.c:17:
In file included from include/linux/mtd/spi-nor.h:11:
In file included from include/linux/spi/spi-mem.h:14:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
692 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
700 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
708 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
717 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
726 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
735 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
In file included from drivers/mtd/spi-nor/core.c:25:
>> drivers/mtd/spi-nor/core.h:722:54: error: expected ';' after return statement
722 | return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
| ^
| ;
17 warnings and 1 error generated.
vim +722 drivers/mtd/spi-nor/core.h
712
713 /**
714 * spi_nor_try_sfdp() - returns true if optional SFDP parsing should be tried
715 * for this flash, with fallback to static parameters and settings based on
716 * flash ID if SFDP parsing fails.
717 *
718 * Return: true if optional SFDP parsing should be tried
719 */
720 static inline bool spi_nor_try_sfdp(const struct spi_nor *nor)
721 {
> 722 return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
723 }
724
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
2024-07-12 8:33 ` kernel test robot
@ 2024-07-12 9:23 ` Esben Haabendal
2024-07-12 16:04 ` kernel test robot
2 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-12 9:23 UTC (permalink / raw)
To: Tudor Ambarus
Cc: Alexandre Belloni, Michael Walle, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, linux-kernel,
Claudiu Beznea, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
Esben Haabendal <esben@geanix.com> writes:
> With all drivers converted to the new SPI_NOR_TRY_SFDP flag, we can remove
> the old deprecated mechanism for triggering optional SFDP parsing.
>
> New flashes must use SPI_NOR_TRY_SFDP to get this behavior. Hopefully, all
> new drivers will be fore pure SFDP flashes, so no or at least very few new
> users of this flag is expected.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
> drivers/mtd/spi-nor/core.h | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
> index dfc81716e068..f4a76f42051a 100644
> --- a/drivers/mtd/spi-nor/core.h
> +++ b/drivers/mtd/spi-nor/core.h
> @@ -719,24 +719,7 @@ static inline bool spi_nor_needs_sfdp(const struct spi_nor *nor)
> */
> static inline bool spi_nor_try_sfdp(const struct spi_nor *nor)
> {
> - if (nor->info->no_sfdp_flags & SPI_NOR_SKIP_SFDP)
> - return false;
> - if (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
> - return true;
> -
> - /* Deprecated/legacy way for triggering optional SFDP parsing.
> - * If one of the no_sfdp_flags indicating dual, quad or octal read is
> - * set, SFDP parsing will be tried.
> - * When all drivers have been converted to set SPI_NOR_TRY_SFDP where
> - * needed, this deprecated mechanism can be removed.
> - */
> - if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
> - SPI_NOR_QUAD_READ |
> - SPI_NOR_OCTAL_READ |
> - SPI_NOR_OCTAL_DTR_READ))
> - return true;
> -
> - return false;
> + return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
Sorry. Bad cherry-pick here. Due to other reasons, I am testing out of
tree :( The missing semicolon will be added in v4.
I assume we can still discuss the idea here in this version.
/Esben
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
2024-07-12 8:33 ` kernel test robot
2024-07-12 9:23 ` Esben Haabendal
@ 2024-07-12 16:04 ` kernel test robot
2 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2024-07-12 16:04 UTC (permalink / raw)
To: Esben Haabendal, Tudor Ambarus, Pratyush Yadav, Michael Walle,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
Cc: oe-kbuild-all, linux-mtd, linux-kernel, Rasmus Villemoes,
linux-arm-kernel, Esben Haabendal
Hi Esben,
kernel test robot noticed the following build errors:
[auto build test ERROR on a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6]
url: https://github.com/intel-lab-lkp/linux/commits/Esben-Haabendal/mtd-spi-nor-core-add-flag-for-doing-optional-SFDP-parsing/20240711-224454
base: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6
patch link: https://lore.kernel.org/r/20240711-macronix-mx25l3205d-fixups-v3-14-99353461dd2d%40geanix.com
patch subject: [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing
config: arm-randconfig-003-20240712 (https://download.01.org/0day-ci/archive/20240712/202407122344.BP3r1VyN-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240712/202407122344.BP3r1VyN-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407122344.BP3r1VyN-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/mtd/spi-nor/atmel.c:9:
drivers/mtd/spi-nor/core.h: In function 'spi_nor_try_sfdp':
>> drivers/mtd/spi-nor/core.h:722:61: error: expected ';' before '}' token
722 | return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
| ^
| ;
723 | }
| ~
vim +722 drivers/mtd/spi-nor/core.h
712
713 /**
714 * spi_nor_try_sfdp() - returns true if optional SFDP parsing should be tried
715 * for this flash, with fallback to static parameters and settings based on
716 * flash ID if SFDP parsing fails.
717 *
718 * Return: true if optional SFDP parsing should be tried
719 */
720 static inline bool spi_nor_try_sfdp(const struct spi_nor *nor)
721 {
> 722 return (nor->info->no_sfdp_flags & SPI_NOR_TRY_SFDP)
723 }
724
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (13 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
@ 2024-07-11 13:00 ` Esben Haabendal
2024-07-12 9:26 ` Esben Haabendal
2024-07-12 9:55 ` [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Michael Walle
2024-09-26 10:08 ` Tudor Ambarus
16 siblings, 1 reply; 28+ messages in thread
From: Esben Haabendal @ 2024-07-11 13:00 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel,
Esben Haabendal
With the implementation of SPI_NOR_TRY_SFDP flag, the removal of the
deprecated mechanism for trying SFDP parsing, and the alignment of
->default_init() hooks handling, the SPI_NOR_SKIP_SFDP flag has become a
no-op, so it can safely be removed.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/mtd/spi-nor/core.c | 2 +-
drivers/mtd/spi-nor/core.h | 5 +----
drivers/mtd/spi-nor/spansion.c | 2 +-
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index d58f107f62ec..518b2707ce80 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3024,7 +3024,7 @@ static int spi_nor_init_params(struct spi_nor *nor)
if (spi_nor_needs_sfdp(nor)) {
ret = spi_nor_parse_sfdp(nor);
if (ret) {
- dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP or SPI_NOR_TRY_SFDP when declaring the flash\n");
+ dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_TRY_SFDP when declaring the flash\n");
return ret;
}
} else {
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index f4a76f42051a..ae10e12e9078 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -485,9 +485,7 @@ struct spi_nor_id {
*
* @no_sfdp_flags: flags that indicate support that can be discovered via SFDP.
* Used when SFDP tables are not defined in the flash. These
- * flags are used together with the SPI_NOR_SKIP_SFDP or
- * SPI_NOR_TRY_SFDP flag.
- * SPI_NOR_SKIP_SFDP: skip parsing of SFDP tables.
+ * flags are used together with the SPI_NOR_TRY_SFDP flag.
* SECT_4K: SPINOR_OP_BE_4K works uniformly.
* SPI_NOR_TRY_SFDP: try parsing SFDP tables before using the
* parameters specified in this struct.
@@ -536,7 +534,6 @@ struct flash_info {
#define SPI_NOR_RWW BIT(9)
u8 no_sfdp_flags;
-#define SPI_NOR_SKIP_SFDP BIT(0)
#define SECT_4K BIT(1)
#define SPI_NOR_TRY_SFDP BIT(2)
#define SPI_NOR_DUAL_READ BIT(3)
diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
index a58c0229003d..afcb684ffe4d 100644
--- a/drivers/mtd/spi-nor/spansion.c
+++ b/drivers/mtd/spi-nor/spansion.c
@@ -793,7 +793,7 @@ static const struct flash_info spansion_nor_parts[] = {
.name = "s25fl256s0",
.size = SZ_32M,
.sector_size = SZ_256K,
- .no_sfdp_flags = SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.mfr_flags = USE_CLSR,
}, {
.id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x81),
--
2.45.2
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag
2024-07-11 13:00 ` [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag Esben Haabendal
@ 2024-07-12 9:26 ` Esben Haabendal
0 siblings, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-07-12 9:26 UTC (permalink / raw)
To: Tudor Ambarus
Cc: Alexandre Belloni, Michael Walle, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, linux-kernel,
Claudiu Beznea, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
Esben Haabendal <esben@geanix.com> writes:
> With the implementation of SPI_NOR_TRY_SFDP flag, the removal of the
> deprecated mechanism for trying SFDP parsing, and the alignment of
> ->default_init() hooks handling, the SPI_NOR_SKIP_SFDP flag has become a
> no-op, so it can safely be removed.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
Should I split this into a commit for the spansion change, and one for
the core change?
/Esben
> ---
> drivers/mtd/spi-nor/core.c | 2 +-
> drivers/mtd/spi-nor/core.h | 5 +----
> drivers/mtd/spi-nor/spansion.c | 2 +-
> 3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index d58f107f62ec..518b2707ce80 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3024,7 +3024,7 @@ static int spi_nor_init_params(struct spi_nor *nor)
> if (spi_nor_needs_sfdp(nor)) {
> ret = spi_nor_parse_sfdp(nor);
> if (ret) {
> - dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP or SPI_NOR_TRY_SFDP when declaring the flash\n");
> + dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_TRY_SFDP when declaring the flash\n");
> return ret;
> }
> } else {
> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
> index f4a76f42051a..ae10e12e9078 100644
> --- a/drivers/mtd/spi-nor/core.h
> +++ b/drivers/mtd/spi-nor/core.h
> @@ -485,9 +485,7 @@ struct spi_nor_id {
> *
> * @no_sfdp_flags: flags that indicate support that can be discovered via SFDP.
> * Used when SFDP tables are not defined in the flash. These
> - * flags are used together with the SPI_NOR_SKIP_SFDP or
> - * SPI_NOR_TRY_SFDP flag.
> - * SPI_NOR_SKIP_SFDP: skip parsing of SFDP tables.
> + * flags are used together with the SPI_NOR_TRY_SFDP flag.
> * SECT_4K: SPINOR_OP_BE_4K works uniformly.
> * SPI_NOR_TRY_SFDP: try parsing SFDP tables before using the
> * parameters specified in this struct.
> @@ -536,7 +534,6 @@ struct flash_info {
> #define SPI_NOR_RWW BIT(9)
>
> u8 no_sfdp_flags;
> -#define SPI_NOR_SKIP_SFDP BIT(0)
> #define SECT_4K BIT(1)
> #define SPI_NOR_TRY_SFDP BIT(2)
> #define SPI_NOR_DUAL_READ BIT(3)
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index a58c0229003d..afcb684ffe4d 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -793,7 +793,7 @@ static const struct flash_info spansion_nor_parts[] = {
> .name = "s25fl256s0",
> .size = SZ_32M,
> .sector_size = SZ_256K,
> - .no_sfdp_flags = SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> .mfr_flags = USE_CLSR,
> }, {
> .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x81),
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (14 preceding siblings ...)
2024-07-11 13:00 ` [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag Esben Haabendal
@ 2024-07-12 9:55 ` Michael Walle
2024-09-26 7:56 ` Esben Haabendal
2024-09-26 10:08 ` Tudor Ambarus
16 siblings, 1 reply; 28+ messages in thread
From: Michael Walle @ 2024-07-12 9:55 UTC (permalink / raw)
To: Esben Haabendal, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1447 bytes --]
Hi,
On Thu Jul 11, 2024 at 3:00 PM CEST, Esben Haabendal wrote:
> As a consequence, the SPI_NOR_SKIP_SFDP flag is no more, and all
> drivers that have been doing optional SFDP is now marked explicitly to
> do that using the SPI_NOR_TRY_SFDP.
First, I haven't looked at your patchset at the moment. But I'd like
to take the opportunity to discuss the following (and excuse me that
I didn't had this idea before all your work on this).
First, I'd like to see it the other way around, that is, doing SFDP
by default and let the driver opt-out instead of opt-in. This will
also align with the current "SFDP only driver", i.e. if a flash is
not known we try SFDP anyway. Going forward, I'd say this is also
the sane behavior and we don't have to add any flags if someone want
to add support for an (older) flash with the same ID but without
SFDP. With the current approach, we'd have to add the TRY_SFDP flag.
Now we might play it safe and add that SPI_NOR_SKIP_SFDP to any
flash which doesn't do the SFDP parsing (because it has size != 0
and not any of the magic flags set) - or we might just go ahead and
do the probing first for *any* flashes. Yes we might issue an
unsupported opcode, but we already do that with the generic SFDP
flash driver. So no big deal maybe (?). Vendors where we know for a
fact that they don't have any SFDP (Everspin I'm looking at you),
would of course set the SKIP_SFDP flag.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-07-12 9:55 ` [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Michael Walle
@ 2024-09-26 7:56 ` Esben Haabendal
2024-09-26 10:47 ` Tudor Ambarus
0 siblings, 1 reply; 28+ messages in thread
From: Esben Haabendal @ 2024-09-26 7:56 UTC (permalink / raw)
To: Michael Walle
Cc: Alexandre Belloni, linux-kernel, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, Claudiu Beznea,
Tudor Ambarus, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
"Michael Walle" <mwalle@kernel.org> writes:
> Hi,
>
> On Thu Jul 11, 2024 at 3:00 PM CEST, Esben Haabendal wrote:
>> As a consequence, the SPI_NOR_SKIP_SFDP flag is no more, and all
>> drivers that have been doing optional SFDP is now marked explicitly to
>> do that using the SPI_NOR_TRY_SFDP.
>
> First, I haven't looked at your patchset at the moment. But I'd like
> to take the opportunity to discuss the following (and excuse me that
> I didn't had this idea before all your work on this).
>
> First, I'd like to see it the other way around, that is, doing SFDP
> by default and let the driver opt-out instead of opt-in. This will
> also align with the current "SFDP only driver", i.e. if a flash is
> not known we try SFDP anyway. Going forward, I'd say this is also
> the sane behavior and we don't have to add any flags if someone want
> to add support for an (older) flash with the same ID but without
> SFDP. With the current approach, we'd have to add the TRY_SFDP flag.
>
> Now we might play it safe and add that SPI_NOR_SKIP_SFDP to any
> flash which doesn't do the SFDP parsing (because it has size != 0
> and not any of the magic flags set) - or we might just go ahead and
> do the probing first for *any* flashes. Yes we might issue an
> unsupported opcode, but we already do that with the generic SFDP
> flash driver. So no big deal maybe (?). Vendors where we know for a
> fact that they don't have any SFDP (Everspin I'm looking at you),
> would of course set the SKIP_SFDP flag.
I like your idea.
Did you discuss this with Tudor?
On 9/23/24 7:04 PM, Tudor Ambarus wrote:
>>> * Always read Macronix chips SFDP, as Macronix replaced all old chips
>>> in the Manufacture table.
>>
>> I'll NACK it unless you prove that the old flavors of flashes are not
>> used anymore in the kernel.
>
> Even if you can prove that the older flashes are not used in the kernel
> anymore, we can't just switch to parsing SFDP, because we have seen in
> the past flashes with wrong SFDP data that made the flashes misbehave.
> The recommended way is to update just the flashes that you can test.
Does it make sense if I work on a patch implementing the proposal you
put forward, or is it possible to discuss it further before doing that
work?
If it will certainly be NACK'ed, I might as well try to find a different
approach.
/Esben
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-09-26 7:56 ` Esben Haabendal
@ 2024-09-26 10:47 ` Tudor Ambarus
2024-09-26 10:52 ` Tudor Ambarus
2024-09-26 12:18 ` Esben Haabendal
0 siblings, 2 replies; 28+ messages in thread
From: Tudor Ambarus @ 2024-09-26 10:47 UTC (permalink / raw)
To: Esben Haabendal, Michael Walle
Cc: Alexandre Belloni, linux-kernel, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, Claudiu Beznea, linux-mtd,
linux-arm-kernel, Miquel Raynal, Pratyush Yadav
Hi, Esben,
Thank you for the perseverance :D
On 9/26/24 8:56 AM, Esben Haabendal wrote:
> "Michael Walle" <mwalle@kernel.org> writes:
>
>> Hi,
>>
>> On Thu Jul 11, 2024 at 3:00 PM CEST, Esben Haabendal wrote:
>>> As a consequence, the SPI_NOR_SKIP_SFDP flag is no more, and all
>>> drivers that have been doing optional SFDP is now marked explicitly to
>>> do that using the SPI_NOR_TRY_SFDP.
>>
>> First, I haven't looked at your patchset at the moment. But I'd like
>> to take the opportunity to discuss the following (and excuse me that
>> I didn't had this idea before all your work on this).
>>
>> First, I'd like to see it the other way around, that is, doing SFDP
>> by default and let the driver opt-out instead of opt-in. This will
>> also align with the current "SFDP only driver", i.e. if a flash is
>> not known we try SFDP anyway. Going forward, I'd say this is also
>> the sane behavior and we don't have to add any flags if someone want
>> to add support for an (older) flash with the same ID but without
>> SFDP. With the current approach, we'd have to add the TRY_SFDP flag.
>>
>> Now we might play it safe and add that SPI_NOR_SKIP_SFDP to any
>> flash which doesn't do the SFDP parsing (because it has size != 0
>> and not any of the magic flags set) - or we might just go ahead and
>> do the probing first for *any* flashes. Yes we might issue an
>> unsupported opcode, but we already do that with the generic SFDP
>> flash driver. So no big deal maybe (?). Vendors where we know for a
>> fact that they don't have any SFDP (Everspin I'm looking at you),
>> would of course set the SKIP_SFDP flag.
Issuing RDSFDP for flashes that don't support it shouldn't be too bad
indeed, it's not recommended, but it shall be fine. What I'm worried
about is flashes with wrong SFDP data (see all the SFDP fixup hooks that
we have). So my suggestion is to play it safe unless one of you guys
step up and commit that will fix or help fix each bug that results from
this.
I'd like you to also consider the SFDP versions and how many parameters
they are exposing. I can't tell exactly, but if I remember correctly,
rev A had 9 dwords for BFPT, revB 16, and revC and other more. If we
consider static init folowed by SFDP with rollback option, point 3/ in
your cover letter, are we sure that all the parameters that are
initialized before parsing SFDP are overwritten at SFDP parsing time? If
yes, we shall be fine.
Esben, to speed up the things on both ends, I recommend you for v4 to
draft just a core patch if you care, then you can handle the vendor
drivers. Or send us some pseudocode and we can talk on that.
Thanks,
ta
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-09-26 10:47 ` Tudor Ambarus
@ 2024-09-26 10:52 ` Tudor Ambarus
2024-09-26 12:18 ` Esben Haabendal
1 sibling, 0 replies; 28+ messages in thread
From: Tudor Ambarus @ 2024-09-26 10:52 UTC (permalink / raw)
To: Esben Haabendal, Michael Walle
Cc: Alexandre Belloni, linux-kernel, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, Claudiu Beznea, linux-mtd,
linux-arm-kernel, Miquel Raynal, Pratyush Yadav
On 9/26/24 11:47 AM, Tudor Ambarus wrote:
> Hi, Esben,
>
> Thank you for the perseverance :D
>
> On 9/26/24 8:56 AM, Esben Haabendal wrote:
>> "Michael Walle" <mwalle@kernel.org> writes:
>>
>>> Hi,
>>>
>>> On Thu Jul 11, 2024 at 3:00 PM CEST, Esben Haabendal wrote:
>>>> As a consequence, the SPI_NOR_SKIP_SFDP flag is no more, and all
>>>> drivers that have been doing optional SFDP is now marked explicitly to
>>>> do that using the SPI_NOR_TRY_SFDP.
>>>
>>> First, I haven't looked at your patchset at the moment. But I'd like
>>> to take the opportunity to discuss the following (and excuse me that
>>> I didn't had this idea before all your work on this).
>>>
>>> First, I'd like to see it the other way around, that is, doing SFDP
>>> by default and let the driver opt-out instead of opt-in. This will
>>> also align with the current "SFDP only driver", i.e. if a flash is
>>> not known we try SFDP anyway. Going forward, I'd say this is also
>>> the sane behavior and we don't have to add any flags if someone want
>>> to add support for an (older) flash with the same ID but without
>>> SFDP. With the current approach, we'd have to add the TRY_SFDP flag.
>>>
>>> Now we might play it safe and add that SPI_NOR_SKIP_SFDP to any
>>> flash which doesn't do the SFDP parsing (because it has size != 0
>>> and not any of the magic flags set) - or we might just go ahead and
>>> do the probing first for *any* flashes. Yes we might issue an
>>> unsupported opcode, but we already do that with the generic SFDP
>>> flash driver. So no big deal maybe (?). Vendors where we know for a
>>> fact that they don't have any SFDP (Everspin I'm looking at you),
>>> would of course set the SKIP_SFDP flag.
>
> Issuing RDSFDP for flashes that don't support it shouldn't be too bad
> indeed, it's not recommended, but it shall be fine. What I'm worried
> about is flashes with wrong SFDP data (see all the SFDP fixup hooks that
> we have). So my suggestion is to play it safe unless one of you guys
> step up and commit that will fix or help fix each bug that results from
> this.
>
> I'd like you to also consider the SFDP versions and how many parameters
> they are exposing. I can't tell exactly, but if I remember correctly,
> rev A had 9 dwords for BFPT, revB 16, and revC and other more. If we
> consider static init folowed by SFDP with rollback option, point 3/ in
> your cover letter, are we sure that all the parameters that are
> initialized before parsing SFDP are overwritten at SFDP parsing time? If
> yes, we shall be fine.
>
> Esben, to speed up the things on both ends, I recommend you for v4 to
> draft just a core patch if you care, then you can handle the vendor
> drivers. Or send us some pseudocode and we can talk on that.
>
To summarize, I like the idea too, as far as we can keep backward
compatibility.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-09-26 10:47 ` Tudor Ambarus
2024-09-26 10:52 ` Tudor Ambarus
@ 2024-09-26 12:18 ` Esben Haabendal
1 sibling, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-09-26 12:18 UTC (permalink / raw)
To: Tudor Ambarus
Cc: Alexandre Belloni, Michael Walle, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, linux-kernel,
Claudiu Beznea, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Hi, Esben,
>
> Thank you for the perseverance :D
>
> On 9/26/24 8:56 AM, Esben Haabendal wrote:
>> "Michael Walle" <mwalle@kernel.org> writes:
>>
>>> Hi,
>>>
>>> On Thu Jul 11, 2024 at 3:00 PM CEST, Esben Haabendal wrote:
>>>> As a consequence, the SPI_NOR_SKIP_SFDP flag is no more, and all
>>>> drivers that have been doing optional SFDP is now marked explicitly to
>>>> do that using the SPI_NOR_TRY_SFDP.
>>>
>>> First, I haven't looked at your patchset at the moment. But I'd like
>>> to take the opportunity to discuss the following (and excuse me that
>>> I didn't had this idea before all your work on this).
>>>
>>> First, I'd like to see it the other way around, that is, doing SFDP
>>> by default and let the driver opt-out instead of opt-in. This will
>>> also align with the current "SFDP only driver", i.e. if a flash is
>>> not known we try SFDP anyway. Going forward, I'd say this is also
>>> the sane behavior and we don't have to add any flags if someone want
>>> to add support for an (older) flash with the same ID but without
>>> SFDP. With the current approach, we'd have to add the TRY_SFDP flag.
>>>
>>> Now we might play it safe and add that SPI_NOR_SKIP_SFDP to any
>>> flash which doesn't do the SFDP parsing (because it has size != 0
>>> and not any of the magic flags set) - or we might just go ahead and
>>> do the probing first for *any* flashes. Yes we might issue an
>>> unsupported opcode, but we already do that with the generic SFDP
>>> flash driver. So no big deal maybe (?). Vendors where we know for a
>>> fact that they don't have any SFDP (Everspin I'm looking at you),
>>> would of course set the SKIP_SFDP flag.
>
> Issuing RDSFDP for flashes that don't support it shouldn't be too bad
> indeed, it's not recommended, but it shall be fine. What I'm worried
> about is flashes with wrong SFDP data (see all the SFDP fixup hooks that
> we have). So my suggestion is to play it safe unless one of you guys
> step up and commit that will fix or help fix each bug that results from
> this.
Sounds like a good idea. I for one will not put my head on the table
like that :D
> I'd like you to also consider the SFDP versions and how many parameters
> they are exposing. I can't tell exactly, but if I remember correctly,
> rev A had 9 dwords for BFPT, revB 16, and revC and other more. If we
> consider static init folowed by SFDP with rollback option, point 3/ in
> your cover letter, are we sure that all the parameters that are
> initialized before parsing SFDP are overwritten at SFDP parsing time? If
> yes, we shall be fine.
How can we be sure of that?
But if you want to be really sure that no static configuraion is left
after SFDP parsing, why are we handing it a copy of nor->params that was
initialized from static configuration?
Why not call spi_nor_parse_sfdp() with nor->params bing basically
uninitialized?
And then, only if spi_nor_parse_sfdp() fails, look into flash_info
static configuration?
> Esben, to speed up the things on both ends, I recommend you for v4 to
> draft just a core patch if you care, then you can handle the vendor
> drivers. Or send us some pseudocode and we can talk on that.
I will see what I can do.
I guess some kind of RFC patch of the core changes for v4 might be a
good next step.
/Esben
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
` (15 preceding siblings ...)
2024-07-12 9:55 ` [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Michael Walle
@ 2024-09-26 10:08 ` Tudor Ambarus
2024-09-26 11:01 ` Esben Haabendal
2024-09-26 11:35 ` Esben Haabendal
16 siblings, 2 replies; 28+ messages in thread
From: Tudor Ambarus @ 2024-09-26 10:08 UTC (permalink / raw)
To: Esben Haabendal, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-mtd, linux-kernel, Rasmus Villemoes, linux-arm-kernel
Hiya, Esben,
On 7/11/24 2:00 PM, Esben Haabendal wrote:
> Following up to various discussions, this series have now been
> modified so that it gets rid of the old deprecated approach
> for detecting when to do optional SFDP parsing.
>
> Before these changes, spi-nor flashes were handled in 4 different
> ways:
>
I'm adding a bit of extra context on each point you made. All your
points contain static init, you missed spi_nor_init_default_params()
There's a 0/ case where we have indeed just SFDP initialized flashes,
and that is the generic flash driver.
0/ SFDP only, generic flash driver
> (1) SFDP only [size==0]
1/ static + SFDP
spi_nor_init_default_params(nor);
spi_nor_parse_sfdp();
>
> (2a) static config only [size!=0 && no_sfdp_flags & SPI_NOR_SKIP_SFDP]
2a/ is
spi_nor_init_default_params(nor);
spi_nor_no_sfdp_init_params(nor);
>
> (2b) static config only
> [size!=0 &&
> !(no_sfdp_flags & (SPI_NOR_SKIP_SFDP |
> SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
2b/ is
spi_nor_init_default_params(nor);
spi_nor_init_params_deprecated(nor); //where parse SFDP is not called
spi_nor_no_sfdp_init_params(nor);
spi_nor_manufacturer_init_params(nor);>
> (3) SFDP with fallback to static config
> [size!=0 &&
> !(no_sfdp_flags & SPI_NOR_SKIP_SFDP) &&
> (no_sfdp_flags & SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>
3/ is 2b/ with parse SFDP called and rollback mechanism
spi_nor_init_default_params(nor);
spi_nor_init_params_deprecated(nor);
spi_nor_no_sfdp_init_params(nor);
spi_nor_manufacturer_init_params(nor);
spi_nor_sfdp_init_params_deprecated(nor);
All cases from above are followed by a call to spi_nor_late_init_params().
> Cases (2a) and (2b) have been handled slightly different, with
> manufacturer and flash_info ->default_init() hooks being called in
> case (2b) but not in case (2a).
default_init() was a mistake and we shall remove it and replace it with
late_init(). The challenge is to do that without affecting backwards
compatibility. But let's move this aside for the moment
>
> With this series, that is changed to this simpler approach instead:
>
> (1) SFDP only [size==0]
>
> (2) static config only
> [size!=0 && !(no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>
> (3) SFDP with fallback to static config
> [size!=0 && (no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>
> Existing struct flash_info entries are modified, so that all those
> that was case (2a) or (2b) are now case (2), and those that were (1)
> and (3) are still (1) and (3).
We indeed want 2a/ and 2b/ to be squashed, ideally by removing the
default_init() hook.
And if we really want SFDP-only init, we shall not call
spi_nor_init_default_params() in this case.
Your patches do not apply on latest SPI NOR, I tried locally. Can you
point me to a branch of yours where I can see them? No need to resend.
Thanks,
ta
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-09-26 10:08 ` Tudor Ambarus
@ 2024-09-26 11:01 ` Esben Haabendal
2024-09-26 11:35 ` Esben Haabendal
1 sibling, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-09-26 11:01 UTC (permalink / raw)
To: Tudor Ambarus
Cc: Alexandre Belloni, Michael Walle, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, linux-kernel,
Claudiu Beznea, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Your patches do not apply on latest SPI NOR, I tried locally. Can you
> point me to a branch of yours where I can see them? No need to resend.
Sure. I have rebased to spi-nor/next and pushed the b4:
https://github.com/esben/linux/tree/b4/macronix-mx25l3205d-fixups
/Esben
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
2024-09-26 10:08 ` Tudor Ambarus
2024-09-26 11:01 ` Esben Haabendal
@ 2024-09-26 11:35 ` Esben Haabendal
1 sibling, 0 replies; 28+ messages in thread
From: Esben Haabendal @ 2024-09-26 11:35 UTC (permalink / raw)
To: Tudor Ambarus
Cc: Alexandre Belloni, Michael Walle, Vignesh Raghavendra,
Rasmus Villemoes, Richard Weinberger, linux-kernel,
Claudiu Beznea, linux-mtd, linux-arm-kernel, Miquel Raynal,
Pratyush Yadav
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Hiya, Esben,
>
> On 7/11/24 2:00 PM, Esben Haabendal wrote:
>> Following up to various discussions, this series have now been
>> modified so that it gets rid of the old deprecated approach
>> for detecting when to do optional SFDP parsing.
>>
>> Before these changes, spi-nor flashes were handled in 4 different
>> ways:
>>
>
> I'm adding a bit of extra context on each point you made. All your
> points contain static init, you missed spi_nor_init_default_params()
I might be even more confused now :) Let me try to understand...
> There's a 0/ case where we have indeed just SFDP initialized flashes,
> and that is the generic flash driver.
>
> 0/ SFDP only, generic flash driver
Ok. So this is when spi_nor_detect() falls back to
spi_nor_generic_flash, right?
>> (1) SFDP only [size==0]
>
> 1/ static + SFDP
So we have found a matching flash_info, and it has size==0. Right?
> spi_nor_init_default_params(nor);
I guess we can assume that flash_info in this case will always have
something set (other than .name and .size=0)?
> spi_nor_parse_sfdp();
>> (2a) static config only [size!=0 && no_sfdp_flags & SPI_NOR_SKIP_SFDP]
>
> 2a/ is
> spi_nor_init_default_params(nor);
> spi_nor_no_sfdp_init_params(nor);
Got it.
>> (2b) static config only
>> [size!=0 &&
>> !(no_sfdp_flags & (SPI_NOR_SKIP_SFDP |
>> SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>
> 2b/ is
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor); //where parse SFDP is not called
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);>
Got it.
>> (3) SFDP with fallback to static config
>> [size!=0 &&
>> !(no_sfdp_flags & SPI_NOR_SKIP_SFDP) &&
>> (no_sfdp_flags & SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>>
>
> 3/ is 2b/ with parse SFDP called and rollback mechanism
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor);
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);
> spi_nor_sfdp_init_params_deprecated(nor);
>
> All cases from above are followed by a call to spi_nor_late_init_params().
Got it.
Should I move your annotations to the cover letter? If I find it
helpful, I think it might also be helpful to somebody else :)
>> Cases (2a) and (2b) have been handled slightly different, with
>> manufacturer and flash_info ->default_init() hooks being called in
>> case (2b) but not in case (2a).
>
> default_init() was a mistake and we shall remove it and replace it with
> late_init(). The challenge is to do that without affecting backwards
> compatibility. But let's move this aside for the moment
>>
>> With this series, that is changed to this simpler approach instead:
>>
>> (1) SFDP only [size==0]
>>
>> (2) static config only
>> [size!=0 && !(no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> (3) SFDP with fallback to static config
>> [size!=0 && (no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> Existing struct flash_info entries are modified, so that all those
>> that was case (2a) or (2b) are now case (2), and those that were (1)
>> and (3) are still (1) and (3).
>
> We indeed want 2a/ and 2b/ to be squashed, ideally by removing the
> default_init() hook.
But you think we should not remove default_init() hook as part of this
series?
> And if we really want SFDP-only init, we shall not call
> spi_nor_init_default_params() in this case.
So move spi_nor_init_default_params() into the if (spi_nor_needs_sfdp())
else section?
I have pushed a fixup commit doing this to my branch. Should I amend
patch 1/15 with it?
/Esben
^ permalink raw reply [flat|nested] 28+ messages in thread