summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/cmd_nand.c2
-rw-r--r--common/env_nand.c3
-rw-r--r--drivers/mtd/nand/nand_util.c7
-rw-r--r--fs/jffs2/jffs2_1pass.c3
-rw-r--r--include/linux/mtd/nand.h4
-rw-r--r--include/onenand_uboot.h5
-rw-r--r--lib_arm/board.c10
-rw-r--r--lib_ppc/board.c4
-rw-r--r--lib_sh/board.c2
9 files changed, 20 insertions, 20 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 37eb41b..37198d2 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -37,8 +37,6 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part);
#endif
-extern nand_info_t nand_info[]; /* info for NAND chips */
-
static int nand_dump_oob(nand_info_t *nand, ulong off)
{
return 0;
diff --git a/common/env_nand.c b/common/env_nand.c
index 70d05ad..3a98d2b 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -57,9 +57,6 @@ int nand_legacy_rw (struct nand_chip* nand, int cmd,
size_t start, size_t len,
size_t * retlen, u_char * buf);
-/* info for NAND chips, defined in drivers/mtd/nand/nand.c */
-extern nand_info_t nand_info[];
-
/* references to names in env_common.c */
extern uchar default_environment[];
extern int default_environment_size;
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 6c5624a..c82f77b 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -153,6 +153,13 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
priv_nand->bbt = NULL;
}
+ if (erase_length < meminfo->erasesize) {
+ printf("Warning: Erase size 0x%08x smaller than one " \
+ "erase block 0x%08x\n",erase_length, meminfo->erasesize);
+ printf(" Erasing 0x%08x instead\n", meminfo->erasesize);
+ erase_length = meminfo->erasesize;
+ }
+
for (;
erase.addr < opts->offset + erase_length;
erase.addr += meminfo->erasesize) {
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 1993dc2..7e27ee1 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -164,9 +164,6 @@ static struct part_info *current_part;
/* this one defined in nand_legacy.c */
int read_jffs2_nand(size_t start, size_t len,
size_t * retlen, u_char * buf, int nanddev);
-#else
-/* info for NAND chips, defined in drivers/mtd/nand/nand.c */
-extern nand_info_t nand_info[];
#endif
#define NAND_PAGE_SIZE 512
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4cc4a7d..e2a25a6 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -385,6 +385,10 @@ struct nand_manufacturers {
extern struct nand_flash_dev nand_flash_ids[];
extern struct nand_manufacturers nand_manuf_ids[];
+#ifndef NAND_MAX_CHIPS
+#define NAND_MAX_CHIPS 8
+#endif
+
/**
* struct nand_bbt_descr - bad block table descriptor
* @options: options for this descriptor
diff --git a/include/onenand_uboot.h b/include/onenand_uboot.h
index bd1831e..4449f98 100644
--- a/include/onenand_uboot.h
+++ b/include/onenand_uboot.h
@@ -14,6 +14,8 @@
#ifndef __UBOOT_ONENAND_H
#define __UBOOT_ONENAND_H
+#include <linux/types.h>
+
struct kvec {
void *iov_base;
size_t iov_len;
@@ -22,6 +24,9 @@ struct kvec {
typedef int spinlock_t;
typedef int wait_queue_head_t;
+struct mtd_info;
+struct erase_info;
+
/* Functions */
extern void onenand_init(void);
extern int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
diff --git a/lib_arm/board.c b/lib_arm/board.c
index 67506b3..5e04553 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -45,6 +45,8 @@
#include <version.h>
#include <net.h>
#include <serial.h>
+#include <nand.h>
+#include <onenand_uboot.h>
#ifdef CONFIG_DRIVER_SMC91111
#include "../drivers/net/smc91111.h"
@@ -55,14 +57,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_CMD_NAND)
-void nand_init (void);
-#endif
-
-#if defined(CONFIG_CMD_ONENAND)
-void onenand_init(void);
-#endif
-
ulong monitor_flash_len;
#ifdef CONFIG_HAS_DATAFLASH
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 4956403..6f7242d 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -93,9 +93,7 @@ void doc_init (void);
#if defined(CONFIG_HARD_SPI)
#include <spi.h>
#endif
-#if defined(CONFIG_CMD_NAND)
-void nand_init (void);
-#endif
+#include <nand.h>
static char *failed = "*** failed ***\n";
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 883c381..807415c 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -76,7 +76,7 @@ static int sh_flash_init(void)
}
#if defined(CONFIG_CMD_NAND)
-void nand_init (void);
+#include <nand.h>
static int sh_nand_init(void)
{
printf("NAND: ");