summaryrefslogtreecommitdiffstats
path: root/linux-2.4.x/drivers/mtd/maps/mbx860.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-2.4.x/drivers/mtd/maps/mbx860.c')
-rw-r--r--linux-2.4.x/drivers/mtd/maps/mbx860.c96
1 files changed, 26 insertions, 70 deletions
diff --git a/linux-2.4.x/drivers/mtd/maps/mbx860.c b/linux-2.4.x/drivers/mtd/maps/mbx860.c
index d4ace26..06b1187 100644
--- a/linux-2.4.x/drivers/mtd/maps/mbx860.c
+++ b/linux-2.4.x/drivers/mtd/maps/mbx860.c
@@ -1,11 +1,11 @@
/*
- * $Id: mbx860.c,v 1.1 2001/11/18 19:43:09 dwmw2 Exp $
+ * $Id: mbx860.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $
*
* Handle mapping of the flash on MBX860 boards
*
* Author: Anton Todorov
* Copyright: (C) 2001 Emness Technology
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/init.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
@@ -36,91 +37,46 @@
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
- { name: "MBX flash BOOT partition",
- offset: 0,
- size: BOOT_PARTITION_SIZE_KiB*1024 },
- { name: "MBX flash DATA partition",
- offset: BOOT_PARTITION_SIZE_KiB*1024,
- size: (KERNEL_PARTITION_SIZE_KiB)*1024 },
- { name: "MBX flash APPLICATION partition",
- offset: (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
+ { .name = "MBX flash BOOT partition",
+ .offset = 0,
+ .size = BOOT_PARTITION_SIZE_KiB*1024 },
+ { .name = "MBX flash DATA partition",
+ .offset = BOOT_PARTITION_SIZE_KiB*1024,
+ .size = (KERNEL_PARTITION_SIZE_KiB)*1024 },
+ { .name = "MBX flash APPLICATION partition",
+ .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
};
-
-
-static struct mtd_info *mymtd;
-
-__u8 mbx_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-__u16 mbx_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-__u32 mbx_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-void mbx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-void mbx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-void mbx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-void mbx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-void mbx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
+static struct mtd_info *mymtd;
struct map_info mbx_map = {
- name: "MBX flash",
- size: WINDOW_SIZE,
- buswidth: 4,
- read8: mbx_read8,
- read16: mbx_read16,
- read32: mbx_read32,
- copy_from: mbx_copy_from,
- write8: mbx_write8,
- write16: mbx_write16,
- write32: mbx_write32,
- copy_to: mbx_copy_to
+ .name = "MBX flash",
+ .size = WINDOW_SIZE,
+ .phys = WINDOW_ADDR,
+ .bankwidth = 4,
};
int __init init_mbx(void)
{
- printk(KERN_NOTICE "Motorola MBX flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
- mbx_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
+ printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR);
+ mbx_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
- if (!mbx_map.map_priv_1) {
+ if (!mbx_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&mbx_map);
+
mymtd = do_map_probe("jedec_probe", &mbx_map);
if (mymtd) {
- mymtd->module = THIS_MODULE;
+ mymtd->owner = THIS_MODULE;
add_mtd_device(mymtd);
add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
return 0;
}
- iounmap((void *)mbx_map.map_priv_1);
+ iounmap((void *)mbx_map.virt);
return -ENXIO;
}
@@ -130,9 +86,9 @@ static void __exit cleanup_mbx(void)
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (mbx_map.map_priv_1) {
- iounmap((void *)mbx_map.map_priv_1);
- mbx_map.map_priv_1 = 0;
+ if (mbx_map.virt) {
+ iounmap((void *)mbx_map.virt);
+ mbx_map.virt = 0;
}
}