From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Grandegger Date: Fri, 16 Jan 2009 08:59:23 +0100 Subject: [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer In-Reply-To: <20090115221719.GB23385@ld0162-tx32.am.freescale.net> References: <4964FA39.3010902@grandegger.com> <20090115221719.GB23385@ld0162-tx32.am.freescale.net> Message-ID: <49703E5B.1080604@grandegger.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Scott Wood wrote: > On Wed, Jan 07, 2009 at 07:53:45PM +0100, Wolfgang Grandegger wrote: >> 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 > > Do we really need the ifdef? Not really, "1x" (one time) would make clear that it's a single-chip device. >> 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 > > This needs to be seen from cmd_nand.c as well. Yep, in the meantime I realized that it's already pre-set in include/linux/mtd/nand.h: /* The maximum number of NAND chips in an array */ #ifndef NAND_MAX_CHIPS #define NAND_MAX_CHIPS 8 #endif but most (if not all) boards set it to 1. But at that occasion, I think the name should be changed to CONFIG_SYS_NAND_MAX_CHIPS, right? Wolfgang.