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()
169 k = (uint64_t)goodebcnt * (mtd->erasesize / 1024) * 1000; in calc_speed()
184 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_speedtest_init()
185 pr_crit("CAREFUL: This test wipes all data on the specified MTD device!\n"); in mtd_speedtest_init()
190 pr_info("MTD device: %d count: %d\n", dev, count); in mtd_speedtest_init()
192 pr_info("MTD device: %d\n", dev); in mtd_speedtest_init()
194 mtd = get_mtd_device(NULL, dev); in mtd_speedtest_init()
195 if (IS_ERR(mtd)) { in mtd_speedtest_init()
196 err = PTR_ERR(mtd); in mtd_speedtest_init()
197 pr_err("error: cannot get MTD device\n"); in mtd_speedtest_init()
201 if (mtd->writesize == 1) { in mtd_speedtest_init()
206 pgsize = mtd->writesize; in mtd_speedtest_init()
208 tmp = mtd->size; in mtd_speedtest_init()
209 do_div(tmp, mtd->erasesize); in mtd_speedtest_init()
211 pgcnt = mtd->erasesize / pgsize; in mtd_speedtest_init()
213 pr_info("MTD device size %llu, eraseblock size %u, " in mtd_speedtest_init()
216 (unsigned long long)mtd->size, mtd->erasesize, in mtd_speedtest_init()
217 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_speedtest_init()
223 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_speedtest_init()
227 prandom_bytes(iobuf, mtd->erasesize); in mtd_speedtest_init()
232 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
240 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
280 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
320 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
363 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_speedtest_init()
403 put_mtd_device(mtd); in mtd_speedtest_init()