mtd/drivers/mtd/nand diskonchip.c,1.6,1.7

David Woodhouse dwmw2 at infradead.org
Wed Nov 5 08:20:13 EST 2003


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

Modified Files:
	diskonchip.c 
Log Message:
Add experimental support for the newer DiskOnChip 2000 with
the Millennium-like ASIC, based on Dave Dillow's patches to
docprobe.c and doc2000.c


Index: diskonchip.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/diskonchip.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- diskonchip.c	17 Oct 2003 12:48:06 -0000	1.6
+++ diskonchip.c	5 Nov 2003 13:20:10 -0000	1.7
@@ -180,22 +180,24 @@
 	return 0;
 }
 
-static uint16_t doc2000_ident_chip(struct mtd_info *mtd, int nr)
+static uint16_t doc200x_ident_chip(struct mtd_info *mtd, int nr)
 {
+	struct nand_chip *this = mtd->priv;
+	struct doc_priv *doc = (void *)this->priv;
 	uint16_t ret;
 
 	doc200x_select_chip(mtd, nr);
 	doc200x_hwcontrol(mtd, NAND_CTL_SETCLE);
-	doc2000_write_byte(mtd, NAND_CMD_READID);
+	this->write_byte(mtd, NAND_CMD_READID);
 	doc200x_hwcontrol(mtd, NAND_CTL_CLRCLE);
 	doc200x_hwcontrol(mtd, NAND_CTL_SETALE);
-	doc2000_write_byte(mtd, 0);
+	this->write_byte(mtd, 0);
 	doc200x_hwcontrol(mtd, NAND_CTL_CLRALE);
 	
-	ret = doc2000_read_byte(mtd) << 8;
-	ret |= doc2000_read_byte(mtd);
+	ret = this->read_byte(mtd) << 8;
+	ret |= this->read_byte(mtd);
 
-	if (try_dword && !nr) {
+	if (doc->ChipID == DOC_ChipID_Doc2k && try_dword && !nr) {
 		/* First chip probe. See if we get same results by 32-bit access */
 		union {
 			uint32_t dword;
@@ -233,11 +235,11 @@
 	doc->chips_per_floor = 4;
 
 	/* Find out what the first chip is */
-	mfrid = doc2000_ident_chip(mtd, 0);
+	mfrid = doc200x_ident_chip(mtd, 0);
 
 	/* Find how many chips in each floor. */
 	for (i = 1; i < 4; i++) {
-		if (doc2000_ident_chip(mtd, i) != mfrid)
+		if (doc200x_ident_chip(mtd, i) != mfrid)
 			break;
 	}
 	doc->chips_per_floor = i;
@@ -425,7 +427,6 @@
 	.physadr = 0xd4000,
 	.curfloor = -1,
 	.curchip = -1,
-	.CDSNControl = CDSN_CTRL_FLASH_IO,
 };
 
 u_char mydatabuf[528];
@@ -450,6 +451,7 @@
 {
 	mydoc.virtadr = (unsigned long)ioremap(mydoc.physadr, DOC_IOREMAP_LEN);
 	int nrchips = 1;
+	char *name;
 
 	WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, 
 		 mydoc.virtadr, DOCControl);
@@ -471,9 +473,23 @@
 		mynand.read_buf = doc2001_readbuf;
 		mynand.verify_buf = doc2001_verifybuf;
 
-		/* Millennium only ever has one chip, apparently  */
-		mydoc.chips_per_floor = 1;
-		nrchips = 1;
+		ReadDOC(mydoc.virtadr, ChipID);
+		ReadDOC(mydoc.virtadr, ChipID);
+		if (ReadDOC(mydoc.virtadr, ChipID) != DOC_ChipID_DocMil) {
+			/* It's not a Millennium; it's one of the newer
+			   DiskOnChip 2000 units with a similar ASIC. 
+			   Treat it like a Millennium, except that it
+			   can have multiple chips. */
+			doc2000_count_chips(&mymtd);
+			nrchips = 4 * mydoc.chips_per_floor;
+			name = "DiskOnChip 2000 (INFTL Model)";
+			mydoc.CDSNControl |= CDSN_CTRL_FLASH_IO;
+		} else {
+			/* Bog-standard Millennium */
+			mydoc.chips_per_floor = 1;
+			nrchips = 1;
+			name = "DiskOnChip Millennium";
+		}
 		break;
 
 	case DOC_ChipID_Doc2k:
@@ -485,6 +501,8 @@
 
 		doc2000_count_chips(&mymtd);
 		nrchips = 4 * mydoc.chips_per_floor;
+		name = "DiskOnChip 2000 (NFTL Model)";
+		mydoc.CDSNControl |= CDSN_CTRL_FLASH_IO;
 
 		break;
 
@@ -495,6 +513,7 @@
 		iounmap((void *)mydoc.virtadr);
 		return -EIO;
 	}
+	mymtd.name = name;
 	add_mtd_device(&mymtd);
 
 	return 0;




More information about the linux-mtd-cvs mailing list