Preliminary ADM5120 support, marked as broken
[openwrt.git] / target / linux / adm5120-2.6 / files / drivers / mtd / maps / adm5120_mtd.c
1 /*
2  *      Flash device on the ADM5120 board
3  *
4  *      Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005
5  *
6  *      This program is free software; you can redistribute it and/or
7  *      modify it under the terms of the GNU General Public License version
8  *      2 as published by the Free Software Foundation.
9  */
10
11 #include <linux/autoconf.h>
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/map.h>
16
17 #define FLASH_PHYS_ADDR         0x1FC00000
18 #define FLASH_SIZE              0x200000  
19
20 static struct mtd_info *adm5120_mtd;
21
22 static struct map_info adm5120_mtd_map = {
23         .name = "ADM5120",
24         .size = FLASH_SIZE,
25         .bankwidth = 2,
26         .phys = FLASH_PHYS_ADDR,
27 };
28
29 static int __init adm5120_mtd_init(void)
30 {
31         printk(KERN_INFO "ADM5120 board flash (0x%x at 0x%x)\n", FLASH_SIZE,
32             FLASH_PHYS_ADDR);
33         adm5120_mtd_map.virt = ioremap_nocache(FLASH_PHYS_ADDR, FLASH_SIZE);
34         simple_map_init(&adm5120_mtd_map);
35         adm5120_mtd = do_map_probe("cfi_probe", &adm5120_mtd_map);
36         if (adm5120_mtd) {
37                 adm5120_mtd->owner = THIS_MODULE;
38                 add_mtd_device(adm5120_mtd);
39                 return 0;
40         }
41         return -ENXIO;
42 }
43
44 static void __exit adm5120_mtd_exit(void)
45 {
46         del_mtd_device(adm5120_mtd);
47         map_destroy(adm5120_mtd);
48 }
49
50 module_init(adm5120_mtd_init);
51 module_exit(adm5120_mtd_exit);
52
53 MODULE_LICENSE("GPL");
54 MODULE_AUTHOR("Jeroen Vreeken (pe1rxq@amsat.org)");
55 MODULE_DESCRIPTION("MTD map driver for ADM5120 boards");