[PATCH] mtd: nand: pxa3xx: Fallback to 1-bit ECC when chip requirement is zero

Ronan Dalton ronan.dalton at alliedtelesis.co.nz
Wed Jun 24 06:12:44 CEST 2026


Currently there is no fallback condition for when a NAND chip connected
reports an ECC requirement of zero and no value is specified in the DTS.
When this happens, pxa_ecc_init attempts to find a match, but fails with
the following error message:

  ECC strength 0 at page size N is not supported

Linux already has a fallback case for this scenario.

Make u-boot match the Linux behavior by triggering the fallback when the
ECC strength requirement reported by the chip is zero. Changing && to ||
is sufficient to make the behavior equivalent.

Signed-off-by: Ronan Dalton <ronan.dalton at alliedtelesis.co.nz>
Cc: Dario Binacchi <dario.binacchi at amarulasolutions.com>
Cc: Michael Trimarchi <michael at amarulasolutions.com>
Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Cc: Chris Packham <chris.packham at alliedtelesis.co.nz>
Cc: Aryan Srivastava <aryan.srivastava at alliedtelesis.co.nz>
---
 drivers/mtd/nand/raw/pxa3xx_nand.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c
index 7324dc72e0a..4a2c1c4bad2 100644
--- a/drivers/mtd/nand/raw/pxa3xx_nand.c
+++ b/drivers/mtd/nand/raw/pxa3xx_nand.c
@@ -1625,8 +1625,10 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
 		ecc_step = chip->ecc_step_ds;
 	}
 
-	/* Set default ECC strength requirements on non-ONFI devices */
-	if (ecc_strength < 1 && ecc_step < 1) {
+	/* Set default ECC strength requirements on non-ONFI devices or devices
+	 * that report a requirement of zero.
+	 */
+	if (ecc_strength < 1 || ecc_step < 1) {
 		ecc_strength = 1;
 		ecc_step = 512;
 	}
-- 
2.54.0



More information about the U-Boot mailing list