[U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option

Marek Vasut
2011-09-12T04:04:10Z

This allows the scrub command to scrub without asking the user if he really
wants to scrub the area. Useful in scripts.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
---
common/cmd_nand.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 5b7e83d..6d66e5d 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -502,6 +502,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
int clean = argc > 2 && !strcmp("clean", argv[2]);
int o = clean ? 3 : 2;
int scrub = !strncmp(cmd, "scrub", 5);
+ int scrub_quiet;
int part = 0;
int chip = 0;
int spread = 0;
@@ -516,6 +517,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
} else if (!strcmp(&cmd[5], ".chip")) {
chip = 1;
args = 0;
+ } else if (!strncmp(cmd, "scrub.quiet", 11)) {
+ scrub_quiet = 1;
} else {
goto usage;
}
@@ -543,7 +546,9 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
opts.quiet = quiet;
opts.spread = spread;

- if (scrub) {
+ if (scrub && scrub_quiet) {
+ opts.scrub = 1;
+ } else if (scrub) {
puts("Warning: "
"scrub option will erase all factory set "
"bad blocks!\n"
@@ -569,6 +574,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return -1;
}
}
+
ret = nand_erase_opts(nand, &opts);
printf("%s\n", ret ? "ERROR" : "OK");

--
1.7.5.4