Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Ignore octal PP bits on < JESD216F
@ 2026-12-03 11:15 Paul Cercueil
  2026-12-03 11:42 ` sashiko-bot
  2026-12-03 11:43 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Cercueil @ 2026-12-03 11:15 UTC (permalink / raw)
  To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: Nuno Sá, linux-mtd, Thomas Petazzoni, Paul Cercueil

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.

Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---

This replaces my other patch sent recently:
"[PATCH] mtd: spi-nor: winbond: Drop octal PP support for W25Q256JW"
---
 drivers/mtd/spi-nor/sfdp.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index 4d77354ee1b2..a7b3fdb8f24e 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -1065,12 +1065,15 @@ static int spi_nor_parse_smpt(struct spi_nor *nor,
 /**
  * spi_nor_parse_4bait() - parse the 4-Byte Address Instruction Table
  * @nor:		pointer to a 'struct spi_nor'.
+ * @bfpt_header:	pointer to the 'struct sfdp_parameter_header' describing
+ *			the Basic Flash Parameter Table length and version.
  * @param_header:	pointer to the 'struct sfdp_parameter_header' describing
  *			the 4-Byte Address Instruction Table length and version.
  *
  * Return: 0 on success, -errno otherwise.
  */
 static int spi_nor_parse_4bait(struct spi_nor *nor,
+			       const struct sfdp_parameter_header *bfpt_header,
 			       const struct sfdp_parameter_header *param_header)
 {
 	static const struct sfdp_4bait reads[] = {
@@ -1162,6 +1165,12 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
 			pp_hwcaps |= program->hwcaps;
 	}
 
+	/* The octal page program bits are reserved before JESD216F. */
+	if (bfpt_header->minor < SFDP_JESD216F_MINOR) {
+		discard_hwcaps |= SNOR_HWCAPS_PP_OCTAL;
+		pp_hwcaps &= ~SNOR_HWCAPS_PP_OCTAL;
+	}
+
 	/*
 	 * Compute the subset of Sector Erase commands for which the 4-byte
 	 * version is supported.
@@ -1683,7 +1692,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor)
 			break;
 
 		case SFDP_4BAIT_ID:
-			err = spi_nor_parse_4bait(nor, param_header);
+			err = spi_nor_parse_4bait(nor, bfpt_header, param_header);
 			break;
 
 		case SFDP_PROFILE1_ID:
-- 
2.47.3


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-03 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 11:15 [PATCH] mtd: spi-nor: Ignore octal PP bits on < JESD216F Paul Cercueil
2026-12-03 11:42 ` sashiko-bot
2026-12-03 11:43 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox