aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/redwood.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/mtd/maps/redwood.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/mtd/maps/redwood.c')
-rw-r--r--drivers/mtd/maps/redwood.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/drivers/mtd/maps/redwood.c b/drivers/mtd/maps/redwood.c
new file mode 100644
index 000000000000..edd01ee4f90b
--- /dev/null
+++ b/drivers/mtd/maps/redwood.c
@@ -0,0 +1,169 @@
1/*
2 * $Id: redwood.c,v 1.10 2004/11/04 13:24:15 gleixner Exp $
3 *
4 * drivers/mtd/maps/redwood.c
5 *
6 * FLASH map for the IBM Redwood 4/5/6 boards.
7 *
8 * Author: MontaVista Software, Inc. <source@mvista.com>
9 *
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
13 * or implied.
14 */
15
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>
21
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h>
24#include <linux/mtd/partitions.h>
25
26#include <asm/io.h>
27
28#if !defined (CONFIG_REDWOOD_6)
29
30#define WINDOW_ADDR 0xffc00000
31#define WINDOW_SIZE 0x00400000
32
33#define RW_PART0_OF 0
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
43
44static struct mtd_partition redwood_flash_partitions[] = {
45 {
46 .name = "Redwood OpenBIOS Vital Product Data",
47 .offset = RW_PART0_OF,
48 .size = RW_PART0_SZ,
49 .mask_flags = MTD_WRITEABLE /* force read-only */
50 },
51 {
52 .name = "Redwood kernel",
53 .offset = RW_PART1_OF,
54 .size = RW_PART1_SZ
55 },
56 {
57 .name = "Redwood OpenBIOS non-volatile storage",
58 .offset = RW_PART2_OF,
59 .size = RW_PART2_SZ,
60 .mask_flags = MTD_WRITEABLE /* force read-only */
61 },
62 {
63 .name = "Redwood filesystem",
64 .offset = RW_PART3_OF,
65 .size = RW_PART3_SZ
66 },
67 {
68 .name = "Redwood OpenBIOS",
69 .offset = RW_PART4_OF,
70 .size = RW_PART4_SZ,
71 .mask_flags = MTD_WRITEABLE /* force read-only */
72 }
73};
74
75#else /* CONFIG_REDWOOD_6 */
76/* FIXME: the window is bigger - armin */
77#define WINDOW_ADDR 0xff800000
78#define WINDOW_SIZE 0x00800000
79
80#define RW_PART0_OF 0
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
88
89static struct mtd_partition redwood_flash_partitions[] = {
90 {
91 .name = "Redwood filesystem",
92 .offset = RW_PART0_OF,
93 .size = RW_PART0_SZ
94 },
95 {
96 .name = "Redwood OpenBIOS Vital Product Data",
97 .offset = RW_PART1_OF,
98 .size = RW_PART1_SZ,
99 .mask_flags = MTD_WRITEABLE /* force read-only */
100 },
101 {
102 .name = "Redwood kernel",
103 .offset = RW_PART2_OF,
104 .size = RW_PART2_SZ
105 },
106 {
107 .name = "Redwood OpenBIOS",
108 .offset = RW_PART3_OF,
109 .size = RW_PART3_SZ,
110 .mask_flags = MTD_WRITEABLE /* force read-only */
111 }
112};
113
114#endif /* CONFIG_REDWOOD_6 */
115
116struct map_info redwood_flash_map = {
117 .name = "IBM Redwood",
118 .size = WINDOW_SIZE,
119 .bankwidth = 2,
120 .phys = WINDOW_ADDR,
121};
122
123
124#define NUM_REDWOOD_FLASH_PARTITIONS \
125 (sizeof(redwood_flash_partitions)/sizeof(redwood_flash_partitions[0]))
126
127static struct mtd_info *redwood_mtd;
128
129int __init init_redwood_flash(void)
130{
131 printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n",
132 WINDOW_SIZE, WINDOW_ADDR);
133
134 redwood_flash_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
135
136 if (!redwood_flash_map.virt) {
137 printk("init_redwood_flash: failed to ioremap\n");
138 return -EIO;
139 }
140 simple_map_init(&redwood_flash_map);
141
142 redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
143
144 if (redwood_mtd) {
145 redwood_mtd->owner = THIS_MODULE;
146 return add_mtd_partitions(redwood_mtd,
147 redwood_flash_partitions,
148 NUM_REDWOOD_FLASH_PARTITIONS);
149 }
150
151 return -ENXIO;
152}
153
154static void __exit cleanup_redwood_flash(void)
155{
156 if (redwood_mtd) {
157 del_mtd_partitions(redwood_mtd);
158 /* moved iounmap after map_destroy - armin */
159 map_destroy(redwood_mtd);
160 iounmap((void *)redwood_flash_map.virt);
161 }
162}
163
164module_init(init_redwood_flash);
165module_exit(cleanup_redwood_flash);
166
167MODULE_LICENSE("GPL");
168MODULE_AUTHOR("MontaVista Software <source@mvista.com>");
169MODULE_DESCRIPTION("MTD map driver for the IBM Redwood reference boards");