2 * Flash memory access on RDC R8610 Evaluation board
4 * (C) 2009, Florian Fainelli
7 #include <linux/init.h>
8 #include <linux/module.h>
9 #include <linux/types.h>
10 #include <linux/kernel.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/map.h>
14 #include <linux/mtd/partitions.h>
18 static struct map_info r8610_map = {
20 .size = CONFIG_MTD_RDC3210_SIZE,
21 .bankwidth = CONFIG_MTD_RDC3210_BUSWIDTH,
24 static struct mtd_partition r8610_partitions[] = {
32 .offset = MTDPART_OFS_APPEND,
36 .offset = MTDPART_OFS_APPEND,
40 .offset = MTDPART_OFS_APPEND,
41 .mask_flags = MTD_WRITEABLE
45 static struct mtd_info *mymtd;
47 int __init r8610_mtd_init(void)
49 struct mtd_partition *parts;
53 * Static partition definition selection
55 parts = r8610_partitions;
56 nb_parts = ARRAY_SIZE(r8610_partitions);
59 * Now let's probe for the actual flash. Do it here since
60 * specific machine settings might have been set above.
62 r8610_map.phys = -r8610_map.size;
63 printk(KERN_NOTICE "r8610: flash device: %lx at %x\n", r8610_map.size, r8610_map.phys);
65 r8610_map.map_priv_1 = (unsigned long)(r8610_map.virt = ioremap_nocache(r8610_map.phys, r8610_map.size));
66 if (!r8610_map.map_priv_1) {
67 printk(KERN_ERR "Failed to ioremap\n");
71 mymtd = do_map_probe("cfi_probe", &r8610_map);
73 iounmap(r8610_map.virt);
76 mymtd->owner = THIS_MODULE;
78 add_mtd_partitions(mymtd, parts, nb_parts);
83 static void __exit r8610_mtd_cleanup(void)
86 del_mtd_partitions(mymtd);
88 iounmap(r8610_map.virt);
92 module_init(r8610_mtd_init);
93 module_exit(r8610_mtd_cleanup);
95 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
96 MODULE_DESCRIPTION("RDC R8610 MTD driver");
97 MODULE_LICENSE("GPL");