Lines Matching full:mtd
5 * Test read and write speed of a MTD device.
17 #include <linux/mtd/mtd.h>
26 MODULE_PARM_DESC(dev, "MTD device number to use");
33 static struct mtd_info *mtd; variable
47 loff_t addr = (loff_t)ebnum * mtd->erasesize; in multiblock_erase()
51 ei.len = mtd->erasesize * blocks; in multiblock_erase()
53 err = mtd_erase(mtd, &ei); in multiblock_erase()
65 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
67 return mtdtest_write(mtd, addr, mtd->erasesize, iobuf); in write_eraseblock()
73 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock_by_page()
77 err = mtdtest_write(mtd, addr, pgsize, buf); in write_eraseblock_by_page()
91 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock_by_2pages()
95 err = mtdtest_write(mtd, addr, sz, buf); in write_eraseblock_by_2pages()
102 err = mtdtest_write(mtd, addr, pgsize, buf); in write_eraseblock_by_2pages()
109 loff_t addr = (loff_t)ebnum * mtd->erasesize; in read_eraseblock()
111 return mtdtest_read(mtd, addr, mtd->erasesize, iobuf); in read_eraseblock()
117 loff_t addr = (loff_t)ebnum * mtd->erasesize; in read_eraseblock_by_page()
121 err = mtdtest_read(mtd, addr, pgsize, buf); in read_eraseblock_by_page()
135 loff_t addr = (loff_t)ebnum * mtd->erasesize; in read_eraseblock_by_2pages()
139 err = mtdtest_read(mtd, addr, sz, buf); in read_eraseblock_by_2pages()
146 err = mtdtest_read(mtd, addr, pgsize, buf); in read_eraseblock_by_2pages()
168 k = (uint64_t)goodebcnt * (mtd->erasesize / 1024) * 1000000; in calc_speed()
183 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_speedtest_init()
184 pr_crit("CAREFUL: This test wipes all data on the specified MTD device!\n"); in mtd_speedtest_init()
189 pr_info("MTD device: %d count: %d\n", dev, count); in mtd_speedtest_init()
191 pr_info("MTD device: %d\n", dev); in mtd_speedtest_init()
193 mtd = get_mtd_device(NULL, dev); in mtd_speedtest_init()
194 if (IS_ERR(mtd)) { in mtd_speedtest_init()
195 err = PTR_ERR(mtd); in mtd_speedtest_init()
196 pr_err("error: cannot get MTD device\n"); in mtd_speedtest_init()
200 if (mtd->writesize == 1) { in mtd_speedtest_init()
205 pgsize = mtd->writesize; in mtd_speedtest_init()
207 tmp = mtd->size; in mtd_speedtest_init()
208 do_div(tmp, mtd->erasesize); in mtd_speedtest_init()
210 pgcnt = mtd->erasesize / pgsize; in mtd_speedtest_init()
212 pr_info("MTD device size %llu, eraseblock size %u, " in mtd_speedtest_init()
215 (unsigned long long)mtd->size, mtd->erasesize, in mtd_speedtest_init()
216 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_speedtest_init()
222 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_speedtest_init()
226 get_random_bytes(iobuf, mtd->erasesize); in mtd_speedtest_init()
231 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
239 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
279 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
319 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
362 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
402 put_mtd_device(mtd); in mtd_speedtest_init()