]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: nand: raw: Add support for DT property nand-ecc-algo=bch
authorPali Rohár <pali@kernel.org>
Mon, 4 Apr 2022 16:17:21 +0000 (18:17 +0200)
committerPriyanka Jain <priyanka.jain@nxp.com>
Tue, 26 Apr 2022 11:48:39 +0000 (17:18 +0530)
According to Linux kernel DT schema nand-controller.yaml, using DT property
nand-ecc-algo=bch is the correct way for specifying BCH as ECC algorithm.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
drivers/mtd/nand/raw/nand_base.c

index a007603df14b46cb850e949c66f5e840a51ae10d..6f81257cf1f5313e05f649904b798674446fba2f 100644 (file)
@@ -4598,6 +4598,12 @@ static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip, ofnode nod
                        ecc_mode = NAND_ECC_SOFT_BCH;
        }
 
+       if (ecc_mode == NAND_ECC_SOFT) {
+               str = ofnode_read_string(node, "nand-ecc-algo");
+               if (str && !strcmp(str, "bch"))
+                       ecc_mode = NAND_ECC_SOFT_BCH;
+       }
+
        ecc_strength = ofnode_read_s32_default(node,
                                               "nand-ecc-strength", -1);
        ecc_step = ofnode_read_s32_default(node,