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;
947 mtd->ecc_stats.failed++;
951 mtd->ecc_stats.corrected += ret;
1000 * @mtd: the device
1005 static int doc_block_isbad(struct mtd_info *mtd, loff_t from)
1007 struct docg3 *docg3 = mtd->priv;
1167 * @mtd: the device
1170 * Erase a bunch of contiguous blocks, by pairs, as a "mtd" page of 1024 is
1176 static int doc_erase(struct mtd_info *mtd, struct erase_info *info)
1178 struct docg3 *docg3 = mtd->priv;
1186 if (info->addr + info->len > mtd->size || page || ofs)
1194 for (len = info->len; !ret && len > 0; len -= mtd->erasesize) {
1361 * @mtd: the device
1364 * @ops: the mtd oob structure
1374 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,
1377 struct docg3 *docg3 = mtd->priv;
1401 oobdelta = mtd->oobsize;
1404 oobdelta = mtd->oobavail;
1743 * @mtd: The structure to fill
1745 static int __init doc_set_driver_info(int chip_id, struct mtd_info *mtd)
1747 struct docg3 *docg3 = mtd->priv;
1756 mtd->name = devm_kasprintf(docg3->dev, GFP_KERNEL, "docg3.%d",
1758 if (!mtd->name)
1763 mtd->type = MTD_NANDFLASH;
1764 mtd->flags = MTD_CAP_NANDFLASH;
1765 mtd->size = (docg3->max_block + 1) * DOC_LAYOUT_BLOCK_SIZE;
1767 mtd->size /= 2;
1768 mtd->erasesize = DOC_LAYOUT_BLOCK_SIZE * DOC_LAYOUT_NBPLANES;
1770 mtd->erasesize /= 2;
1771 mtd->writebufsize = mtd->writesize = DOC_LAYOUT_PAGE_SIZE;
1772 mtd->oobsize = DOC_LAYOUT_OOB_SIZE;
1773 mtd->_erase = doc_erase;
1774 mtd->_read_oob = doc_read_oob;
1775 mtd->_write_oob = doc_write_oob;
1776 mtd->_block_isbad = doc_block_isbad;
1777 mtd_set_ooblayout(mtd, &nand_ooblayout_docg3_ops);
1778 mtd->oobavail = 8;
1779 mtd->ecc_strength = DOC_ECC_BCH_T;
1803 struct mtd_info *mtd;
1809 mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
1810 if (!mtd)
1812 mtd->priv = docg3;
1813 mtd->dev.parent = dev;
1846 ret = doc_set_driver_info(chip_id, mtd);
1852 return mtd;
1857 kfree(mtd);
1866 * @mtd: the device
1868 static void doc_release_device(struct mtd_info *mtd)
1870 struct docg3 *docg3 = mtd->priv;
1872 mtd_device_unregister(mtd);
1875 kfree(mtd);
1888 struct mtd_info **docg3_floors, *mtd;
1893 mtd = docg3_floors[0];
1894 docg3 = mtd->priv;
1915 struct mtd_info **docg3_floors, *mtd;
1922 mtd = docg3_floors[floor];
1923 if (!mtd)
1925 docg3 = mtd->priv;
1948 mtd = docg3_floors[0];
1949 docg3 = mtd->priv;
1966 struct mtd_info *mtd;
1998 mtd = doc_probe_device(cascade, floor, dev);
1999 if (IS_ERR(mtd)) {
2000 ret = PTR_ERR(mtd);
2003 if (!mtd) {
2009 cascade->floors[floor] = mtd;
2010 ret = mtd_device_parse_register(mtd, part_probes, NULL, NULL,