mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/3] mtd: nand: Make software ECC support optional
Date: Fri, 11 Dec 2020 10:58:03 +0100	[thread overview]
Message-ID: <20201211095803.22050-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20201211095803.22050-1-s.hauer@pengutronix.de>

Most NAND controllers use hardware ECC, so make software ECC support
optional to save some binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/Kconfig     | 5 +++++
 drivers/mtd/nand/nand_base.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 339f7a923d..7c93260892 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -7,8 +7,13 @@ menuconfig NAND
 
 if NAND
 
+config MTD_NAND_ECC_SOFT
+	bool
+	prompt "Support software ecc"
+
 config MTD_NAND_ECC_SW_BCH
 	select BCH
+	depends on MTD_NAND_ECC_SOFT
 	bool
 	prompt "Support software BCH ecc"
 
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0a980e4499..7c325f1f70 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -5053,6 +5053,9 @@ static int nand_set_ecc_soft_ops(struct nand_chip *chip)
 	struct mtd_info *mtd = nand_to_mtd(chip);
 	struct nand_ecc_ctrl *ecc = &chip->ecc;
 
+	if (!IS_ENABLED(CONFIG_MTD_NAND_ECC_SOFT))
+		return -ENOSYS;
+
 	if (WARN_ON(ecc->mode != NAND_ECC_SOFT))
 		return -EINVAL;
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2020-12-11  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  9:58 [PATCH 1/3] mtd: spi-nor: Make write " Sascha Hauer
2020-12-11  9:58 ` [PATCH 2/3] mtd: nand: Make support for syndrome hardware ecc optional Sascha Hauer
2020-12-11  9:58 ` Sascha Hauer [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=20201211095803.22050-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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