[PATCH 2/3] mtd: nand: Make support for syndrome hardware ecc optional

Sascha Hauer s.hauer at pengutronix.de
Fri Dec 11 04:58:02 EST 2020


NAND_ECC_HW_SYNDROME is currently not needed by the drivers in barebox,
so make support for it optional again. This has been optional before the
last NAND layer update, just re-add the option. This time drop the
"default y", as this option shouldn't be needed.

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

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 97819e5c0b..339f7a923d 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -12,6 +12,10 @@ config MTD_NAND_ECC_SW_BCH
 	bool
 	prompt "Support software BCH ecc"
 
+config NAND_ECC_HW_SYNDROME
+	bool
+	prompt "Support syndrome hardware ecc controllers"
+
 config NAND_ALLOW_ERASE_BAD
 	bool
 	depends on MTD_WRITE
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 2c3c0b360f..0a980e4499 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -5574,6 +5574,10 @@ int nand_scan_tail(struct nand_chip *chip)
 		if (!ecc->write_subpage && ecc->hwctl && ecc->calculate)
 			ecc->write_subpage = nand_write_subpage_hwecc;
 	case NAND_ECC_HW_SYNDROME:
+		if (!IS_ENABLED(CONFIG_NAND_ECC_HW_SYNDROME)) {
+			ret = -ENOSYS;
+			goto err_nand_manuf_cleanup;
+		}
 		if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
 		    (!ecc->read_page ||
 		     ecc->read_page == nand_read_page_hwecc ||
-- 
2.20.1




More information about the barebox mailing list