summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-06-20 13:07:03 +0200
committerPeng Fan <peng.fan@nxp.com>2022-07-03 15:13:51 +0800
commit712a172499a0c9baa93fdadbf62d10a0a0efbfeb (patch)
tree02ca0904aea1fc4c3d393410e48f7c9d5a296433 /drivers/mtd
parent284c1a9b4b91120385c346a1924628a695314905 (diff)
downloadu-boot-712a172499a0c9baa93fdadbf62d10a0a0efbfeb.tar.gz
u-boot-712a172499a0c9baa93fdadbf62d10a0a0efbfeb.tar.bz2
u-boot-712a172499a0c9baa93fdadbf62d10a0a0efbfeb.zip
mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function nand_scan_ident() has not selected ecc.mode or when it selected it to none ecc mode. Distinguish between these two states by checking of node property "nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode. This change fixes usage of none ecc mode if it is specified in DTS file. Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree") Signed-off-by: Pali Rohár <pali@kernel.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/fsl_elbc_nand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index b0e3eb607e..48a3687f27 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -745,7 +745,11 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, struct udevice *dev)
return ret;
/* If nand_scan_ident() has not selected ecc.mode, do it now */
- if (nand->ecc.mode == NAND_ECC_NONE) {
+ if (nand->ecc.mode == 0
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+ && !ofnode_read_string(nand->flash_node, "nand-ecc-mode")
+#endif
+ ) {
/* If CS Base Register selects full hardware ECC then use it */
if ((br & BR_DECC) == BR_DECC_CHK_GEN) {
nand->ecc.mode = NAND_ECC_HW;