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>
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>
23 static struct map_info mtx1_map = {
24 .name = "MTX-1 flash",
30 static struct mtd_partition mtx1_partitions[] = {
38 .offset = MTDPART_OFS_APPEND,
39 .mask_flags = MTD_WRITEABLE,
43 .offset = MTDPART_OFS_APPEND,
47 .offset = MTDPART_OFS_APPEND,
51 static struct mtd_info *mtx1_mtd;
53 int __init mtx1_mtd_init(void)
57 simple_map_init(&mtx1_map);
59 mtx1_map.virt = ioremap(mtx1_map.phys, mtx1_map.size);
63 mtx1_mtd = do_map_probe("cfi_probe", &mtx1_map);
67 mtx1_mtd->owner = THIS_MODULE;
69 ret = add_mtd_partitions(mtx1_mtd, mtx1_partitions,
70 ARRAY_SIZE(mtx1_partitions));
77 iounmap(mtx1_map.virt);
81 static void __exit mtx1_mtd_cleanup(void)
84 del_mtd_partitions(mtx1_mtd);
85 map_destroy(mtx1_mtd);
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");