aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/alchemy-flash.c
diff options
context:
space:
mode:
authorPete Popov <ppopov@pacbell.net>2005-02-27 16:50:25 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:45:13 -0400
commit002fa30170f9500ac31fa22931c689029af7f27b (patch)
treeb633bd9776af565884251588fc86d7aadbf77c43 /drivers/mtd/maps/alchemy-flash.c
parentd30f11d22549c54e9b05d153e37d166f88a2aa43 (diff)
[MTD] Replace all the Au1x mapping drivers with a simplified single driver
This driver does not have as many options but it's easier to maintain. And, it turns out AMD never shipped boards with different flash densities. Signed-off-by: Pete Popov <ppopov@pacbell.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/maps/alchemy-flash.c')
-rw-r--r--drivers/mtd/maps/alchemy-flash.c192
1 files changed, 192 insertions, 0 deletions
diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c
new file mode 100644
index 000000000000..27fd2a3c3b60
--- /dev/null
+++ b/drivers/mtd/maps/alchemy-flash.c
@@ -0,0 +1,192 @@
1/*
2 * Flash memory access on AMD Alchemy evaluation boards
3 *
4 * $Id: alchemy-flash.c,v 1.1 2005/02/27 21:50:21 ppopov Exp $
5 *
6 * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
7 *
8 */
9
10#include <linux/config.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/types.h>
14#include <linux/kernel.h>
15
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/map.h>
18#include <linux/mtd/partitions.h>
19
20#include <asm/io.h>
21
22#ifdef DEBUG_RW
23#define DBG(x...) printk(x)
24#else
25#define DBG(x...)
26#endif
27
28#ifdef CONFIG_MIPS_PB1000
29#define BOARD_MAP_NAME "Pb1000 Flash"
30#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
31#define BOARD_FLASH_WIDTH 4 /* 32-bits */
32#endif
33
34#ifdef CONFIG_MIPS_PB1500
35#define BOARD_MAP_NAME "Pb1500 Flash"
36#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
37#define BOARD_FLASH_WIDTH 4 /* 32-bits */
38#endif
39
40#ifdef CONFIG_MIPS_PB1100
41#define BOARD_MAP_NAME "Pb1100 Flash"
42#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
43#define BOARD_FLASH_WIDTH 4 /* 32-bits */
44#endif
45
46#ifdef CONFIG_MIPS_PB1550
47#define BOARD_MAP_NAME "Pb1550 Flash"
48#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
49#define BOARD_FLASH_WIDTH 4 /* 32-bits */
50#endif
51
52#ifdef CONFIG_MIPS_PB1200
53#define BOARD_MAP_NAME "Pb1200 Flash"
54#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
55#define BOARD_FLASH_WIDTH 2 /* 16-bits */
56#endif
57
58#ifdef CONFIG_MIPS_DB1000
59#define BOARD_MAP_NAME "Db1000 Flash"
60#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
61#define BOARD_FLASH_WIDTH 4 /* 32-bits */
62#endif
63
64#ifdef CONFIG_MIPS_DB1500
65#define BOARD_MAP_NAME "Db1500 Flash"
66#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
67#define BOARD_FLASH_WIDTH 4 /* 32-bits */
68#endif
69
70#ifdef CONFIG_MIPS_DB1100
71#define BOARD_MAP_NAME "Db1100 Flash"
72#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
73#define BOARD_FLASH_WIDTH 4 /* 32-bits */
74#endif
75
76#ifdef CONFIG_MIPS_DB1550
77#define BOARD_MAP_NAME "Db1550 Flash"
78#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
79#define BOARD_FLASH_WIDTH 4 /* 32-bits */
80#endif
81
82#ifdef CONFIG_MIPS_DB1200
83#define BOARD_MAP_NAME "Db1200 Flash"
84#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
85#define BOARD_FLASH_WIDTH 2 /* 16-bits */
86#endif
87
88#ifdef CONFIG_MIPS_HYDROGEN3
89#define BOARD_MAP_NAME "Hydrogen3 Flash"
90#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
91#define BOARD_FLASH_WIDTH 4 /* 32-bits */
92#define USE_LOCAL_ACCESSORS /* why? */
93#endif
94
95#ifdef CONFIG_MIPS_BOSPORUS
96#define BOARD_MAP_NAME "Bosporus Flash"
97#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
98#define BOARD_FLASH_WIDTH 2 /* 16-bits */
99#endif
100
101#ifdef CONFIG_MIPS_MIRAGE
102#define BOARD_MAP_NAME "Mirage Flash"
103#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
104#define BOARD_FLASH_WIDTH 4 /* 32-bits */
105#define USE_LOCAL_ACCESSORS /* why? */
106#endif
107
108static struct map_info alchemy_map = {
109 .name = BOARD_MAP_NAME,
110};
111
112static struct mtd_partition alchemy_partitions[] = {
113 {
114 .name = "User FS",
115 .size = BOARD_FLASH_SIZE - 0x00400000,
116 .offset = 0x0000000
117 },{
118 .name = "YAMON",
119 .size = 0x0100000,
120 .offset = MTDPART_OFS_APPEND,
121 .mask_flags = MTD_WRITEABLE
122 },{
123 .name = "raw kernel",
124 .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
125 .offset = MTDPART_OFS_APPEND,
126 }
127};
128
129#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
130
131static struct mtd_info *mymtd;
132
133int __init alchemy_mtd_init(void)
134{
135 struct mtd_partition *parts;
136 int nb_parts = 0;
137 unsigned long window_addr;
138 unsigned long window_size;
139
140 /* Default flash buswidth */
141 alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
142
143 window_addr = 0x20000000 - BOARD_FLASH_SIZE;
144 window_size = BOARD_FLASH_SIZE;
145#ifdef CONFIG_MIPS_MIRAGE_WHY
146 /* Boot ROM flash bank only; no user bank */
147 window_addr = 0x1C000000;
148 window_size = 0x04000000;
149 /* USERFS from 0x1C00 0000 to 0x1FC00000 */
150 alchemy_partitions[0].size = 0x03C00000;
151#endif
152
153 /*
154 * Static partition definition selection
155 */
156 parts = alchemy_partitions;
157 nb_parts = NB_OF(alchemy_partitions);
158 alchemy_map.size = window_size;
159
160 /*
161 * Now let's probe for the actual flash. Do it here since
162 * specific machine settings might have been set above.
163 */
164 printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
165 alchemy_map.bankwidth*8);
166 alchemy_map.virt = ioremap(window_addr, window_size);
167 mymtd = do_map_probe("cfi_probe", &alchemy_map);
168 if (!mymtd) {
169 iounmap(alchemy_map.virt);
170 return -ENXIO;
171 }
172 mymtd->owner = THIS_MODULE;
173
174 add_mtd_partitions(mymtd, parts, nb_parts);
175 return 0;
176}
177
178static void __exit alchemy_mtd_cleanup(void)
179{
180 if (mymtd) {
181 del_mtd_partitions(mymtd);
182 map_destroy(mymtd);
183 iounmap(alchemy_map.virt);
184 }
185}
186
187module_init(alchemy_mtd_init);
188module_exit(alchemy_mtd_cleanup);
189
190MODULE_AUTHOR("Embedded Alley Solutions, Inc");
191MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
192MODULE_LICENSE("GPL");