Lines Matching refs:mtd

17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/nand-ecc-sw-bch.h>
19 #include <linux/mtd/rawnand.h>
20 #include <linux/mtd/partitions.h>
30 #include <linux/platform_data/mtd-nand-omap2.h>
185 static inline struct omap_nand_info *mtd_to_omap(struct mtd_info *mtd)
187 return container_of(mtd_to_nand(mtd), struct omap_nand_info, nand);
447 struct mtd_info *mtd = nand_to_mtd(chip);
454 if (len <= mtd->oobsize)
468 struct mtd_info *mtd = nand_to_mtd(chip);
475 if (len <= mtd->oobsize)
535 struct mtd_info *mtd = nand_to_mtd(&info->nand);
538 if (len <= mtd->oobsize || force_8bit) {
577 struct mtd_info *mtd = nand_to_mtd(&info->nand);
582 if (len <= mtd->oobsize || force_8bit) {
993 * @mtd: MTD device structure
1001 static int _omap_calculate_ecc_bch(struct mtd_info *mtd,
1004 struct omap_nand_info *info = mtd_to_omap(mtd);
1137 * @mtd: MTD device structure
1143 static int omap_calculate_ecc_bch_multi(struct mtd_info *mtd,
1146 struct omap_nand_info *info = mtd_to_omap(mtd);
1153 ret = _omap_calculate_ecc_bch(mtd, dat, ecc_calc, i);
1387 struct mtd_info *mtd = nand_to_mtd(chip);
1388 struct omap_nand_info *info = mtd_to_omap(mtd);
1406 ret = omap_calculate_ecc_bch_multi(mtd,
1412 ret = mtd_ooblayout_set_eccbytes(mtd, ecc_calc,
1421 info->data_out(chip, chip->oob_poi, mtd->oobsize, false);
1441 struct mtd_info *mtd = nand_to_mtd(chip);
1442 struct omap_nand_info *info = mtd_to_omap(mtd);
1479 ret = _omap_calculate_ecc_bch(mtd,
1492 ret = mtd_ooblayout_set_eccbytes(mtd, ecc_calc, chip->oob_poi,
1500 info->data_out(chip, chip->oob_poi, mtd->oobsize, false);
1522 struct mtd_info *mtd = nand_to_mtd(chip);
1523 struct omap_nand_info *info = mtd_to_omap(mtd);
1546 mtd->writesize + BBM_LEN +
1555 ret = omap_calculate_ecc_bch_multi(mtd,
1561 ret = mtd_ooblayout_get_eccbytes(mtd, ecc_code,
1572 mtd->ecc_stats.failed++;
1574 mtd->ecc_stats.corrected += stat;
1724 static int omap_ooblayout_ecc(struct mtd_info *mtd, int section,
1727 struct omap_nand_info *info = mtd_to_omap(mtd);
1744 static int omap_ooblayout_free(struct mtd_info *mtd, int section,
1747 struct omap_nand_info *info = mtd_to_omap(mtd);
1759 if (off >= mtd->oobsize)
1763 oobregion->length = mtd->oobsize - off;
1773 static int omap_sw_ooblayout_ecc(struct mtd_info *mtd, int section,
1776 struct nand_device *nand = mtd_to_nanddev(mtd);
1794 static int omap_sw_ooblayout_free(struct mtd_info *mtd, int section,
1797 struct nand_device *nand = mtd_to_nanddev(mtd);
1810 if (off >= mtd->oobsize)
1814 oobregion->length = mtd->oobsize - off;
1826 struct mtd_info *mtd = nand_to_mtd(chip);
1827 struct omap_nand_info *info = mtd_to_omap(mtd);
1942 mtd_set_ooblayout(mtd, &omap_ooblayout_ops);
1959 mtd_set_ooblayout(mtd, &omap_sw_ooblayout_ops);
1982 mtd_set_ooblayout(mtd, &omap_ooblayout_ops);
1996 mtd_set_ooblayout(mtd, &omap_sw_ooblayout_ops);
2019 mtd_set_ooblayout(mtd, &omap_ooblayout_ops);
2035 mtd_set_ooblayout(mtd, &omap_ooblayout_ops);
2045 chip->ecc.steps = mtd->writesize / chip->ecc.size;
2065 (mtd->writesize / chip->ecc.size));
2066 if (mtd->oobsize < min_oobbytes) {
2069 min_oobbytes, mtd->oobsize);
2184 struct mtd_info *mtd;
2209 mtd = nand_to_mtd(nand_chip);
2210 mtd->dev.parent = &pdev->dev;
2213 if (!mtd->name) {
2214 mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
2216 if (!mtd->name) {
2255 err = mtd_device_register(mtd, NULL, 0);
2259 platform_set_drvdata(pdev, mtd);
2277 struct mtd_info *mtd = platform_get_drvdata(pdev);
2278 struct nand_chip *nand_chip = mtd_to_nand(mtd);
2279 struct omap_nand_info *info = mtd_to_omap(mtd);
2285 WARN_ON(mtd_device_unregister(mtd));
2289 /* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */