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

Kremer, Alex alex.kremer at intel.com
Tue Oct 16 08:43:32 EDT 2001


Hi again,

I was testing the new support for Boot Block via jedec_probe.
I have 2 4MB boot block parts in 16 bit mode (no interleaving)
mapped over dc21285 (selected using A22)

The jedec_probe alias detection code misdetected an alias for a 3rd chip!

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)

        for (i=0; i<cfi->numchips; i++) {
                /* This chip should be in read mode if it's one
                   we've already touched. */
HERE --->>      if (jedec_read_mfr(map, base, osf) == cfi->mfr &&
HERE --->>          jedec_read_id(map, base, osf) == cfi->id) {
                        /* Eep. This chip also looks like it's in autoselect
mode.
                           Is it an alias for the new one? */

It should be 'chips[i].start' instead of 'base' in those lines. The current
one is
always in autoselect mode at this point.

I'm attaching a patch that fixed it for me (against cvs from yesterday Oct.
15).
The patch also includes a fix for a non critical bug -- the first
 chip is not reported and is not put back in read-array mode!

I think there is a somewhat similar bug in cfi_probe code, but I couldn't
verify this.

		if (qry_present(map,chips[i].start,cfi)) {
			/* Eep. This chip also had the QRY marker. 
			 * Is it an alias for the new one? */
			cfi_send_gen_cmd(0xF0, 0, chips[i].start, map, cfi,
cfi->device_type, NULL);

			/* If the QRY marker goes away, it's an alias */
HERE --->>>		if (!qry_present(map, chips[i].start, cfi)) {
				printk(KERN_DEBUG "%s: Found an alias at
0x%x for the chip at 0x%lx\n",
				       map->name, base, chips[i].start);
				return 0;
			}

when chips[i] is switched to read-array, the current one should be checked
(base),
not the chips[i], which was put in read-array mode in the previous line.

Kreso

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtd-jedec-alias.patch
Type: application/octet-stream
Size: 1334 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20011016/d7e7b605/attachment.obj 


More information about the linux-mtd mailing list