Concurrency erase/write on the same AMD chip with not aligned words

Stefano Babic stefano.babic at
Tue Aug 5 06:12:08 EDT 2003

Hi all,

I have seen a problem when I am writing not-aligned words on AMD chips
while on the same chip another process starts an erase procedure for
other sectors or a different MTD device. 

I have tested with the cfi_cmdset_0002.c v.1.75 and I have found the
problem in the cfi_amstd_write() function.

In fact, when we want to write less that CFIDEV_BUSWIDTH bytes, the
function performs a read/modify/write on the flash with the

        if (ofs & (CFIDEV_BUSWIDTH-1)) {
                map->copy_from(map, tmp_buf, ....

The flash is directly read using the copy_from() function. However, if
another process is currently erasing the same chip (even if it erases on
a different MTD device), we are not allowed to read from flash because
we are reading only the status of the internal state machine (DQ7, DQ6,
DQ5). The resulting read value is wrong and then the write function has
no success (a wrong value is written).

I set the check with the cfi status before the copy_from() as usual with
(mutex omissis):

        if (cfi->chips[chipnum].state != FL_READY) {

to be sure that the chip is not in FL_ERASING and everything is working

Has anybody had the same problem ? 



More information about the linux-mtd mailing list