[U-Boot] [PATCH] mtdparts: Call nand_init() during mtdparts_init().

Scott Wood scottwood at freescale.com
Fri Oct 15 20:59:02 CEST 2010


The mtdparts code depends on the devices referred to by
partition specs actually existing, both for error checking,
when the spread feature is used, for bad block checking.

Signed-off-by: Scott Wood <scottwood at freescale.com>
---
 common/cmd_mtdparts.c |    5 +----
 include/nand.h        |    6 ++++++
 2 files changed, 7 insertions(+), 4 deletions(-)

Applied to u-boot-nand-flash

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 5481c88..8e8ba47 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -96,15 +96,11 @@
 #include <linux/err.h>
 #include <linux/mtd/mtd.h>
 
-#if defined(CONFIG_CMD_NAND)
 #include <linux/mtd/nand.h>
 #include <nand.h>
-#endif
 
-#if defined(CONFIG_CMD_ONENAND)
 #include <linux/mtd/onenand.h>
 #include <onenand_uboot.h>
-#endif
 
 /* special size referring to all the remaining space in a partition */
 #define SIZE_REMAINING		0xFFFFFFFF
@@ -1711,6 +1707,7 @@ int mtdparts_init(void)
 		memset(last_ids, 0, MTDIDS_MAXLEN);
 		memset(last_parts, 0, MTDPARTS_MAXLEN);
 		memset(last_partition, 0, PARTITION_MAXLEN);
+		nand_init();
 		initialized = 1;
 	}
 
diff --git a/include/nand.h b/include/nand.h
index a452411..5ced821 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -24,7 +24,13 @@
 #ifndef _NAND_H_
 #define _NAND_H_
 
+#ifdef CONFIG_CMD_NAND
 extern void nand_init(void);
+#else
+static inline void nand_init(void)
+{
+}
+#endif
 
 #include <linux/mtd/compat.h>
 #include <linux/mtd/mtd.h>
-- 
1.7.0.4



More information about the U-Boot mailing list