Skip to contentSkip to conversation

mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

PATCH New Jason McMullan 4 participants 6 messages May 15, 2008 – May 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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(-)
lib_mips/board.c +6 -0
index 1645f2c..e33070d 100644
@@ -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 ();
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

Hi Jason,

lib_mips/board.c line 31

Quoted 9 lines · Jason McMullan
lib_mips/board.c +1 -0
index 1645f2c..e33070d 100644
@@ -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=43d8be8e21f25e37e7ade0eea86549b125775152;hb=a38dc3ea8614f8b0c41e432b445a9959b9711295#l25

# by the way, all ARCHs which need nand_init() should include <nand.h>
  in the same way as blackfin, shouldn't they?
Quoted 5 lines
lib_mips/board.c +0 -0
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -416,6 +417,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	}

lib_mips/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 427

Quoted 10 lines
lib_mips/board.c +5 -0
 #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

#2 lore raw

PATCH 1/1 mips: Call 'nand_init()' in genericboard initialization when CONFIG_CMD_NAND is set

Quoted 5 lines · Shinya Kuribayashi
Quoted 1 line · Jason McMullan

+#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 at netapp.com
www.netapp.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080516/d1dfc601/attachment.pgp

#3 lore raw

PATCH 1/1 mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

In reply to Shinya Kuribayashi
Quoted 15 lines · Shinya Kuribayashi

Hi Jason,

lib_mips/board.c line 31

Quoted 9 lines · Jason McMullan
lib_mips/board.c +1 -0
index 1645f2c..e33070d 100644
@@ -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

#4 lore raw

PATCH 1/1 mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

Quoted 4 lines · Scott Wood
Quoted 2 lines

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 at debian:~/devel/u-boot.git$

#5 lore raw

PATCH 1/1 mips: Call 'nand_init()' in generic board initialization when CONFIG_CMD_NAND is set

In reply to Jason McMullan
Quoted 3 lines · Jason McMullan
---
 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.

---

 lib_mips/board.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
lib_mips/board.c +6 -0
index 1645f2c..43cfc17 100644
@@ -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 ();