[MTD] [NAND] Don't panic if a controller driver does ecc its own way.
authorScott Wood <scottwood@freescale.com>
Thu, 13 Dec 2007 17:15:28 +0000 (11:15 -0600)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 8 Jan 2008 07:51:57 +0000 (07:51 +0000)
Some hardware, such as the enhanced local bus controller used on some
mpc83xx chips, does ecc transparently when reading and writing data, rather
than providing a generic calculate/correct mechanism that can be exported to
the nand subsystem.

The subsystem should not BUG() when calculate, correct, or hwctl are
missing, if the methods that call them have been overridden.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/nand/nand_base.c

index e29c1da7f56e82530a987beb96ab84a735a2b637..85a7283845ff2a0b5270d87233fbb7d73f2b471f 100644 (file)
@@ -2469,8 +2469,12 @@ int nand_scan_tail(struct mtd_info *mtd)
                        chip->ecc.write_oob = nand_write_oob_std;
 
        case NAND_ECC_HW_SYNDROME:
-               if (!chip->ecc.calculate || !chip->ecc.correct ||
-                   !chip->ecc.hwctl) {
+               if ((!chip->ecc.calculate || !chip->ecc.correct ||
+                    !chip->ecc.hwctl) &&
+                   (!chip->ecc.read_page ||
+                    chip->ecc.read_page == nand_read_page_hwecc) ||
+                    !chip->ecc.write_page ||
+                    chip->ecc.write_page == nand_write_page_hwecc) {
                        printk(KERN_WARNING "No ECC functions supplied, "
                               "Hardware ECC not possible\n");
                        BUG();