Lines Matching defs:mtd

17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/partitions.h>
56 static int docg3_ooblayout_ecc(struct mtd_info *mtd, int section,
69 static int docg3_ooblayout_free(struct mtd_info *mtd, int section,
856 * @mtd: the device
859 * @ops: the mtd oob structure
865 static int doc_read_oob(struct mtd_info *mtd, loff_t from,
868 struct docg3 *docg3 = mtd->priv;
899 old_stats = mtd->ecc_stats;
949 mtd->ecc_stats.failed++;
953 mtd->ecc_stats.corrected += ret;
973 mtd->ecc_stats.failed - old_stats.failed;
975 mtd->ecc_stats.corrected - old_stats.corrected;
1008 * @mtd: the device
1013 static int doc_block_isbad(struct mtd_info *mtd, loff_t from)
1015 struct docg3 *docg3 = mtd->priv;
1175 * @mtd: the device
1178 * Erase a bunch of contiguous blocks, by pairs, as a "mtd" page of 1024 is
1184 static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
1186 struct docg3 *docg3 = mtd->priv;
1194 if (info->addr + info->len > mtd->size || page || ofs)
1202 for (len = info->len; !ret && len > 0; len -= mtd->erasesize) {
1369 * @mtd: the device
1372 * @ops: the mtd oob structure
1382 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
1385 struct docg3 *docg3 = mtd->priv;
1409 oobdelta = mtd->oobsize;
1412 oobdelta = mtd->oobavail;
1751 * @mtd: The structure to fill
1753 static int __init doc_set_driver_info(int chip_id, struct mtd_info *mtd)
1755 struct docg3 *docg3 = mtd->priv;
1764 mtd->name = devm_kasprintf(docg3->dev, GFP_KERNEL, "docg3.%d",
1766 if (!mtd->name)
1771 mtd->type = MTD_NANDFLASH;
1772 mtd->flags = MTD_CAP_NANDFLASH;
1773 mtd->size = (docg3->max_block + 1) * DOC_LAYOUT_BLOCK_SIZE;
1775 mtd->size /= 2;
1776 mtd->erasesize = DOC_LAYOUT_BLOCK_SIZE * DOC_LAYOUT_NBPLANES;
1778 mtd->erasesize /= 2;
1779 mtd->writebufsize = mtd->writesize = DOC_LAYOUT_PAGE_SIZE;
1780 mtd->oobsize = DOC_LAYOUT_OOB_SIZE;
1781 mtd->_erase = doc_erase;
1782 mtd->_read_oob = doc_read_oob;
1783 mtd->_write_oob = doc_write_oob;
1784 mtd->_block_isbad = doc_block_isbad;
1785 mtd_set_ooblayout(mtd, &nand_ooblayout_docg3_ops);
1786 mtd->oobavail = 8;
1787 mtd->ecc_strength = DOC_ECC_BCH_T;
1810 struct mtd_info *mtd;
1816 mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
1817 if (!mtd)
1819 mtd->priv = docg3;
1820 mtd->dev.parent = dev;
1853 ret = doc_set_driver_info(chip_id, mtd);
1859 return mtd;
1864 kfree(mtd);
1873 * @mtd: the device
1875 static void doc_release_device(struct mtd_info *mtd)
1877 struct docg3 *docg3 = mtd->priv;
1879 mtd_device_unregister(mtd);
1882 kfree(mtd);
1895 struct mtd_info **docg3_floors, *mtd;
1900 mtd = docg3_floors[0];
1901 docg3 = mtd->priv;
1922 struct mtd_info **docg3_floors, *mtd;
1929 mtd = docg3_floors[floor];
1930 if (!mtd)
1932 docg3 = mtd->priv;
1955 mtd = docg3_floors[0];
1956 docg3 = mtd->priv;
1973 struct mtd_info *mtd;
2005 mtd = doc_probe_device(cascade, floor, dev);
2006 if (IS_ERR(mtd)) {
2007 ret = PTR_ERR(mtd);
2010 if (!mtd) {
2016 cascade->floors[floor] = mtd;
2017 ret = mtd_device_parse_register(mtd, part_probes, NULL, NULL,