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 <[email protected]>
Cc: Dario Binacchi <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Miquel Raynal <[email protected]>
Cc: Chris Packham <[email protected]>
Cc: Aryan Srivastava <[email protected]>
---
 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

Reply via email to