mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Steam Lin" <STLin2@winbond.com>, <linux-mtd@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 16/25] mtd: spi-nor: winbond: Prepare introduction of W25QxxPW-Q/N parts
Date: Fri, 18 Sep 2026 11:11:10 +0200	[thread overview]
Message-ID: <DLIBQKG04DIF.1FKAYOEZH6ZU0@kernel.org> (raw)
In-Reply-To: <20260909-winbond-master-spi-nor-jw-cleanup-pw-addition-v1-16-c1b20c39dd1f@bootlin.com>

[-- Attachment #1: Type: text/plain, Size: 4393 bytes --]

On Wed Sep 9, 2026 at 5:25 PM CEST, Miquel Raynal wrote:
> There is an ID collision between chips of same density from the JW
> family (which it self conflicted with yet another family) with new PW
> parts. Chips are very similar in practice, it is mostly a matter of
> electrical differences (mostly power consumption being lower) as well as
> the addition of inline ECC capability for the higher devices (> 32Mb).
>
> Chips with ECC capability protect 16 bytes chunks are against single
> errors. In case a non-aligned write happens, ECC is locally disabled
> until the next erase.
>
> Another significant difference is that PW chips identify themselves as
> supporting the new SFDP (rev F) QER field which forces an alternate
> write SR2 opcode (0x31).
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/mtd/spi-nor/winbond.c | 55 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
> index fbad9e408d7a..efa9de1f0f66 100644
> --- a/drivers/mtd/spi-nor/winbond.c
> +++ b/drivers/mtd/spi-nor/winbond.c
> @@ -71,6 +71,41 @@ static bool winbond_rv_match(const struct spi_nor *nor)
>  	return nor->sfdp && is_w25qxxrv(nor);
>  }
>  
> +static bool is_w25qxxpw(const struct spi_nor *nor)
> +{
> +	struct sfdp_header *sfdp_h = spi_nor_sfdp_get_header(nor);
> +
> +	/*
> +	 * W25QxxPW chips re-use the same ID as the W25QxxJW/NW family.
> +	 *
> +	 * Chips are very similar, W25QxxPW brings mostly performance and power
> +	 * consumption improvements. One key difference in behaviour is the
> +	 * automatic 16-byte based error correction.
> +	 *
> +	 * They can be distinguished based on their SFDP minor revision:
> +	 * W25QxxJW:       JESD216B, minor revision == 06h
> +	 * W25Q51/01/02NW: JESD216B, minor revision == 06h
> +	 * W25QxxPW:       JESD216F, minor revision >= 0Ah
> +	 */
> +	return sfdp_h->minor >= SFDP_JESD216F_MINOR;
> +}
> +
> +static bool winbond_pw_match(const struct spi_nor *nor)
> +{
> +	return nor->sfdp && is_w25qxxpw(nor);
> +}
> +
> +static bool winbond_pw_with_ecc_match(const struct spi_nor *nor)
> +{
> +	const struct spi_nor_id *id = nor->info->id;
> +
> +	if (!winbond_pw_match(nor))
> +		return false;
> +
> +	/* W25Q33PW chips (id[2] == 0x16) do not have built-in ECC support */

The commit message mentions ECC is available for >= 32Mbit. Doesn't
align with this comment. Also about the 8MBit and 16Mbit ones?

"W25QxxPW chips smaller than 32MBit doesn't provide built-in ECC support"?

If you like I could rewrite it as I'll apply it. The rest of this
series looks good.

> +	return id->len == 3 && id->bytes[2] >= 0x17;

Then this makes more sense.

-michael

> +}
> +
>  static int
>  w25q128_post_bfpt_fixups(struct spi_nor *nor,
>  			 const struct sfdp_parameter_header *bfpt_header,
> @@ -201,6 +236,22 @@ static const struct spi_nor_fixups winbond_nor_partname_fixups = {
>  	.post_sfdp = winbond_nor_partname_post_sfdp_fixups,
>  };
>  
> +static int winbond_nor_ecc_configuration_post_sfdp_fixups(struct spi_nor *nor)
> +{
> +	/*
> +	 * PW chips feature automatic error correction. Non 16-byte aligned
> +	 * writes work, but disable error correction on the region until next erase.
> +	 */
> +	nor->params->writesize = 16;
> +	nor->params->flags |= SNOR_F_ECC;
> +
> +	return 0;
> +}
> +
> +static const struct spi_nor_fixups winbond_nor_ecc_configuration_fixups = {
> +	.post_sfdp = winbond_nor_ecc_configuration_post_sfdp_fixups,
> +};
> +
>  static const struct flash_info winbond_nor_parts[] = {
>  	{
>  		.id = SNOR_ID(0xef, 0x30, 0x10),
> @@ -622,6 +673,10 @@ static const struct spi_nor_fixup winbond_fixups[] = {
>  	  .fixups = &winbond_nor_multi_die_fixups },
>  	{ .id = SNOR_ID(0xef, 0x40, 0x22), .match = winbond_jv_match,
>  	  .fixups = &winbond_nor_multi_die_fixups },
> +	{ .id = SNOR_ID(0xef, 0x60), .match = winbond_pw_with_ecc_match,
> +	  .fixups = &winbond_nor_ecc_configuration_fixups },
> +	{ .id = SNOR_ID(0xef, 0x60), .match = winbond_pw_match,
> +	  .fixups = &winbond_nor_partname_fixups },
>  	{ .id = SNOR_ID(0xef, 0x70), .match = winbond_rv_match,
>  	  .fixups = &winbond_nor_partname_fixups },
>  	{ .id = SNOR_ID(0xef, 0x70, 0x18), .fixups = &w25q128_fixups },


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

  reply	other threads:[~2026-09-18  9:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 15:25 [PATCH 00/25] mtd: spi-nor: winbond: Cleanup JW family, add support for PW chips Miquel Raynal
2026-09-09 15:25 ` [PATCH 01/25] mtd: spi-nor: winbond: W25Q32xW-Q/N: Enhance identification of the chips Miquel Raynal
2026-09-09 15:25 ` [PATCH 02/25] mtd: spi-nor: winbond: W25Q64xW-Q/N: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 04/25] mtd: spi-nor: winbond: W25Q64xW-Q/N: Fill locking information Miquel Raynal
2026-09-09 15:25 ` [PATCH 05/25] mtd: spi-nor: winbond: W25Q128JW-Q/N: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 07/25] mtd: spi-nor: winbond: W25Q64JW-M: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 08/25] mtd: spi-nor: winbond: W25Q128JW-M: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 09/25] mtd: spi-nor: winbond: W25Q256JW-Q/N/M: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 11/25] mtd: spi-nor: winbond: W25Q64JW-Q/N: Add quad page program capability Miquel Raynal
2026-09-09 15:25 ` [PATCH 12/25] mtd: spi-nor: winbond: W25Q128JW-Q/N: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 13/25] mtd: spi-nor: winbond: W25Q32JW-M: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 14/25] mtd: spi-nor: winbond: W25Q64JW-M: " Miquel Raynal
2026-09-09 15:25 ` [PATCH 16/25] mtd: spi-nor: winbond: Prepare introduction of W25QxxPW-Q/N parts Miquel Raynal
2026-09-18  9:11   ` Michael Walle [this message]
2026-09-18 10:20     ` Miquel Raynal
2026-09-09 15:25 ` [PATCH 17/25] mtd: spi-nor: winbond: Add support for W25Q33PW-Q/N Miquel Raynal
2026-09-09 15:25 ` [PATCH 18/25] mtd: spi-nor: winbond: Add support for W25Q64PW-Q/N Miquel Raynal
2026-09-09 15:25 ` [PATCH 19/25] mtd: spi-nor: winbond: Add support for W25Q12PW-Q/N Miquel Raynal
2026-09-09 15:25 ` [PATCH 20/25] mtd: spi-nor: winbond: Add support for W25Q25PW-Q/N Miquel Raynal
2026-09-09 15:25 ` [PATCH 21/25] mtd: spi-nor: winbond: Prepare introduction of W25QxxPW-M parts Miquel Raynal
2026-09-09 15:25 ` [PATCH 22/25] mtd: spi-nor: winbond: Add support for W25Q33PW-M Miquel Raynal
2026-09-09 15:25 ` [PATCH 23/25] mtd: spi-nor: winbond: Add support for W25Q64PW-M Miquel Raynal
2026-09-09 15:25 ` [PATCH 24/25] mtd: spi-nor: winbond: Add support for W25Q12PW-M Miquel Raynal
2026-09-09 15:25 ` [PATCH 25/25] mtd: spi-nor: winbond: Add support for W25Q25PW-M Miquel Raynal
2026-09-18 11:29 ` [PATCH 00/25] mtd: spi-nor: winbond: Cleanup JW family, add support for PW chips Michael Walle
2026-09-18 13:32   ` Miquel Raynal

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=DLIBQKG04DIF.1FKAYOEZH6ZU0@kernel.org \
    --to=mwalle@kernel.org \
    --cc=STLin2@winbond.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=takahiro.kuwano@infineon.com \
    --cc=thomas.petazzoni@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®