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 --- 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