Skip to content

Commit b4af7d1

Browse files
David LaPortemiquelraynal
authored andcommitted
mtd: spinand: Disable continuous read during probe
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: 631cfdd ("mtd: spi-nand: Add continuous read support") Cc: stable@vger.kernel.org Signed-off-by: David LaPorte <dalaport@amazon.com> Reviewed-by: Gunnar Kudrjavets <gunnarku@amazon.com> Reviewed-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 1d9d5f5 commit b4af7d1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/mtd/nand/spi/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,14 @@ static void spinand_cont_read_init(struct spinand_device *spinand)
940940
(engine_type == NAND_ECC_ENGINE_TYPE_ON_DIE ||
941941
engine_type == NAND_ECC_ENGINE_TYPE_NONE)) {
942942
spinand->cont_read_possible = true;
943+
944+
/*
945+
* Ensure continuous read is disabled on probe.
946+
* Some devices retain this state across soft reset,
947+
* which leaves the OOB area inaccessible and results
948+
* in false positive returns from spinand_isbad().
949+
*/
950+
spinand_cont_read_enable(spinand, false);
943951
}
944952
}
945953

0 commit comments

Comments
 (0)