[U-Boot-Users] [PATCH] mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

--- lib_mips/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib_mips/board.c b/lib_mips/board.c index 1645f2c..e33070d 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -28,6 +28,7 @@ #include <version.h> #include <net.h> #include <environment.h> +#include <nand.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -416,6 +417,11 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif
+#ifdef CONFIG_CMD_NAND + puts("NAND: "); + nand_init(); /* go init the NAND */ +#endif + #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r ();

Hi Jason,
Jason McMullan wrote:
diff --git a/lib_mips/board.c b/lib_mips/board.c index 1645f2c..e33070d 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -28,6 +28,7 @@ #include <version.h> #include <net.h> #include <environment.h> +#include <nand.h>
This will break build. According to the blackfin, we can't even include <nand.h> if it's not configured.
http://git.denx.de/?p=u-boot.git;a=blob;f=lib_blackfin/board.c;h=43d8be8e21f...
# by the way, all ARCHs which need nand_init() should include <nand.h> in the same way as blackfin, shouldn't they?
DECLARE_GLOBAL_DATA_PTR;
@@ -416,6 +417,11 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif
+#ifdef CONFIG_CMD_NAND
- puts("NAND: ");
- nand_init(); /* go init the NAND */
+#endif
#if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r ();
I'm not familiar with NAND, so don't know that above is a good timing to call nand_init(). If this works for you, I'm fine ATM.
Thanks!
Shinya

On Sat, 2008-05-17 at 01:26 +0900, Shinya Kuribayashi wrote:
Jason McMullan wrote:
+#include <nand.h>
This will break build. According to the blackfin, we can't even include <nand.h> if it's not configured.
That is, of course, why I originally just had 'extern int nand_init(void)' instead of the #include.
So, should I send in another patch with #ifdef CONFIG_CMD_NAND around the #include?
That seems messy, as including any common include nand.h shouldn't break the build regardless of the state of the CONFIG_CMD_* defines.
But that's just my opinion.
Jason McMullan MTS SW System Firmware
NetApp 724.741.5011 Fax 724.741.5166 Direct 412.656.3519 Mobile jason.mcmullan@netapp.com www.netapp.com

On Sat, May 17, 2008 at 01:26:27AM +0900, Shinya Kuribayashi wrote:
Hi Jason,
Jason McMullan wrote:
diff --git a/lib_mips/board.c b/lib_mips/board.c index 1645f2c..e33070d 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -28,6 +28,7 @@ #include <version.h> #include <net.h> #include <environment.h> +#include <nand.h>
This will break build. According to the blackfin, we can't even include <nand.h> if it's not configured.
Let's fix that, then. What is the error?
I just tried doing something similar on ppc, and it built fine.
-Scott

Scott Wood wrote:
This will break build. According to the blackfin, we can't even include <nand.h> if it's not configured.
Let's fix that, then. What is the error?
mips-linux-gnu-gcc -g -Os -D__KERNEL__ -DTEXT_BASE=0xbfc00000 -I/home/skuribay/devel/u-boot.git/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/codesourcery/mips-4.2/bin/../lib/gcc/mips-linux-gnu/4.2.3/include -pipe -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -msoft-float -march=r5500 -Wa,--trap -Wall -Wstrict-prototypes -c -o board.o board.c In file included from /home/skuribay/devel/u-boot.git/include/nand.h:29, from board.c:31: /home/skuribay/devel/u-boot.git/include/linux/mtd/nand.h:413: error: 'NAND_MAX_CHIPS' undeclared here (not in a function) make[1]: *** [board.o] Error 1 make[1]: Leaving directory `/home/skuribay/devel/u-boot.git/lib_mips' make: *** [lib_mips/libmips.a] Error 2 skuribay@debian:~/devel/u-boot.git$

Jason McMullan wrote:
lib_mips/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
As you submitted this patch and its description separately, I manually combined them with two CodingStyle fixes. Now you seem to be getting along with git :-)
Applied, thanks. Will be pushed out soon.
Shinya
================================>
[MIPS] lib_mips/board.c: Add nand_init
This patch adds the standard 'nand_init()' call to the mips generic 'board_init_r()' call, bringing MIPS in line with the other architectures.
Signed-off-by: Jason McMullan mcmullan@netapp.com Signed-off-by: Shinya Kuribayashi skuribay@ruby.dti.ne.jp ---
lib_mips/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib_mips/board.c b/lib_mips/board.c index 1645f2c..43cfc17 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -28,6 +28,7 @@ #include <version.h> #include <net.h> #include <environment.h> +#include <nand.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -416,6 +417,11 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif
+#ifdef CONFIG_CMD_NAND + puts ("NAND: "); + nand_init (); /* go init the NAND */ +#endif + #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r ();
participants (4)
-
Jason McMullan
-
McMullan, Jason
-
Scott Wood
-
Shinya Kuribayashi