On Fri Oct 23, 2026 at 9:11 AM CEST, haibo.chen wrote: > From: Haibo Chen > > The core defaults opcodes.read_sr2 to the legacy RDCR opcode (0x35), and > spi_nor_cache_sr_lock_bits() reads SR2 during spi_nor_init(), i.e. after > the flash has been switched to its runtime protocol. On an octal flash > running in 8D-8D-8D mode the opcode is extended per cmd_ext_type (e.g. > 0x3535), but RDCR is not a valid register read there: these parts access > their status/configuration registers through a vendor-specific indirect > space, if at all. The flash does not answer, the register read times out > and probe (or resume) fails (on i.MX FlexSPI: -ETIMEDOUT and a controller > WARN(), seen with a Micron MT35XU01G and a Macronix MX25UW51345G). > > Clear read_sr2 on every path that enables 8D-8D-8D, so that > spi_nor_read_sr1_and_sr2() degrades to an SR1-only read and no > unsupported command is issued. A manufacturer driver that genuinely > needs an SR2 read in this mode can still install its own opcode in a > later fixup. > > - spi_nor_parse_profile1(): the common case. The xSPI Profile 1.0 table > does not describe any SR2/RDCR read, and it runs before the > manufacturer late_init. > - mt35xu512aba_post_sfdp_fixup(): some mt35xu512aba batches lack the > Profile 1.0 table and enable 8D here instead, with the BFPT QER field > left at a reserved value so read_sr2 keeps its RDCR default. > - spi_nor_no_sfdp_init_params(): non-SFDP parts that enable 8D via > SPI_NOR_OCTAL_DTR_READ keep the RDCR default too. > > CMP (the only user of SR2 beyond quad-enable in the locking code) is > Winbond-specific and is not placed in SR2 on their 8D-capable parts, so > no octal flash loses a usable SR2 read because of this change. > > Fixes: 63489002d397 ("mtd: spi-nor: Refactor Read Status/Write Status support") > Cc: stable@vger.kernel.org > Signed-off-by: Haibo Chen > Reviewed-by: Miquel Raynal Miquel, if you want to pick it yourself for fixes, otherwise I can also push it there. In any case, Acked-by: Michael Walle