summaryrefslogtreecommitdiff
path: root/common/cmd_onenand.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-07-08 21:51:17 +0200
committerWolfgang Denk <wd@denx.de>2009-07-08 21:51:17 +0200
commit23bca26ab0d09c043bfcada881e423a28cb6b574 (patch)
tree265c1f385a0b452518ae555d2aab64173e7d2129 /common/cmd_onenand.c
parentefbf14e9a2394a154b12643d4a011994b5096b5a (diff)
parent2e8a6f551cba550e9220dca4d8504066203b1f74 (diff)
downloadu-boot-imx-23bca26ab0d09c043bfcada881e423a28cb6b574.zip
u-boot-imx-23bca26ab0d09c043bfcada881e423a28cb6b574.tar.gz
u-boot-imx-23bca26ab0d09c043bfcada881e423a28cb6b574.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/custodians
Diffstat (limited to 'common/cmd_onenand.c')
-rw-r--r--common/cmd_onenand.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 85bd2cb..9090940 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -340,7 +340,7 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
int blocksize;
ulong addr, ofs;
size_t len, retlen = 0;
- int ret;
+ int ret = 0;
char *cmd, *s;
mtd = &onenand_mtd;
@@ -434,18 +434,29 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
if (strcmp(cmd, "markbad") == 0) {
- addr = (ulong)simple_strtoul(argv[2], NULL, 16);
+ argc -= 2;
+ argv += 2;
- int ret = mtd->block_markbad(mtd, addr);
- if (ret == 0) {
- printf("block 0x%08lx successfully marked as bad\n",
- (ulong) addr);
- return 0;
- } else {
- printf("block 0x%08lx NOT marked as bad! ERROR %d\n",
- (ulong) addr, ret);
+ if (argc <= 0)
+ goto usage;
+
+ while (argc > 0) {
+ addr = simple_strtoul(*argv, NULL, 16);
+
+ if (mtd->block_markbad(mtd, addr)) {
+ printf("block 0x%08lx NOT marked "
+ "as bad! ERROR %d\n",
+ addr, ret);
+ ret = 1;
+ } else {
+ printf("block 0x%08lx successfully "
+ "marked as bad\n",
+ addr);
+ }
+ --argc;
+ ++argv;
}
- return 1;
+ return ret;
}
if (strncmp(cmd, "dump", 4) == 0) {
@@ -474,7 +485,7 @@ usage:
}
U_BOOT_CMD(
- onenand, 6, 1, do_onenand,
+ onenand, CONFIG_SYS_MAXARGS, 1, do_onenand,
"OneNAND sub-system",
"info - show available OneNAND devices\n"
"onenand bad - show bad blocks\n"