mtd: nand: davinci: set ECC algorithm explicitly
authorRafał Miłecki <zajec5@gmail.com>
Sun, 17 Apr 2016 20:52:58 +0000 (22:52 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 5 May 2016 21:52:02 +0000 (23:52 +0200)
This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/davinci_nand.c

index 0198536a19443ccc69edab3194c16c0e0a47bc30..cc07ba0f044deeb167772c529a635236377d983b 100644 (file)
@@ -723,8 +723,17 @@ static int nand_davinci_probe(struct platform_device *pdev)
 
        switch (info->chip.ecc.mode) {
        case NAND_ECC_NONE:
+               pdata->ecc_bits = 0;
+               break;
        case NAND_ECC_SOFT:
                pdata->ecc_bits = 0;
+               /*
+                * This driver expects Hamming based ECC when ecc_mode is set
+                * to NAND_ECC_SOFT. Force ecc.algo to NAND_ECC_HAMMING to
+                * avoid adding an extra ->ecc_algo field to
+                * davinci_nand_pdata.
+                */
+               info->chip.ecc.algo = NAND_ECC_HAMMING;
                break;
        case NAND_ECC_HW:
                if (pdata->ecc_bits == 4) {