Lines Matching refs:mtd
28 static struct mtd_info *mtd; variable
43 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
45 prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize); in write_eraseblock()
47 return mtdtest_write(mtd, addr, mtd->erasesize, writebuf); in write_eraseblock()
55 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock()
59 addr0 += mtd->erasesize; in verify_eraseblock()
61 addrn = mtd->size; in verify_eraseblock()
63 addrn -= mtd->erasesize; in verify_eraseblock()
65 prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize); in verify_eraseblock()
68 err = mtdtest_read(mtd, addr0, bufsize, twopages); in verify_eraseblock()
71 err = mtdtest_read(mtd, addrn - bufsize, bufsize, twopages); in verify_eraseblock()
75 err = mtdtest_read(mtd, addr, bufsize, twopages); in verify_eraseblock()
89 err = mtdtest_read(mtd, addr0, bufsize, twopages); in verify_eraseblock()
92 err = mtdtest_read(mtd, addrn - bufsize, bufsize, twopages); in verify_eraseblock()
96 err = mtdtest_read(mtd, addr, bufsize, twopages); in verify_eraseblock()
99 memcpy(boundary, writebuf + mtd->erasesize - pgsize, pgsize); in verify_eraseblock()
127 addr0 += mtd->erasesize; in crosstest()
129 addrn = mtd->size; in crosstest()
131 addrn -= mtd->erasesize; in crosstest()
135 err = mtdtest_read(mtd, addr, pgsize, pp1); in crosstest()
143 err = mtdtest_read(mtd, addr, pgsize, pp1); in crosstest()
152 err = mtdtest_read(mtd, addr, pgsize, pp2); in crosstest()
161 err = mtdtest_read(mtd, addr, pgsize, pp3); in crosstest()
170 err = mtdtest_read(mtd, addr, pgsize, pp4); in crosstest()
199 addr0 += mtd->erasesize; in erasecrosstest()
208 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasecrosstest()
215 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasecrosstest()
221 err = mtdtest_read(mtd, addr0, pgsize, readbuf); in erasecrosstest()
233 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasecrosstest()
240 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasecrosstest()
245 err = mtdtest_erase_eraseblock(mtd, ebnum2); in erasecrosstest()
251 err = mtdtest_read(mtd, addr0, pgsize, readbuf); in erasecrosstest()
277 addr0 += mtd->erasesize; in erasetest()
282 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasetest()
288 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasetest()
293 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasetest()
298 err = mtdtest_read(mtd, addr0, pgsize, twopages); in erasetest()
336 mtd = get_mtd_device(NULL, dev); in mtd_pagetest_init()
337 if (IS_ERR(mtd)) { in mtd_pagetest_init()
338 err = PTR_ERR(mtd); in mtd_pagetest_init()
343 if (!mtd_type_is_nand(mtd)) { in mtd_pagetest_init()
348 tmp = mtd->size; in mtd_pagetest_init()
349 do_div(tmp, mtd->erasesize); in mtd_pagetest_init()
351 pgcnt = mtd->erasesize / mtd->writesize; in mtd_pagetest_init()
352 pgsize = mtd->writesize; in mtd_pagetest_init()
357 (unsigned long long)mtd->size, mtd->erasesize, in mtd_pagetest_init()
358 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_pagetest_init()
362 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_pagetest_init()
375 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_pagetest_init()
381 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_pagetest_init()
445 put_mtd_device(mtd); in mtd_pagetest_init()