Skip to content

Commit 78ffbef

Browse files
committed
mtd: rawnand: Constrain even more when continuous reads are enabled
As a matter of fact, continuous reads require additional handling at the operation level in order for them to work properly. The core helpers do have this additional logic now, but any time a controller implements its own page helper, this extra logic is "lost". This means we need another level of per-controller driver checks to ensure they can leverage continuous reads. This is for now unsupported, so in order to ensure continuous reads are enabled only when fully using the core page helpers, we need to add more initial checks. Also, as performance is not relevant during raw accesses, we also prevent these from enabling the feature. This should solve the issue seen with controllers such as the STM32 FMC2 when in sequencer mode. In this case, the continuous read feature would be enabled but not leveraged, and most importantly not disabled, leading to further operations to fail. Reported-by: Christophe Kerello <christophe.kerello@foss.st.com> Fixes: 003fe4b ("mtd: rawnand: Support for sequential cache reads") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Tested-by: Christophe Kerello <christophe.kerello@foss.st.com> Link: https://lore.kernel.org/linux-mtd/20240307115315.1942678-1-miquel.raynal@bootlin.com
1 parent c2cf7e2 commit 78ffbef

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/mtd/nand/raw/nand_base.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3594,7 +3594,8 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
35943594
oob = ops->oobbuf;
35953595
oob_required = oob ? 1 : 0;
35963596

3597-
rawnand_enable_cont_reads(chip, page, readlen, col);
3597+
if (likely(ops->mode != MTD_OPS_RAW))
3598+
rawnand_enable_cont_reads(chip, page, readlen, col);
35983599

35993600
while (1) {
36003601
struct mtd_ecc_stats ecc_stats = mtd->ecc_stats;
@@ -5212,6 +5213,15 @@ static void rawnand_late_check_supported_ops(struct nand_chip *chip)
52125213
if (!nand_has_exec_op(chip))
52135214
return;
52145215

5216+
/*
5217+
* For now, continuous reads can only be used with the core page helpers.
5218+
* This can be extended later.
5219+
*/
5220+
if (!(chip->ecc.read_page == nand_read_page_hwecc ||
5221+
chip->ecc.read_page == nand_read_page_syndrome ||
5222+
chip->ecc.read_page == nand_read_page_swecc))
5223+
return;
5224+
52155225
rawnand_check_cont_read_support(chip);
52165226
}
52175227

0 commit comments

Comments
 (0)