Bug in chip alias detection! (jedec_probe, possibly cfi_probe)

David Woodhouse dwmw2 at infradead.org
Tue Oct 16 10:44:41 EDT 2001


alex.kremer at intel.com said:
>  I think I have found the problem. When scanning over previously found
> chips *THEY* (chips[i].start) should be checked if they also  switched
> to autoselect mode when we switched the one we are checking now (base)

Thanks. Please could you test this slightly edited fix:

Index: drivers/mtd/chips/jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.5
diff -u -r1.5 jedec_probe.c
--- drivers/mtd/chips/jedec_probe.c	2001/10/06 15:56:57	1.5
+++ drivers/mtd/chips/jedec_probe.c	2001/10/16 14:44:31
@@ -583,8 +583,11 @@
 		
 		for (i=0; i<sizeof(jedec_table)/sizeof(jedec_table[0]); i++) {
 			if (mfr == jedec_table[i].mfr_id &&
-			    id == jedec_table[i].dev_id)
-				return cfi_jedec_setup(cfi, i);
+			    id == jedec_table[i].dev_id) {
+				if (!cfi_jedec_setup(cfi, i))
+					return 0;
+				goto ok_out;
+			}
 		}
 		if (!retried++) {
 			/* Deal with whichever strange chips these were */
@@ -599,8 +602,8 @@
 	for (i=0; i<cfi->numchips; i++) {
 		/* This chip should be in read mode if it's one
 		   we've already touched. */
-		if (jedec_read_mfr(map, base, osf) == cfi->mfr &&
-		    jedec_read_id(map, base, osf) == cfi->id) {
+		if (jedec_read_mfr(map, chips[i].start, osf) == cfi->mfr &&
+		    jedec_read_id(map, chips[i[.start, osf) == cfi->id) {
 			/* Eep. This chip also looks like it's in autoselect mode.
 			   Is it an alias for the new one? */
 			
@@ -640,6 +643,7 @@
 	chips[cfi->numchips].state = FL_READY;
 	cfi->numchips++;
 		
+ok_out:
 	/* Put it back into Read Mode */
 	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
 	cfi_send_gen_cmd(0xff, 0, base, map, cfi, cfi->device_type, NULL);


--
dwmw2






More information about the linux-mtd mailing list