[PATCH] CFI cmdset_0001 A small fixup of wrong cache invalidation regions.

Korolev, Alexey alexey.korolev at intel.com
Tue Jan 31 11:16:08 EST 2006


Hi all,
 
I found issue in cfi_cmdset0001.c. It related to setting up of cache
regions for invalidating in buffered write porcedure.
Code performs cache invalidation from "cmd_addr" to "cmd_adr + len" in
do_write_buffer function. In fact we modify region from "adr" to
"adr+len". 
The issue affects when you try to write and read data by small chunks.
This case you may catch read errors on SND configurations. 
 
I made fix for it. Please take a look at the patch.
=================================================================
--- b/drivers/mtd/chips/cfi_cmdset_0001.c 2006-01-26 18:59:52.000000000
+0300
+++ a/drivers/mtd/chips/cfi_cmdset_0001.c 2006-01-31 18:56:01.315227496
+0300
@@ -1019,8 +1019,8 @@
 #define XIP_INVAL_CACHED_RANGE(map, from, size)  \
  INVALIDATE_CACHED_RANGE(map, from, size)
 
-#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec)  \
- UDELAY(map, chip, adr, usec)
+#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec)  \
+ UDELAY(map, chip, cmd_adr, usec)
 
 /*
  * Extra notes:
@@ -1052,7 +1052,7 @@
  spin_lock(chip->mutex);  \
 } while (0)
 
-#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec)  \
+#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec)  \
 do {  \
  spin_unlock(chip->mutex);  \
  INVALIDATE_CACHED_RANGE(map, adr, len);  \
@@ -1284,7 +1284,7 @@
  map_write(map, datum, adr);
  chip->state = mode;
 
- INVALIDATE_CACHE_UDELAY(map, chip,
+ INVALIDATE_CACHE_UDELAY(map, chip, adr, 
     adr, map_bankwidth(map),
     chip->word_write_time);
 
@@ -1572,8 +1572,8 @@
  map_write(map, CMD(0xd0), cmd_adr);
  chip->state = FL_WRITING;
 
- INVALIDATE_CACHE_UDELAY(map, chip,
-    cmd_adr, len,
+ INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr,
+    adr, len,
     chip->buffer_write_time);
 
  timeo = jiffies + (HZ/2);
@@ -1749,7 +1749,7 @@
  chip->state = FL_ERASING;
  chip->erase_suspended = 0;
 
- INVALIDATE_CACHE_UDELAY(map, chip,
+ INVALIDATE_CACHE_UDELAY(map, chip, adr,
     adr, len,
     chip->erase_time*1000/2);
 
=====================================================
 
Thanks,
Alexey




More information about the linux-mtd mailing list