comparison src/cs/drivers/drv_app/ffs/board/dev.c.org @ 0:b6a5e36de839

src/cs: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:39:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b6a5e36de839
1 /******************************************************************************
2 * Flash File System (ffs)
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
4 *
5 * ffs flash device definitions
6 *
7 * $Id: dev.c 1.34.1.25 Thu, 18 Dec 2003 10:50:52 +0100 tsj $
8 *
9 ******************************************************************************/
10
11 #include "ffs/ffs.h"
12 #include "ffs/board/drv.h"
13 #include "config/board.cfg"
14 #include "config/rf.cfg"
15
16 /******************************************************************************
17
18 Flash memories supported:
19
20 The real flash device names are listed in the Device column. The names of
21 compatible/similar devices are listed in the "aliases" column.
22 Compatible/similar devices are e.g. combo devices using that particular
23 flash device.
24
25 The size column denotes the full device memory size in megabits (Mb). For
26 dual and multi-bank devices, two or more numbers indicate the sizes of the
27 respective banks, starting from the lowest address.
28
29 ---------------+--------+-------------------------------------------------
30 Device | Size| Aliases and Notes
31 ---------------+--------+-----------------------------------------------------
32 AMD | |
33 29DL161T |15.5+0.5|
34 29DL162T |14.0+2.0|
35 29DL163T |12.0+4.0|
36 29DL164T | 8.0+8.0|
37 29DL322T |28.0+4.0|
38 29DL323T |24.0+8.0|
39 ---------------+--------+-----------------------------------------------------
40 Fujitsu | |
41 29DL161T |15.5+0.5| (Am29DL161)
42 29DL162T |14.0+2.0| (Am29DL162)
43 29DL163T |12.0+4.0| (Am29DL163)
44 29DL164T | 8.0+8.0| (Am29DL164)
45 29DL321TD | | (Am29DL321), MB84VD22181, MB84VD22081, MB84VD22191
46 29DL322TD |28.0+4.0| (Am29DL322), MB84VD22182, MB84VD22082, MB84VD22192
47 29DL323TD |24.0+8.0| (Am29DL323), MB84VD22183, MB84VD22083, MB84VD22193,
48 | | BSample device
49 ---------------+--------+-----------------------------------------------------
50 Samsung | |
51 K5A3240YT |24+8 |
52 K5A3240YB | 8+24 |
53 K5A3340YT |16+16 |
54 K5A3340YB |14+18 | (!?)
55 ---------------+--------+-----------------------------------------------------
56 SST | |
57 SST36VF1601 | |
58 ---------------+--------+-----------------------------------------------------
59 Toshiba | |
60 ? | | TH50VSF2581AASB
61 ---------------+--------+-----------------------------------------------------
62 Intel | |
63 28F160C3 | 16.0| Both Top and Bottom boot
64 28F320C3 | 32.0| Both Top and Bottom boot
65 28F640C3 | 64.0| Both Top and Bottom boot
66 28F640W30 | 64.0| Both Top and Bottom boot, DSample device
67 ---------------+--------+-----------------------------------------------------
68 Test | |
69 | |
70 ---------------+--------+-----------------------------------------------------
71
72 ******************************************************************************/
73
74
75 /******************************************************************************
76 * Flash Device Memory Maps
77 ******************************************************************************/
78
79 // The memory map, flash_AAxBB[], used by each flash device definition in
80 // the flash_info[] array below can be either one of the pre-defined ones
81 // below or a custom-defined one. Each line in the memory map represents one
82 // physical device sector. The columns in the memory map has the following
83 // meaning:
84 //
85 // 1. Relative address offset of sector.
86 // 2. Base 2 logarithm of sector byte size, e.g. 64kB ~ 2^16.
87 //
88 // Note that does NOT support a flash definition with different sized blocks
89 // so all blocks contained in the device definition MUST be the same size!
90
91
92 // 128x64kb
93 static const struct block_info_s flash_128x64[] =
94 {
95 { 0x00000, 16 },
96 { 0x10000, 16 },
97 { 0x20000, 16 },
98 { 0x30000, 16 },
99 { 0x40000, 16 },
100 { 0x50000, 16 },
101 { 0x60000, 16 },
102 { 0x70000, 16 },
103 { 0x80000, 16 },
104 { 0x90000, 16 },
105 { 0xa0000, 16 },
106 { 0xb0000, 16 },
107 { 0xc0000, 16 },
108 { 0xd0000, 16 },
109 { 0xe0000, 16 },
110 { 0xf0000, 16 },
111 { 0x100000, 16 },
112 { 0x110000, 16 },
113 { 0x120000, 16 },
114 { 0x130000, 16 },
115 { 0x140000, 16 },
116 { 0x150000, 16 },
117 { 0x160000, 16 },
118 { 0x170000, 16 },
119 { 0x180000, 16 },
120 { 0x190000, 16 },
121 { 0x1a0000, 16 },
122 { 0x1b0000, 16 },
123 { 0x1c0000, 16 },
124 { 0x1d0000, 16 },
125 { 0x1e0000, 16 },
126 { 0x1f0000, 16 },
127 { 0x200000, 16 },
128 { 0x210000, 16 },
129 { 0x220000, 16 },
130 { 0x230000, 16 },
131 { 0x240000, 16 },
132 { 0x250000, 16 },
133 { 0x260000, 16 },
134 { 0x270000, 16 },
135 { 0x280000, 16 },
136 { 0x290000, 16 },
137 { 0x2a0000, 16 },
138 { 0x2b0000, 16 },
139 { 0x2c0000, 16 },
140 { 0x2d0000, 16 },
141 { 0x2e0000, 16 },
142 { 0x2f0000, 16 },
143 { 0x300000, 16 },
144 { 0x310000, 16 },
145 { 0x320000, 16 },
146 { 0x330000, 16 },
147 { 0x340000, 16 },
148 { 0x350000, 16 },
149 { 0x360000, 16 },
150 { 0x370000, 16 },
151 { 0x380000, 16 },
152 { 0x390000, 16 },
153 { 0x3a0000, 16 },
154 { 0x3b0000, 16 },
155 { 0x3c0000, 16 },
156 { 0x3d0000, 16 },
157 { 0x3e0000, 16 },
158 { 0x3f0000, 16 },
159 { 0x400000, 16 },
160 { 0x410000, 16 },
161 { 0x420000, 16 },
162 { 0x430000, 16 },
163 { 0x440000, 16 },
164 { 0x450000, 16 },
165 { 0x460000, 16 },
166 { 0x470000, 16 },
167 { 0x480000, 16 },
168 { 0x490000, 16 },
169 { 0x4a0000, 16 },
170 { 0x4b0000, 16 },
171 { 0x4c0000, 16 },
172 { 0x4d0000, 16 },
173 { 0x4e0000, 16 },
174 { 0x4f0000, 16 },
175 { 0x500000, 16 },
176 { 0x510000, 16 },
177 { 0x520000, 16 },
178 { 0x530000, 16 },
179 { 0x540000, 16 },
180 { 0x550000, 16 },
181 { 0x560000, 16 },
182 { 0x570000, 16 },
183 { 0x580000, 16 },
184 { 0x590000, 16 },
185 { 0x5a0000, 16 },
186 { 0x5b0000, 16 },
187 { 0x5c0000, 16 },
188 { 0x5d0000, 16 },
189 { 0x5e0000, 16 },
190 { 0x5f0000, 16 },
191 { 0x600000, 16 },
192 { 0x610000, 16 },
193 { 0x620000, 16 },
194 { 0x630000, 16 },
195 { 0x640000, 16 },
196 { 0x650000, 16 },
197 { 0x660000, 16 },
198 { 0x670000, 16 },
199 { 0x680000, 16 },
200 { 0x690000, 16 },
201 { 0x6a0000, 16 },
202 { 0x6b0000, 16 },
203 { 0x6c0000, 16 },
204 { 0x6d0000, 16 },
205 { 0x6e0000, 16 },
206 { 0x6f0000, 16 },
207 { 0x700000, 16 },
208 { 0x710000, 16 },
209 { 0x720000, 16 },
210 { 0x730000, 16 },
211 { 0x740000, 16 },
212 { 0x750000, 16 },
213 { 0x760000, 16 },
214 { 0x770000, 16 },
215 { 0x780000, 16 },
216 { 0x790000, 16 },
217 { 0x7a0000, 16 },
218 { 0x7b0000, 16 },
219 { 0x7c0000, 16 },
220 { 0x7d0000, 16 },
221 { 0x7e0000, 16 },
222 { 0x7f0000, 16 }
223 };
224
225 // 16x64kB
226 static const struct block_info_s flash_16x64[] =
227 {
228 { 0x00000, 16 },
229 { 0x10000, 16 },
230 { 0x20000, 16 },
231 { 0x30000, 16 },
232 { 0x40000, 16 },
233 { 0x50000, 16 },
234 { 0x60000, 16 },
235 { 0x70000, 16 },
236 { 0x80000, 16 },
237 { 0x90000, 16 },
238 { 0xA0000, 16 },
239 { 0xB0000, 16 },
240 { 0xC0000, 16 },
241 { 0xD0000, 16 },
242 { 0xE0000, 16 },
243 { 0xF0000, 16 }
244 };
245
246
247 // 8x8kB
248 static const struct block_info_s flash_8x8[] =
249 {
250 { 0x0000, 13 },
251 { 0x2000, 13 },
252 { 0x4000, 13 },
253 { 0x6000, 13 },
254 { 0x8000, 13 },
255 { 0xa000, 13 },
256 { 0xc000, 13 },
257 { 0xe000, 13 }
258 };
259
260
261 // 4x4kB
262 static const struct block_info_s flash_4x4[] =
263 {
264 { 0x0000, 12 },
265 { 0x1000, 12 },
266 { 0x2000, 12 },
267 { 0x3000, 12 }
268 };
269
270
271 /******************************************************************************
272 * Flash Device Info Array
273 ******************************************************************************/
274
275 // Each entry in the array below represents one flash device definition as
276 // FFS needs it. The columns have the following meaning:
277 //
278 // 1. Device memory map.
279 // 2. Absolute address of the first sector to be used by/for FFS.
280 // 3. Manufacturer code. Values are from FFS_MANUFACTURER enumeration
281 // in drv.h
282 // 4. Device code. Available from device datasheet.
283 // 5. FFS device driver to use. Values are from FFS_DRIVER enumeration
284 // in drv.h
285 // 6. Number of sectors to use, starting from the address given in
286 // column 2.
287
288 /********** RAM configuration *************************************************
289 * Note it is necessary to hardwire the configuration of the ram driver
290 * in cfgffs.c. The ram driver is configured like and pseudo flash
291 * device with only a few exceptions: Field 2 which is the absolute
292 * address of the first sector MUST be set to zero, instead the address
293 * is configured in cfgffs.c. Field 4 'Device code' is an arbitrary
294 * value and not a real device code.
295 ******************************************************************************/
296
297 /********** Multi-id configuration ********************************************
298 * When 227Eh is output, it indicates that two additional codes, called
299 * Extended Device Codes, will be required. The two additional codes will be
300 * read and the lower byte of each code will be combined into one id, which
301 * is used for auto-detection of the flash configuration. The device code
302 * format for the multi-id devices is as follow: 0x227E, 0x22YY, 0x22ZZ ->
303 * 0xYYZZ.
304 ******************************************************************************/
305
306 const struct flash_info_s flash_info[] =
307 {
308 //BOARD 34. Ram device 4x4kB. Note it is necessary to hardwire the conf
309 //in cfgffs.c
310 { &flash_4x4[0], 0, MANUFACT_RAM, 0x0404,
311 FFS_DRIVER_RAM, 4},
312
313 // Ram device 8x8kB. Note it is necessary to hardwire the conf in cfgffs.c
314 { &flash_8x8[0], 0, MANUFACT_RAM, 0x080D,
315 FFS_DRIVER_RAM, 8},
316
317 /********** AMD Devices ***********************************************/
318
319 // AMD Am29DL640F. Ignoring the 8kB sectors
320 // Multi-id device: 0x227E, 0x2221, 0x2200. Converted to 0x2100
321 { &flash_16x64[0], (char *) 0x01800000, MANUFACT_AMD, 0x2100,
322 FFS_DRIVER_AMD, 15 },
323
324 // AMD Am29DL640G. Ignoring the 8kB sectors
325 // Multi-id device: 0x227E, 0x2202, 0x2201. Converted to 0x0201
326 { &flash_16x64[0], (char *) 0x700000, MANUFACT_AMD, 0x0201,
327 FFS_DRIVER_AMD, 15 },
328
329 // AMD Am29DL321DT does not exist as of 2000-0217
330
331 // AMD Am29DL322DT. Ignoring the 8kB sectors
332 { &flash_16x64[0], (char *) 0x380000, MANUFACT_AMD, 0x2255,
333 FFS_DRIVER_AMD_SB, 7 },
334
335 // AMD Am29DL323DT. Ignoring the 8kB sectors
336 { &flash_16x64[0], (char *) 0x300000, MANUFACT_AMD, 0x2250,
337 FFS_DRIVER_AMD, 15 },
338
339 // AMD Am29DL161DT. Using 8x8kB sectors.
340 { &flash_8x8[0], (char *) 0x1F0000, MANUFACT_AMD, 0x2236,
341 FFS_DRIVER_AMD, 8 },
342
343 // AMD Am29DL162DT. Ignoring the 8kB sectors
344 { &flash_16x64[0], (char *) 0x1C0000, MANUFACT_AMD, 0x222D,
345 FFS_DRIVER_AMD, 3 },
346
347 // AMD Am29DL163DT. Ignoring the 8kB sectors
348 { &flash_16x64[0], (char *) 0x180000, MANUFACT_AMD, 0x2228,
349 FFS_DRIVER_AMD, 7 },
350
351 // AMD Am29DL164DT. Ignoring the 8kB sectors
352 { &flash_16x64[0], (char *) 0x100000, MANUFACT_AMD, 0x2233,
353 FFS_DRIVER_AMD, 15 },
354
355
356 /********** Fujitsu Devices *******************************************/
357
358 // Fujitsu MBM29DL321TD. Using 8x8kB sectors.
359 { &flash_8x8[0], (char *) 0x3f0000, MANUFACT_FUJITSU, 0x2259,
360 FFS_DRIVER_AMD, 8 },
361
362 // Fujitsu MBM29DL322TD. Ignoring all the 8kB sectors
363 { &flash_16x64[0], (char *) 0x380000, MANUFACT_FUJITSU, 0x2255,
364 FFS_DRIVER_AMD, 7 },
365
366 // Fujitsu MBM29DL323TD (BSample). Dual bank device definition.
367 { &flash_16x64[0], (char *) 0x300000, MANUFACT_FUJITSU, 0x2250,
368 FFS_DRIVER_AMD, 15 },
369
370 // Fujitsu MBM29DL161DT (similar to Am29DL161T).
371 { &flash_8x8[0], (char *) 0x1F0000, MANUFACT_FUJITSU, 0x2236,
372 FFS_DRIVER_AMD, 8 },
373
374 // Fujitsu MBM29DL162DT (similar to Am29DL162T).
375 { &flash_16x64[0], (char *) 0x1C0000, MANUFACT_FUJITSU, 0x222D,
376 FFS_DRIVER_AMD, 3 },
377
378 // Fujitsu MBM29DL163DT (similar to Am29DL163T).
379 { &flash_16x64[0], (char *) 0x180000, MANUFACT_FUJITSU, 0x2228,
380 FFS_DRIVER_AMD, 7 },
381
382 // Fujitsu MBM29DL164DT (similar to Am29DL164T).
383 { &flash_16x64[0], (char *) 0x100000, MANUFACT_FUJITSU, 0x2233,
384 FFS_DRIVER_AMD, 15 },
385
386 /* This is the RITA flash configuration */
387 // Fujitsu MBM29DL320FB
388 // Multi-id device: 0x227E, 0x220A, 0x2200. Converted to 0x0A00
389 { &flash_16x64[0], (char *) 0x320000, MANUFACT_FUJITSU, 0x0A00,
390 FFS_DRIVER_AMD_SB, 13 },
391
392 // Fujitsu MBM29DL320FT
393 // Multi-id device: 0x227E, 0x220A, 0x2201. Converted to 0x0A01
394 { &flash_16x64[0], (char *) 0x320000, MANUFACT_FUJITSU, 0x0A01,
395 FFS_DRIVER_AMD_SB, 13 },
396
397 // Fujitsu MBM29DL640F,
398 // Multi-id device: 0x227E, 0x2221, 0x2200. Converted to 0x2100
399 { &flash_16x64[0], (char *) 0x700000, MANUFACT_FUJITSU, 0x2100,
400 FFS_DRIVER_AMD_SB, 15 },
401
402 // Fujitsu 84VF5F5F4J2,
403 // Multi-id device: 0x227E, 0x2202, 0x2201. Converted to 0x0201
404 { &flash_16x64[0], (char *) 0x700000, MANUFACT_FUJITSU, 0x0201,
405 FFS_DRIVER_AMD_SB, 15 },
406
407 // Fujitsu MB84VF5F5F4J2 stacked device. Using the 2nd sub device
408 // The 8x8 are located both in top and bottom, thus only 126
409 // blocks are used.
410 { &flash_128x64[0], (char *) 0x1810000, MANUFACT_FUJITSU, 0xB496,
411 FFS_DRIVER_AMD_SB, 126 },
412
413 /********** Intel Devices *********************************************/
414
415 // Intel 28F160C3-T 16Mb. Using top-most 8x8kB (parameter) sectors.
416 { &flash_8x8[0], (char *) 0x1F0000, MANUFACT_INTEL, 0x88C2,
417 FFS_DRIVER_INTEL_SB, 8 },
418
419 // Intel 28F160C3-B, 16Mb. Using top-most 6x64kB sectors
420 { &flash_16x64[0], (char *) 0x1A0000, MANUFACT_INTEL, 0x88C3,
421 FFS_DRIVER_INTEL_SB, 6 },
422
423 // Intel 28F320C3-T, 32Mb. Using top-most 8x8kB (parameter) sectors.
424 { &flash_8x8[0], (char *) 0x3F0000, MANUFACT_INTEL, 0x88C4,
425 FFS_DRIVER_INTEL_SB, 8 },
426
427 // Intel 28F320C3-B, 32Mb. Using top-most 8x64kB sectors
428 { &flash_16x64[0], (char *) 0x380000, MANUFACT_INTEL, 0x88C5,
429 FFS_DRIVER_INTEL_SB, 8 },
430
431 // Intel 28F640C3-T, 64Mb. Using top-most 8x8kB (parameter) sectors.
432 { &flash_8x8[0], (char *) 0x7F0000, MANUFACT_INTEL, 0x88CC,
433 FFS_DRIVER_INTEL_SB, 8 },
434
435 // Intel 28F640C3-B, 64Mb. Using top-most 16x64kB sectors
436 { &flash_16x64[0], (char *) 0x700000, MANUFACT_INTEL, 0x88CD,
437 FFS_DRIVER_INTEL_SB, 15 },
438
439 // Intel 28F640W30-T, 64Mb. Using top-most 8x8kB sectors
440 { &flash_8x8[0], (char *) 0x7F0000, MANUFACT_INTEL, 0x8854,
441 FFS_DRIVER_INTEL_SB, 8 },
442
443 // Intel 28F640W30-B, 64Mb. (DSample). Using top-most 47x64kB sectors
444 // { &flash_128x64[0], (char *) 0x500000, MANUFACT_INTEL, 0x8855,
445 // FFS_DRIVER_INTEL_SB, 47 },
446
447 // Intel 28F640W30-B, 64Mb. (DSample). Using top-most 15x64kB sectors
448 { &flash_16x64[0], (char *) 0x700000, MANUFACT_INTEL, 0x8855,
449 FFS_DRIVER_INTEL, 15 },
450
451 // Intel 28F640W30-B, 64Mb. (DSample). Using top-most 15x64kB sectors
452 { &flash_16x64[0], (char *) 0x700000, MANUFACT_INTEL, 0x88FF,
453 FFS_DRIVER_INTEL_SB, 15 },
454
455 /********** MXIC Devices *******************************************/
456
457 // Intel 28F640W30-T, 64Mb. Using top-most 8x8kB sectors
458 { &flash_8x8[0], (char *) 0x3F0000, MANUFACT_MXIC, 0x0024,
459 FFS_DRIVER_INTEL_SB, 8 },
460
461
462 /********** Samsung Devices *******************************************/
463
464 // Samsung K5A3240YT Top boot, 24Mb + 8Mb
465 { &flash_16x64[0], (char *) 0x380000, MANUFACT_SAMSUNG, 0x22A0,
466 FFS_DRIVER_AMD_SB, 7 },
467
468 // Samsung K5A3340YT Top boot, 16Mb + 16Mb
469 { &flash_16x64[0], (char *) 0x380000, MANUFACT_SAMSUNG, 0x22BA,
470 FFS_DRIVER_AMD_SB, 7 },
471
472 // Samsung K5A3240YB Bottom boot, 8Mb + 24Mb
473 { &flash_16x64[0], (char *) 0x380000, MANUFACT_SAMSUNG, 0x223F,
474 FFS_DRIVER_AMD_SB, 8 },
475
476 // Samsung K5A3340YB Bottom boot, 14Mb + 18Mb (!?)
477 { &flash_16x64[0], (char *) 0x380000, MANUFACT_SAMSUNG, 0x223D,
478 FFS_DRIVER_AMD_SB, 8 },
479
480
481 /********** SST Devices ***********************************************/
482
483 // SST SST36VF1601
484 { &flash_16x64[0], (char *) 0x180000, MANUFACT_SST, 0x2761,
485 FFS_DRIVER_SST, 8 },
486
487 /********** Toshiba Devices *******************************************/
488
489 // Toshiba TH50VSF2581AASB Bottom boot combo device
490 { &flash_16x64[0], (char *) 0x380000, MANUFACT_TOSHIBA, 0x009C,
491 FFS_DRIVER_AMD, 8 },
492
493
494 /********** Special/Test Devices **************************************/
495
496 // Intel 28F160C3-B, 16Mb. Single bank driver
497 // Note that device ID is bogus!
498 { &flash_16x64[0], (char *) 0x1A0000, MANUFACT_INTEL, 0x01C3,
499 FFS_DRIVER_INTEL_SB, 6 },
500
501 // Fujitsu MBM29DL323TD (BSample). Single bank device definition.
502 // Note that device ID is bogus!
503 { &flash_16x64[0], (char *) 0x300000, MANUFACT_FUJITSU, 0x0150,
504 FFS_DRIVER_AMD_SB, 15 },
505
506 // Fujitsu MBM29DL323TD (BSample). Pseudo single bank device definition.
507 // Note that device ID is bogus!
508 { &flash_16x64[0], (char *) 0x300000, MANUFACT_FUJITSU, 0x0250,
509 FFS_DRIVER_AMD_PSEUDO_SB, 15 },
510
511 // Fujitsu MBM29DL323TD (BSample). "True" single bank device definition
512 // within first flash device bank!
513 // Note that device ID is bogus!
514 { &flash_16x64[0], (char *) 0x280000, MANUFACT_FUJITSU, 0x0350,
515 FFS_DRIVER_AMD_SB, 8 },
516
517 // AMD Am29DL323DT on EVA4 (base address = 0x200000)
518 { &flash_16x64[0], (char *) 0x500000, MANUFACT_AMD, 0xF250,
519 FFS_DRIVER_AMD, 15 },
520
521 // PC Test/Simulation flash 128x64kb
522 { &flash_128x64[0], (char *) 0x000000, MANUFACT_TEST, 0x0F12,
523 FFS_DRIVER_TEST, 127 },
524
525 // PC Test/Simulation flash 16x64kB
526 { &flash_16x64[0], (char *) 0x000000, MANUFACT_TEST, 0x0F10,
527 FFS_DRIVER_TEST, 15 },
528
529 // PC Test/Simulation flash 8x8kB
530 { &flash_8x8[0], (char *) 0x000000, MANUFACT_TEST, 0x080D,
531 FFS_DRIVER_TEST, 8 },
532
533 // PC Test/Simulation flash 4x4kB
534 { &flash_4x4[0], (char *) 0x000000, MANUFACT_TEST, 0x0404,
535 FFS_DRIVER_TEST, 4 },
536
537 // terminator
538 { 0, 0, 0, 0 }
539 };
540