mtd/include/linux/mtd map.h,1.36,1.37

Nicolas Pitre nico at infradead.org
Thu Jun 3 00:10:25 EDT 2004


Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24269/include/linux/mtd

Modified Files:
	map.h 
Log Message:
default cached access for map drivers.


Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- map.h	3 Jun 2004 02:08:41 -0000	1.36
+++ map.h	3 Jun 2004 04:10:22 -0000	1.37
@@ -55,6 +55,9 @@
 	void (*write64)(struct map_info *, u64, unsigned long);
 	void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);
 
+	/* We can perhaps put in 'point' and 'unpoint' methods, if we really
+	   want to enable XIP for non-linear mappings. Not yet though. */
+#endif
 	/* It's possible for the map driver to use cached memory in its
 	   copy_from implementation (and _only_ with copy_from).  However,
 	   when the chip driver knows some flash area has changed contents,
@@ -63,9 +66,6 @@
 	   If there is no cache to care about this can be set to NULL. */
 	void (*inval_cache)(struct map_info *, unsigned long, ssize_t);
 
-	/* We can perhaps put in 'point' and 'unpoint' methods, if we really
-	   want to enable XIP for non-linear mappings. Not yet though. */
-#endif
 	/* set_vpp() must handle being reentered -- enable, enable, disable 
 	   must leave it enabled. */
 	void (*set_vpp)(struct map_info *, int);
@@ -167,7 +167,10 @@
 
 static inline void map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
 {
-	memcpy_fromio(to, map->virt + from, len);
+	if (map->cached)
+		memcpy(to, (char *)map->cached + from, len);
+	else
+		memcpy_fromio(to, map->virt + from, len);
 }
 
 static inline void map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)





More information about the linux-mtd-cvs mailing list