mtd/drivers/mtd/chips jedec_probe.c,1.15,1.16

spse at infradead.org spse at infradead.org
Fri Jun 7 07:20:54 EDT 2002


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

Modified Files:
	jedec_probe.c 
Log Message:
Add a second pass into jedec_probe to identify some older Sharp/Intel
chips which dont like the autoselect mode command


Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jedec_probe.c	17 May 2002 08:48:57 -0000	1.15
+++ jedec_probe.c	7 Jun 2002 11:20:52 -0000	1.16
@@ -874,7 +874,7 @@
 			      struct flchip *chips, struct cfi_private *cfi)
 {
 	int i;
-	int retried = 0;
+	int unlockpass = 0;
 
 	if (!cfi->numchips) {
 		switch (cfi->device_type) {
@@ -929,8 +929,10 @@
 	jedec_reset(base, map, cfi);
 
 	/* Autoselect Mode */
-	cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
-	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
+	if(cfi->addr_unlock1) {
+		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
+		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
+	}
 	cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
 
 	if (!cfi->numchips) {
@@ -949,9 +951,13 @@
 				goto ok_out;
 			}
 		}
-		if (!retried++) {
+		switch(unlockpass++) {
+		case 0:
 			cfi->addr_unlock1 |= cfi->addr_unlock1 << 4;
 			cfi->addr_unlock2 |= cfi->addr_unlock2 << 4;
+			goto retry;
+		case 1:
+			cfi->addr_unlock1 = cfi->addr_unlock2 = 0;
 			goto retry;
 		}
 		return 0;





More information about the linux-mtd-cvs mailing list