This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / mtd / maps / map_funcs.c
index 38f6a7a..4bb4af6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: map_funcs.c,v 1.9 2004/07/13 22:33:15 dwmw2 Exp $
+ * $Id: map_funcs.c,v 1.2 2003/05/21 15:15:07 dwmw2 Exp $
  *
  * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS
  * is enabled.
@@ -7,35 +7,87 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <asm/io.h>
 
 #include <linux/mtd/map.h>
+#include <linux/mtd/cfi.h>
 
-static map_word simple_map_read(struct map_info *map, unsigned long ofs)
+static u8 simple_map_read8(struct map_info *map, unsigned long ofs)
 {
-       return inline_map_read(map, ofs);
+       return __raw_readb(map->virt + ofs);
 }
 
-static void simple_map_write(struct map_info *map, const map_word datum, unsigned long ofs)
+static u16 simple_map_read16(struct map_info *map, unsigned long ofs)
 {
-       inline_map_write(map, datum, ofs);
+       return __raw_readw(map->virt + ofs);
+}
+
+static u32 simple_map_read32(struct map_info *map, unsigned long ofs)
+{
+       return __raw_readl(map->virt + ofs);
+}
+
+static u64 simple_map_read64(struct map_info *map, unsigned long ofs)
+{
+#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
+       BUG();
+       return 0;
+#else
+       return __raw_readll(map->virt + ofs);
+#endif
+}
+
+static void simple_map_write8(struct map_info *map, u8 datum, unsigned long ofs)
+{
+       __raw_writeb(datum, map->virt + ofs);
+       mb();
+}
+
+static void simple_map_write16(struct map_info *map, u16 datum, unsigned long ofs)
+{
+       __raw_writew(datum, map->virt + ofs);
+       mb();
+}
+
+static void simple_map_write32(struct map_info *map, u32 datum, unsigned long ofs)
+{
+       __raw_writel(datum, map->virt + ofs);
+       mb();
+}
+
+static void simple_map_write64(struct map_info *map, u64 datum, unsigned long ofs)
+{
+#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
+       BUG();
+#else
+       __raw_writell(datum, map->virt + ofs);
+       mb();
+#endif /* CFI_B8 */
 }
 
 static void simple_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
 {
-       inline_map_copy_from(map, to, from, len);
+       memcpy_fromio(to, map->virt + from, len);
 }
 
 static void simple_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
 {
-       inline_map_copy_to(map, to, from, len);
+       memcpy_toio(map->virt + to, from, len);
 }
 
 void simple_map_init(struct map_info *map)
 {
-       BUG_ON(!map_bankwidth_supported(map->bankwidth));
-
-       map->read = simple_map_read;
-       map->write = simple_map_write;
+       map->read8 = simple_map_read8;
+       map->read16 = simple_map_read16;
+       map->read32 = simple_map_read32;
+       map->read64 = simple_map_read64;
+       map->write8 = simple_map_write8;
+       map->write16 = simple_map_write16;
+       map->write32 = simple_map_write32;
+       map->write64 = simple_map_write64;
        map->copy_from = simple_map_copy_from;
        map->copy_to = simple_map_copy_to;
 }