summaryrefslogtreecommitdiff
path: root/common/cmd_nand.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-04-15 21:48:45 +0000
committerwdenk <wdenk>2004-04-15 21:48:45 +0000
commita3d991bd0da8b9fb9dbf2c7481091c3d082b9b13 (patch)
treec474375dc1cc812e006921ab2ad122b21923e512 /common/cmd_nand.c
parenta6ab4bf978a3d5a52a47bbd259b7eb4c860ebd0c (diff)
downloadu-boot-imx-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.zip
u-boot-imx-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.tar.gz
u-boot-imx-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.tar.bz2
Patches by Pantelis Antoniou, 30 Mar 2004:
add networking support for VLANs (802.1q), and CDP (Cisco Discovery Protocol)
Diffstat (limited to 'common/cmd_nand.c')
-rw-r--r--common/cmd_nand.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 0e49e9f..c2e67ab 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -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 @@ struct nand_oob_config {
#define NANDRW_READ 0x01
#define NANDRW_WRITE 0x00
#define NANDRW_JFFS2 0x02
+#define NANDRW_JFFS2_SKIP 0x04
/*
* Function Prototypes
@@ -207,6 +209,11 @@ int do_nand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
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 @@ U_BOOT_CMD(
"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 @@ static void nand_print_bad(struct nand_chip* nand)
* 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 @@ static int nand_rw (struct nand_chip* nand, int cmd,
}
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;