]> Gentwo Git Trees - linux/.git/commitdiff
mtd: nand: relax ECC parameter validation check
authorAryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Fri, 24 Oct 2025 00:19:42 +0000 (13:19 +1300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 28 Oct 2025 16:04:34 +0000 (17:04 +0100)
Due to the custom handling and layouts of certain nand controllers this
validity check will always fail for certain layouts. The check
inherently depends on even chunk sizing and this is not always the
case.

Modify the check to only print a warning, instead of failing to
init the attached NAND. This allows various 8 bit and 12 ECC strength
layouts to be used.

Fixes: 68c18dae6888 ("mtd: rawnand: marvell: add missing layouts")
Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/nand_base.c

index c7d9501f646b36f837f61757cf4c0e22c2866165..ad6d66309597b3f2697298ea8af0970966b67a41 100644 (file)
@@ -6338,11 +6338,14 @@ static int nand_scan_tail(struct nand_chip *chip)
                ecc->steps = mtd->writesize / ecc->size;
        if (!base->ecc.ctx.nsteps)
                base->ecc.ctx.nsteps = ecc->steps;
-       if (ecc->steps * ecc->size != mtd->writesize) {
-               WARN(1, "Invalid ECC parameters\n");
-               ret = -EINVAL;
-               goto err_nand_manuf_cleanup;
-       }
+
+       /*
+        * Validity check: Warn if ECC parameters are not compatible with page size.
+        * Due to the custom handling of ECC blocks in certain controllers the check
+        * may result in an expected failure.
+        */
+       if (ecc->steps * ecc->size != mtd->writesize)
+               pr_warn("ECC parameters may be invalid in reference to underlying NAND chip\n");
 
        if (!ecc->total) {
                ecc->total = ecc->steps * ecc->bytes;