public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Priyanka Jain <priyanka.jain@nxp.com>, Wolfgang Denk <wd@denx.de>
Cc: Michal Simek <michal.simek@xilinx.com>,
	Simon Glass <sjg@chromium.org>,
	u-boot@lists.denx.de
Subject: [PATCH 4/5] mtd: nand: raw: Add support for DT property nand-ecc-algo=bch
Date: Mon,  4 Apr 2022 18:17:21 +0200	[thread overview]
Message-ID: <20220404161722.4884-5-pali@kernel.org> (raw)
In-Reply-To: <20220404161722.4884-1-pali@kernel.org>

According to Linux kernel DT schema nand-controller.yaml, using DT property
nand-ecc-algo=bch is the correct way for specifying BCH as ECC algorithm.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/mtd/nand/raw/nand_base.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index f7616985d95e..e0c087f0ebaf 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4598,6 +4598,12 @@ static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip, ofnode nod
 			ecc_mode = NAND_ECC_SOFT_BCH;
 	}
 
+	if (ecc_mode == NAND_ECC_SOFT) {
+		str = ofnode_read_string(node, "nand-ecc-algo");
+		if (str && !strcmp(str, "bch"))
+			ecc_mode = NAND_ECC_SOFT_BCH;
+	}
+
 	ecc_strength = ofnode_read_s32_default(node,
 					       "nand-ecc-strength", -1);
 	ecc_step = ofnode_read_s32_default(node,
-- 
2.20.1


  parent reply	other threads:[~2022-04-04 16:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 16:17 [PATCH 0/5] mtd: rawnand: fsl_elbc: Device tree support Pali Rohár
2022-04-04 16:17 ` [PATCH 1/5] mtd: rawnand: fsl_elbc: Implement RNDOUT command Pali Rohár
2022-04-04 16:17 ` [PATCH 2/5] mtd: rawnand: fsl_elbc: Add device tree support Pali Rohár
2022-04-04 16:17 ` [PATCH 3/5] mtd: rawnand: fsl_elbc: Use ECC configuration from device tree Pali Rohár
2022-04-04 16:17 ` Pali Rohár [this message]
2022-04-04 16:17 ` [PATCH 5/5] powerpc: dts: p2020: Add localbus node Pali Rohár
2022-04-05  9:15   ` [PATCH v2] " Pali Rohár

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=20220404161722.4884-5-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=priyanka.jain@nxp.com \
    --cc=sjg@chromium.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox