[ARM] Support register switch in nommu mode
[linux-2.6/verdex.git] / drivers / mtd / maps / mtx-1_flash.c
blobd1e66e186746bf4116476ae2a8fb17b95660600c
1 /*
2 * Flash memory access on 4G Systems MTX-1 boards
4 * $Id: mtx-1_flash.c,v 1.2 2005/11/07 11:14:27 gleixner Exp $
6 * (C) 2005 Bruno Randolf <bruno.randolf@4g-systems.biz>
7 * (C) 2005 Jörn Engel <joern@wohnheim.fh-wedel.de>
9 */
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/map.h>
19 #include <linux/mtd/partitions.h>
21 #include <asm/io.h>
23 static struct map_info mtx1_map = {
24 .name = "MTX-1 flash",
25 .bankwidth = 4,
26 .size = 0x2000000,
27 .phys = 0x1E000000,
30 static struct mtd_partition mtx1_partitions[] = {
32 .name = "filesystem",
33 .size = 0x01C00000,
34 .offset = 0,
35 },{
36 .name = "yamon",
37 .size = 0x00100000,
38 .offset = MTDPART_OFS_APPEND,
39 .mask_flags = MTD_WRITEABLE,
40 },{
41 .name = "kernel",
42 .size = 0x002c0000,
43 .offset = MTDPART_OFS_APPEND,
44 },{
45 .name = "yamon env",
46 .size = 0x00040000,
47 .offset = MTDPART_OFS_APPEND,
51 static struct mtd_info *mtx1_mtd;
53 int __init mtx1_mtd_init(void)
55 int ret = -ENXIO;
57 simple_map_init(&mtx1_map);
59 mtx1_map.virt = ioremap(mtx1_map.phys, mtx1_map.size);
60 if (!mtx1_map.virt)
61 return -EIO;
63 mtx1_mtd = do_map_probe("cfi_probe", &mtx1_map);
64 if (!mtx1_mtd)
65 goto err;
67 mtx1_mtd->owner = THIS_MODULE;
69 ret = add_mtd_partitions(mtx1_mtd, mtx1_partitions,
70 ARRAY_SIZE(mtx1_partitions));
71 if (ret)
72 goto err;
74 return 0;
76 err:
77 iounmap(mtx1_map.virt);
78 return ret;
81 static void __exit mtx1_mtd_cleanup(void)
83 if (mtx1_mtd) {
84 del_mtd_partitions(mtx1_mtd);
85 map_destroy(mtx1_mtd);
87 if (mtx1_map.virt)
88 iounmap(mtx1_map.virt);
91 module_init(mtx1_mtd_init);
92 module_exit(mtx1_mtd_cleanup);
94 MODULE_AUTHOR("Bruno Randolf <bruno.randolf@4g-systems.biz>");
95 MODULE_DESCRIPTION("MTX-1 flash map");
96 MODULE_LICENSE("GPL");