From patchwork Thu Sep 8 20:39:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 113951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 08DEDB6FD7 for ; Fri, 9 Sep 2011 06:44:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D96F22829B; Thu, 8 Sep 2011 22:40:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wBlXoPOcHA6S; Thu, 8 Sep 2011 22:40:26 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 796962829C; Thu, 8 Sep 2011 22:40:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 504E12823F for ; Thu, 8 Sep 2011 22:40:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hh5HuyE1hPWo for ; Thu, 8 Sep 2011 22:40:06 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by theia.denx.de (Postfix) with ESMTPS id 727D828260 for ; Thu, 8 Sep 2011 22:39:57 +0200 (CEST) Received: by mail-fx0-f44.google.com with SMTP id 6so1773864fxe.3 for ; Thu, 08 Sep 2011 13:39:57 -0700 (PDT) Received: by 10.223.48.211 with SMTP id s19mr1061572faf.33.1315514397273; Thu, 08 Sep 2011 13:39:57 -0700 (PDT) Received: from mashiro.kolej.mff.cuni.cz (vasut.kolej.mff.cuni.cz [78.128.198.52]) by mx.google.com with ESMTPS id c12sm1887020fad.14.2011.09.08.13.39.55 (version=SSLv3 cipher=OTHER); Thu, 08 Sep 2011 13:39:56 -0700 (PDT) From: Marek Vasut To: u-boot@lists.denx.de Date: Thu, 8 Sep 2011 22:39:40 +0200 Message-Id: <1315514380-19089-6-git-send-email-marek.vasut@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1315514380-19089-1-git-send-email-marek.vasut@gmail.com> References: <1315514380-19089-1-git-send-email-marek.vasut@gmail.com> Cc: Scott Wood Subject: [U-Boot] [PATCH 5/5] NAND: Add scrub.quiet command option X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Scott Wood Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- 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");