aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-02-03 14:02:09 -0500
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-05-05 17:51:44 -0400
commit2ca9ec9acd3bea9f3160e0e0975c06914da3ae4e (patch)
treeefc7eecfff7fe90648e98668682a4bd01f95d24c
parent3f158e47dfe92ee53f1e09c5fa76a07116100f02 (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.c26
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
634static struct nand_ecclayout nand_ecc_2K_16bits = { 634static 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
641static 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
653static const struct mtd_ooblayout_ops hisi_ooblayout_ops = {
654 .ecc = hisi_ooblayout_ecc,
655 .free = hisi_ooblayout_free,
636}; 656};
637 657
638static int hisi_nfc_ecc_probe(struct hinfc_host *host) 658static 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;