Commit c8766e81 authored by Boris Brezillon's avatar Boris Brezillon

mtd: nand: bf5xx: 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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent cc003837
...@@ -109,28 +109,33 @@ static const unsigned short bfin_nfc_pin_req[] = ...@@ -109,28 +109,33 @@ static const unsigned short bfin_nfc_pin_req[] =
0}; 0};
#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC #ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
static struct nand_ecclayout bootrom_ecclayout = { static int bootrom_ooblayout_ecc(struct mtd_info *mtd, int section,
.eccbytes = 24, struct mtd_oob_region *oobregion)
.eccpos = { {
0x8 * 0, 0x8 * 0 + 1, 0x8 * 0 + 2, if (section > 7)
0x8 * 1, 0x8 * 1 + 1, 0x8 * 1 + 2, return -ERANGE;
0x8 * 2, 0x8 * 2 + 1, 0x8 * 2 + 2,
0x8 * 3, 0x8 * 3 + 1, 0x8 * 3 + 2, oobregion->offset = section * 8;
0x8 * 4, 0x8 * 4 + 1, 0x8 * 4 + 2, oobregion->length = 3;
0x8 * 5, 0x8 * 5 + 1, 0x8 * 5 + 2,
0x8 * 6, 0x8 * 6 + 1, 0x8 * 6 + 2, return 0;
0x8 * 7, 0x8 * 7 + 1, 0x8 * 7 + 2 }
},
.oobfree = { static int bootrom_ooblayout_free(struct mtd_info *mtd, int section,
{ 0x8 * 0 + 3, 5 }, struct mtd_oob_region *oobregion)
{ 0x8 * 1 + 3, 5 }, {
{ 0x8 * 2 + 3, 5 }, if (section > 7)
{ 0x8 * 3 + 3, 5 }, return -ERANGE;
{ 0x8 * 4 + 3, 5 },
{ 0x8 * 5 + 3, 5 }, oobregion->offset = (section * 8) + 3;
{ 0x8 * 6 + 3, 5 }, oobregion->length = 5;
{ 0x8 * 7 + 3, 5 },
} return 0;
}
static const struct mtd_ooblayout_ops bootrom_ooblayout_ops = {
.ecc = bootrom_ooblayout_ecc,
.free = bootrom_ooblayout_free,
}; };
#endif #endif
...@@ -800,7 +805,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev) ...@@ -800,7 +805,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
/* setup hardware ECC data struct */ /* setup hardware ECC data struct */
if (hardware_ecc) { if (hardware_ecc) {
#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC #ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
chip->ecc.layout = &bootrom_ecclayout; mtd_set_ooblayout(mtd, &bootrom_ooblayout_ops);
#endif #endif
chip->read_buf = bf5xx_nand_dma_read_buf; chip->read_buf = bf5xx_nand_dma_read_buf;
chip->write_buf = bf5xx_nand_dma_write_buf; chip->write_buf = bf5xx_nand_dma_write_buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment