From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] NAND: Add -y option to nand scrub command
Date: Wed, 14 Sep 2011 00:20:35 +0200 [thread overview]
Message-ID: <1315952435-4152-1-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1315800250-19761-6-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>
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 | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 5b7e83d..c2a5623 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -500,12 +500,23 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
nand_erase_options_t opts;
/* "clean" at index 2 means request to write cleanmarker */
int clean = argc > 2 && !strcmp("clean", argv[2]);
- int o = clean ? 3 : 2;
+ int scrub_yes = argc > 2 && !strcmp("-y", argv[2]);
+ int o = (clean || scrub_yes) ? 3 : 2;
int scrub = !strncmp(cmd, "scrub", 5);
int part = 0;
int chip = 0;
int spread = 0;
int args = 2;
+ const char *scrub_warn =
+ "Warning: "
+ "scrub option will erase all factory set bad blocks!\n"
+ " "
+ "There is no reliable way to recover them.\n"
+ " "
+ "Use this command only for testing purposes if you\n"
+ " "
+ "are sure of what you are doing!\n"
+ "\nReally scrub this NAND flash? <y/N>\n";
if (cmd[5] != 0) {
if (!strcmp(&cmd[5], ".spread")) {
@@ -544,19 +555,12 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
opts.spread = spread;
if (scrub) {
- puts("Warning: "
- "scrub option will erase all factory set "
- "bad blocks!\n"
- " "
- "There is no reliable way to recover them.\n"
- " "
- "Use this command only for testing purposes "
- "if you\n"
- " "
- "are sure of what you are doing!\n"
- "\nReally scrub this NAND flash? <y/N>\n");
-
- if (getc() == 'y') {
+ if (!scrub_yes)
+ puts(scrub_warn);
+
+ if (scrub_yes)
+ opts.scrub = 1;
+ else if (getc() == 'y') {
puts("y");
if (getc() == '\r')
opts.scrub = 1;
@@ -768,7 +772,7 @@ U_BOOT_CMD(
"nand erase.chip [clean] - erase entire chip'\n"
"nand bad - show bad blocks\n"
"nand dump[.oob] off - dump page\n"
- "nand scrub off size | scrub.part partition | scrub.chip\n"
+ "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"
"nand biterr off - make a bit error at offset (UNSAFE)"
--
1.7.5.4
next prev parent reply other threads:[~2011-09-13 22:20 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-12 4:04 [U-Boot] [PATCH 0/5 V2] Random NAND fixes and improvements Marek Vasut
2011-09-12 4:04 ` [U-Boot] [PATCH 1/5] NAND: Really ignore bad blocks when scrubbing Marek Vasut
2011-09-27 18:54 ` Scott Wood
2011-09-12 4:04 ` [U-Boot] [PATCH 2/5] NAND: Add nand read.raw and write.raw commands Marek Vasut
2011-09-21 18:48 ` Scott Wood
2011-09-22 1:55 ` [U-Boot] [PATCH 2/5 V2] " Marek Vasut
2011-09-22 16:03 ` Scott Wood
2011-09-22 18:36 ` [U-Boot] [PATCH 2/5 V3] " Marek Vasut
2011-09-22 18:40 ` Scott Wood
2011-09-23 13:43 ` [U-Boot] [PATCH 2/5 V4] " Marek Vasut
2011-09-27 18:57 ` Scott Wood
2011-09-12 4:04 ` [U-Boot] [PATCH 3/5] NAND: Allow per-buffer allocation Marek Vasut
2011-09-21 18:50 ` Scott Wood
2011-09-21 19:49 ` Wolfgang Denk
2011-09-21 19:55 ` Scott Wood
2011-09-21 20:16 ` Wolfgang Denk
2011-09-22 1:34 ` Marek Vasut
2011-09-22 7:41 ` Stefano Babic
2011-09-22 8:51 ` Marek Vasut
2011-09-23 17:35 ` Scott Wood
2011-09-24 12:37 ` Marek Vasut
2011-09-26 18:33 ` Scott Wood
2011-09-26 18:49 ` Marek Vasut
2011-09-12 4:04 ` [U-Boot] [PATCH 4/5] NAND: Make page, erase, oob size available via cmd_nand Marek Vasut
2011-09-21 18:55 ` Scott Wood
2011-09-21 19:52 ` Wolfgang Denk
2011-09-22 1:57 ` [U-Boot] [PATCH 4/5 V2] " Marek Vasut
2011-09-27 19:01 ` Scott Wood
2011-09-27 19:38 ` Marek Vasut
2011-09-27 19:51 ` Scott Wood
2011-09-27 20:07 ` Marek Vasut
2011-09-27 20:53 ` Scott Wood
2011-09-27 21:04 ` Marek Vasut
2011-09-27 21:14 ` Scott Wood
2011-09-12 4:04 ` [U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option Marek Vasut
2011-09-12 16:45 ` Mike Frysinger
2011-09-12 17:45 ` Marek Vasut
2011-09-12 18:06 ` Scott Wood
2011-09-12 18:24 ` Marek Vasut
2011-09-12 18:31 ` Scott Wood
2011-09-12 18:36 ` Marek Vasut
2011-09-12 19:19 ` Scott Wood
2011-09-12 19:28 ` Marek Vasut
2011-09-12 19:36 ` Scott Wood
2011-09-12 19:42 ` Marek Vasut
2011-09-12 23:24 ` Scott Wood
2011-09-13 1:02 ` Marek Vasut
2011-09-13 4:25 ` Wolfgang Denk
2011-09-13 4:36 ` Marek Vasut
2011-09-13 22:22 ` Scott Wood
2011-09-13 22:41 ` Marek Vasut
2011-09-13 22:53 ` Scott Wood
2011-09-12 18:37 ` Wolfgang Denk
2011-09-12 18:50 ` Marek Vasut
2011-09-12 20:33 ` Mike Frysinger
2011-09-12 22:59 ` Marek Vasut
2011-09-13 22:20 ` Marek Vasut [this message]
2011-09-13 22:28 ` [U-Boot] [PATCH 5/5] NAND: Add -y option to nand scrub command Mike Frysinger
2011-09-27 19:03 ` Scott Wood
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=1315952435-4152-1-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