[U-Boot] [U-Boot,v3,2/2] nand: extend nand torture

Scott Wood oss at buserror.net
Mon Jun 20 02:25:00 CEST 2016


On Mon, Jun 13, 2016 at 10:15:48AM +0200, Max Krummenacher wrote:
> nand torture currently works on exactly one nand block which is specified
> by giving the byteoffset to the beginning of the block.
> 
> Extend this by allowing for a second parameter specifying the byte size
> to be tested.
> 
> e.g.
> ==> nand torture 1000000
> 
> NAND torture: device 0 offset 0x1000000 size 0x20000 (block size 0x20000)
>  Passed: 1, failed: 0
> 
> ==> nand torture 1000000 40000
> 
> NAND torture: device 0 offset 0x1000000 size 0x40000 (block size 0x20000)
>  Passed: 2, failed: 0
> 
> Signed-off-by: Max Krummenacher <max.krummenacher at toradex.com>
> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev at gmail.com>
> ---

Applying with these changes:

diff --git a/cmd/nand.c b/cmd/nand.c
index 6d239a3..ffdeea4 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -659,11 +659,12 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 
 		size = mtd->erasesize;
-		if (argc > 3)
+		if (argc > 3) {
 			if (!str2off(argv[3], &size)) {
 				puts("Size is not a valid number\n");
 				return 1;
 			}
+		}
 
 		endoff = off + size;
 		if (endoff > mtd->size) {
@@ -803,7 +804,7 @@ static char nand_help_text[] =
 	"nand dump[.oob] off - dump page\n"
 #ifdef CONFIG_CMD_NAND_TORTURE
 	"nand torture off - torture one block at offset\n"
-	"nand torture off size - torture blocks from off to off+size\n"
+	"nand torture off [size] - torture blocks from off to off+size\n"
 #endif
 	"nand scrub [-y] off size | scrub.part partition | scrub.chip\n"
 	"    really clean NAND erasing bad blocks (UNSAFE)\n"

-Scott


More information about the U-Boot mailing list