]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: gpmi: provide the option to use legacy bch geometry
authorYe Li <ye.li@nxp.com>
Mon, 4 May 2020 14:08:51 +0000 (22:08 +0800)
committerStefano Babic <sbabic@denx.de>
Sun, 10 May 2020 18:55:20 +0000 (20:55 +0200)
Provide an option in DT to use legacy bch geometry, which compatible
with the 3.10 kernel bch setting. To enable the feature, adding
"fsl,legacy-bch-geometry" under gpmi-nand node.

NOTICE: The feature must be enabled/disabled in both u-boot and kernel.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mtd/nand/raw/mxs_nand.c
drivers/mtd/nand/raw/mxs_nand_dt.c
include/mxs_nand.h

index 8da59e39c0188debec13b85fc6f2301ce0e0e54f..3247064c3f742b8a1d08f64731353624a9e3fbbe 100644 (file)
@@ -1053,8 +1053,8 @@ static int mxs_nand_set_geometry(struct mtd_info *mtd, struct bch_geometry *geo)
                return -EINVAL;
        }
 
-       if (!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0) &&
-                       (mtd->oobsize < 1024)) {
+       if ((!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0) &&
+            mtd->oobsize < 1024) || nand_info->legacy_bch_geometry) {
                dev_warn(this->dev, "use legacy bch geometry\n");
                return mxs_nand_legacy_calc_ecc_layout(geo, mtd);
        }
index 8ad7d618c64ee6bc8e10b118a62eaf25e708e033..7a32b284f7f7d0c9517567cc4b1cc0c6a500bce5 100644 (file)
@@ -69,6 +69,8 @@ static int mxs_nand_dt_probe(struct udevice *dev)
 
        info->use_minimum_ecc = dev_read_bool(dev, "fsl,use-minimum-ecc");
 
+       info->legacy_bch_geometry = dev_read_bool(dev, "fsl,legacy-bch-geometry");
+
        return mxs_nand_init_ctrl(info);
 }
 
index 497da77a16d18b315c5c4bf3cff7dd5d3b15b18c..1ac628d064719745a65a371dfa6256e5ab586cc6 100644 (file)
@@ -43,6 +43,8 @@ struct mxs_nand_info {
        struct udevice *dev;
        unsigned int    max_ecc_strength_supported;
        bool            use_minimum_ecc;
+       /* legacy bch geometry flag */
+       bool            legacy_bch_geometry;
        int             cur_chip;
 
        uint32_t        cmd_queue_len;