Lines Matching refs:mtd
40 static struct mtd_info *mtd; variable
55 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
57 prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize); in write_eraseblock()
59 return mtdtest_write(mtd, addr, mtd->erasesize, writebuf); in write_eraseblock()
67 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock()
71 addr0 += mtd->erasesize; in verify_eraseblock()
73 addrn = mtd->size; in verify_eraseblock()
75 addrn -= mtd->erasesize; in verify_eraseblock()
77 prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize); in verify_eraseblock()
80 err = mtdtest_read(mtd, addr0, bufsize, twopages); in verify_eraseblock()
83 err = mtdtest_read(mtd, addrn - bufsize, bufsize, twopages); in verify_eraseblock()
87 err = mtdtest_read(mtd, addr, bufsize, twopages); in verify_eraseblock()
101 err = mtdtest_read(mtd, addr0, bufsize, twopages); in verify_eraseblock()
104 err = mtdtest_read(mtd, addrn - bufsize, bufsize, twopages); in verify_eraseblock()
108 err = mtdtest_read(mtd, addr, bufsize, twopages); in verify_eraseblock()
111 memcpy(boundary, writebuf + mtd->erasesize - pgsize, pgsize); in verify_eraseblock()
139 addr0 += mtd->erasesize; in crosstest()
141 addrn = mtd->size; in crosstest()
143 addrn -= mtd->erasesize; in crosstest()
147 err = mtdtest_read(mtd, addr, pgsize, pp1); in crosstest()
155 err = mtdtest_read(mtd, addr, pgsize, pp1); in crosstest()
164 err = mtdtest_read(mtd, addr, pgsize, pp2); in crosstest()
173 err = mtdtest_read(mtd, addr, pgsize, pp3); in crosstest()
182 err = mtdtest_read(mtd, addr, pgsize, pp4); in crosstest()
211 addr0 += mtd->erasesize; in erasecrosstest()
220 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasecrosstest()
227 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasecrosstest()
233 err = mtdtest_read(mtd, addr0, pgsize, readbuf); in erasecrosstest()
245 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasecrosstest()
252 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasecrosstest()
257 err = mtdtest_erase_eraseblock(mtd, ebnum2); in erasecrosstest()
263 err = mtdtest_read(mtd, addr0, pgsize, readbuf); in erasecrosstest()
289 addr0 += mtd->erasesize; in erasetest()
294 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasetest()
300 err = mtdtest_write(mtd, addr0, pgsize, writebuf); in erasetest()
305 err = mtdtest_erase_eraseblock(mtd, ebnum); in erasetest()
310 err = mtdtest_read(mtd, addr0, pgsize, twopages); in erasetest()
348 mtd = get_mtd_device(NULL, dev); in mtd_pagetest_init()
349 if (IS_ERR(mtd)) { in mtd_pagetest_init()
350 err = PTR_ERR(mtd); in mtd_pagetest_init()
355 if (!mtd_type_is_nand(mtd)) { in mtd_pagetest_init()
360 tmp = mtd->size; in mtd_pagetest_init()
361 do_div(tmp, mtd->erasesize); in mtd_pagetest_init()
363 pgcnt = mtd->erasesize / mtd->writesize; in mtd_pagetest_init()
364 pgsize = mtd->writesize; in mtd_pagetest_init()
369 (unsigned long long)mtd->size, mtd->erasesize, in mtd_pagetest_init()
370 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_pagetest_init()
374 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_pagetest_init()
387 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_pagetest_init()
393 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_pagetest_init()
453 put_mtd_device(mtd); in mtd_pagetest_init()