[PATCH][CFI] Wrong cache invalidation bug fix

Alexey Korolev akorolev at infradead.org
Fri Jan 11 05:50:03 EST 2008


Hi David,

Please include patch from Massimo? It fixes bad dug in CFI driver.

Thanks,
Alexey







Signed-off-by Massimo Cirillo <maxcir at gmail.com> and Giuseppe D'Eliseo
<giuseppedeliseo at gmail.com>
Acked-by: Nicolas Pitre <nico at cam.org> and Jörn Engel <joern at logfs.org>

------
diff -aur a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
--- a/drivers/mtd/chips/cfi_cmdset_0001.c       2007-12-05 10:45:20.000000000 +0100
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c       2007-11-16 19:14:27.000000000 +0100
@@ -1486,9 +1486,12 @@
       int ret, wbufsize, word_gap, words;
       const struct kvec *vec;
       unsigned long vec_seek;
+       unsigned long initial_adr;
+       int initial_len=len;

       wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
       adr += chip->start;
+       initial_adr = adr;
       cmd_adr = adr & ~(wbufsize-1);

       /* Let's determine this according to the interleave only once */
@@ -1501,7 +1504,7 @@
               return ret;
       }

-       XIP_INVAL_CACHED_RANGE(map, adr, len);
+       XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
       ENABLE_VPP(map);
       xip_disable(map, chip, cmd_adr);

@@ -1592,7 +1595,7 @@
       chip->state = FL_WRITING;

       ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
-                                  adr, len,
+                                  initial_adr, initial_len,
                                  chip->buffer_write_time);
       if (ret) {
               map_write(map, CMD(0x70), cmd_adr);
---------------


More information about the linux-mtd mailing list