diff options
| author | Benoît Thébaudeau <benoit.thebaudeau@advansee.com> | 2012-11-16 20:20:54 +0100 | 
|---|---|---|
| committer | Scott Wood <scottwood@freescale.com> | 2012-11-26 15:41:29 -0600 | 
| commit | 3287f6d3858faee768a7c47515bd21914ad591a2 (patch) | |
| tree | 389079aae420c3b0b05a64b7c7dc2fb557334744 /common/cmd_nand.c | |
| parent | 8156f732ee49fc4d91aef1ce09fb6679b3a23c0c (diff) | |
| download | olio-uboot-2014.01-3287f6d3858faee768a7c47515bd21914ad591a2.tar.xz olio-uboot-2014.01-3287f6d3858faee768a7c47515bd21914ad591a2.zip | |
nand: Add torture feature
This patch adds a NAND Flash torture feature, which is useful as a block stress
test to determine if a block is still good and reliable (or should be marked as
bad), e.g. after a write error.
This code is ported from mtd-utils' lib/libmtd.c.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Scott Wood <scottwood@freescale.com>
[scottwood@freescale.com: removed unnec. ifdef and unwrapped error strings]
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common/cmd_nand.c')
| -rw-r--r-- | common/cmd_nand.c | 22 | 
1 files changed, 22 insertions, 0 deletions
| diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 4b1606972..1568594ca 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -700,6 +700,25 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  		return ret == 0 ? 0 : 1;  	} +#ifdef CONFIG_CMD_NAND_TORTURE +	if (strcmp(cmd, "torture") == 0) { +		if (argc < 3) +			goto usage; + +		if (!str2off(argv[2], &off)) { +			puts("Offset is not a valid number\n"); +			return 1; +		} + +		printf("\nNAND torture: device %d offset 0x%llx size 0x%x\n", +			dev, off, nand->erasesize); +		ret = nand_torture(nand, off); +		printf(" %s\n", ret ? "Failed" : "Passed"); + +		return ret == 0 ? 0 : 1; +	} +#endif +  	if (strcmp(cmd, "markbad") == 0) {  		argc -= 2;  		argv += 2; @@ -810,6 +829,9 @@ static char nand_help_text[] =  	"nand erase.chip [clean] - erase entire chip'\n"  	"nand bad - show bad blocks\n"  	"nand dump[.oob] off - dump page\n" +#ifdef CONFIG_CMD_NAND_TORTURE +	"nand torture off - torture block at offset\n" +#endif  	"nand scrub [-y] off size | scrub.part partition | scrub.chip\n"  	"    really clean NAND erasing bad blocks (UNSAFE)\n"  	"nand markbad off [...] - mark bad block(s) at offset (UNSAFE)\n" |