Lines Matching full:mtd

5  * Check MTD device read.
16 #include <linux/mtd/mtd.h>
24 MODULE_PARM_DESC(dev, "MTD device number to use");
26 static struct mtd_info *mtd; variable
38 loff_t addr = (loff_t)ebnum * mtd->erasesize; in read_eraseblock_by_page()
44 ret = mtdtest_read(mtd, addr, pgsize, buf); in read_eraseblock_by_page()
49 if (mtd->oobsize) { in read_eraseblock_by_page()
55 ops.ooblen = mtd->oobsize; in read_eraseblock_by_page()
60 ret = mtd_read_oob(mtd, addr, &ops); in read_eraseblock_by_page()
62 ops.oobretlen != mtd->oobsize) { in read_eraseblock_by_page()
70 oobbuf += mtd->oobsize; in read_eraseblock_by_page()
86 n = mtd->erasesize; in dump_eraseblock()
96 if (!mtd->oobsize) in dump_eraseblock()
99 n = mtd->oobsize; in dump_eraseblock()
122 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_readtest_init()
126 pr_info("MTD device: %d\n", dev); in mtd_readtest_init()
128 mtd = get_mtd_device(NULL, dev); in mtd_readtest_init()
129 if (IS_ERR(mtd)) { in mtd_readtest_init()
130 err = PTR_ERR(mtd); in mtd_readtest_init()
131 pr_err("error: Cannot get MTD device\n"); in mtd_readtest_init()
135 if (mtd->writesize == 1) { in mtd_readtest_init()
140 pgsize = mtd->writesize; in mtd_readtest_init()
142 tmp = mtd->size; in mtd_readtest_init()
143 do_div(tmp, mtd->erasesize); in mtd_readtest_init()
145 pgcnt = mtd->erasesize / pgsize; in mtd_readtest_init()
147 pr_info("MTD device size %llu, eraseblock size %u, " in mtd_readtest_init()
150 (unsigned long long)mtd->size, mtd->erasesize, in mtd_readtest_init()
151 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_readtest_init()
154 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_readtest_init()
157 iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_readtest_init()
164 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_readtest_init()
199 put_mtd_device(mtd); in mtd_readtest_init()