diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-02-03 14:02:09 -0500 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-05-05 17:51:44 -0400 |
commit | 2ca9ec9acd3bea9f3160e0e0975c06914da3ae4e (patch) | |
tree | efc7eecfff7fe90648e98668682a4bd01f95d24c | |
parent | 3f158e47dfe92ee53f1e09c5fa76a07116100f02 (diff) |
mtd: nand: hisi504: 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>
-rw-r--r-- | drivers/mtd/nand/hisi504_nand.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c index 96502b624cfb..7bf844c55085 100644 --- a/drivers/mtd/nand/hisi504_nand.c +++ b/drivers/mtd/nand/hisi504_nand.c | |||
@@ -631,8 +631,28 @@ static void hisi_nfc_host_init(struct hinfc_host *host) | |||
631 | hinfc_write(host, HINFC504_INTEN_DMA, HINFC504_INTEN); | 631 | hinfc_write(host, HINFC504_INTEN_DMA, HINFC504_INTEN); |
632 | } | 632 | } |
633 | 633 | ||
634 | static struct nand_ecclayout nand_ecc_2K_16bits = { | 634 | static int hisi_ooblayout_ecc(struct mtd_info *mtd, int section, |
635 | .oobfree = { {2, 6} }, | 635 | struct mtd_oob_region *oobregion) |
636 | { | ||
637 | /* FIXME: add ECC bytes position */ | ||
638 | return -ENOTSUPP; | ||
639 | } | ||
640 | |||
641 | static int hisi_ooblayout_free(struct mtd_info *mtd, int section, | ||
642 | struct mtd_oob_region *oobregion) | ||
643 | { | ||
644 | if (section) | ||
645 | return -ERANGE; | ||
646 | |||
647 | oobregion->offset = 2; | ||
648 | oobregion->length = 6; | ||
649 | |||
650 | return 0; | ||
651 | } | ||
652 | |||
653 | static const struct mtd_ooblayout_ops hisi_ooblayout_ops = { | ||
654 | .ecc = hisi_ooblayout_ecc, | ||
655 | .free = hisi_ooblayout_free, | ||
636 | }; | 656 | }; |
637 | 657 | ||
638 | static int hisi_nfc_ecc_probe(struct hinfc_host *host) | 658 | static int hisi_nfc_ecc_probe(struct hinfc_host *host) |
@@ -668,7 +688,7 @@ static int hisi_nfc_ecc_probe(struct hinfc_host *host) | |||
668 | case 16: | 688 | case 16: |
669 | ecc_bits = 6; | 689 | ecc_bits = 6; |
670 | if (mtd->writesize == 2048) | 690 | if (mtd->writesize == 2048) |
671 | chip->ecc.layout = &nand_ecc_2K_16bits; | 691 | mtd_set_ooblayout(mtd, &hisi_ooblayout_ops); |
672 | 692 | ||
673 | /* TODO: add more page size support */ | 693 | /* TODO: add more page size support */ |
674 | break; | 694 | break; |