2 * flash.h: Common definitions for flash access.
4 * Copyright 2004, Broadcom Corporation
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
15 /* FILE-CSTYLED Cannot figure out how to make the initialization continuation lines acceptable */
17 /* Types of flashes we know about */
18 typedef enum _flash_type
{OLD
, BSC
, SCS
, AMD
, SST
, SFLASH
} flash_type_t
;
20 /* Commands to write/erase the flases */
21 typedef struct _flash_cmds
{
36 #define UNLOCK_CMD_WORDS 2 /* 2 words per command */
38 typedef struct _unlock_cmd
{
39 uint addr
[UNLOCK_CMD_WORDS
];
40 uint16 cmd
[UNLOCK_CMD_WORDS
];
43 /* Flash descriptors */
44 typedef struct _flash_desc
{
45 uint16 mfgid
; /* Manufacturer Id */
46 uint16 devid
; /* Device Id */
47 uint size
; /* Total size in bytes */
48 uint width
; /* Device width in bytes */
49 flash_type_t type
; /* Device type old, S, J */
50 uint bsize
; /* Block size */
51 uint nb
; /* Number of blocks */
52 uint ff
; /* First full block */
53 uint lf
; /* Last full block */
54 uint nsub
; /* Number of subblocks */
55 uint
*subblocks
; /* Offsets for subblocks */
56 char *desc
; /* Description */
60 #ifdef DECLARE_FLASHES
61 flash_cmds_t sflash_cmd_t
=
62 { SFLASH
, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
64 flash_cmds_t flash_cmds
[] = {
65 /* type needu preera eraseb erasech write wbuf clcsr rdcsr rdid
68 { BSC
, 0, 0x00, 0x20, 0x00, 0x40, 0x00, 0x50, 0x70, 0x90,
70 { SCS
, 0, 0x00, 0x20, 0x00, 0x40, 0xe8, 0x50, 0x70, 0x90,
72 { AMD
, 1, 0x80, 0x30, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90,
74 { SST
, 1, 0x80, 0x50, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90,
79 unlock_cmd_t unlock_cmd_amd
= {
81 /* addr: */ { 0x0aa8, 0x0556},
83 /* addr: */ { 0x0aaa, 0x0554},
85 /* data: */ { 0xaa, 0x55}
88 unlock_cmd_t unlock_cmd_sst
= {
90 /* addr: */ { 0xaaa8, 0x5556},
92 /* addr: */ { 0xaaaa, 0x5554},
94 /* data: */ { 0xaa, 0x55}
98 #define SST_CMD 0xaaaa
100 /* intel unlock block cmds */
101 #define INTEL_UNLOCK1 0x60
102 #define INTEL_UNLOCK2 0xD0
104 /* Just eight blocks of 8KB byte each */
118 /* Funky AMD arrangement for 29xx800's */
120 0x00000000, /* 16KB */
121 0x00004000, /* 32KB */
122 0x0000c000, /* 8KB */
123 0x0000e000, /* 8KB */
124 0x00010000, /* 8KB */
125 0x00012000, /* 8KB */
126 0x00014000, /* 32KB */
127 0x0001c000, /* 16KB */
131 /* AMD arrangement for 29xx160's */
133 0x00000000, /* 32KB */
134 0x00008000, /* 8KB */
135 0x0000a000, /* 8KB */
136 0x0000c000, /* 16KB */
141 0x00000000, /* 16KB */
142 0x00004000, /* 8KB */
143 0x00006000, /* 8KB */
144 0x00008000, /* 32KB */
149 flash_desc_t sflash_desc
=
150 { 0, 0, 0, 0, SFLASH
, 0, 0, 0, 0, 0, NULL
, "SFLASH" };
152 flash_desc_t flashes
[] = {
153 { 0x00b0, 0x00d0, 0x0200000, 2, SCS
, 0x10000, 32, 0, 31, 0, NULL
,
154 "Intel 28F160S3/5 1Mx16" },
155 { 0x00b0, 0x00d4, 0x0400000, 2, SCS
, 0x10000, 64, 0, 63, 0, NULL
,
156 "Intel 28F320S3/5 2Mx16" },
157 { 0x0089, 0x8890, 0x0200000, 2, BSC
, 0x10000, 32, 0, 30, 8, blk8x8k
,
158 "Intel 28F160B3 1Mx16 TopB" },
159 { 0x0089, 0x8891, 0x0200000, 2, BSC
, 0x10000, 32, 1, 31, 8, blk8x8k
,
160 "Intel 28F160B3 1Mx16 BotB" },
161 { 0x0089, 0x8896, 0x0400000, 2, BSC
, 0x10000, 64, 0, 62, 8, blk8x8k
,
162 "Intel 28F320B3 2Mx16 TopB" },
163 { 0x0089, 0x8897, 0x0400000, 2, BSC
, 0x10000, 64, 1, 63, 8, blk8x8k
,
164 "Intel 28F320B3 2Mx16 BotB" },
165 { 0x0089, 0x8898, 0x0800000, 2, BSC
, 0x10000, 128, 0, 126, 8, blk8x8k
,
166 "Intel 28F640B3 4Mx16 TopB" },
167 { 0x0089, 0x8899, 0x0800000, 2, BSC
, 0x10000, 128, 1, 127, 8, blk8x8k
,
168 "Intel 28F640B3 4Mx16 BotB" },
169 { 0x0089, 0x88C2, 0x0200000, 2, BSC
, 0x10000, 32, 0, 30, 8, blk8x8k
,
170 "Intel 28F160C3 1Mx16 TopB" },
171 { 0x0089, 0x88C3, 0x0200000, 2, BSC
, 0x10000, 32, 1, 31, 8, blk8x8k
,
172 "Intel 28F160C3 1Mx16 BotB" },
173 { 0x0089, 0x88C4, 0x0400000, 2, BSC
, 0x10000, 64, 0, 62, 8, blk8x8k
,
174 "Intel 28F320C3 2Mx16 TopB" },
175 { 0x0089, 0x88C5, 0x0400000, 2, BSC
, 0x10000, 64, 1, 63, 8, blk8x8k
,
176 "Intel 28F320C3 2Mx16 BotB" },
177 { 0x0089, 0x88CC, 0x0800000, 2, BSC
, 0x10000, 128, 0, 126, 8, blk8x8k
,
178 "Intel 28F640C3 4Mx16 TopB" },
179 { 0x0089, 0x88CD, 0x0800000, 2, BSC
, 0x10000, 128, 1, 127, 8, blk8x8k
,
180 "Intel 28F640C3 4Mx16 BotB" },
181 { 0x0089, 0x0014, 0x0400000, 2, SCS
, 0x20000, 32, 0, 31, 0, NULL
,
182 "Intel 28F320J5 2Mx16" },
183 { 0x0089, 0x0015, 0x0800000, 2, SCS
, 0x20000, 64, 0, 63, 0, NULL
,
184 "Intel 28F640J5 4Mx16" },
185 { 0x0089, 0x0016, 0x0400000, 2, SCS
, 0x20000, 32, 0, 31, 0, NULL
,
186 "Intel 28F320J3 2Mx16" },
187 { 0x0089, 0x0017, 0x0800000, 2, SCS
, 0x20000, 64, 0, 63, 0, NULL
,
188 "Intel 28F640J3 4Mx16" },
189 { 0x0089, 0x0018, 0x1000000, 2, SCS
, 0x20000, 128, 0, 127, 0, NULL
,
190 "Intel 28F128J3 8Mx16" },
191 { 0x00b0, 0x00e3, 0x0400000, 2, BSC
, 0x10000, 64, 1, 63, 8, blk8x8k
,
192 "Sharp 28F320BJE 2Mx16 BotB" },
193 { 0x0001, 0x224a, 0x0100000, 2, AMD
, 0x10000, 16, 0, 13, 8, amd800
,
194 "AMD 29DL800BT 512Kx16 TopB" },
195 { 0x0001, 0x22cb, 0x0100000, 2, AMD
, 0x10000, 16, 2, 15, 8, amd800
,
196 "AMD 29DL800BB 512Kx16 BotB" },
197 { 0x0001, 0x22c4, 0x0200000, 2, AMD
, 0x10000, 32, 0, 30, 4, amd4112
,
198 "AMD 29W160ET 1Mx16 TopB" },
199 { 0x0001, 0x2249, 0x0200000, 2, AMD
, 0x10000, 32, 1, 31, 4, amd2114
,
200 "AMD 29lv160DB 1Mx16 BotB" },
201 { 0x0001, 0x22f6, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 8, blk8x8k
,
202 "AMD 29LV320DT 2Mx16 TopB" },
203 { 0x0001, 0x22f9, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
204 "AMD 29lv320DB 2Mx16 BotB" },
205 { 0x0001, 0x00f9, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
206 "AMD 29lv320DB 2Mx16 BotB in BYTE mode" },
207 { 0x0001, 0x0201, 0x0800000, 2, AMD
, 0x10000, 128, 1, 126, 8, blk8x8k
,
208 "AMD 29DL640D 4Mx16" },
209 { 0x0001, 0x1200, 0x01000000, 2, AMD
, 0x10000, 256, 0, 255, 0, NULL
,
210 "AMD 29LV128MH/L 8Mx16" },
211 { 0x0001, 0x1301, 0x0800000, 2, AMD
, 0x10000, 128, 0, 127, 0, NULL
,
212 "AMD 29LV641MT 4Mx16" },
213 { 0x0001, 0x1a01, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 8, blk8x8k
,
214 "AMD 29lv320MT 2Mx16 TopB" },
215 { 0x0001, 0x1a00, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
216 "AMD 29lv320MB 2Mx16 BotB" },
217 { 0x0001, 0x1001, 0x0800000, 2, AMD
, 0x10000, 128, 0, 126, 8, blk8x8k
,
218 "Spansion S29GL064A-R3 4Mx16 TopB" },
219 { 0x0001, 0x1000, 0x0800000, 2, AMD
, 0x10000, 128, 1, 127, 8, blk8x8k
,
220 "Spansion S29GL064A-R4 4Mx16 BotB" },
221 { 0x0001, 0x0c01, 0x0800000, 2, AMD
, 0x10000, 128, 0, 127, 0, NULL
,
222 "Spansion S29GL640A 8Mx16" },
223 { 0x0020, 0x22CA, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 4, amd4112
,
224 "ST 29w320DT 2Mx16 TopB" },
225 { 0x0020, 0x22CB, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 4, amd2114
,
226 "ST 29w320DB 2Mx16 BotB" },
227 { 0x0020, 0x22c4, 0x0200000, 2, AMD
, 0x10000, 32, 0, 30, 4, amd4112
,
228 "ST 29w160ET 1Mx16 TopB" },
229 { 0x0020, 0x2249, 0x0200000, 2, AMD
, 0x10000, 32, 1, 31, 4, amd2114
,
230 "ST 29w160ET 1Mx16 BotB" },
231 { 0x0020, 0x225d, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
232 "ST M29DW324DB 2Mx16 TopB" },
233 { 0x007f, 0x22f9, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
234 "EON 29LV320CB 2Mx16 BotB" },
235 { 0x00C2, 0x22c4, 0x0200000, 2, AMD
, 0x10000, 32, 0, 30, 4, amd4112
,
236 "MX 29LV160CT 1Mx16 TopB" },
237 { 0x00C2, 0x2249, 0x0200000, 2, AMD
, 0x10000, 32, 1, 31, 4, amd2114
,
238 "MX 29LV160CB 1Mx16 BotB" },
239 { 0x00C2, 0x22a8, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
240 "MX 29LV320CB 2Mx16 BotB" },
241 { 0x00C2, 0x00A7, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 4, amd4112
,
242 "MX29LV320T 2Mx16 TopB" },
243 { 0x00C2, 0x00A8, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 4, amd2114
,
244 "MX29LV320B 2Mx16 BotB" },
245 { 0x0004, 0x22F6, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 4, amd4112
,
246 "MBM29LV320TE 2Mx16 TopB" },
247 { 0x0004, 0x22F9, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 4, amd2114
,
248 "MBM29LV320BE 2Mx16 BotB" },
249 { 0x0098, 0x009A, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 4, amd4112
,
250 "TC58FVT321 2Mx16 TopB" },
251 { 0x0098, 0x009C, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 4, amd2114
,
252 "TC58FVB321 2Mx16 BotB" },
253 { 0x00C2, 0x22A7, 0x0400000, 2, AMD
, 0x10000, 64, 0, 62, 4, amd4112
,
254 "MX29LV320T 2Mx16 TopB" },
255 { 0x00C2, 0x22A8, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 4, amd2114
,
256 "MX29LV320B 2Mx16 BotB" },
257 { 0x00BF, 0x2783, 0x0400000, 2, SST
, 0x10000, 64, 0, 63, 0, NULL
,
258 "SST39VF320 2Mx16" },
259 { 0x00ec, 0x22e2, 0x0800000, 2, AMD
, 0x10000, 128, 1, 127, 8, blk8x8k
,
260 "Samsung K8D631UB 4Mx16 BotB" },
261 { 0xddda, 0x0a00, 0x0400000, 2, AMD
, 0x10000, 64, 1, 63, 8, blk8x8k
,
262 "Samsung K8D631UB 4Mx16 BotB" },
263 { 0, 0, 0, 0, OLD
, 0, 0, 0, 0, 0, NULL
,
267 #else /* !DECLARE_FLASHES */
269 extern flash_cmds_t flash_cmds
[];
270 extern unlock_cmd_t unlock_cmd
;
271 extern flash_desc_t flashes
[];
273 #endif /* DECLARE_FLASHES */