|
@@ -222,10 +222,33 @@ struct docg4_priv {
|
|
|
* Bytes 8 - 14 are hw-generated ecc covering entire page + oob bytes 0 - 14.
|
|
|
* Byte 15 (the last) is used by the driver as a "page written" flag.
|
|
|
*/
|
|
|
-static struct nand_ecclayout docg4_oobinfo = {
|
|
|
- .eccbytes = 9,
|
|
|
- .eccpos = {7, 8, 9, 10, 11, 12, 13, 14, 15},
|
|
|
- .oobfree = { {.offset = 2, .length = 5} }
|
|
|
+static int docg4_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
|
+ struct mtd_oob_region *oobregion)
|
|
|
+{
|
|
|
+ if (section)
|
|
|
+ return -ERANGE;
|
|
|
+
|
|
|
+ oobregion->offset = 7;
|
|
|
+ oobregion->length = 9;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int docg4_ooblayout_free(struct mtd_info *mtd, int section,
|
|
|
+ struct mtd_oob_region *oobregion)
|
|
|
+{
|
|
|
+ if (section)
|
|
|
+ return -ERANGE;
|
|
|
+
|
|
|
+ oobregion->offset = 2;
|
|
|
+ oobregion->length = 5;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static const struct mtd_ooblayout_ops docg4_ooblayout_ops = {
|
|
|
+ .ecc = docg4_ooblayout_ecc,
|
|
|
+ .free = docg4_ooblayout_free,
|
|
|
};
|
|
|
|
|
|
/*
|
|
@@ -1209,6 +1232,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
|
|
|
mtd->writesize = DOCG4_PAGE_SIZE;
|
|
|
mtd->erasesize = DOCG4_BLOCK_SIZE;
|
|
|
mtd->oobsize = DOCG4_OOB_SIZE;
|
|
|
+ mtd_set_ooblayout(mtd, &docg4_ooblayout_ops);
|
|
|
nand->chipsize = DOCG4_CHIP_SIZE;
|
|
|
nand->chip_shift = DOCG4_CHIP_SHIFT;
|
|
|
nand->bbt_erase_shift = nand->phys_erase_shift = DOCG4_ERASE_SHIFT;
|
|
@@ -1217,7 +1241,6 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
|
|
|
nand->pagemask = 0x3ffff;
|
|
|
nand->badblockpos = NAND_LARGE_BADBLOCK_POS;
|
|
|
nand->badblockbits = 8;
|
|
|
- nand->ecc.layout = &docg4_oobinfo;
|
|
|
nand->ecc.mode = NAND_ECC_HW_SYNDROME;
|
|
|
nand->ecc.size = DOCG4_PAGE_SIZE;
|
|
|
nand->ecc.prepad = 8;
|