[PATCH 2/3][v2] nand_base: use nand_ooblayout_lp_hamming_ops for 1bit hamming as default

Alexander Couzens lynxis at fe80.eu
Tue May 2 01:13:22 PDT 2017


commit 41b207a70d3a ("mtd: nand: implement the default mtd_ooblayout_ops")
uses a different ooblayout for platforms which doesn't set the
layout by itself. Use for 1bit hamming the old layout.

Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 drivers/mtd/nand/nand_base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index daf3df157885..6a9e99377181 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4724,7 +4724,11 @@ int nand_scan_tail(struct mtd_info *mtd)
 			break;
 		case 64:
 		case 128:
-			mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
+			if (ecc->algo == NAND_ECC_HAMMING && ecc->strength == 1)
+				mtd_set_ooblayout(mtd,
+						&nand_ooblayout_lp_hamming_ops);
+			else
+				mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
 			break;
 		default:
 			WARN(1, "No oob scheme defined for oobsize %d\n",
-- 
2.12.2




More information about the linux-mtd mailing list