public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
@ 2006-02-28  9:21 Wolfgang Denk
  2006-02-28 10:05 ` Pantelis Antoniou
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2006-02-28  9:21 UTC (permalink / raw)
  To: u-boot

Hello,

this is a "heads up" note to all  maintainers  of  boards  with  NAND
flash: 

I am going to drop support for the old NAND flash code and replace it
by Ladislav Michl's rewrite, which is available in the "testing-NAND"
branch of our git repository.

This new code has been available for testing for 6 months, and I have
not received any negative feedback (I did not  receive  any  positive
feedback,  either  - but if you did not care until now you should not
complain later).


Dropping the support for the old code means that the  build  for  all
boards  that use NAND currently will *break*. I am aware that this is
not a nice thing to do, but I see no other way to get  the  attention
of  the  board maintainers and force them to update their code to the
new way for their boards. This should be not be  very  hard,  though.
Since  the  new  implementation  is  borrowed from Linux, it is quite
likely that the said boards could use the new  NAND  support  already
present for them in the Linux source.


We will now merge the "testing-NAND" branch back into the main  tree;
once  this  is done, I will allow for a transition period of 4 weeks.
After this, the old code will be removed, even if it  breaks  support
for some boards.


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
 The software required `Windows 95 or better', so I installed Linux.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Pantelis Antoniou @ 2006-02-28 10:05 UTC (permalink / raw)
  To: u-boot

On Tuesday 28 February 2006 11:21, Wolfgang Denk wrote:
> 
> Hello,
> 
> this is a "heads up" note to all  maintainers  of  boards  with  NAND
> flash: 
> 
> I am going to drop support for the old NAND flash code and replace it
> by Ladislav Michl's rewrite, which is available in the "testing-NAND"
> branch of our git repository.
> 
> This new code has been available for testing for 6 months, and I have
> not received any negative feedback (I did not  receive  any  positive
> feedback,  either  - but if you did not care until now you should not
> complain later).
> 
> 
> Dropping the support for the old code means that the  build  for  all
> boards  that use NAND currently will *break*. I am aware that this is
> not a nice thing to do, but I see no other way to get  the  attention
> of  the  board maintainers and force them to update their code to the
> new way for their boards. This should be not be  very  hard,  though.
> Since  the  new  implementation  is  borrowed from Linux, it is quite
> likely that the said boards could use the new  NAND  support  already
> present for them in the Linux source.
> 
> 
> We will now merge the "testing-NAND" branch back into the main  tree;
> once  this  is done, I will allow for a transition period of 4 weeks.
> After this, the old code will be removed, even if it  breaks  support
> for some boards.
> 
> 

I did test it, it works.

A few things are missing but most are doable.


> Best regards,
> 
> Wolfgang Denk
> 

Regards

Pantelis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  2006-02-28 10:05 ` Pantelis Antoniou
@ 2006-03-17 18:50   ` Ladislav Michl
  2006-03-17 21:14     ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Ladislav Michl @ 2006-03-17 18:50 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 28, 2006 at 12:05:32PM +0200, Pantelis Antoniou wrote:

Hi Wolfgang & Pantelis,

> A few things are missing but most are doable.

Here is one of those 'few' things - erasing OOB area...

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

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

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 21adb1b..bf4173f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -198,13 +198,15 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
 	}
 
 	if (strcmp(cmd, "erase") == 0) {
-		arg_off_size(argc - 2, argv + 2, &off, &size, nand->size);
+		int clean = (argc > 2 && strcmp(argv[2], "clean") == 0) ? 1 : 0;
+		int o = clean ? 3 : 2;
+		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 +277,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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  2006-03-17 18:50   ` Ladislav Michl
@ 2006-03-17 21:14     ` Wolfgang Denk
  2006-03-24  0:43       ` Ladislav Michl
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2006-03-17 21:14 UTC (permalink / raw)
  To: u-boot

Dear Ladislav,

in message <20060317185016.GA10588@orphique> you wrote:
> 
> Here is one of those 'few' things - erasing OOB area...

Thanks a lot, but...

> +		int clean = (argc > 2 && strcmp(argv[2], "clean") == 0) ? 1 : 0;
> +		int o = clean ? 3 : 2;
> +		arg_off_size(argc - o, argv + o, &off, &size, nand->size);

Can you please re-implement this in a bit a less cryptic way? I  will
not  complain  if  it takes 6 lines instead of 3. LoC are cheap these
days ;-)

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
That's their goal, remember, a goal that's really contrary to that of
the programmer or administrator. We just want to get our  jobs  done.
$Bill  just  wants  to  become  $$Bill. These aren't even marginallly
congruent.
         -- Tom Christiansen in <6jhtqk$qls$1@csnews.cs.colorado.edu>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  2006-03-17 21:14     ` Wolfgang Denk
@ 2006-03-24  0:43       ` Ladislav Michl
  2006-03-24  0:55         ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Ladislav Michl @ 2006-03-24  0:43 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 17, 2006 at 10:14:12PM +0100, Wolfgang Denk wrote:
> > +		int clean = (argc > 2 && strcmp(argv[2], "clean") == 0) ? 1 : 0;
> > +		int o = clean ? 3 : 2;
> > +		arg_off_size(argc - o, argv + o, &off, &size, nand->size);
> 
> Can you please re-implement this in a bit a less cryptic way? I  will
> not  complain  if  it takes 6 lines instead of 3. LoC are cheap these
> days ;-)

Syntax is:
	0	1	2	3	4
	nand	erase 	[clean] [off 	size]

So we just look if there are more that two arguments and argument at
index 2 is "clean". In that case we want also erase OOB. Then we just
skip first 2 or 3 argumets while looking for offset and size. Shall
I try harder to reimplement it or is additional comment okay? ;-)

Best regards,
	ladis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  2006-03-24  0:43       ` Ladislav Michl
@ 2006-03-24  0:55         ` Wolfgang Denk
  2006-03-24  1:23           ` Ladislav Michl
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2006-03-24  0:55 UTC (permalink / raw)
  To: u-boot

In message <20060324004338.GA14228@orphique> you wrote:
>
> Syntax is:
> 	0	1	2	3	4
> 	nand	erase 	[clean] [off 	size]
> 
> So we just look if there are more that two arguments and argument at
> index 2 is "clean". In that case we want also erase OOB. Then we just
> skip first 2 or 3 argumets while looking for offset and size. Shall
> I try harder to reimplement it or is additional comment okay? ;-)

Yes :-)


Meaning - the comment is IMHO necessary. Thanks.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The last thing one knows in constructing a work is what to put first.
- Blaise Pascal

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] IMPORTANT NOTE to all maintainers with NAND flash
  2006-03-24  0:55         ` Wolfgang Denk
@ 2006-03-24  1:23           ` Ladislav Michl
  0 siblings, 0 replies; 7+ messages in thread
From: Ladislav Michl @ 2006-03-24  1:23 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-24  1:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox