Lines Matching refs:mtd
36 static struct mtd_info *mtd; variable
73 loff_t addr = ebnum * mtd->erasesize; in erase_eraseblock()
76 ei.mtd = mtd; in erase_eraseblock()
78 ei.len = mtd->erasesize; in erase_eraseblock()
80 err = mtd->erase(mtd, &ei); in erase_eraseblock()
129 loff_t addr = ebnum * mtd->erasesize; in write_eraseblock()
131 for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { in write_eraseblock()
141 err = mtd->write_oob(mtd, addr, &ops); in write_eraseblock()
182 loff_t addr = ebnum * mtd->erasesize; in verify_eraseblock()
184 for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { in verify_eraseblock()
194 err = mtd->read_oob(mtd, addr, &ops); in verify_eraseblock()
210 if (use_offset != 0 || use_len < mtd->ecclayout->oobavail) { in verify_eraseblock()
216 ops.ooblen = mtd->ecclayout->oobavail; in verify_eraseblock()
221 err = mtd->read_oob(mtd, addr, &ops); in verify_eraseblock()
222 if (err || ops.oobretlen != mtd->ecclayout->oobavail) { in verify_eraseblock()
251 k < mtd->ecclayout->oobavail; ++k) in verify_eraseblock()
274 loff_t addr = ebnum * mtd->erasesize; in verify_eraseblock_in_one_go()
275 size_t len = mtd->ecclayout->oobavail * pgcnt; in verify_eraseblock_in_one_go()
286 err = mtd->read_oob(mtd, addr, &ops); in verify_eraseblock_in_one_go()
329 loff_t addr = ebnum * mtd->erasesize; in is_block_bad()
331 ret = mtd->block_isbad(mtd, addr); in is_block_bad()
371 mtd = get_mtd_device(NULL, dev); in mtd_oobtest_init()
372 if (IS_ERR(mtd)) { in mtd_oobtest_init()
373 err = PTR_ERR(mtd); in mtd_oobtest_init()
378 if (mtd->type != MTD_NANDFLASH) { in mtd_oobtest_init()
383 tmp = mtd->size; in mtd_oobtest_init()
384 do_div(tmp, mtd->erasesize); in mtd_oobtest_init()
386 pgcnt = mtd->erasesize / mtd->writesize; in mtd_oobtest_init()
391 (unsigned long long)mtd->size, mtd->erasesize, in mtd_oobtest_init()
392 mtd->writesize, ebcnt, pgcnt, mtd->oobsize); in mtd_oobtest_init()
395 mtd->erasesize = mtd->erasesize; in mtd_oobtest_init()
396 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_oobtest_init()
401 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_oobtest_init()
412 use_len = mtd->ecclayout->oobavail; in mtd_oobtest_init()
413 use_len_max = mtd->ecclayout->oobavail; in mtd_oobtest_init()
475 use_len = mtd->ecclayout->oobavail; in mtd_oobtest_init()
476 use_len_max = mtd->ecclayout->oobavail; in mtd_oobtest_init()
494 use_len = mtd->ecclayout->oobavail; in mtd_oobtest_init()
495 use_len_max = mtd->ecclayout->oobavail; in mtd_oobtest_init()
503 use_len = mtd->ecclayout->oobavail; in mtd_oobtest_init()
504 use_len_max = mtd->ecclayout->oobavail; in mtd_oobtest_init()
516 addr0 += mtd->erasesize; in mtd_oobtest_init()
524 ops.ooboffs = mtd->ecclayout->oobavail; in mtd_oobtest_init()
529 err = mtd->write_oob(mtd, addr0, &ops); in mtd_oobtest_init()
544 ops.ooboffs = mtd->ecclayout->oobavail; in mtd_oobtest_init()
549 err = mtd->read_oob(mtd, addr0, &ops); in mtd_oobtest_init()
566 ops.ooblen = mtd->ecclayout->oobavail + 1; in mtd_oobtest_init()
573 err = mtd->write_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
586 ops.ooblen = mtd->ecclayout->oobavail + 1; in mtd_oobtest_init()
593 err = mtd->read_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
610 ops.ooblen = mtd->ecclayout->oobavail; in mtd_oobtest_init()
617 err = mtd->write_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
630 ops.ooblen = mtd->ecclayout->oobavail; in mtd_oobtest_init()
637 err = mtd->read_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
661 size_t sz = mtd->ecclayout->oobavail; in mtd_oobtest_init()
664 addr = (i + 1) * mtd->erasesize - mtd->writesize; in mtd_oobtest_init()
675 err = mtd->write_oob(mtd, addr, &ops); in mtd_oobtest_init()
682 addr += mtd->writesize; in mtd_oobtest_init()
693 set_random_data(writebuf, mtd->ecclayout->oobavail * 2); in mtd_oobtest_init()
694 addr = (i + 1) * mtd->erasesize - mtd->writesize; in mtd_oobtest_init()
698 ops.ooblen = mtd->ecclayout->oobavail * 2; in mtd_oobtest_init()
703 err = mtd->read_oob(mtd, addr, &ops); in mtd_oobtest_init()
706 if (memcmp(readbuf, writebuf, mtd->ecclayout->oobavail * 2)) { in mtd_oobtest_init()
726 put_mtd_device(mtd); in mtd_oobtest_init()