* [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F
@ 2026-12-03 15:46 Paul Cercueil
2026-12-03 16:37 ` Nuno Sá
0 siblings, 1 reply; 2+ messages in thread
From: Paul Cercueil @ 2026-12-03 15:46 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Nuno Sá, linux-mtd, Thomas Petazzoni, gregory.clement,
maxime.chevallier, thomas.richard, Paul Cercueil, stable
Octal page program support was added in JESD216F. Before that, the bits
were marked as reserved. Some chips like the Winbond W25Q256JW have some
of these bits set, which caused octal PP support to be incorrectly
detected.
Fixes: 68d7115d77a8 ("mtd: spi-nor: sfdp: get the 1-1-8 and 1-8-8 page programs from 4BAIT")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
Changelog:
v2:
- Skip these bits when parsing the 4BAIT.
- Check the top-level SFDP header version rather than the BFPT header
- Added Fixes: tag
---
drivers/mtd/spi-nor/sfdp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index 4d77354ee1b2..f86dae8019fc 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -1103,6 +1103,7 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
struct spi_nor_pp_command *params_pp = params->page_programs;
struct spi_nor_erase_map *map = ¶ms->erase_map;
struct spi_nor_erase_type *erase_type = map->erase_type;
+ struct sfdp_header *sfdp_header = spi_nor_sfdp_get_header(nor);
u32 *dwords;
size_t len;
u32 addr, discard_hwcaps, read_hwcaps, pp_hwcaps, erase_mask;
@@ -1156,7 +1157,14 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
* SFDP table that indicates support for Page Program Commands.
* Bypass the params->hwcaps.mask and consider 4BAIT the biggest
* authority for specifying Page Program support.
+ *
+ * The octal page program bits are reserved before JESD216F,
+ * so skip them entirely.
*/
+ if ((program->hwcaps & (SNOR_HWCAPS_PP_1_1_8 | SNOR_HWCAPS_PP_1_8_8)) &&
+ sfdp_header->minor < SFDP_JESD216F_MINOR)
+ continue;
+
discard_hwcaps |= program->hwcaps;
if (dwords[SFDP_DWORD(1)] & program->supported_bit)
pp_hwcaps |= program->hwcaps;
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F
2026-12-03 15:46 [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F Paul Cercueil
@ 2026-12-03 16:37 ` Nuno Sá
0 siblings, 0 replies; 2+ messages in thread
From: Nuno Sá @ 2026-12-03 16:37 UTC (permalink / raw)
To: Paul Cercueil
Cc: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, linux-mtd,
Thomas Petazzoni, gregory.clement, maxime.chevallier,
thomas.richard, stable
On Thu, Dec 03, 2026 at 04:46:44PM +0100, Paul Cercueil wrote:
> Octal page program support was added in JESD216F. Before that, the bits
> were marked as reserved. Some chips like the Winbond W25Q256JW have some
> of these bits set, which caused octal PP support to be incorrectly
> detected.
>
> Fixes: 68d7115d77a8 ("mtd: spi-nor: sfdp: get the 1-1-8 and 1-8-8 page programs from 4BAIT")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
> ---
>
> Changelog:
>
> v2:
> - Skip these bits when parsing the 4BAIT.
> - Check the top-level SFDP header version rather than the BFPT header
> - Added Fixes: tag
> ---
LGTM,
Acked-by: Nuno Sá <nuno.sa@analog.com>
> drivers/mtd/spi-nor/sfdp.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
> index 4d77354ee1b2..f86dae8019fc 100644
> --- a/drivers/mtd/spi-nor/sfdp.c
> +++ b/drivers/mtd/spi-nor/sfdp.c
> @@ -1103,6 +1103,7 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
> struct spi_nor_pp_command *params_pp = params->page_programs;
> struct spi_nor_erase_map *map = ¶ms->erase_map;
> struct spi_nor_erase_type *erase_type = map->erase_type;
> + struct sfdp_header *sfdp_header = spi_nor_sfdp_get_header(nor);
> u32 *dwords;
> size_t len;
> u32 addr, discard_hwcaps, read_hwcaps, pp_hwcaps, erase_mask;
> @@ -1156,7 +1157,14 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
> * SFDP table that indicates support for Page Program Commands.
> * Bypass the params->hwcaps.mask and consider 4BAIT the biggest
> * authority for specifying Page Program support.
> + *
> + * The octal page program bits are reserved before JESD216F,
> + * so skip them entirely.
> */
> + if ((program->hwcaps & (SNOR_HWCAPS_PP_1_1_8 | SNOR_HWCAPS_PP_1_8_8)) &&
> + sfdp_header->minor < SFDP_JESD216F_MINOR)
> + continue;
> +
> discard_hwcaps |= program->hwcaps;
> if (dwords[SFDP_DWORD(1)] & program->supported_bit)
> pp_hwcaps |= program->hwcaps;
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 16:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 15:46 [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F Paul Cercueil
2026-12-03 16:37 ` Nuno Sá
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox