* [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
* RE: [PATCH] Interleave order while probing
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
0 siblings, 1 reply; 5+ messages in thread
From: Christopher Hoover @ 2004-10-20 23:39 UTC (permalink / raw)
To: 'Scott Wood', linux-mtd
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Interleave order while probing
2004-10-20 23:39 ` Christopher Hoover
@ 2004-10-21 0:11 ` Nicolas Pitre
2004-10-21 16:04 ` Scott Wood
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Pitre @ 2004-10-21 0:11 UTC (permalink / raw)
To: Christopher Hoover; +Cc: 'Scott Wood', linux-mtd
On Wed, 20 Oct 2004, Christopher Hoover wrote:
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Interleave order while probing
2004-10-21 0:11 ` Nicolas Pitre
@ 2004-10-21 16:04 ` Scott Wood
2004-10-21 16:15 ` Nicolas Pitre
0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2004-10-21 16:04 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Christopher Hoover, 'Scott Wood', linux-mtd
On Wed, Oct 20, 2004 at 08:11:37PM -0400, Nicolas Pitre wrote:
> On Wed, 20 Oct 2004, Christopher Hoover wrote:
>
> > > 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".
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Interleave order while probing
2004-10-21 16:04 ` Scott Wood
@ 2004-10-21 16:15 ` Nicolas Pitre
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Pitre @ 2004-10-21 16:15 UTC (permalink / raw)
To: Scott Wood; +Cc: Christopher Hoover, linux-mtd
On Thu, 21 Oct 2004, Scott Wood wrote:
> > 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
^ 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