[PATCH 6.12.y-cip 1/8] mtd: spi-nor: add support for Macronix Octal flash

Lad Prabhakar <[email protected]> Mon, 6 Jul 2026 19:23:21 +0100
Newsgroups org.cip-project.lists.cip-dev
Message-ID <[email protected]>
From: AlvinZhou <[email protected]>

commit afe1ea1344bbd3a40be5a2547ff1b13899c5a7fa upstream.

Add manufacturer ID 0xc2 at the end of ID table to allow manufacturer
fixups to be applied for any Macronix flash. This spares us of adding
new flash entries for flashes that can be initialized solely based on
the SFDP data, but still need the manufacturer hooks to set parameters
that can't be discovered at SFDP parsing time.

The ID is added in order to set the octal DTR methods. SFDP defines a
"Command Sequences to Change to Octal DDR (8D-8D-8D) Mode" which can
enable the octal DTR mode. Until that is parsed and used, use the
local defined method.

Suggested-by: Michael Walle <[email protected]>
Signed-off-by: JaimeLiao <[email protected]>
Signed-off-by: AlvinZhou <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ta: update commit message and comment in the code]
Signed-off-by: Tudor Ambarus <[email protected]>
Signed-off-by: Lad Prabhakar <[email protected]>
---
 drivers/mtd/spi-nor/macronix.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ea6be95e75a5..3f33f793da15 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -182,7 +182,14 @@ static const struct flash_info macronix_nor_parts[] = {
 		.name = "mx25l3255e",
 		.size = SZ_4M,
 		.no_sfdp_flags = SECT_4K,
-	}
+	},
+	/*
+	 * This spares us of adding new flash entries for flashes that can be
+	 * initialized solely based on the SFDP data, but still need the
+	 * manufacturer hooks to set parameters that can't be discovered at SFDP
+	 * parsing time.
+	 */
+	{ .id = SNOR_ID(0xc2) }
 };
 
 static void macronix_nor_default_init(struct spi_nor *nor)
-- 
2.43.0