mtd/drivers/mtd/nand Config.in,1.9,1.10 Makefile,1.7,1.8 nand.c,1.33,1.34
gleixner at infradead.org
gleixner at infradead.org
Mon Nov 25 15:56:27 EST 2002
Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv29184
Modified Files:
Config.in Makefile nand.c
Log Message:
removed CONFIG_MTD_NAND_ECC, moved device ID's from nand_ids.h, which is now obsolete
Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Config.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Config.in 29 Aug 2002 21:44:14 -0000 1.9
+++ Config.in 25 Nov 2002 20:56:23 -0000 1.10
@@ -8,7 +8,6 @@
dep_tristate ' NAND Device Support' CONFIG_MTD_NAND $CONFIG_MTD
if [ "$CONFIG_MTD_NAND" = "y" -o "$CONFIG_MTD_NAND" = "m" ]; then
- bool ' Enable ECC correction algorithm' CONFIG_MTD_NAND_ECC
bool ' Verify NAND page writes' CONFIG_MTD_NAND_VERIFY_WRITE
fi
Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile 30 Apr 2002 09:34:16 -0000 1.7
+++ Makefile 25 Nov 2002 20:56:23 -0000 1.8
@@ -7,8 +7,7 @@
export-objs := nand.o nand_ecc.o
-nandobjs-y := nand.o
-nandobjs-$(CONFIG_MTD_NAND_ECC) += nand_ecc.o
+nandobjs-y := nand.o nand_ecc.o
obj-$(CONFIG_MTD_NAND) += $(nandobjs-y)
obj-$(CONFIG_MTD_NAND_SPIA) += spia.o
Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- nand.c 11 Nov 2002 15:47:17 -0000 1.33
+++ nand.c 25 Nov 2002 20:56:23 -0000 1.34
@@ -105,6 +105,13 @@
* 11-11-2002 tglx: fixed debug output in nand_write_page
* (John Hall (john.hall at optionexist.co.uk))
*
+ * 11-25-2002 tglx: Moved device ID/ manufacturer ID from nand_ids.h
+ * Splitted device ID and manufacturer ID table.
+ * Removed CONFIG_MTD_NAND_ECC, as it defaults to ECC_NONE for
+ * mtd->read / mtd->write and is controllable by the fs driver
+ * for mtd->read_ecc / mtd->write_ecc
+ * some minor cleanups
+ *
* $Id$
*
* This program is free software; you can redistribute it and/or modify
@@ -119,7 +126,6 @@
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
-#include <linux/mtd/nand_ids.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/interrupt.h>
#include <asm/io.h>
@@ -145,6 +151,39 @@
};
/*
+* Chip ID list
+*/
+static struct nand_flash_dev nand_flash_ids[] = {
+ {"NAND 1MB 5V", 0x6e, 20, 0x1000, 1}, // 1Mb 5V
+ {"NAND 2MB 5V", 0x64, 21, 0x1000, 1}, // 2Mb 5V
+ {"NAND 4MB 5V", 0x6b, 22, 0x2000, 0}, // 4Mb 5V
+ {"NAND 1MB 3,3V", 0xe8, 20, 0x1000, 1}, // 1Mb 3.3V
+ {"NAND 1MB 3,3V", 0xec, 20, 0x1000, 1}, // 1Mb 3.3V
+ {"NAND 2MB 3,3V", 0xea, 21, 0x1000, 1}, // 2Mb 3.3V
+ {"NAND 4MB 3,3V", 0xd5, 22, 0x2000, 0}, // 4Mb 3.3V
+ {"NAND 4MB 3,3V", 0xe3, 22, 0x2000, 0}, // 4Mb 3.3V
+ {"NAND 4MB 3,3V", 0xe5, 22, 0x2000, 0}, // 4Mb 3.3V
+ {"NAND 8MB 3,3V", 0xd6, 23, 0x2000, 0}, // 8Mb 3.3V
+ {"NAND 8MB 3,3V", 0xe6, 23, 0x2000, 0}, // 8Mb 3.3V
+ {"NAND 16MB 3,3V", 0x73, 24, 0x4000, 0},// 16Mb 3,3V
+ {"NAND 32MB 3,3V", 0x75, 25, 0x4000, 0}, // 32Mb 3,3V
+ {"NAND 64MB 3,3V", 0x76, 26, 0x4000, 0}, // 64Mb 3,3V
+ {"NAND 128MB 3,3V", 0x79, 27, 0x4000, 0}, // 128Mb 3,3V
+ {NULL,}
+};
+
+/*
+* Manufacturer ID list
+*/
+static struct nand_manufacturers nand_manuf_ids[] = {
+ {NAND_MFR_TOSHIBA, "Toshiba"},
+ {NAND_MFR_SAMSUNG, "Samsung"},
+ {NAND_MFR_FUJITSU, "Fujitsu"},
+ {NAND_MFR_NATIONAL, "National"},
+ {0x0, "Unknown"}
+};
+
+/*
* NAND low-level MTD interface functions
*/
static int nand_read (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf);
@@ -254,7 +293,7 @@
}
/* wait until command is processed */
- while (!this->dev_ready());
+ while (!this->dev_ready());
}
/*
@@ -903,10 +942,6 @@
goto out;
}
- /* Invalidate cache, if we write to this page */
- if (this->cache_page == page)
- this->cache_page = -1;
-
/* Write out desired data */
this->cmdfunc (mtd, NAND_CMD_SEQIN, mtd->oobblock, page);
/* prepad 0xff for partial programming */
@@ -1162,10 +1197,6 @@
/* Check, if we were interupted */
if (this->state == FL_ERASING) {
- /* Invalidate cache, if last_page is inside erase-block */
- if (this->cache_page >= page && this->cache_page < (page + pages_per_block))
- this->cache_page = -1;
-
/* Increment page address and decrement length */
len -= mtd->erasesize;
page += pages_per_block;
@@ -1275,9 +1306,6 @@
if (this->waitfunc == NULL)
this->waitfunc = nand_wait;
- /* make sure, that cache page is invalid */
- this->cache_page = -1;
-
/* Select the device */
nand_select ();
@@ -1290,24 +1318,28 @@
/* Print and store flash device information */
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
- if (nand_maf_id == nand_flash_ids[i].manufacture_id && nand_dev_id == nand_flash_ids[i].model_id) {
- if (!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;
- if (nand_flash_ids[i].page256) {
- mtd->oobblock = 256;
- mtd->oobsize = 8;
- this->page_shift = 8;
- } else {
- mtd->oobblock = 512;
- mtd->oobsize = 16;
- this->page_shift = 9;
- }
+ 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;
+ if (nand_flash_ids[i].page256) {
+ mtd->oobblock = 256;
+ mtd->oobsize = 8;
+ this->page_shift = 8;
+ } else {
+ mtd->oobblock = 512;
+ mtd->oobsize = 16;
+ this->page_shift = 9;
}
+ /* Try to identify manufacturer */
+ for (i = 0; nand_manuf_ids[i].id != 0x0; i++) {
+ if (nand_manuf_ids[i].id == nand_maf_id)
+ break;
+ }
printk (KERN_INFO "NAND device: Manufacture ID:"
- " 0x%02x, Chip ID: 0x%02x (%s)\n", nand_maf_id, nand_dev_id, mtd->name);
+ " 0x%02x, Chip ID: 0x%02x (%s %s)\n", nand_maf_id, nand_dev_id,
+ nand_manuf_ids[i].name , mtd->name);
break;
}
}
@@ -1317,7 +1349,6 @@
* if 3byte/512byte hardware ECC is selected and we have 256 byte pagesize
* fallback to software ECC
*/
-#ifdef CONFIG_MTD_NAND_ECC
this->eccsize = 256; /* set default eccsize */
switch (this->eccmode) {
@@ -1351,9 +1382,6 @@
printk (KERN_WARNING "Invalid NAND_ECC_MODE %d\n", this->eccmode);
BUG();
}
-#else
- this->eccmode = NAND_ECC_NONE;
-#endif
/* Initialize state, waitqueue and spinlock */
this->state = FL_READY;
More information about the linux-mtd-cvs
mailing list