]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/omap_gpmc.c
mtd: nand: omap: fix ecc-layout for HAM1 ecc-scheme
[karo-tx-uboot.git] / drivers / mtd / nand / omap_gpmc.c
index 5e7e6b337544f3f7543baf7e8c1bcee9242a00e4..23a961c9d4efcd49d8062d7d7f5c6f0c5ec20fff 100644 (file)
@@ -798,8 +798,12 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
                nand->ecc.calculate     = omap_calculate_ecc;
                /* define ecc-layout */
                ecclayout->eccbytes     = nand->ecc.bytes * eccsteps;
-               for (i = 0; i < ecclayout->eccbytes; i++)
-                       ecclayout->eccpos[i] = i + BADBLOCK_MARKER_LENGTH;
+               for (i = 0; i < ecclayout->eccbytes; i++) {
+                       if (nand->options & NAND_BUSWIDTH_16)
+                               ecclayout->eccpos[i] = i + 2;
+                       else
+                               ecclayout->eccpos[i] = i + 1;
+               }
                ecclayout->oobfree[0].offset = i + BADBLOCK_MARKER_LENGTH;
                ecclayout->oobfree[0].length = oobsize - ecclayout->eccbytes -
                                                BADBLOCK_MARKER_LENGTH;