[PATCH][CFI] Wrong cache invalidation bug fix

massimo cirillo maxcir at gmail.com
Thu Dec 13 05:54:03 EST 2007


Hi David,

Could you please apply the patch? It has been tested and acknowledged
by Nicolas and Jörn.

Description
This patch fixes improper setting of cache invalidation regions and
solves the issue of data corrupting.

Signed-off-by: Massimo Cirillo <maxcir at gmail.com>
Signed-off-by: Giuseppe D'Eliseo <giuseppedeliseo at gmail.com>
Acked-by: Nicolas Pitre <nico at cam.org>
Acked-by: 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-11-16
19:14:27.000000000 +0100
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c       2007-12-05
10:45:20.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);
------

2007/12/4, Jörn Engel <joern at logfs.org>:
> On Mon, 3 December 2007 12:12:37 -0500, Nicolas Pitre wrote:
> >
> > With that change you can add "Acked-by: Nicolas Pitre <nico at cam.org>".
>
> Mine as well, if you feel so inclined.
>
> Jörn
>
> --
> Beware of bugs in the above code; I have only proved it correct, but
> not tried it.
> -- Donald Knuth
>



More information about the linux-mtd mailing list