|
@@ -24,8 +24,8 @@
|
|
|
|
|
|
#include <common.h>
|
|
#include <common.h>
|
|
|
|
|
|
-#ifndef CFG_NAND_LEGACY
|
|
|
|
-#error CFG_NAND_LEGACY not defined in a file using the legacy NAND support!
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
|
|
|
|
+#warning CFG_NAND_LEGACY not defined in a file using the legacy NAND support!
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#include <command.h>
|
|
#include <command.h>
|
|
@@ -74,7 +74,7 @@ extern int flash_write (char *, ulong, ulong);
|
|
/* change char* to void* to shutup the compiler */
|
|
/* change char* to void* to shutup the compiler */
|
|
extern block_dev_desc_t *get_dev (char*, int);
|
|
extern block_dev_desc_t *get_dev (char*, int);
|
|
|
|
|
|
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
|
|
/* references to names in cmd_nand.c */
|
|
/* references to names in cmd_nand.c */
|
|
#define NANDRW_READ 0x01
|
|
#define NANDRW_READ 0x01
|
|
#define NANDRW_WRITE 0x00
|
|
#define NANDRW_WRITE 0x00
|
|
@@ -84,7 +84,7 @@ extern struct nand_chip nand_dev_desc[];
|
|
extern int nand_legacy_rw(struct nand_chip* nand, int cmd, size_t start, size_t len,
|
|
extern int nand_legacy_rw(struct nand_chip* nand, int cmd, size_t start, size_t len,
|
|
size_t * retlen, u_char * buf);
|
|
size_t * retlen, u_char * buf);
|
|
extern int nand_legacy_erase(struct nand_chip* nand, size_t ofs, size_t len, int clean);
|
|
extern int nand_legacy_erase(struct nand_chip* nand, size_t ofs, size_t len, int clean);
|
|
-#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
|
|
|
|
|
+#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY) */
|
|
|
|
|
|
extern block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
|
|
extern block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
|
|
|
|
|
|
@@ -188,7 +188,7 @@ int au_do_update(int i, long sz)
|
|
int off, rc;
|
|
int off, rc;
|
|
uint nbytes;
|
|
uint nbytes;
|
|
int k;
|
|
int k;
|
|
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
|
|
int total;
|
|
int total;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -262,7 +262,7 @@ int au_do_update(int i, long sz)
|
|
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
|
|
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
|
|
flash_sect_erase(start, end);
|
|
flash_sect_erase(start, end);
|
|
} else {
|
|
} else {
|
|
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
|
|
printf("Updating NAND FLASH with image %s\n", au_image[i].name);
|
|
printf("Updating NAND FLASH with image %s\n", au_image[i].name);
|
|
debug ("nand_legacy_erase(%lx, %lx);\n", start, end);
|
|
debug ("nand_legacy_erase(%lx, %lx);\n", start, end);
|
|
rc = nand_legacy_erase (nand_dev_desc, start, end - start + 1, 0);
|
|
rc = nand_legacy_erase (nand_dev_desc, start, end - start + 1, 0);
|
|
@@ -290,7 +290,7 @@ int au_do_update(int i, long sz)
|
|
debug ("flash_write(%p, %lx %x)\n", addr, start, nbytes);
|
|
debug ("flash_write(%p, %lx %x)\n", addr, start, nbytes);
|
|
rc = flash_write((char *)addr, start, nbytes);
|
|
rc = flash_write((char *)addr, start, nbytes);
|
|
} else {
|
|
} else {
|
|
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
|
|
debug ("nand_legacy_rw(%p, %lx %x)\n", addr, start, nbytes);
|
|
debug ("nand_legacy_rw(%p, %lx %x)\n", addr, start, nbytes);
|
|
rc = nand_legacy_rw(nand_dev_desc, NANDRW_WRITE | NANDRW_JFFS2,
|
|
rc = nand_legacy_rw(nand_dev_desc, NANDRW_WRITE | NANDRW_JFFS2,
|
|
start, nbytes, (size_t *)&total, (uchar *)addr);
|
|
start, nbytes, (size_t *)&total, (uchar *)addr);
|
|
@@ -308,7 +308,7 @@ int au_do_update(int i, long sz)
|
|
if (au_image[i].type != AU_NAND) {
|
|
if (au_image[i].type != AU_NAND) {
|
|
rc = crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size));
|
|
rc = crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size));
|
|
} else {
|
|
} else {
|
|
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
|
|
|
|
|
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
|
|
rc = nand_legacy_rw(nand_dev_desc, NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP,
|
|
rc = nand_legacy_rw(nand_dev_desc, NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP,
|
|
start, nbytes, (size_t *)&total, (uchar *)addr);
|
|
start, nbytes, (size_t *)&total, (uchar *)addr);
|
|
rc = crc32 (0, (uchar *)(addr + off), ntohl(hdr->ih_size));
|
|
rc = crc32 (0, (uchar *)(addr + off), ntohl(hdr->ih_size));
|