[package] base-files: format hexdump output instead of using awk for sysupgrade
[openwrt.git] / target / linux / rdc / files-2.6.28 / drivers / mtd / maps / r8610.c
1 /*
2 * Flash memory access on RDC R8610 Evaluation board
3 *
4 * (C) 2009, Florian Fainelli
5 */
6
7 #include <linux/init.h>
8 #include <linux/module.h>
9 #include <linux/types.h>
10 #include <linux/kernel.h>
11
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/map.h>
14 #include <linux/mtd/partitions.h>
15
16 #include <asm/io.h>
17
18 static struct map_info r8610_map = {
19 .name = "r8610",
20 .size = CONFIG_MTD_RDC3210_SIZE,
21 .bankwidth = CONFIG_MTD_RDC3210_BUSWIDTH,
22 };
23
24 static struct mtd_partition r8610_partitions[] = {
25 {
26 .name = "Kernel",
27 .size = 0x001f0000,
28 .offset = 0
29 },{
30 .name = "Config",
31 .size = 0x10000,
32 .offset = MTDPART_OFS_APPEND,
33 },{
34 .name = "Initrd",
35 .size = 0x1E0000,
36 .offset = MTDPART_OFS_APPEND,
37 },{
38 .name = "Redboot",
39 .size = 0x20000,
40 .offset = MTDPART_OFS_APPEND,
41 .mask_flags = MTD_WRITEABLE
42 }
43 };
44
45 static struct mtd_info *mymtd;
46
47 int __init r8610_mtd_init(void)
48 {
49 struct mtd_partition *parts;
50 int nb_parts = 0;
51
52 /*
53 * Static partition definition selection
54 */
55 parts = r8610_partitions;
56 nb_parts = ARRAY_SIZE(r8610_partitions);
57
58 /*
59 * Now let's probe for the actual flash. Do it here since
60 * specific machine settings might have been set above.
61 */
62 r8610_map.phys = -r8610_map.size;
63 printk(KERN_NOTICE "r8610: flash device: %lx at %x\n", r8610_map.size, r8610_map.phys);
64
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");
68 return -EIO;
69 }
70
71 mymtd = do_map_probe("cfi_probe", &r8610_map);
72 if (!mymtd) {
73 iounmap(r8610_map.virt);
74 return -ENXIO;
75 }
76 mymtd->owner = THIS_MODULE;
77
78 add_mtd_partitions(mymtd, parts, nb_parts);
79
80 return 0;
81 }
82
83 static void __exit r8610_mtd_cleanup(void)
84 {
85 if (mymtd) {
86 del_mtd_partitions(mymtd);
87 map_destroy(mymtd);
88 iounmap(r8610_map.virt);
89 }
90 }
91
92 module_init(r8610_mtd_init);
93 module_exit(r8610_mtd_cleanup);
94
95 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
96 MODULE_DESCRIPTION("RDC R8610 MTD driver");
97 MODULE_LICENSE("GPL");
This page took 0.047425 seconds and 5 git commands to generate.