[U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer

Wolfgang Grandegger wg at grandegger.com
Fri Jan 16 08:59:23 CET 2009


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.


More information about the U-Boot mailing list