[MTD] Make init_fortunet function static
[deliverable/linux.git] / drivers / mtd / maps / alchemy-flash.c
CommitLineData
002fa301
PP
1/*
2 * Flash memory access on AMD Alchemy evaluation boards
69f34c98 3 *
002fa301 4 * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
002fa301
PP
5 */
6
002fa301
PP
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
002fa301
PP
18#ifdef CONFIG_MIPS_PB1000
19#define BOARD_MAP_NAME "Pb1000 Flash"
20#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
21#define BOARD_FLASH_WIDTH 4 /* 32-bits */
22#endif
23
24#ifdef CONFIG_MIPS_PB1500
25#define BOARD_MAP_NAME "Pb1500 Flash"
26#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
27#define BOARD_FLASH_WIDTH 4 /* 32-bits */
28#endif
29
30#ifdef CONFIG_MIPS_PB1100
31#define BOARD_MAP_NAME "Pb1100 Flash"
32#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
33#define BOARD_FLASH_WIDTH 4 /* 32-bits */
34#endif
35
36#ifdef CONFIG_MIPS_PB1550
37#define BOARD_MAP_NAME "Pb1550 Flash"
38#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
39#define BOARD_FLASH_WIDTH 4 /* 32-bits */
40#endif
41
42#ifdef CONFIG_MIPS_PB1200
43#define BOARD_MAP_NAME "Pb1200 Flash"
44#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
45#define BOARD_FLASH_WIDTH 2 /* 16-bits */
46#endif
47
48#ifdef CONFIG_MIPS_DB1000
49#define BOARD_MAP_NAME "Db1000 Flash"
50#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
51#define BOARD_FLASH_WIDTH 4 /* 32-bits */
52#endif
53
54#ifdef CONFIG_MIPS_DB1500
55#define BOARD_MAP_NAME "Db1500 Flash"
56#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
57#define BOARD_FLASH_WIDTH 4 /* 32-bits */
58#endif
59
60#ifdef CONFIG_MIPS_DB1100
61#define BOARD_MAP_NAME "Db1100 Flash"
62#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
63#define BOARD_FLASH_WIDTH 4 /* 32-bits */
64#endif
65
66#ifdef CONFIG_MIPS_DB1550
67#define BOARD_MAP_NAME "Db1550 Flash"
68#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
69#define BOARD_FLASH_WIDTH 4 /* 32-bits */
70#endif
71
72#ifdef CONFIG_MIPS_DB1200
73#define BOARD_MAP_NAME "Db1200 Flash"
74#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
75#define BOARD_FLASH_WIDTH 2 /* 16-bits */
76#endif
77
002fa301
PP
78#ifdef CONFIG_MIPS_BOSPORUS
79#define BOARD_MAP_NAME "Bosporus Flash"
80#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
81#define BOARD_FLASH_WIDTH 2 /* 16-bits */
82#endif
83
84#ifdef CONFIG_MIPS_MIRAGE
85#define BOARD_MAP_NAME "Mirage Flash"
86#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
87#define BOARD_FLASH_WIDTH 4 /* 32-bits */
88#define USE_LOCAL_ACCESSORS /* why? */
89#endif
90
91static struct map_info alchemy_map = {
92 .name = BOARD_MAP_NAME,
93};
94
95static struct mtd_partition alchemy_partitions[] = {
96 {
97 .name = "User FS",
98 .size = BOARD_FLASH_SIZE - 0x00400000,
99 .offset = 0x0000000
100 },{
101 .name = "YAMON",
102 .size = 0x0100000,
103 .offset = MTDPART_OFS_APPEND,
104 .mask_flags = MTD_WRITEABLE
105 },{
106 .name = "raw kernel",
107 .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
108 .offset = MTDPART_OFS_APPEND,
109 }
110};
111
002fa301
PP
112static struct mtd_info *mymtd;
113
b93dc2e9 114static int __init alchemy_mtd_init(void)
002fa301
PP
115{
116 struct mtd_partition *parts;
117 int nb_parts = 0;
118 unsigned long window_addr;
119 unsigned long window_size;
69f34c98 120
002fa301
PP
121 /* Default flash buswidth */
122 alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
123
124 window_addr = 0x20000000 - BOARD_FLASH_SIZE;
125 window_size = BOARD_FLASH_SIZE;
002fa301
PP
126
127 /*
128 * Static partition definition selection
129 */
130 parts = alchemy_partitions;
87d10f3c 131 nb_parts = ARRAY_SIZE(alchemy_partitions);
002fa301
PP
132 alchemy_map.size = window_size;
133
134 /*
135 * Now let's probe for the actual flash. Do it here since
136 * specific machine settings might have been set above.
137 */
69f34c98 138 printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
002fa301
PP
139 alchemy_map.bankwidth*8);
140 alchemy_map.virt = ioremap(window_addr, window_size);
141 mymtd = do_map_probe("cfi_probe", &alchemy_map);
142 if (!mymtd) {
143 iounmap(alchemy_map.virt);
144 return -ENXIO;
145 }
146 mymtd->owner = THIS_MODULE;
147
148 add_mtd_partitions(mymtd, parts, nb_parts);
149 return 0;
150}
151
152static void __exit alchemy_mtd_cleanup(void)
153{
154 if (mymtd) {
155 del_mtd_partitions(mymtd);
156 map_destroy(mymtd);
157 iounmap(alchemy_map.virt);
158 }
159}
160
161module_init(alchemy_mtd_init);
162module_exit(alchemy_mtd_cleanup);
163
164MODULE_AUTHOR("Embedded Alley Solutions, Inc");
165MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
166MODULE_LICENSE("GPL");
This page took 0.528118 seconds and 5 git commands to generate.