[U-Boot-Users] [patch #8/11] Trivial new NAND flash functionality

Hello
The following patch adds a new mode for reading from a NAND device.
The option is named .jffs2s, and on read it just skips over bad blocks.
Regards
Pantelis
cmd_nand.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletion(-)
diff -ruNb u-boot-original/common/cmd_nand.c u-boot-nand/common/cmd_nand.c --- u-boot-original/common/cmd_nand.c 2004-03-30 14:37:28.663931328 +0300 +++ u-boot-nand/common/cmd_nand.c 2004-03-30 15:38:40.985653568 +0300 @@ -9,6 +9,7 @@ #include <command.h> #include <malloc.h> #include <asm/io.h> +#include <watchdog.h>
#ifdef CONFIG_SHOW_BOOT_PROGRESS # include <status_led.h> @@ -63,6 +64,7 @@ #define NANDRW_READ 0x01 #define NANDRW_WRITE 0x00 #define NANDRW_JFFS2 0x02 +#define NANDRW_JFFS2_SKIP 0x04
/* * Function Prototypes @@ -207,6 +209,11 @@ } else if (cmdtail && !strncmp(cmdtail, ".jffs2", 2)) cmd |= NANDRW_JFFS2; /* skip bad blocks */ + else if (cmdtail && !strncmp(cmdtail, ".jffs2s", 2)) { + cmd |= NANDRW_JFFS2; /* skip bad blocks (on read too) */ + if (cmd & NANDRW_READ) + cmd |= NANDRW_JFFS2_SKIP; /* skip bad blocks (on read too) */ + } #ifdef SXNI855T /* need ".e" same as ".j" for compatibility with older units */ else if (cmdtail && !strcmp(cmdtail, ".e")) @@ -258,7 +265,7 @@ "nand - NAND sub-system\n", "info - show available NAND devices\n" "nand device [dev] - show or set current device\n" - "nand read[.jffs2] addr off size\n" + "nand read[.jffs2[s]] addr off size\n" "nand write[.jffs2] addr off size - read/write `size' bytes starting\n" " at offset `off' to/from memory address `addr'\n" "nand erase [clean] [off size] - erase `size' bytes from\n" @@ -420,6 +427,7 @@ * 1: NANDRW_READ read, fail on bad block * 2: NANDRW_WRITE | NANDRW_JFFS2 write, skip bad blocks * 3: NANDRW_READ | NANDRW_JFFS2 read, data all 0xff for bad blocks + * 7: NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP read, skip bad blocks */ static int nand_rw (struct nand_chip* nand, int cmd, size_t start, size_t len, @@ -450,6 +458,10 @@ } continue; } + else if (cmd == (NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP)) { + start += erasesize; + continue; + } else if (cmd == (NANDRW_WRITE | NANDRW_JFFS2)) { /* skip bad block */ start += erasesize;

In message 406988D5.4020902@intracom.gr you wrote:
The following patch adds a new mode for reading from a NAND device.
The option is named .jffs2s, and on read it just skips over bad blocks.
Added, thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Pantelis Antoniou
-
Wolfgang Denk