Lines Matching defs:mtd

16 #include <linux/mtd/spinand.h>
232 static int spinand_noecc_ooblayout_ecc(struct mtd_info *mtd, int section,
238 static int spinand_noecc_ooblayout_free(struct mtd_info *mtd, int section,
259 struct mtd_info *mtd = nanddev_to_mtd(nand);
273 mtd_set_ooblayout(mtd, spinand->eccinfo.ooblayout);
275 mtd_set_ooblayout(mtd, &spinand_noecc_ooblayout);
302 struct mtd_info *mtd = spinand_to_mtd(spinand);
315 mtd->ecc_stats.failed++;
317 mtd->ecc_stats.corrected += ret;
363 struct mtd_info *mtd = spinand_to_mtd(spinand);
408 mtd_ooblayout_get_databytes(mtd, req->oobbuf.in,
424 struct mtd_info *mtd = spinand_to_mtd(spinand);
449 mtd_ooblayout_set_databytes(mtd, req->oobbuf.out,
633 static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
636 struct spinand_device *spinand = mtd_to_spinand(mtd);
637 struct nand_device *nand = mtd_to_nanddev(mtd);
650 old_stats = mtd->ecc_stats;
676 mtd->ecc_stats.failed - old_stats.failed;
678 mtd->ecc_stats.corrected - old_stats.corrected;
689 static int spinand_mtd_write(struct mtd_info *mtd, loff_t to,
692 struct spinand_device *spinand = mtd_to_spinand(mtd);
693 struct nand_device *nand = mtd_to_nanddev(mtd);
698 if (ops->mode == MTD_OPS_RAW || !mtd->ooblayout)
744 static int spinand_mtd_block_isbad(struct mtd_info *mtd, loff_t offs)
746 struct nand_device *nand = mtd_to_nanddev(mtd);
783 static int spinand_mtd_block_markbad(struct mtd_info *mtd, loff_t offs)
785 struct nand_device *nand = mtd_to_nanddev(mtd);
827 static int spinand_mtd_erase(struct mtd_info *mtd,
830 struct spinand_device *spinand = mtd_to_spinand(mtd);
834 ret = nanddev_mtd_erase(mtd, einfo);
840 static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
842 struct spinand_device *spinand = mtd_to_spinand(mtd);
843 struct nand_device *nand = mtd_to_nanddev(mtd);
1199 static void spinand_mtd_resume(struct mtd_info *mtd)
1201 struct spinand_device *spinand = mtd_to_spinand(mtd);
1218 struct mtd_info *mtd = spinand_to_mtd(spinand);
1219 struct nand_device *nand = mtd_to_nanddev(mtd);
1270 mtd->_read_oob = spinand_mtd_read;
1271 mtd->_write_oob = spinand_mtd_write;
1272 mtd->_block_isbad = spinand_mtd_block_isbad;
1273 mtd->_block_markbad = spinand_mtd_block_markbad;
1274 mtd->_block_isreserved = spinand_mtd_block_isreserved;
1275 mtd->_erase = spinand_mtd_erase;
1276 mtd->_max_bad_blocks = nanddev_mtd_max_bad_blocks;
1277 mtd->_resume = spinand_mtd_resume;
1280 ret = mtd_ooblayout_count_freebytes(mtd);
1285 mtd->oobavail = ret;
1288 mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
1289 mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
1329 struct mtd_info *mtd;
1341 mtd = spinand_to_mtd(spinand);
1342 mtd->dev.parent = &mem->spi->dev;
1348 ret = mtd_device_register(mtd, NULL, 0);
1363 struct mtd_info *mtd;
1367 mtd = spinand_to_mtd(spinand);
1369 ret = mtd_device_unregister(mtd);