All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Paul Cercueil <paul.cercueil@bootlin.com>
Cc: Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <mwalle@kernel.org>,
	Takahiro Kuwano <takahiro.kuwano@infineon.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	gregory.clement@bootlin.com, maxime.chevallier@bootlin.com,
	thomas.richard@bootlin.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F
Date: Thu, 3 Dec 2026 16:37:26 +0000	[thread overview]
Message-ID: <axGaKdTMDqdsz3o5@nsa> (raw)
In-Reply-To: <20261203154644.144198-1-paul.cercueil@bootlin.com>

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 = &params->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
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Nuno Sá" <nuno.sa@analog.com>
To: Paul Cercueil <paul.cercueil@bootlin.com>
Cc: Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <mwalle@kernel.org>,
	Takahiro Kuwano <takahiro.kuwano@infineon.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	gregory.clement@bootlin.com, maxime.chevallier@bootlin.com,
	thomas.richard@bootlin.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F
Date: Thu, 3 Dec 2026 16:37:26 +0000	[thread overview]
Message-ID: <axGaKdTMDqdsz3o5@nsa> (raw)
In-Reply-To: <20261203154644.144198-1-paul.cercueil@bootlin.com>

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 = &params->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
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2026-12-03 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:46 [PATCH v2] mtd: spi-nor: Ignore octal PP bits on < JESD216F Paul Cercueil
2026-12-03 15:46 ` Paul Cercueil
2026-12-03 16:37 ` Nuno Sá [this message]
2026-12-03 16:37   ` Nuno Sá

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axGaKdTMDqdsz3o5@nsa \
    --to=nuno.sa@analog.com \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=paul.cercueil@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=takahiro.kuwano@infineon.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=thomas.richard@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.