2 * $Id: redwood.c,v 1.11 2005/11/07 11:14:28 gleixner Exp $
4 * drivers/mtd/maps/redwood.c
6 * FLASH map for the IBM Redwood 4/5/6 boards.
8 * Author: MontaVista Software, Inc. <source@mvista.com>
10 * 2001-2003 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
16 #include <linux/config.h>
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/map.h>
24 #include <linux/mtd/partitions.h>
28 #if !defined (CONFIG_REDWOOD_6)
30 #define WINDOW_ADDR 0xffc00000
31 #define WINDOW_SIZE 0x00400000
34 #define RW_PART0_SZ 0x10000
35 #define RW_PART1_OF RW_PART0_SZ
36 #define RW_PART1_SZ 0x200000 - 0x10000
37 #define RW_PART2_OF 0x200000
38 #define RW_PART2_SZ 0x10000
39 #define RW_PART3_OF 0x210000
40 #define RW_PART3_SZ 0x200000 - (0x10000 + 0x20000)
41 #define RW_PART4_OF 0x3e0000
42 #define RW_PART4_SZ 0x20000
44 static struct mtd_partition redwood_flash_partitions[] = {
46 .name = "Redwood OpenBIOS Vital Product Data",
47 .offset = RW_PART0_OF,
49 .mask_flags = MTD_WRITEABLE /* force read-only */
52 .name = "Redwood kernel",
53 .offset = RW_PART1_OF,
57 .name = "Redwood OpenBIOS non-volatile storage",
58 .offset = RW_PART2_OF,
60 .mask_flags = MTD_WRITEABLE /* force read-only */
63 .name = "Redwood filesystem",
64 .offset = RW_PART3_OF,
68 .name = "Redwood OpenBIOS",
69 .offset = RW_PART4_OF,
71 .mask_flags = MTD_WRITEABLE /* force read-only */
75 #else /* CONFIG_REDWOOD_6 */
76 /* FIXME: the window is bigger - armin */
77 #define WINDOW_ADDR 0xff800000
78 #define WINDOW_SIZE 0x00800000
81 #define RW_PART0_SZ 0x400000 /* 4 MiB data */
82 #define RW_PART1_OF RW_PART0_OF + RW_PART0_SZ
83 #define RW_PART1_SZ 0x10000 /* 64K VPD */
84 #define RW_PART2_OF RW_PART1_OF + RW_PART1_SZ
85 #define RW_PART2_SZ 0x400000 - (0x10000 + 0x20000)
86 #define RW_PART3_OF RW_PART2_OF + RW_PART2_SZ
87 #define RW_PART3_SZ 0x20000
89 static struct mtd_partition redwood_flash_partitions[] = {
91 .name = "Redwood filesystem",
92 .offset = RW_PART0_OF,
96 .name = "Redwood OpenBIOS Vital Product Data",
97 .offset = RW_PART1_OF,
99 .mask_flags = MTD_WRITEABLE /* force read-only */
102 .name = "Redwood kernel",
103 .offset = RW_PART2_OF,
107 .name = "Redwood OpenBIOS",
108 .offset = RW_PART3_OF,
110 .mask_flags = MTD_WRITEABLE /* force read-only */
114 #endif /* CONFIG_REDWOOD_6 */
116 struct map_info redwood_flash_map = {
117 .name = "IBM Redwood",
124 #define NUM_REDWOOD_FLASH_PARTITIONS ARRAY_SIZE(redwood_flash_partitions)
126 static struct mtd_info *redwood_mtd;
128 int __init init_redwood_flash(void)
130 printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n",
131 WINDOW_SIZE, WINDOW_ADDR);
133 redwood_flash_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
135 if (!redwood_flash_map.virt) {
136 printk("init_redwood_flash: failed to ioremap\n");
139 simple_map_init(&redwood_flash_map);
141 redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
144 redwood_mtd->owner = THIS_MODULE;
145 return add_mtd_partitions(redwood_mtd,
146 redwood_flash_partitions,
147 NUM_REDWOOD_FLASH_PARTITIONS);
153 static void __exit cleanup_redwood_flash(void)
156 del_mtd_partitions(redwood_mtd);
157 /* moved iounmap after map_destroy - armin */
158 map_destroy(redwood_mtd);
159 iounmap((void *)redwood_flash_map.virt);
163 module_init(init_redwood_flash);
164 module_exit(cleanup_redwood_flash);
166 MODULE_LICENSE("GPL");
167 MODULE_AUTHOR("MontaVista Software <source@mvista.com>");
168 MODULE_DESCRIPTION("MTD map driver for the IBM Redwood reference boards");