public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer
@ 2009-01-07 18:53 Wolfgang Grandegger
  2009-01-15 22:17 ` Scott Wood
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Grandegger @ 2009-01-07 18:53 UTC (permalink / raw)
  To: u-boot

This patch adds support for NAND_MAX_CHIPS to the MTD NAND layer.
Multi-chip devices are then displayed as shown:

Device 0: 2x NAND 512MiB 3,3V 8-bit, sector size 128 KiB

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 common/cmd_nand.c       |   10 +++++++++-
 drivers/mtd/nand/nand.c |   10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

Index: u-boot/common/cmd_nand.c
===================================================================
--- u-boot.orig/common/cmd_nand.c
+++ u-boot/common/cmd_nand.c
@@ -191,10 +191,18 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
 
 		putc('\n');
 		for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
-			if (nand_info[i].name)
+			if (nand_info[i].name) {
+#if NAND_MAX_CHIPS > 1
+				struct nand_chip *chip = nand_info[i].priv;
+				printf("Device %d: %dx %s, sector size %u KiB\n",
+				       i, chip->numchips, nand_info[i].name,
+				       nand_info[i].erasesize >> 10);
+#else
 				printf("Device %d: %s, sector size %u KiB\n",
 				       i, nand_info[i].name,
 				       nand_info[i].erasesize >> 10);
+#endif
+			}
 		}
 		return 0;
 	}
Index: u-boot/drivers/mtd/nand/nand.c
===================================================================
--- u-boot.orig/drivers/mtd/nand/nand.c
+++ u-boot/drivers/mtd/nand/nand.c
@@ -28,6 +28,10 @@
 #define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
 #endif
 
+#ifndef NAND_MAX_CHIPS
+#define NAND_MAX_CHIPS 1
+#endif
+
 int nand_curr_device = -1;
 nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
 
@@ -41,11 +45,15 @@ extern int board_nand_init(struct nand_c
 static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
 			   ulong base_addr)
 {
+	int maxchips = NAND_MAX_CHIPS;
+
+	if (maxchips < 1)
+		maxchips = 1;
 	mtd->priv = nand;
 
 	nand->IO_ADDR_R = nand->IO_ADDR_W = (void  __iomem *)base_addr;
 	if (board_nand_init(nand) == 0) {
-		if (nand_scan(mtd, 1) == 0) {
+		if (nand_scan(mtd, maxchips) == 0) {
 			if (!mtd->name)
 				mtd->name = (char *)default_nand_name;
 		} else

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-01-20  8:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 18:53 [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer Wolfgang Grandegger
2009-01-15 22:17 ` Scott Wood
2009-01-16  7:59   ` Wolfgang Grandegger
2009-01-16  8:22     ` Wolfgang Denk
2009-01-16 17:15       ` Wolfgang Grandegger
2009-01-19 16:12         ` Stefan Roese
2009-01-19 17:08           ` Scott Wood
2009-01-19 17:21             ` Stefan Roese
2009-01-19 19:50               ` Wolfgang Grandegger
2009-01-20  7:40                 ` Stefan Roese
2009-01-20  8:36                   ` Wolfgang Grandegger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox