summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHan Xu <han.xu@nxp.com>2016-03-28 11:26:51 -0500
committerYe Li <ye.li@nxp.com>2017-04-05 14:04:26 +0800
commit58794b3ebefea468bb1c57184b79df500f427927 (patch)
tree86af32c2e831916285b625855f42b040805840b9 /drivers
parent64c6a7b5d621080b8bd948c061a4f223a8c2d886 (diff)
downloadu-boot-imx-58794b3ebefea468bb1c57184b79df500f427927.zip
u-boot-imx-58794b3ebefea468bb1c57184b79df500f427927.tar.gz
u-boot-imx-58794b3ebefea468bb1c57184b79df500f427927.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) (cherry picked from commit 772af34b1216acc8e6a1a3faf43fef7c90b26a2f) Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/Kconfig7
-rw-r--r--drivers/mtd/nand/mxs_nand.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index a2ea9b1..8333d49 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -87,6 +87,13 @@ config NAND_MXS
This enables NAND driver for the NAND flash controller on the
MXS processors.
+config NAND_MXS_BCH_LEGACY_GEO
+ bool "Keep using legacy bch geometry for MXS NAND driver"
+ depends on NAND_MXS
+ help
+ Users can use legacy bch geometry in u-boot by enabling this configuration.
+ NOTICE: the feature must be enabled/disabled in both u-boot and kernel.
+
config NAND_ZYNQ
bool "Support for Zynq Nand controller"
select SYS_NAND_SELF_INIT
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 1ffe4ce..22ba85e 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -254,6 +254,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;
};