[PATCH 1/4] mtd: spi-nor: macronix: Clear the default RDCR opcode

Miquel Raynal miquel.raynal at bootlin.com
Wed Nov 25 10:01:34 PST 2026


The core defaults opcodes.read_sr2 to the JEDEC RDCR opcode (0x35).
Macronix flashes do not use 0x35 to access their configuration
register; they read it with 0x15, and some parts have no configuration
register at all.

Clear the opcode in the manufacturer default_init, which runs after the
core default and before the SFDP parsing. Parts that do support the
vendor opcode can then opt in from their own fixup.

Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
 drivers/mtd/spi-nor/macronix.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index b3fdb4b2fa1c..2c6f507a2dde 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -333,6 +333,13 @@ static void macronix_nor_default_init(struct spi_nor *nor)
 {
 	nor->params->qe_mask[0] = BIT(6);
 	nor->params->qe_mask[1] = 0;
+
+	/*
+	 * The JEDEC RDCR opcode (0x35) is not valid for Macronix: some parts
+	 * have no CR at all, others use 0x15. Clear the core default. Parts
+	 * that do support the vendor opcode can opt-in from their own fixup.
+	 */
+	nor->params->opcodes.read_sr2 = 0;
 }
 
 static int macronix_nor_late_init(struct spi_nor *nor)

-- 
2.56.0




More information about the linux-mtd mailing list