All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
Date: Fri, 24 Mar 2006 02:23:27 +0100	[thread overview]
Message-ID: <20060324012327.GA14685@orphique> (raw)
In-Reply-To: <20060324005535.BEA42353B50@atlas.denx.de>

On Fri, Mar 24, 2006 at 01:55:35AM +0100, Wolfgang Denk wrote:
> Meaning - the comment is IMHO necessary. Thanks.

I hope it makes enough sense...

Best regards,
	ladis

Signed-off-by Ladislav Michl <ladis@linux-mips.org>

CHANGELOG
* Implement NAND OOB erase command
  Patch by Ladislav Michl, 24 Mar 2006

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 21adb1b..d443086 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -197,14 +197,23 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
 		return 0;
 	}
 
+	/*
+	 * Syntax is:
+	 *    0    1     2       3    4
+	 *   nand erase [clean] [off size]
+	 */
 	if (strcmp(cmd, "erase") == 0) {
-		arg_off_size(argc - 2, argv + 2, &off, &size, nand->size);
+		/* "clean" at index 2 means request to erase OOB */
+		int clean = (argc > 2 && strcmp(argv[2], "clean") == 0) ? 1 : 0;
+		int o = clean ? 3 : 2;
+		/* skip first two or three arguments, look for offset and size */
+		arg_off_size(argc - o, argv + o, &off, &size, nand->size);
 		if (off == 0 && size == 0)
-			return 1;
+			size = nand->size;
 
 		printf("\nNAND erase: device %d offset 0x%x, size 0x%x ",
 		       nand_curr_device, off, size);
-		ret = nand_erase(nand, off, size);
+		ret = nand_erase(nand, off, size, clean);
 		printf("%s\n", ret ? "ERROR" : "OK");
 
 		return ret == 0 ? 0 : 1;
@@ -275,7 +284,6 @@ U_BOOT_CMD(nand, 5, 1, do_nand,
 	"    offset `off' (entire device if not specified)\n"
 	"nand bad - show bad blocks\n"
 	"nand dump[.oob] off - dump page\n"
-	"nand scrub - really clean NAND erasing bad blocks (UNSAFE)\n"
 	"nand markbad off - mark bad block at offset (UNSAFE)\n"
 	"nand biterr off - make a bit error at offset (UNSAFE)\n");
 
diff --git a/common/env_nand.c b/common/env_nand.c
index dd27f7b..97371e9 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -116,7 +116,7 @@ int saveenv(void)
 	int ret = 0;
 
 	puts ("Erasing Nand...");
-	if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))
+	if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE, 0))
 		return 1;
 
 	puts ("Writing to Nand... ");
diff --git a/include/nand.h b/include/nand.h
index 905115b..ccac9c1 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -48,7 +48,7 @@ static inline int nand_block_isbad(nand_
 	return info->block_isbad(info, ofs);
 }
 
-static inline int nand_erase(nand_info_t *info, ulong off, ulong size)
+static inline int nand_erase(nand_info_t *info, ulong off, ulong size, int clean)
 {
 	struct erase_info instr;
 
@@ -57,7 +57,7 @@ static inline int nand_erase(nand_info_t
 	instr.len = size;
 	instr.callback = 0;
 
-	return info->erase(info, &instr);
+	return nand_erase_nand(info, &instr, clean);
 }
 
 #endif

      reply	other threads:[~2006-03-24  1:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-28  9:21 [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash Wolfgang Denk
2006-02-28 10:05 ` Pantelis Antoniou
2006-03-17 18:50   ` Ladislav Michl
2006-03-17 21:14     ` Wolfgang Denk
2006-03-24  0:43       ` Ladislav Michl
2006-03-24  0:55         ` Wolfgang Denk
2006-03-24  1:23           ` Ladislav Michl [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=20060324012327.GA14685@orphique \
    --to=ladis@linux-mips.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.