Found a potential bug in MTD

Frederic Giasson fgiasson at
Tue May 29 14:38:48 EDT 2001

-----Original Message-----
From: David Woodhouse [mailto:dwmw2 at]
Sent: Tuesday, May 29, 2001 2:26 PM
To: Frederic Giasson
Cc: linux-mtd at
Subject: Re: Found a potential bug in MTD 

fgiasson at said:
> 	I compiled and tested the change with my board, and it works OK.  It
> also make sense since CFI_DEVICETYPE_X8 is an hardcoded value for 8
> bits type devices, and cfi->device_type holds the buswidth specified
> in xconfig. 

The addr_unlock values set in cfi_probe_chip() are supposed to compensate
for that. We can't do it by shifting by the device_type, because sometimes 
we need to put an odd address value on the bus for 16-bit chips. 

But the actual _detection_ of CFI chips shouldn't be affected by that 
anyway, unless it's falling back to the JEDEC probe.


	Maybe but the actual code does not work if you specify a 1x16
geometry with an actual single 16 bits chip on the memory bus.  Also, either
specifying 2x8 geometry or letting MTD autodetect the geometry leads to a
wrong sector organization detection on my board.  I don't know know if it is
the case with other board with 16 bits flash on it (does somebody else
already experienced that problem?), but with 2x8 I come out with bad sizes
and of course bad offset for my sectors.

	I understand that one may want to address a byte at a time, but many
flash chips has a pin called BYTE to specify byte (8 bits) or word (16 bits)
addressing.  If BYTE is set to 8 bits, then it serves nothing to wire all 16
I/O pins because all MSB pins would be don't care.  If it has not been done
yet, maybe someone should check in CFI standard specifications to see if
this is right.  

	But despite of that, doesn't cfi->device_type hold the right
devicetype specified by xconfig?  If someone wants to address the chip in
byte mode, then he will be able to do so (as if CFI_DEVICETYPE_X8 would have
been hardcoded), and if 16 bits (word mode) is specified in xconfig, then it
will work right too.  What do you think?

More information about the linux-mtd mailing list