Skip to contentSkip to conversation

Interleave order while probing

PATCH In review Scott Wood 3 participants 5 messages Oct 19, 2004 – Oct 21, 2004 Memory technology devices (MTD)

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 Interleave order while probing

The current 2.6 MTD code probes starting with minimal interleave. This can result in false positives, if the flash happens to contain zeroes at the QRY address. For example, two interleaved 16-bit chips can be detected as a non-interleaved 32-bit chip when only one of the chips is put into read-CFI-query mode, and the "\0\0\0Q" that it gets back is the same as what a real 32-bit chip would produce.

The patch below (against the latest MTD CVS snapshot) starts with the highest interleave first; I don't think there are any situations where that would produce a false positive (short of having QRY as the actual flash data at the relevant addresses).

drivers/mtd/chips/gen_probe.c +1 -1
diff -urN mtd.orig/drivers/mtd/chips/gen_probe.c mtd/drivers/mtd/chips/gen_probe.c
@@ -162,7 +162,7 @@
 	int max_chips = map_bankwidth(map); /* And minimum 1 */
 	int nr_chips, type;
 
-	for (nr_chips = min_chips; nr_chips <= max_chips; nr_chips <<= 1) {
+	for (nr_chips = max_chips; nr_chips >= min_chips; nr_chips >>= 1) {
 
 		if (!cfi_interleave_supported(nr_chips))
 		    continue;
#1 lore raw
Quoted 3 lines

I don't think there are any situations
where that would produce a false positive (short of having QRY as the actual flash data at the relevant addresses).

That would be a problem. It's a block device: you can store whatever you want, wherever you want.

-ch

#2 lore raw
Quoted 6 lines · Christopher Hoover
Quoted 3 lines

I don't think there are any situations
where that would produce a false positive (short of having QRY as the actual flash data at the relevant addresses).

That would be a problem. It's a block device: you can store whatever you want, wherever you want.

Not in query mode though.

Nicolas

author
#3 lore raw
Quoted 8 lines · Nicolas Pitre
Quoted 6 lines · Christopher Hoover
Quoted 3 lines

I don't think there are any situations
where that would produce a false positive (short of having QRY as the actual flash data at the relevant addresses).

That would be a problem. It's a block device: you can store whatever you want, wherever you want.

Yes, but that's always been a problem. Perhaps the device could be asked to produce a status word as an additional check?

In any case, a prohibition on having zeroes there is worse than a prohibition on having "QRY".

Quoted 1 line

Not in query mode though.

But if you've guessed the wrong interleave, you could be seeing some non-query-mode data for the chips that didn't get the query command.

-Scott

#4 lore raw
Quoted 4 lines · Scott Wood
Quoted 1 line

Not in query mode though.

But if you've guessed the wrong interleave, you could be seeing some non-query-mode data for the chips that didn't get the query command.

True.

Like you said, the flash could then be asked to go into status mode, which is sure not to have "qry" anywhere.

Nicolas