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

Marek Vasut marek.vasut at gmail.com
Mon Sep 12 06:04:10 CEST 2011


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 at gmail.com>
Cc: Scott Wood <scottwood at freescale.com>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
Cc: Detlev Zundel <dzu at 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



More information about the U-Boot mailing list