summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHan Xu <han.xu@nxp.com>2016-03-28 11:26:51 -0500
committerFrank Li <Frank.Li@nxp.com>2016-05-23 15:44:14 -0500
commit1820cf22ce9a7e4ba075cf7a9a9f95a4859e34f1 (patch)
tree1c77b84c2b8c92b6a898df954eb38a668f56d45e /drivers
parent42ff66942919ab926c7e6b223b6e2835cabfcf98 (diff)
downloadu-boot-imx-1820cf22ce9a7e4ba075cf7a9a9f95a4859e34f1.zip
u-boot-imx-1820cf22ce9a7e4ba075cf7a9a9f95a4859e34f1.tar.gz
u-boot-imx-1820cf22ce9a7e4ba075cf7a9a9f95a4859e34f1.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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/mxs_nand.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index d81f83c..5bba8c5 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -7,7 +7,7 @@
* Based on code from LTIB:
* Freescale GPMI NFC NAND Flash Driver
*
- * Copyright (C) 2010-2015 Freescale Semiconductor, Inc.
+ * Copyright (C) 2010-2016 Freescale Semiconductor, Inc.
* Copyright (C) 2008 Embedded Alley Solutions, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
@@ -248,6 +248,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;
};