From: "Pali Rohár" <pali@kernel.org>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>, Wolfgang Denk <wd@denx.de>,
Sinan Akman <sinan@writeme.com>,
u-boot@lists.denx.de
Subject: [PATCH v2] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
Date: Mon, 20 Jun 2022 13:07:03 +0200 [thread overview]
Message-ID: <20220620110703.30463-1-pali@kernel.org> (raw)
In-Reply-To: <20220620110218.dtzplvmtv4elhfos@pali>
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>
---
Changes in v2:
* Add guard for ofnode_read_string()
---
drivers/mtd/nand/raw/fsl_elbc_nand.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index e734139b5ea5..5d50302eefbe 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -744,7 +744,11 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, ofnode flash_node)
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;
--
2.20.1
prev parent reply other threads:[~2022-06-20 11:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 18:24 [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode Pali Rohár
2022-06-20 7:08 ` Peng Fan (OSS)
2022-06-20 11:02 ` Pali Rohár
2022-06-20 11:07 ` Pali Rohár [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220620110703.30463-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=peng.fan@oss.nxp.com \
--cc=priyanka.jain@nxp.com \
--cc=sinan@writeme.com \
--cc=u-boot@lists.denx.de \
--cc=wd@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.