mtd/drivers/mtd/maps lubbock-flash.c,1.11,1.12

Nicolas Pitre nico at infradead.org
Thu Jun 3 00:11:19 EDT 2004


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv24307/drivers/mtd/maps

Modified Files:
	lubbock-flash.c 
Log Message:
enable cached flash access on Lubbock


Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- lubbock-flash.c	30 Apr 2004 15:28:33 -0000	1.11
+++ lubbock-flash.c	3 Jun 2004 04:11:16 -0000	1.12
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/dma-mapping.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
@@ -27,12 +28,19 @@
 
 #define WINDOW_SIZE 	64*1024*1024
 
+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);
+}
+
 static struct map_info lubbock_maps[2] = { {
 	.size =		WINDOW_SIZE,
 	.phys =		0x00000000,
+	.inval_cache = 	lubbock_map_inval_cache,
 }, {
 	.size =		WINDOW_SIZE,
 	.phys =		0x04000000,
+	.inval_cache = 	lubbock_map_inval_cache,
 } };
 
 static struct mtd_partition lubbock_partitions[] = {
@@ -81,6 +89,11 @@
 				ret = -ENOMEM;
 			continue;
 		}
+		lubbock_maps[i].cached = __ioremap(lubbock_maps[i].phys,
+						   WINDOW_SIZE,
+						   L_PTE_CACHEABLE, 1);
+		if (!lubbock_maps[i].cached)
+			printk(KERN_WARNING "Failed to ioremap cached %s\n", lubbock_maps[i].name);
 		simple_map_init(&lubbock_maps[i]);
 
 		printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit buswidth)\n",
@@ -91,6 +104,8 @@
 		
 		if (!mymtds[i]) {
 			iounmap((void *)lubbock_maps[i].virt);
+			if (lubbock_maps[i].cached)
+				iounmap(lubbock_maps[i].cached);
 			if (!ret)
 				ret = -EIO;
 			continue;
@@ -137,6 +152,8 @@
 
 		map_destroy(mymtds[i]);
 		iounmap((void *)lubbock_maps[i].virt);
+		if (lubbock_maps[i].cached)
+			iounmap(lubbock_maps[i].cached);
 
 		if (parsed_parts[i])
 			kfree(parsed_parts[i]);





More information about the linux-mtd-cvs mailing list