* [PATCH] mtd: spinand: Disable continuous read during probe
@ 2026-01-29 22:15 David LaPorte
2026-01-30 0:05 ` Mikhail Kshevetskiy
0 siblings, 1 reply; 2+ messages in thread
From: David LaPorte @ 2026-01-29 22:15 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Tudor Ambarus, Martin Kurbanov, Mikhail Kshevetskiy,
Cheng Ming Lin, Pratyush Yadav, linux-mtd, linux-kernel
Cc: David LaPorte, Gunnar Kudrjavets
Macronix serial NAND devices with continuous read support do not
clear the configuration register on soft reset and lack a hardware
reset pin. When continuous read is interrupted (e.g., during reboot),
the feature remains enabled at the device level.
With continuous read enabled, the OOB area becomes inaccessible and
all reads are instead directed to the main area. As a result, during
partition allocation as part of MTD device registration, the first two
bytes of the main area for the master block are read and indicate that
the block is bad. This process repeats for every subsequent block for
the partition.
All reads and writes that reference the BBT find no good blocks and
fail.
The only paths for recovery from this state are triggering the
continuous read feature by way of raw MTD reads or through a NAND
device power drain.
Disable continuous read explicitly during spinand probe to ensure
quiescent feature state.
Fixes: 631cfdd0520d ("mtd: spi-nand: Add continuous read support")
Signed-off-by: David LaPorte <dalaport@amazon.com>
Reviewed-by: Gunnar Kudrjavets <gunnarku@amazon.com>
---
Testing details:
- Instrumented feature enablement and verified fix with affected Macronix
serial NAND device: warm reboot without patch marks all blocks bad
during partition allocation; with patch applied, device registers
cleanly with no bad blocks marked
- Patch cherry-picks cleanly to mainline v6.19-rc6 and builds without
warnings
- Boot tested mainline + patch on aarch64 host without SPI interface
---
drivers/mtd/nand/spi/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index d207286572d8..1fb05ac8678b 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -859,6 +859,7 @@ static void spinand_cont_read_init(struct spinand_device *spinand)
(engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE ||
engine_type == NAND_ECC_ENGINE_TYPE_NONE)) {
spinand->cont_read_possible = true;
+ spinand_cont_read_enable(spinand, false);
}
}
--
2.43.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mtd: spinand: Disable continuous read during probe
2026-01-29 22:15 [PATCH] mtd: spinand: Disable continuous read during probe David LaPorte
@ 2026-01-30 0:05 ` Mikhail Kshevetskiy
0 siblings, 0 replies; 2+ messages in thread
From: Mikhail Kshevetskiy @ 2026-01-30 0:05 UTC (permalink / raw)
To: David LaPorte, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Tudor Ambarus, Martin Kurbanov,
Cheng Ming Lin, Pratyush Yadav, linux-mtd, linux-kernel
Cc: Gunnar Kudrjavets
On 1/30/26 01:15, David LaPorte wrote:
> [You don't often get email from dalaport@amazon.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Macronix serial NAND devices with continuous read support do not
> clear the configuration register on soft reset and lack a hardware
> reset pin. When continuous read is interrupted (e.g., during reboot),
> the feature remains enabled at the device level.
>
> With continuous read enabled, the OOB area becomes inaccessible and
> all reads are instead directed to the main area. As a result, during
> partition allocation as part of MTD device registration, the first two
> bytes of the main area for the master block are read and indicate that
> the block is bad. This process repeats for every subsequent block for
> the partition.
>
> All reads and writes that reference the BBT find no good blocks and
> fail.
>
> The only paths for recovery from this state are triggering the
> continuous read feature by way of raw MTD reads or through a NAND
> device power drain.
>
> Disable continuous read explicitly during spinand probe to ensure
> quiescent feature state.
>
> Fixes: 631cfdd0520d ("mtd: spi-nand: Add continuous read support")
> Signed-off-by: David LaPorte <dalaport@amazon.com>
> Reviewed-by: Gunnar Kudrjavets <gunnarku@amazon.com>
> ---
> Testing details:
> - Instrumented feature enablement and verified fix with affected Macronix
> serial NAND device: warm reboot without patch marks all blocks bad
> during partition allocation; with patch applied, device registers
> cleanly with no bad blocks marked
> - Patch cherry-picks cleanly to mainline v6.19-rc6 and builds without
> warnings
> - Boot tested mainline + patch on aarch64 host without SPI interface
> ---
> drivers/mtd/nand/spi/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index d207286572d8..1fb05ac8678b 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -859,6 +859,7 @@ static void spinand_cont_read_init(struct spinand_device *spinand)
> (engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE ||
> engine_type == NAND_ECC_ENGINE_TYPE_NONE)) {
> spinand->cont_read_possible = true;
> + spinand_cont_read_enable(spinand, false);
I think a comment should be added here explaining why you disable
cont_read here
> }
> }
>
> --
> 2.43.0
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-30 0:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 22:15 [PATCH] mtd: spinand: Disable continuous read during probe David LaPorte
2026-01-30 0:05 ` Mikhail Kshevetskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox