[PATCH 7/8] mtd: spi-nor: Add Macronix MX25U quad-mode fixups

Leo Yu-Chi Liang ycliang at andestech.com
Fri Apr 17 04:40:33 CEST 2026


Add quad mode (1-4-4) read and page program fixups for Macronix
MX25U1635E and MX25U25635F SPI NOR flash chips. These chips do not
properly expose their quad capabilities via SFDP, requiring explicit
fixup hooks.

The fixup enables SNOR_HWCAPS_READ_1_4_4 and SNOR_HWCAPS_PP_1_4_4
capabilities with the appropriate opcodes and protocols.

Both chips share the same fixup function since their quad mode
configuration is identical.

Signed-off-by: Leo Yu-Chi Liang <ycliang at andestech.com>
---
 drivers/mtd/spi/spi-nor-core.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 937d79af64e..d8a073fef3f 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -4248,6 +4248,21 @@ static struct spi_nor_fixups macronix_octal_fixups = {
 	.post_sfdp = macronix_octal_post_sfdp_fixup,
 	.late_init = macronix_octal_late_init,
 };
+
+static void macronix_quad_post_sfdp_fixup(struct spi_nor *nor,
+					  struct spi_nor_flash_parameter *params)
+{
+	params->hwcaps.mask |= SNOR_HWCAPS_READ_1_4_4 | SNOR_HWCAPS_PP_1_4_4;
+	spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ_1_4_4],
+				  0, 8, SPINOR_OP_READ_1_4_4,
+				  SNOR_PROTO_1_4_4);
+	spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_1_4_4],
+				SPINOR_OP_PP_1_4_4, SNOR_PROTO_1_4_4);
+}
+
+static struct spi_nor_fixups macronix_quad_fixups = {
+	.post_sfdp = macronix_quad_post_sfdp_fixup,
+};
 #endif /* CONFIG_SPI_FLASH_MACRONIX */
 
 #if CONFIG_IS_ENABLED(SPI_FLASH_WINBOND)
@@ -4544,9 +4559,13 @@ void spi_nor_set_fixups(struct spi_nor *nor)
 #endif
 
 #if CONFIG_IS_ENABLED(SPI_FLASH_MACRONIX)
-	if (JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX &&
-	    nor->info->flags & SPI_NOR_OCTAL_DTR_READ)
-		nor->fixups = &macronix_octal_fixups;
+	if (JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX) {
+		if (nor->info->flags & SPI_NOR_OCTAL_DTR_READ)
+			nor->fixups = &macronix_octal_fixups;
+		else if (!strcmp(nor->info->name, "mx25u1635e") ||
+			 !strcmp(nor->info->name, "mx25u25635f"))
+			nor->fixups = &macronix_quad_fixups;
+	}
 #endif /* SPI_FLASH_MACRONIX */
 
 #if CONFIG_IS_ENABLED(SPI_FLASH_WINBOND)
-- 
2.34.1



More information about the U-Boot mailing list