Lines Matching +full:ext +full:- +full:32 +full:k
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006-2007 Nokia Corporation
5 * Test sub-page read and write on MTD device.
6 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
22 static int dev = -EINVAL;
47 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
58 return err ? err : -1; in write_eraseblock()
72 return err ? err : -1; in write_eraseblock()
81 int err = 0, k; in write_eraseblock2() local
82 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock2()
84 for (k = 1; k < 33; ++k) { in write_eraseblock2()
85 if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) in write_eraseblock2()
87 prandom_bytes_state(&rnd_state, writebuf, subpgsize * k); in write_eraseblock2()
88 err = mtd_write(mtd, addr, subpgsize * k, &written, writebuf); in write_eraseblock2()
89 if (unlikely(err || written != subpgsize * k)) { in write_eraseblock2()
92 if (written != subpgsize * k) { in write_eraseblock2()
94 subpgsize * k); in write_eraseblock2()
98 return err ? err : -1; in write_eraseblock2()
100 addr += subpgsize * k; in write_eraseblock2()
111 for (j = 0; i < subpgsize && j < 32; ++i, ++j) in print_subpage()
121 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock()
134 return err ? err : -1; in verify_eraseblock()
140 pr_info("------------- written----------------\n"); in verify_eraseblock()
142 pr_info("------------- read ------------------\n"); in verify_eraseblock()
144 pr_info("-------------------------------------\n"); in verify_eraseblock()
161 return err ? err : -1; in verify_eraseblock()
167 pr_info("------------- written----------------\n"); in verify_eraseblock()
169 pr_info("------------- read ------------------\n"); in verify_eraseblock()
171 pr_info("-------------------------------------\n"); in verify_eraseblock()
181 int err = 0, k; in verify_eraseblock2() local
182 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock2()
184 for (k = 1; k < 33; ++k) { in verify_eraseblock2()
185 if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) in verify_eraseblock2()
187 prandom_bytes_state(&rnd_state, writebuf, subpgsize * k); in verify_eraseblock2()
188 clear_data(readbuf, subpgsize * k); in verify_eraseblock2()
189 err = mtd_read(mtd, addr, subpgsize * k, &read, readbuf); in verify_eraseblock2()
190 if (unlikely(err || read != subpgsize * k)) { in verify_eraseblock2()
191 if (mtd_is_bitflip(err) && read == subpgsize * k) { in verify_eraseblock2()
198 return err ? err : -1; in verify_eraseblock2()
201 if (unlikely(memcmp(readbuf, writebuf, subpgsize * k))) { in verify_eraseblock2()
206 addr += subpgsize * k; in verify_eraseblock2()
217 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock_ff()
220 for (j = 0; j < mtd->erasesize / subpgsize; ++j) { in verify_eraseblock_ff()
231 return err ? err : -1; in verify_eraseblock_ff()
278 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_subpagetest_init()
280 return -EINVAL; in mtd_subpagetest_init()
297 subpgsize = mtd->writesize >> mtd->subpage_sft; in mtd_subpagetest_init()
298 tmp = mtd->size; in mtd_subpagetest_init()
299 do_div(tmp, mtd->erasesize); in mtd_subpagetest_init()
301 pgcnt = mtd->erasesize / mtd->writesize; in mtd_subpagetest_init()
306 (unsigned long long)mtd->size, mtd->erasesize, in mtd_subpagetest_init()
307 mtd->writesize, subpgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_subpagetest_init()
309 err = -ENOMEM; in mtd_subpagetest_init()
310 bufsize = subpgsize * 32; in mtd_subpagetest_init()