Linux 2.6.20.7
[linux/fpc-iii.git] / drivers / mtd / maps / rpxlite.c
blob809a0c8e7aaf7c0fd2a1b5d8d12536f6aadd7eb1
1 /*
2 * $Id: rpxlite.c,v 1.22 2004/11/04 13:24:15 gleixner Exp $
4 * Handle mapping of the flash on the RPX Lite and CLLF boards
5 */
7 #include <linux/module.h>
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <asm/io.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/map.h>
16 #define WINDOW_ADDR 0xfe000000
17 #define WINDOW_SIZE 0x800000
19 static struct mtd_info *mymtd;
21 static struct map_info rpxlite_map = {
22 .name = "RPX",
23 .size = WINDOW_SIZE,
24 .bankwidth = 4,
25 .phys = WINDOW_ADDR,
28 int __init init_rpxlite(void)
30 printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
31 rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
33 if (!rpxlite_map.virt) {
34 printk("Failed to ioremap\n");
35 return -EIO;
37 simple_map_init(&rpxlite_map);
38 mymtd = do_map_probe("cfi_probe", &rpxlite_map);
39 if (mymtd) {
40 mymtd->owner = THIS_MODULE;
41 add_mtd_device(mymtd);
42 return 0;
45 iounmap((void *)rpxlite_map.virt);
46 return -ENXIO;
49 static void __exit cleanup_rpxlite(void)
51 if (mymtd) {
52 del_mtd_device(mymtd);
53 map_destroy(mymtd);
55 if (rpxlite_map.virt) {
56 iounmap((void *)rpxlite_map.virt);
57 rpxlite_map.virt = 0;
61 module_init(init_rpxlite);
62 module_exit(cleanup_rpxlite);
64 MODULE_LICENSE("GPL");
65 MODULE_AUTHOR("Arnold Christensen <AKC@pel.dk>");
66 MODULE_DESCRIPTION("MTD map driver for RPX Lite and CLLF boards");