[ARM] 4554/1: replace consistent_sync() with flush_ioremap_region()
authorJared Hulbert <jaredeh@gmail.com>
Wed, 22 Aug 2007 16:38:25 +0000 (17:38 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 23 Aug 2007 11:31:31 +0000 (12:31 +0100)
This fixes a regression from around 2.6.18, consistent_sync() will now BUG()
under these circumstances.  The use of consistent_sync() was a hack, replacing
it's usage here with a new function, flush_ioremap_region().

Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/mtd/maps/lubbock-flash.c
drivers/mtd/maps/mainstone-flash.c
include/asm-arm/cacheflush.h

index 1aa0447c5e66a2430ec9dd42bf5b86fba8549f16..e8560683b97352d05dab82624a820ebc9cb3019e 100644 (file)
@@ -15,9 +15,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/slab.h>
 
-#include <linux/dma-mapping.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
@@ -26,7 +24,7 @@
 #include <asm/hardware.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/lubbock.h>
-
+#include <asm/cacheflush.h>
 
 #define ROM_ADDR       0x00000000
 #define FLASH_ADDR     0x04000000
@@ -35,7 +33,7 @@
 
 static void lubbock_map_inval_cache(struct map_info *map, unsigned long from, ssize_t len)
 {
-       consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
+       flush_ioremap_region(map->phys, map->cached, from, len);
 }
 
 static struct map_info lubbock_maps[2] = { {
index eaa4bbb868a32855adef0adcb9e7f4ca7d492f2d..d76487d82dcdc4259d14554692a5e7e4f0c4ada2 100644 (file)
@@ -15,8 +15,6 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/dma-mapping.h>
-#include <linux/slab.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
@@ -26,6 +24,7 @@
 #include <asm/hardware.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/mainstone.h>
+#include <asm/cacheflush.h>
 
 
 #define ROM_ADDR       0x00000000
@@ -36,7 +35,7 @@
 static void mainstone_map_inval_cache(struct map_info *map, unsigned long from,
                                      ssize_t len)
 {
-       consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
+       flush_ioremap_region(map->phys, map->cached, from, len);
 }
 
 static struct map_info mainstone_maps[2] = { {
index d1294a46c70c62237c9d0e266d90c645f1182bf0..6c1c968b298709069878bccde03fb7b6cc8dbdc2 100644 (file)
@@ -426,6 +426,13 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
  */
 #define flush_icache_page(vma,page)    do { } while (0)
 
+static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
+       unsigned offset, size_t size)
+{
+       const void *start = (void __force *)virt + offset;
+       dmac_inv_range(start, start + size);
+}
+
 #define __cacheid_present(val)                 (val != read_cpuid(CPUID_ID))
 #define __cacheid_type_v7(val)                 ((val & (7 << 29)) == (4 << 29))