AMD flash problems

Rune Torgersen runet at innovsys.com
Mon Mar 28 17:48:42 EST 2005


Hi

I have a AMD 29LV640 flash (16bit) that behaves incorrectly with mtd.

When doing erase or programming, the cfi mtd functions return too early.

I can especially see this when usiong flash_eraseall -j /dev/mtd5

The erase returns too quicly, so that every other sector is erased.

I tracked it down to the chiplevel, where it seems that this particular
AMD chip doesn't always toggle the toggle bits, causion chip_ready() to
retturn true, and the erase (or program_onw_word) functions to think
they are ready.

Only way I could get it to work correctly, was to add an extra read when
chip_ready() returns, to see if the data is what it should be (all FF's
on erase or actual data when programming one word)

This is what I did (and I think this should be done for all chips, adds
an extra check that everything went ok)

--- tmp/drivers/mtd/chips/cfi_cmdset_0002.c     2005-03-28
16:41:30.438298024 -0600
+++ linux-innsys/drivers/mtd/chips/cfi_cmdset_0002.c    2005-03-28
16:45:21.000000000 -0600
@@ -764,7 +764,7 @@ static int do_write_oneword(struct map_i
                        continue;
                }

-               if (chip_ready(map, adr))
+               if (chip_ready(map, adr) && map_word_equal(map, datum,
map_read(map, adr)))
                        goto op_done;

                if (time_after(jiffies, timeo))
@@ -1220,8 +1220,11 @@ static inline int do_erase_oneblock(stru
 {
        struct cfi_private *cfi = map->fldrv_priv;
        unsigned long timeo = jiffies + HZ;
+       map_word all_ones;
        DECLARE_WAITQUEUE(wait, current);
-       int ret = 0;
+       int ret = 0;
+
+       memset(all_ones.x, 0xff, map->bankwidth);

        adr += chip->start;

@@ -1271,7 +1274,7 @@ static inline int do_erase_oneblock(stru
                        chip->erase_suspended = 0;
                }

-               if (chip_ready(map, adr))
+               if (chip_ready(map, adr) && map_word_equal(map,
all_ones, map_read(map,adr)))
                        goto op_done;

                if (time_after(jiffies, timeo))


Rune Torgersen
System Developer
Innovative Systems LLC
1000 Innovative Drive
Mitchell, SD 57301
Ph: 605-995-6120
www.innovsys.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amd_flash_patch
Type: application/octet-stream
Size: 991 bytes
Desc: amd_flash_patch
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20050328/1bc34618/attachment.obj 


More information about the linux-mtd mailing list