Fix MTD device probing... (really)

Russell King rmk at arm.linux.org.uk
Mon Jan 24 18:39:41 EST 2005


Fix MTD device probing, trying larger numbers of chips before smaller
numbers of chips across the bus width.

This means we'll avoid misdetecting a 2 x16 array as 1 x32 if the
high 16-bits happen to read as zeros in the QRY area.

--- orig/drivers/mtd/chips/gen_probe.c	Sat Oct 23 11:38:17 2004
+++ linux/drivers/mtd/chips/gen_probe.c	Mon Jan 24 22:54:38 2005
@@ -162,7 +162,7 @@ static int genprobe_new_chip(struct map_
 	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;

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core




More information about the linux-mtd mailing list