2 * drivers/mtd/maps/redwood.c
4 * FLASH map for the IBM Redwood 4/5/6 boards.
6 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * 2001-2003 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
19 #include <linux/mtd/mtd.h>
20 #include <linux/mtd/map.h>
21 #include <linux/mtd/partitions.h>
25 #if !defined (CONFIG_REDWOOD_6)
27 #define WINDOW_ADDR 0xffc00000
28 #define WINDOW_SIZE 0x00400000
31 #define RW_PART0_SZ 0x10000
32 #define RW_PART1_OF RW_PART0_SZ
33 #define RW_PART1_SZ 0x200000 - 0x10000
34 #define RW_PART2_OF 0x200000
35 #define RW_PART2_SZ 0x10000
36 #define RW_PART3_OF 0x210000
37 #define RW_PART3_SZ 0x200000 - (0x10000 + 0x20000)
38 #define RW_PART4_OF 0x3e0000
39 #define RW_PART4_SZ 0x20000
41 static struct mtd_partition redwood_flash_partitions
[] = {
43 .name
= "Redwood OpenBIOS Vital Product Data",
44 .offset
= RW_PART0_OF
,
46 .mask_flags
= MTD_WRITEABLE
/* force read-only */
49 .name
= "Redwood kernel",
50 .offset
= RW_PART1_OF
,
54 .name
= "Redwood OpenBIOS non-volatile storage",
55 .offset
= RW_PART2_OF
,
57 .mask_flags
= MTD_WRITEABLE
/* force read-only */
60 .name
= "Redwood filesystem",
61 .offset
= RW_PART3_OF
,
65 .name
= "Redwood OpenBIOS",
66 .offset
= RW_PART4_OF
,
68 .mask_flags
= MTD_WRITEABLE
/* force read-only */
72 #else /* CONFIG_REDWOOD_6 */
73 /* FIXME: the window is bigger - armin */
74 #define WINDOW_ADDR 0xff800000
75 #define WINDOW_SIZE 0x00800000
78 #define RW_PART0_SZ 0x400000 /* 4 MiB data */
79 #define RW_PART1_OF RW_PART0_OF + RW_PART0_SZ
80 #define RW_PART1_SZ 0x10000 /* 64K VPD */
81 #define RW_PART2_OF RW_PART1_OF + RW_PART1_SZ
82 #define RW_PART2_SZ 0x400000 - (0x10000 + 0x20000)
83 #define RW_PART3_OF RW_PART2_OF + RW_PART2_SZ
84 #define RW_PART3_SZ 0x20000
86 static struct mtd_partition redwood_flash_partitions
[] = {
88 .name
= "Redwood filesystem",
89 .offset
= RW_PART0_OF
,
93 .name
= "Redwood OpenBIOS Vital Product Data",
94 .offset
= RW_PART1_OF
,
96 .mask_flags
= MTD_WRITEABLE
/* force read-only */
99 .name
= "Redwood kernel",
100 .offset
= RW_PART2_OF
,
104 .name
= "Redwood OpenBIOS",
105 .offset
= RW_PART3_OF
,
107 .mask_flags
= MTD_WRITEABLE
/* force read-only */
111 #endif /* CONFIG_REDWOOD_6 */
113 struct map_info redwood_flash_map
= {
114 .name
= "IBM Redwood",
121 #define NUM_REDWOOD_FLASH_PARTITIONS ARRAY_SIZE(redwood_flash_partitions)
123 static struct mtd_info
*redwood_mtd
;
125 static int __init
init_redwood_flash(void)
129 printk(KERN_NOTICE
"redwood: flash mapping: %x at %x\n",
130 WINDOW_SIZE
, WINDOW_ADDR
);
132 redwood_flash_map
.virt
= ioremap(WINDOW_ADDR
, WINDOW_SIZE
);
134 if (!redwood_flash_map
.virt
) {
135 printk("init_redwood_flash: failed to ioremap\n");
138 simple_map_init(&redwood_flash_map
);
140 redwood_mtd
= do_map_probe("cfi_probe",&redwood_flash_map
);
143 redwood_mtd
->owner
= THIS_MODULE
;
144 err
= add_mtd_partitions(redwood_mtd
,
145 redwood_flash_partitions
,
146 NUM_REDWOOD_FLASH_PARTITIONS
);
148 printk("init_redwood_flash: add_mtd_partitions failed\n");
149 iounmap(redwood_flash_map
.virt
);
155 iounmap(redwood_flash_map
.virt
);
159 static void __exit
cleanup_redwood_flash(void)
162 del_mtd_partitions(redwood_mtd
);
163 /* moved iounmap after map_destroy - armin */
164 map_destroy(redwood_mtd
);
165 iounmap((void *)redwood_flash_map
.virt
);
169 module_init(init_redwood_flash
);
170 module_exit(cleanup_redwood_flash
);
172 MODULE_LICENSE("GPL");
173 MODULE_AUTHOR("MontaVista Software <source@mvista.com>");
174 MODULE_DESCRIPTION("MTD map driver for the IBM Redwood reference boards");