mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-09 22:24:04 +08:00
mtd: nand: s3c2410: switch to mtd_ooblayout_ops
Implementing the mtd_ooblayout_ops interface is the new way of exposing ECC/OOB layout to MTD users. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:
parent
39980c5616
commit
bf01e06b32
@ -84,11 +84,33 @@
|
|||||||
|
|
||||||
/* new oob placement block for use with hardware ecc generation
|
/* new oob placement block for use with hardware ecc generation
|
||||||
*/
|
*/
|
||||||
|
static int s3c2410_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||||
|
struct mtd_oob_region *oobregion)
|
||||||
|
{
|
||||||
|
if (section)
|
||||||
|
return -ERANGE;
|
||||||
|
|
||||||
static struct nand_ecclayout nand_hw_eccoob = {
|
oobregion->offset = 0;
|
||||||
.eccbytes = 3,
|
oobregion->length = 3;
|
||||||
.eccpos = {0, 1, 2},
|
|
||||||
.oobfree = {{8, 8}}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int s3c2410_ooblayout_free(struct mtd_info *mtd, int section,
|
||||||
|
struct mtd_oob_region *oobregion)
|
||||||
|
{
|
||||||
|
if (section)
|
||||||
|
return -ERANGE;
|
||||||
|
|
||||||
|
oobregion->offset = 8;
|
||||||
|
oobregion->length = 8;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct mtd_ooblayout_ops s3c2410_ooblayout_ops = {
|
||||||
|
.ecc = s3c2410_ooblayout_ecc,
|
||||||
|
.free = s3c2410_ooblayout_free,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* controller and mtd information */
|
/* controller and mtd information */
|
||||||
@ -920,7 +942,7 @@ static void s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
|
|||||||
} else {
|
} else {
|
||||||
chip->ecc.size = 512;
|
chip->ecc.size = 512;
|
||||||
chip->ecc.bytes = 3;
|
chip->ecc.bytes = 3;
|
||||||
chip->ecc.layout = &nand_hw_eccoob;
|
mtd_set_ooblayout(nand_to_mtd(chip), &s3c2410_ooblayout_ops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user