mtd/drivers/mtd/nand nand.c,1.52,1.53

David Woodhouse dwmw2 at infradead.org
Fri Jul 11 11:09:53 EDT 2003


Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv10881

Modified Files:
	nand.c 
Log Message:
Scan for multiple chips.


Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- nand.c	8 Jul 2003 12:53:35 -0000	1.52
+++ nand.c	11 Jul 2003 15:09:50 -0000	1.53
@@ -1316,7 +1316,7 @@
 /*
  * Scan for the NAND device
  */
-int nand_scan (struct mtd_info *mtd)
+int nand_scan (struct mtd_info *mtd, int maxchips)
 {
 	int i, nand_maf_id, nand_dev_id;
 	struct nand_chip *this = mtd->priv;
@@ -1363,8 +1363,8 @@
 		if (nand_dev_id == nand_flash_ids[i].id && !mtd->size) {
 			mtd->name = nand_flash_ids[i].name;
 			mtd->erasesize = nand_flash_ids[i].erasesize;
-			mtd->size = (1 << nand_flash_ids[i].chipshift);
 			mtd->eccsize = 256;
+			this->chipshift = nand_flash_ids[i].chipshift;
 			if (nand_flash_ids[i].page256) {
 				mtd->oobblock = 256;
 				mtd->oobsize = 8;
@@ -1385,6 +1385,22 @@
 			break;
 		}
 	}
+
+	for (i=1; i < maxchips; i++) {
+		this->select_chip(mtd, i);
+
+		/* Send the command for reading device ID */
+		this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);
+
+		/* Read manufacturer and device IDs */
+		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 << nand_flash_ids[i].chipshift) /* * i when we fix the rest of the code */;
 
 	/* 
 	 * check ECC mode, default to software




More information about the linux-mtd-cvs mailing list