Lines Matching defs:mtd

28 #include <linux/mtd/mtd.h>
29 #include <linux/mtd/rawnand.h>
30 #include <linux/mtd/doc2000.h>
31 #include <linux/mtd/partitions.h>
32 #include <linux/mtd/inftl.h>
76 int (*late_init)(struct mtd_info *mtd);
362 static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
364 struct nand_chip *this = mtd_to_nand(mtd);
393 static void __init doc2000_count_chips(struct mtd_info *mtd)
395 struct nand_chip *this = mtd_to_nand(mtd);
404 mfrid = doc200x_ident_chip(mtd, 0);
408 if (doc200x_ident_chip(mtd, i) != mfrid)
810 static int doc200x_ooblayout_ecc(struct mtd_info *mtd, int section,
822 static int doc200x_ooblayout_free(struct mtd_info *mtd, int section,
862 static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const char *id, int findmirror)
864 struct nand_chip *this = mtd_to_nand(mtd);
870 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) {
871 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf);
872 if (retlen != mtd->writesize)
896 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf);
897 if (retlen != mtd->writesize) {
905 static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
907 struct nand_chip *this = mtd_to_nand(mtd);
920 buf = kmalloc(mtd->writesize, GFP_KERNEL);
924 if (!(numheaders = find_media_headers(mtd, buf, "ANAND", 1)))
941 blocks = mtd->size >> this->phys_erase_shift;
942 maxblocks = min(32768U, mtd->erasesize - psize);
967 mtd->erasesize <<= (0xff - mh->UnitSizeFactor);
968 pr_info("Setting virtual erase size to %d\n", mtd->erasesize);
969 blocks = mtd->size >> this->bbt_erase_shift;
970 maxblocks = min(32768U, mtd->erasesize - psize);
981 offs += mtd->erasesize;
997 if (offs < mtd->size) {
1000 parts[numparts].size = mtd->size - offs;
1011 static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
1013 struct nand_chip *this = mtd_to_nand(mtd);
1023 int end = mtd->size;
1028 buf = kmalloc(mtd->writesize, GFP_KERNEL);
1033 if (!find_media_headers(mtd, buf, "BNAND", 0))
1065 blocks = mtd->size >> vshift;
1072 if (inftl_bbt_write && (blocks > mtd->erasesize)) {
1101 parts[0].size = mtd->erasesize * ip->firstUnit;
1130 static int __init nftl_scan_bbt(struct mtd_info *mtd)
1133 struct nand_chip *this = mtd_to_nand(mtd);
1140 numparts = nftl_partscan(mtd, parts);
1162 return mtd_device_register(mtd, parts, no_autopart ? 0 : numparts);
1165 static int __init inftl_scan_bbt(struct mtd_info *mtd)
1168 struct nand_chip *this = mtd_to_nand(mtd);
1210 numparts = inftl_partscan(mtd, parts);
1216 return mtd_device_register(mtd, parts, no_autopart ? 0 : numparts);
1219 static inline int __init doc2000_init(struct mtd_info *mtd)
1221 struct nand_chip *this = mtd_to_nand(mtd);
1227 doc2000_count_chips(mtd);
1228 mtd->name = "DiskOnChip 2000 (NFTL Model)";
1232 static inline int __init doc2001_init(struct mtd_info *mtd)
1234 struct nand_chip *this = mtd_to_nand(mtd);
1245 doc2000_count_chips(mtd);
1246 mtd->name = "DiskOnChip 2000 (INFTL Model)";
1252 mtd->name = "DiskOnChip Millennium";
1258 static inline int __init doc2001plus_init(struct mtd_info *mtd)
1260 struct nand_chip *this = mtd_to_nand(mtd);
1267 mtd->name = "DiskOnChip Millennium Plus";
1304 struct mtd_info *mtd;
1397 for (mtd = doclist; mtd; mtd = doc->nextdoc) {
1400 nand = mtd_to_nand(mtd);
1465 mtd = nand_to_mtd(nand);
1469 mtd->owner = THIS_MODULE;
1470 mtd_set_ooblayout(mtd, &doc200x_ooblayout_ops);
1488 numchips = doc2000_init(mtd);
1490 numchips = doc2001plus_init(mtd);
1492 numchips = doc2001_init(mtd);
1498 ret = doc->late_init(mtd);
1505 doclist = mtd;
1526 struct mtd_info *mtd, *nextmtd;
1531 for (mtd = doclist; mtd; mtd = nextmtd) {
1532 nand = mtd_to_nand(mtd);
1536 ret = mtd_device_unregister(mtd);