public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] NAND: Add scrub.quiet command option
Date: Sat, 27 Aug 2011 05:09:40 +0200	[thread overview]
Message-ID: <1314414580-14552-2-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1314414580-14552-1-git-send-email-marek.vasut@gmail.com>

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>
---
 common/cmd_nand.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 5b7e83d..45179e9 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -502,11 +502,19 @@ 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 = !strncmp(cmd, "scrub.quiet", 11);
 		int part = 0;
 		int chip = 0;
 		int spread = 0;
 		int args = 2;
 
+		/*
+		 * Quiet scrub is a special option only for the scrub command,
+		 * ignore it in the following construction.
+		 */
+		if (scrub_quiet)
+			cmd[5] = 0;
+
 		if (cmd[5] != 0) {
 			if (!strcmp(&cmd[5], ".spread")) {
 				spread = 1;
@@ -543,7 +551,7 @@ 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) {
 			puts("Warning: "
 			     "scrub option will erase all factory set "
 			     "bad blocks!\n"
@@ -569,6 +577,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 				return -1;
 			}
 		}
+
+		if (scrub_quiet)
+			opts.scrub = 1;
+
 		ret = nand_erase_opts(nand, &opts);
 		printf("%s\n", ret ? "ERROR" : "OK");
 
-- 
1.7.5.4

      reply	other threads:[~2011-08-27  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-27  3:09 [U-Boot] [PATCH 1/2] NAND: Make page, erase, oob size available via cmd_nand Marek Vasut
2011-08-27  3:09 ` Marek Vasut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314414580-14552-2-git-send-email-marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox