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 Joern Engel <joern@wohnheim.fh-wedel.de>
11 #include <linux/module.h>
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/kernel.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/map.h>
18 #include <linux/mtd/partitions.h>
22 static struct map_info mtx1_map = {
23 .name = "MTX-1 flash",
29 static struct mtd_partition mtx1_partitions[] = {
37 .offset = MTDPART_OFS_APPEND,
38 .mask_flags = MTD_WRITEABLE,
42 .offset = MTDPART_OFS_APPEND,
46 .offset = MTDPART_OFS_APPEND,
50 static struct mtd_info *mtx1_mtd;
52 int __init mtx1_mtd_init(void)
56 simple_map_init(&mtx1_map);
58 mtx1_map.virt = ioremap(mtx1_map.phys, mtx1_map.size);
62 mtx1_mtd = do_map_probe("cfi_probe", &mtx1_map);
66 mtx1_mtd->owner = THIS_MODULE;
68 ret = add_mtd_partitions(mtx1_mtd, mtx1_partitions,
69 ARRAY_SIZE(mtx1_partitions));
76 iounmap(mtx1_map.virt);
80 static void __exit mtx1_mtd_cleanup(void)
83 del_mtd_partitions(mtx1_mtd);
84 map_destroy(mtx1_mtd);
87 iounmap(mtx1_map.virt);
90 module_init(mtx1_mtd_init);
91 module_exit(mtx1_mtd_cleanup);
93 MODULE_AUTHOR("Bruno Randolf <bruno.randolf@4g-systems.biz>");
94 MODULE_DESCRIPTION("MTX-1 flash map");
95 MODULE_LICENSE("GPL");