summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan Xu <han.xu@nxp.com>2016-03-28 11:26:51 -0500
committerPeng Fan <peng.fan@nxp.com>2016-04-13 13:27:10 +0800
commit772af34b1216acc8e6a1a3faf43fef7c90b26a2f (patch)
tree867ba1bcb582f62c8b4147fe1e0dbfd1d3133924
parent67c19ad1a21780783efbcf1899cb6fdd7726ead7 (diff)
downloadu-boot-imx-772af34b1216acc8e6a1a3faf43fef7c90b26a2f.zip
u-boot-imx-772af34b1216acc8e6a1a3faf43fef7c90b26a2f.tar.gz
u-boot-imx-772af34b1216acc8e6a1a3faf43fef7c90b26a2f.tar.bz2
MLK-12603: mtd: gpmi: may use legacy bch geometry in u-boot
provide one config "CONFIG_NAND_MXS_BCH_LEGACY_GEO" to keep using legacy bch geometry. NOTICE: the feature must be enabled/disabled in both u-boot and kernel. Signed-off-by: Han Xu <han.xu@nxp.com> (cherry picked from commit 0abc9c182c24f88522bd74fa1b53cd2fa3477184)
-rw-r--r--drivers/mtd/nand/mxs_nand.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 871f5ab..2d75124 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -249,6 +249,12 @@ static int mxs_nand_get_ecc_strength(struct mtd_info *mtd)
} else {
ecc_strength = chip->ecc_strength_ds;
ecc_strength += ecc_strength & 1;
+#if defined(CONFIG_NAND_MXS_BCH_LEGACY_GEO)
+ ecc_strength = ((page_oob_size - MXS_NAND_METADATA_SIZE) * 8)
+ /(galois_field * mxs_nand_ecc_chunk_cnt(mtd->writesize));
+ ecc_strength += ecc_strength & 1;
+ ecc_strength = min(ecc_strength, MXS_NAND_MAX_ECC_STRENGTH);
+#endif
}
return 0;
};