• Home
  • Raw
  • Download

Lines Matching refs:mtd

51 	struct mtd_info *mtd;  member
58 return fixed_size_llseek(file, offset, orig, mfi->mtd->size); in mtdchar_lseek()
66 struct mtd_info *mtd; in mtdchar_open() local
76 mtd = get_mtd_device(NULL, devnum); in mtdchar_open()
78 if (IS_ERR(mtd)) { in mtdchar_open()
79 ret = PTR_ERR(mtd); in mtdchar_open()
83 if (mtd->type == MTD_ABSENT) { in mtdchar_open()
89 if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { in mtdchar_open()
99 mfi->mtd = mtd; in mtdchar_open()
105 put_mtd_device(mtd); in mtdchar_open()
116 struct mtd_info *mtd = mfi->mtd; in mtdchar_close() local
122 mtd_sync(mtd); in mtdchar_close()
124 put_mtd_device(mtd); in mtdchar_close()
153 struct mtd_info *mtd = mfi->mtd; in mtdchar_read() local
163 if (*ppos + count > mtd->size) in mtdchar_read()
164 count = mtd->size - *ppos; in mtdchar_read()
169 kbuf = mtd_kmalloc_up_to(mtd, &size); in mtdchar_read()
178 ret = mtd_read_fact_prot_reg(mtd, *ppos, len, in mtdchar_read()
182 ret = mtd_read_user_prot_reg(mtd, *ppos, len, in mtdchar_read()
194 ret = mtd_read_oob(mtd, *ppos, &ops); in mtdchar_read()
199 ret = mtd_read(mtd, *ppos, len, &retlen, kbuf); in mtdchar_read()
239 struct mtd_info *mtd = mfi->mtd; in mtdchar_write() local
249 if (*ppos == mtd->size) in mtdchar_write()
252 if (*ppos + count > mtd->size) in mtdchar_write()
253 count = mtd->size - *ppos; in mtdchar_write()
258 kbuf = mtd_kmalloc_up_to(mtd, &size); in mtdchar_write()
275 ret = mtd_write_user_prot_reg(mtd, *ppos, len, in mtdchar_write()
289 ret = mtd_write_oob(mtd, *ppos, &ops); in mtdchar_write()
295 ret = mtd_write(mtd, *ppos, len, &retlen, kbuf); in mtdchar_write()
334 struct mtd_info *mtd = mfi->mtd; in otp_select_filemode() local
339 if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == in otp_select_filemode()
346 if (mtd_read_user_prot_reg(mtd, -1, 0, &retlen, NULL) == in otp_select_filemode()
362 static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, in mtdchar_writeoob() argument
377 if (!mtd->_write_oob) in mtdchar_writeoob()
386 ops.ooboffs = start & (mtd->writesize - 1); in mtdchar_writeoob()
391 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) in mtdchar_writeoob()
398 start &= ~((uint64_t)mtd->writesize - 1); in mtdchar_writeoob()
399 ret = mtd_write_oob(mtd, start, &ops); in mtdchar_writeoob()
411 static int mtdchar_readoob(struct file *file, struct mtd_info *mtd, in mtdchar_readoob() argument
426 ops.ooboffs = start & (mtd->writesize - 1); in mtdchar_readoob()
431 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) in mtdchar_readoob()
438 start &= ~((uint64_t)mtd->writesize - 1); in mtdchar_readoob()
439 ret = mtd_read_oob(mtd, start, &ops); in mtdchar_readoob()
475 static int shrink_ecclayout(struct mtd_info *mtd, in shrink_ecclayout() argument
481 if (!mtd || !to) in shrink_ecclayout()
490 ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); in shrink_ecclayout()
507 ret = mtd_ooblayout_free(mtd, i, &oobregion); in shrink_ecclayout()
523 static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to) in get_oobinfo() argument
528 if (!mtd || !to) in get_oobinfo()
537 ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); in get_oobinfo()
556 ret = mtd_ooblayout_free(mtd, i, &oobregion); in get_oobinfo()
573 static int mtdchar_blkpg_ioctl(struct mtd_info *mtd, in mtdchar_blkpg_ioctl() argument
588 if (mtd_is_partition(mtd)) in mtdchar_blkpg_ioctl()
594 return mtd_add_partition(mtd, p.devname, p.start, p.length); in mtdchar_blkpg_ioctl()
601 return mtd_del_partition(mtd, p.pno); in mtdchar_blkpg_ioctl()
608 static int mtdchar_write_ioctl(struct mtd_info *mtd, in mtdchar_write_ioctl() argument
625 if (!mtd->_write_oob) in mtdchar_write_ioctl()
651 ret = mtd_write_oob(mtd, (loff_t)req.start, &ops); in mtdchar_write_ioctl()
662 struct mtd_info *mtd = mfi->mtd; in mtdchar_ioctl() local
682 if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int))) in mtdchar_ioctl()
695 if (ur_idx >= mtd->numeraseregions) in mtdchar_ioctl()
698 kr = &(mtd->eraseregions[ur_idx]); in mtdchar_ioctl()
710 info.type = mtd->type; in mtdchar_ioctl()
711 info.flags = mtd->flags; in mtdchar_ioctl()
712 info.size = mtd->size; in mtdchar_ioctl()
713 info.erasesize = mtd->erasesize; in mtdchar_ioctl()
714 info.writesize = mtd->writesize; in mtdchar_ioctl()
715 info.oobsize = mtd->oobsize; in mtdchar_ioctl()
760 erase->mtd = mtd; in mtdchar_ioctl()
773 ret = mtd_erase(mtd, erase); in mtdchar_ioctl()
799 ret = mtdchar_writeoob(file, mtd, buf.start, buf.length, in mtdchar_ioctl()
813 ret = mtdchar_readoob(file, mtd, buf.start, buf.length, in mtdchar_ioctl()
826 ret = mtdchar_writeoob(file, mtd, buf.start, buf.length, in mtdchar_ioctl()
840 ret = mtdchar_readoob(file, mtd, buf.start, buf.length, in mtdchar_ioctl()
848 ret = mtdchar_write_ioctl(mtd, in mtdchar_ioctl()
860 ret = mtd_lock(mtd, einfo.start, einfo.length); in mtdchar_ioctl()
871 ret = mtd_unlock(mtd, einfo.start, einfo.length); in mtdchar_ioctl()
882 ret = mtd_is_locked(mtd, einfo.start, einfo.length); in mtdchar_ioctl()
891 if (!mtd->ooblayout) in mtdchar_ioctl()
894 ret = get_oobinfo(mtd, &oi); in mtdchar_ioctl()
909 return mtd_block_isbad(mtd, offs); in mtdchar_ioctl()
919 return mtd_block_markbad(mtd, offs); in mtdchar_ioctl()
946 ret = mtd_get_fact_prot_info(mtd, 4096, &retlen, buf); in mtdchar_ioctl()
949 ret = mtd_get_user_prot_info(mtd, 4096, &retlen, buf); in mtdchar_ioctl()
976 ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length); in mtdchar_ioctl()
985 if (!mtd->ooblayout) in mtdchar_ioctl()
992 shrink_ecclayout(mtd, usrlay); in mtdchar_ioctl()
1002 if (copy_to_user(argp, &mtd->ecc_stats, in mtdchar_ioctl()
1019 if (!mtd_has_oob(mtd)) in mtdchar_ioctl()
1040 ret = mtdchar_blkpg_ioctl(mtd, &a); in mtdchar_ioctl()
1084 struct mtd_info *mtd = mfi->mtd; in mtdchar_compat_ioctl() local
1099 ret = mtdchar_writeoob(file, mtd, buf.start, in mtdchar_compat_ioctl()
1114 ret = mtdchar_readoob(file, mtd, buf.start, in mtdchar_compat_ioctl()
1138 ret = mtdchar_blkpg_ioctl(mtd, &a); in mtdchar_compat_ioctl()
1166 struct mtd_info *mtd = mfi->mtd; in mtdchar_get_unmapped_area() local
1173 if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT)) in mtdchar_get_unmapped_area()
1177 if (offset > mtd->size - len) in mtdchar_get_unmapped_area()
1180 ret = mtd_get_unmapped_area(mtd, len, offset, flags); in mtdchar_get_unmapped_area()
1188 return mtd_mmap_capabilities(mfi->mtd); in mtdchar_mmap_capabilities()
1199 struct mtd_info *mtd = mfi->mtd; in mtdchar_mmap() local
1200 struct map_info *map = mtd->priv; in mtdchar_mmap()