nand_scan() returns 0 even if no nand chip exists
Kevin Kaichuan He
hek_u5 at yahoo.com
Thu Oct 9 23:32:36 EDT 2003
It seems to me that the nand_scan() in nand.c will return 0
even if no NAND chip is detected (CVS code on 10/09/03). This
has negative impact since my hardware specific nand driver
will assume a NAND chip is detected and go on doing
add_mtd_partition() ...
I applied the following patch to avoid the problem, not sure
if I missed anything:
--- ./nand/nand.c 2003-10-09 19:10:05.000000000 -0700
***************
*** 1388,1394 ****
}
}
! for (i=1; i < maxchips; i++) {
this->select_chip(mtd, i);
/* Send the command for reading device ID */
--- 1388,1396 ----
}
}
! if (nand_flash_ids[i].name) { /* Added by Kevin */
! /* Found NAND */
! for (i=1; i < maxchips; i++) {
this->select_chip(mtd, i);
/* Send the command for reading device ID */
***************
*** 1398,1408 ****
if (nand_maf_id != this->read_byte(mtd) ||
nand_dev_id != this->read_byte(mtd))
break;
}
if (i > 1)
printk(KERN_INFO "%d NAND chips detected\n", i);
mtd->size = (1 << this->chipshift) /* * i when we fix the rest of the code */;
/*
* check ECC mode, default to software
--- 1400,1411 ----
if (nand_maf_id != this->read_byte(mtd) ||
nand_dev_id != this->read_byte(mtd))
break;
}
if (i > 1)
printk(KERN_INFO "%d NAND chips detected\n", i);
mtd->size = (1 << this->chipshift) /* * i when we fix the rest of the code */;
+ }
/*
* check ECC mode, default to software
Thanks
Kevin
More information about the linux-mtd
mailing list