public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] Interleave order while probing
@ 2004-10-19 21:03 Scott Wood
  2004-10-20 23:39 ` Christopher Hoover
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2004-10-19 21:03 UTC (permalink / raw)
  To: linux-mtd

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).

Signed-off-by: Scott Wood <scott.wood@timesys.com> under TS0068

diff -urN mtd.orig/drivers/mtd/chips/gen_probe.c mtd/drivers/mtd/chips/gen_probe.c
--- mtd.orig/drivers/mtd/chips/gen_probe.c	2004-08-14 18:00:11.000000000 -0400
+++ mtd/drivers/mtd/chips/gen_probe.c	2004-10-19 16:42:11.000000000 -0400
@@ -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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-21 16:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-19 21:03 [PATCH] Interleave order while probing Scott Wood
2004-10-20 23:39 ` Christopher Hoover
2004-10-21  0:11   ` Nicolas Pitre
2004-10-21 16:04     ` Scott Wood
2004-10-21 16:15       ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox