mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: spinand: Do not update the QE bit on devices without one
@ 2026-09-10 11:33 Sagnik Sasmal
  2026-09-10 12:40 ` Miquel Raynal
  0 siblings, 1 reply; 5+ messages in thread
From: Sagnik Sasmal @ 2026-09-10 11:33 UTC (permalink / raw)
  To: miquel.raynal
  Cc: richard, vigneshr, tudor.ambarus, mikhail.kshevetskiy, linux-mtd,
	linux-kernel

Commit be0b86c648bf ("mtd: spinand: Gather all the bus interface
steps in one single function") moved quad-enable setup into
spinand_configure_chip(). The new code only determines whether quad
mode is needed when SPINAND_HAS_QE_BIT is set, but calls
spinand_init_quad_enable() unconditionally. This clears configuration
register bit 0 on devices without a QE bit.

That bit is not universally a QE bit. On the Winbond W25N02KV it is
H-DIS, which disables the active-low HOLD function. Clearing H-DIS
enables HOLD during single and dual I/O operations. If IO3 is not kept
high, the flash can pause a command and ignore clock and data.

H-DIS is not restored by the FFh reset command, allowing the incorrect
state to survive an SoC warm reboot while the flash remains powered.

Before the refactoring, spinand_init_quad_enable() returned without
touching the configuration register when SPINAND_HAS_QE_BIT was not
set. Restore that behavior.

The regression was reproduced on a Jio JIDU6401 with an MT7986 SoC and
a W25N02KV. With Linux 6.18.44, sysupgrade failed and the following warm
reboot hung in BL2. With this change applied, both sysupgrade and warm
reboot completed successfully.

Fixes: be0b86c648bf ("mtd: spinand: Gather all the bus interface steps in one single function")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Sagnik Sasmal <sagnik@sagnik.me>
---
 drivers/mtd/nand/spi/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 8bf9301f25e7..89e9f5410cfa 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -281,6 +281,9 @@ static int spinand_init_cfg_cache(struct spinand_device *spinand)
 static int spinand_init_quad_enable(struct spinand_device *spinand,
 				    bool enable)
 {
+	if (!(spinand->flags & SPINAND_HAS_QE_BIT))
+		return 0;
+
 	return spinand_upd_cfg(spinand, CFG_QUAD_ENABLE,
 			       enable ? CFG_QUAD_ENABLE : 0);
 }
-- 
2.53.0


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

end of thread, other threads:[~2026-09-10 22:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 11:33 [PATCH] mtd: spinand: Do not update the QE bit on devices without one Sagnik Sasmal
2026-09-10 12:40 ` Miquel Raynal
2026-09-10 16:46   ` [PATCH v2] " Sagnik Sasmal
2026-09-10 16:54     ` sashiko-bot
2026-09-10 22:44     ` [PATCH v3] " Sagnik Sasmal

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

all inboxes | Powered by JetHome®