Found a potential bug in MTD

Frederic Giasson fgiasson at mediatrix.com
Tue May 29 14:05:53 EDT 2001


Hi,

	I did as it is said in document
ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/mtd/mtd-jffs/HOWTO.txt to add MTD
support in linux kernel 2.4.4 for my PowerPC MPC860 embedded platform.  I
have a single flash chip on by board, an ATMEL AT49BV1614, which has a 2MB
capacity.  So I configured xconfig with CFI support ( since I had found that
my atmel chip was CFI compliant ) and geometry 1x16 but the MTD driver
didn't detect the flash.  Then I tryed not to specify the geometry of my
flash chip, and two 8-bits chips ( 2x8 geometry ) was detected.  At this
point, I began suspecting a bug in the cfi_probe.c functions, which I
tracked down and found (at least, I think).  

	In /mtd/chips/cfi_probe.c, function cfi_qry_mode( ).  Calls to
function cfi_send_gen that read as:
 
		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map,
cfi->interleave, CFI_DEVICETYPE_X8, NULL);
		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map,
cfi->interleave, CFI_DEVICETYPE_X8, NULL);
		cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map,
cfi->interleave, CFI_DEVICETYPE_X8, NULL);
 
should, in my opinion, read like:
		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map,
cfi->interleave, cfi->device_type, NULL);
		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map,
cfi->interleave, cfi->device_type, NULL);
		cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map,
cfi->interleave, cfi->device_type, NULL);   

	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.

	Please come back to me on that. 

Best regards,

Frédéric Giasson








More information about the linux-mtd mailing list