Why CFI_DEVICETYPE_X8 in cfi_send_gen_cmd()?

David Vrabel dvrabel at arcom.com
Wed Feb 25 06:08:21 EST 2004


Shawn Jin wrote:
> 
> In cfi_cmdset_0002.c, there is a piece of comment stating that the
> CFI_DEVICETYPE_X8 is needed even when cfi->device_type !=
> CFI_DEVICETYPE_X8. Why is it the case?

It appears to be to handle the case of x16 chips in x8 mode.  In such a 
case the device width is 2, interleave is 1 and buswidth is 1. 
Therefore, cfi_build_cmd_addr() will not generate the correct unlock 
addresses. (i.e., there's no integral solution to 0xaaa = addr * 
device_width (2) * interleave (1) which is the required unlock address.)

Not sure how to handle all possible arrangements of chips.

Dev. width | interleave  | buswidth |   addr1 |   addr2
-------------------------------------------------------
2          | 1           | 2        |   0xaaa |   0x554
2          | 1           | 1        |   0xaaa |   0x555
4          | 2           | 8        |  0x2aa8 |  0x1550

(addr1 and addr2 are byte addresses -- the AMD datasheets typically 
gives word addresses)

> So I replaced CFI_DEVICETYPE_X8 with cfi->device_type in both
> do_erase_oneblock() and do_write_oneword(). I tested and found that erase
> can succeed but write still fails.

Maybe you're using do_write_buffer(..) instead? There's a comment near 
it that says it may well be broken for interleaved chips, though.

David Vrabel
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/




More information about the linux-mtd mailing list