diff options
Diffstat (limited to 'commands/nandtest.c')
-rw-r--r-- | commands/nandtest.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/commands/nandtest.c b/commands/nandtest.c index 112bb012a5..4a7db9cc74 100644 --- a/commands/nandtest.c +++ b/commands/nandtest.c @@ -1,15 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only + /* * Based on nandtest.c source in mtd-utils package. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #include <common.h> #include <command.h> @@ -177,8 +169,10 @@ static int erase_and_write(loff_t ofs, unsigned char *data, printf("\ncompare failed. seed %d\n", seed); for (i = 0; i < meminfo.erasesize; i++) { if (data[i] != rbuf[i]) - printf("Byte 0x%x is %02x should be %02x\n", - i, rbuf[i], data[i]); + printf("Block 0x%llx byte 0x%0x (page 0x%x offset 0x%x) is %02x should be %02x\n", + div64_ul(ofs, meminfo.erasesize), i, + i / meminfo.writesize, i % meminfo.writesize, + rbuf[i], data[i]); } return ret; } @@ -186,12 +180,14 @@ static int erase_and_write(loff_t ofs, unsigned char *data, } /* Print stats of nandtest. */ -static void print_stats(int nr_passes, int length) +static void print_stats(int nr_passes, loff_t length) { unsigned int i; + uint64_t blocks = (uint64_t)length; + + do_div(blocks, meminfo.erasesize); printf("-------- Summary --------\n"); - printf("Tested blocks : %d\n", (length/meminfo.erasesize) - * nr_passes); + printf("Tested blocks : %lld\n", blocks * nr_passes); for (i = 0; i < MAX_ECC_BITS; i++) printf("ECC %d bit error(s) : %u\n", i + 1, ecc_stats[i]); |