Skip to contentSkip to conversation

nand read.jffs2 (nand_legacy) in common/cmd_nand.c

PATCH New Schlaegl Manfred jun. 3 participants 5 messages Jan 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nand read.jffs2 (nand_legacy) in common/cmd_nand.c

Hi!

Error with CONFIG_NAND_LEGACY in common/cmd_nand.c:
With current code "nand read.jffs2s" (read and skip bad blocks) is always interpreted as "nand read.jffs2" (read and fill bad blocks with 0xff). This is because ".jffs2" is tested before ".jffs2s" and only the first two characters are compared.

Correction:
Test for ".jffs2s" first and compare the first 7 characters.

common/cmd_nand.c +3 -4
index 0a366d3..ba1b27f 100644
@@ -854,13 +854,12 @@ int do_nand (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 							      (u_char *) addr);
 				}
 				return ret;
-			} else if (cmdtail && !strncmp (cmdtail, ".jffs2", 2))
-				cmd |= NANDRW_JFFS2;	/* skip bad blocks */
-			else if (cmdtail && !strncmp (cmdtail, ".jffs2s", 2)) {
+			} else if (cmdtail && !strncmp (cmdtail, ".jffs2s", 7)) {
 				cmd |= NANDRW_JFFS2;	/* skip bad blocks (on read too) */
 				if (cmd & NANDRW_READ)
 					cmd |= NANDRW_JFFS2_SKIP;	/* skip bad blocks (on read too) */
-			}
+			} else if (cmdtail && !strncmp (cmdtail, ".jffs2", 2))
+				cmd |= NANDRW_JFFS2;	/* skip bad blocks */
 #ifdef SXNI855T
 			/* need ".e" same as ".j" for compatibility with older units */
 			else if (cmdtail && !strcmp (cmdtail, ".e"))
#1 lore raw

PATCH 1/1 nand read.jffs2 (nand_legacy) in common/cmd_nand.c

Quoted 7 lines · Schlaegl Manfred jun.

Error with CONFIG_NAND_LEGACY in common/cmd_nand.c:
With current code "nand read.jffs2s" (read and skip bad blocks) is always interpreted as "nand read.jffs2" (read and fill bad blocks with 0xff). This is because ".jffs2" is tested before ".jffs2s" and only the first two characters are compared.

Correction:
Test for ".jffs2s" first and compare the first 7 characters.

I'll apply this, though I recommend switching to the non-legacy code (which always block-skips, BTW). I'd like to see the legacy code go away soon.

-Scott

#2 lore raw

PATCH 1/1 nand read.jffs2 (nand_legacy) in common/cmd_nand.c

Quoted 6 lines · Scott Wood
Quoted 5 lines · Schlaegl Manfred jun.

Error with CONFIG_NAND_LEGACY in common/cmd_nand.c:
With current code "nand read.jffs2s" (read and skip bad blocks) is always interpreted as "nand read.jffs2" (read and fill bad blocks with 0xff). This is because ".jffs2" is tested before ".jffs2s" and only the first two characters are compared.

Quoted 6 lines
Quoted 2 lines

Correction:
Test for ".jffs2s" first and compare the first 7 characters.

I'll apply this, though I recommend switching to the non-legacy code (which always block-skips, BTW). I'd like to see the legacy code go away soon.

And in the future, please add a Signed-off-by line.

-Scott

#3 lore raw

PATCH 1/1 nand read.jffs2 (nand_legacy) in common/cmd_nand.c

In reply to Scott Wood
Quoted 7 lines · Scott Wood
Quoted 6 lines · Schlaegl Manfred jun.

Error with CONFIG_NAND_LEGACY in common/cmd_nand.c:
With current code "nand read.jffs2s" (read and skip bad blocks) is always interpreted as "nand read.jffs2" (read and fill bad blocks with 0xff). This is because ".jffs2" is tested before ".jffs2s" and only the first two characters are compared.

Quoted 6 lines
Quoted 2 lines

Correction:
Test for ".jffs2s" first and compare the first 7 characters.

I'll apply this, though I recommend switching to the non-legacy code (which always block-skips, BTW). I'd like to see the legacy code go away soon.

Yes. How about setting a date for this removal? I suggest to remove it after the next two releases (after v2009-03/04).

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#4 lore raw

[U-Boot] Legacy NAND support to be removed after April 2009; please update your boards.

Quoted 7 lines · Stefan Roese
Quoted 3 lines · Scott Wood

I'll apply this, though I recommend switching to the non-legacy code (which always block-skips, BTW). I'd like to see the legacy code go away soon.

Yes. How about setting a date for this removal? I suggest to remove it after the next two releases (after v2009-03/04).

OK, feature removal schedule updated.

To anyone with an interest in a board that still uses legacy NAND, please try to get it converted over the next two merge windows.

-Scott