2 Common Flash Interface probe code.
3 (C) 2000 Red Hat. GPL'd.
4 See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5)
5 for the standard this probe goes back to.
7 Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
15 #include <asm/byteorder.h>
16 #include <linux/errno.h>
17 #include <linux/slab.h>
18 #include <linux/interrupt.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/cfi.h>
23 #include <linux/mtd/gen_probe.h>
26 #define MANUFACTURER_AMD 0x0001
27 #define MANUFACTURER_ATMEL 0x001f
28 #define MANUFACTURER_EON 0x001c
29 #define MANUFACTURER_FUJITSU 0x0004
30 #define MANUFACTURER_HYUNDAI 0x00AD
31 #define MANUFACTURER_INTEL 0x0089
32 #define MANUFACTURER_MACRONIX 0x00C2
33 #define MANUFACTURER_NEC 0x0010
34 #define MANUFACTURER_PMC 0x009D
35 #define MANUFACTURER_SHARP 0x00b0
36 #define MANUFACTURER_SST 0x00BF
37 #define MANUFACTURER_ST 0x0020
38 #define MANUFACTURER_TOSHIBA 0x0098
39 #define MANUFACTURER_WINBOND 0x00da
40 #define CONTINUATION_CODE 0x007f
44 #define AM29DL800BB 0x22CB
45 #define AM29DL800BT 0x224A
47 #define AM29F800BB 0x2258
48 #define AM29F800BT 0x22D6
49 #define AM29LV400BB 0x22BA
50 #define AM29LV400BT 0x22B9
51 #define AM29LV800BB 0x225B
52 #define AM29LV800BT 0x22DA
53 #define AM29LV160DT 0x22C4
54 #define AM29LV160DB 0x2249
55 #define AM29F017D 0x003D
56 #define AM29F016D 0x00AD
57 #define AM29F080 0x00D5
58 #define AM29F040 0x00A4
59 #define AM29LV040B 0x004F
60 #define AM29F032B 0x0041
61 #define AM29F002T 0x00B0
62 #define AM29SL800DB 0x226B
63 #define AM29SL800DT 0x22EA
66 #define AT49BV512 0x0003
67 #define AT29LV512 0x003d
68 #define AT49BV16X 0x00C0
69 #define AT49BV16XT 0x00C2
70 #define AT49BV32X 0x00C8
71 #define AT49BV32XT 0x00C9
74 #define EN29SL800BB 0x226B
75 #define EN29SL800BT 0x22EA
78 #define MBM29F040C 0x00A4
79 #define MBM29F800BA 0x2258
80 #define MBM29LV650UE 0x22D7
81 #define MBM29LV320TE 0x22F6
82 #define MBM29LV320BE 0x22F9
83 #define MBM29LV160TE 0x22C4
84 #define MBM29LV160BE 0x2249
85 #define MBM29LV800BA 0x225B
86 #define MBM29LV800TA 0x22DA
87 #define MBM29LV400TC 0x22B9
88 #define MBM29LV400BC 0x22BA
91 #define HY29F002T 0x00B0
94 #define I28F004B3T 0x00d4
95 #define I28F004B3B 0x00d5
96 #define I28F400B3T 0x8894
97 #define I28F400B3B 0x8895
98 #define I28F008S5 0x00a6
99 #define I28F016S5 0x00a0
100 #define I28F008SA 0x00a2
101 #define I28F008B3T 0x00d2
102 #define I28F008B3B 0x00d3
103 #define I28F800B3T 0x8892
104 #define I28F800B3B 0x8893
105 #define I28F016S3 0x00aa
106 #define I28F016B3T 0x00d0
107 #define I28F016B3B 0x00d1
108 #define I28F160B3T 0x8890
109 #define I28F160B3B 0x8891
110 #define I28F320B3T 0x8896
111 #define I28F320B3B 0x8897
112 #define I28F640B3T 0x8898
113 #define I28F640B3B 0x8899
114 #define I82802AB 0x00ad
115 #define I82802AC 0x00ac
118 #define MX29LV040C 0x004F
119 #define MX29LV160T 0x22C4
120 #define MX29LV160B 0x2249
121 #define MX29F040 0x00A4
122 #define MX29F016 0x00AD
123 #define MX29F002T 0x00B0
124 #define MX29F004T 0x0045
125 #define MX29F004B 0x0046
128 #define UPD29F064115 0x221C
131 #define PM49FL002 0x006D
132 #define PM49FL004 0x006E
133 #define PM49FL008 0x006A
136 #define LH28F640BF 0x00b0
138 /* ST - www.st.com */
139 #define M29F800AB 0x0058
140 #define M29W800DT 0x00D7
141 #define M29W800DB 0x005B
142 #define M29W400DT 0x00EE
143 #define M29W400DB 0x00EF
144 #define M29W160DT 0x22C4
145 #define M29W160DB 0x2249
146 #define M29W040B 0x00E3
147 #define M50FW040 0x002C
148 #define M50FW080 0x002D
149 #define M50FW016 0x002E
150 #define M50LPW080 0x002F
151 #define M50FLW080A 0x0080
152 #define M50FLW080B 0x0081
155 #define SST29EE020 0x0010
156 #define SST29LE020 0x0012
157 #define SST29EE512 0x005d
158 #define SST29LE512 0x003d
159 #define SST39LF800 0x2781
160 #define SST39LF160 0x2782
161 #define SST39VF1601 0x234b
162 #define SST39VF3201 0x235b
163 #define SST39LF512 0x00D4
164 #define SST39LF010 0x00D5
165 #define SST39LF020 0x00D6
166 #define SST39LF040 0x00D7
167 #define SST39SF010A 0x00B5
168 #define SST39SF020A 0x00B6
169 #define SST49LF004B 0x0060
170 #define SST49LF040B 0x0050
171 #define SST49LF008A 0x005a
172 #define SST49LF030A 0x001C
173 #define SST49LF040A 0x0051
174 #define SST49LF080A 0x005B
175 #define SST36VF3203 0x7354
178 #define TC58FVT160 0x00C2
179 #define TC58FVB160 0x0043
180 #define TC58FVT321 0x009A
181 #define TC58FVB321 0x009C
182 #define TC58FVT641 0x0093
183 #define TC58FVB641 0x0095
186 #define W49V002A 0x00b0
190 * Unlock address sets for AMD command sets.
191 * Intel command sets use the MTD_UADDR_UNNECESSARY.
192 * Each identifier, except MTD_UADDR_UNNECESSARY, and
193 * MTD_UADDR_NO_SUPPORT must be defined below in unlock_addrs[].
194 * MTD_UADDR_NOT_SUPPORTED must be 0 so that structure
195 * initialization need not require initializing all of the
196 * unlock addresses for all bit widths.
199 MTD_UADDR_NOT_SUPPORTED = 0, /* data width not supported */
200 MTD_UADDR_0x0555_0x02AA,
201 MTD_UADDR_0x0555_0x0AAA,
202 MTD_UADDR_0x5555_0x2AAA,
203 MTD_UADDR_0x0AAA_0x0555,
204 MTD_UADDR_0xAAAA_0x5555,
205 MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */
206 MTD_UADDR_UNNECESSARY, /* Does not require any address */
217 * I don't like the fact that the first entry in unlock_addrs[]
218 * exists, but is for MTD_UADDR_NOT_SUPPORTED - and, therefore,
219 * should not be used. The problem is that structures with
220 * initializers have extra fields initialized to 0. It is _very_
221 * desireable to have the unlock address entries for unsupported
222 * data widths automatically initialized - that means that
223 * MTD_UADDR_NOT_SUPPORTED must be 0 and the first entry here
226 static const struct unlock_addr unlock_addrs[] = {
227 [MTD_UADDR_NOT_SUPPORTED] = {
232 [MTD_UADDR_0x0555_0x02AA] = {
237 [MTD_UADDR_0x0555_0x0AAA] = {
242 [MTD_UADDR_0x5555_0x2AAA] = {
247 [MTD_UADDR_0x0AAA_0x0555] = {
252 [MTD_UADDR_0xAAAA_0x5555] = {
257 [MTD_UADDR_DONT_CARE] = {
258 .addr1 = 0x0000, /* Doesn't matter which address */
259 .addr2 = 0x0000 /* is used - must be last entry */
262 [MTD_UADDR_UNNECESSARY] = {
268 struct amd_flash_info {
270 const uint16_t mfr_id;
271 const uint16_t dev_id;
272 const uint8_t dev_size;
273 const uint8_t nr_regions;
274 const uint16_t cmd_set;
275 const uint32_t regions[6];
276 const uint8_t devtypes; /* Bitmask for x8, x16 etc. */
277 const uint8_t uaddr; /* unlock addrs for 8, 16, 32, 64 */
280 #define ERASEINFO(size,blocks) (size<<8)|(blocks-1)
282 #define SIZE_64KiB 16
283 #define SIZE_128KiB 17
284 #define SIZE_256KiB 18
285 #define SIZE_512KiB 19
293 * Please keep this list ordered by manufacturer!
294 * Fortunately, the list isn't searched often and so a
295 * slow, linear search isn't so bad.
297 static const struct amd_flash_info jedec_table[] = {
299 .mfr_id = MANUFACTURER_AMD,
301 .name = "AMD AM29F032B",
302 .uaddr = MTD_UADDR_0x0555_0x02AA,
303 .devtypes = CFI_DEVICETYPE_X8,
304 .dev_size = SIZE_4MiB,
305 .cmd_set = P_ID_AMD_STD,
308 ERASEINFO(0x10000,64)
311 .mfr_id = MANUFACTURER_AMD,
312 .dev_id = AM29LV160DT,
313 .name = "AMD AM29LV160DT",
314 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
315 .uaddr = MTD_UADDR_0x0AAA_0x0555,
316 .dev_size = SIZE_2MiB,
317 .cmd_set = P_ID_AMD_STD,
320 ERASEINFO(0x10000,31),
321 ERASEINFO(0x08000,1),
322 ERASEINFO(0x02000,2),
326 .mfr_id = MANUFACTURER_AMD,
327 .dev_id = AM29LV160DB,
328 .name = "AMD AM29LV160DB",
329 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
330 .uaddr = MTD_UADDR_0x0AAA_0x0555,
331 .dev_size = SIZE_2MiB,
332 .cmd_set = P_ID_AMD_STD,
335 ERASEINFO(0x04000,1),
336 ERASEINFO(0x02000,2),
337 ERASEINFO(0x08000,1),
338 ERASEINFO(0x10000,31)
341 .mfr_id = MANUFACTURER_AMD,
342 .dev_id = AM29LV400BB,
343 .name = "AMD AM29LV400BB",
344 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
345 .uaddr = MTD_UADDR_0x0AAA_0x0555,
346 .dev_size = SIZE_512KiB,
347 .cmd_set = P_ID_AMD_STD,
350 ERASEINFO(0x04000,1),
351 ERASEINFO(0x02000,2),
352 ERASEINFO(0x08000,1),
356 .mfr_id = MANUFACTURER_AMD,
357 .dev_id = AM29LV400BT,
358 .name = "AMD AM29LV400BT",
359 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
360 .uaddr = MTD_UADDR_0x0AAA_0x0555,
361 .dev_size = SIZE_512KiB,
362 .cmd_set = P_ID_AMD_STD,
365 ERASEINFO(0x10000,7),
366 ERASEINFO(0x08000,1),
367 ERASEINFO(0x02000,2),
371 .mfr_id = MANUFACTURER_AMD,
372 .dev_id = AM29LV800BB,
373 .name = "AMD AM29LV800BB",
374 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
375 .uaddr = MTD_UADDR_0x0AAA_0x0555,
376 .dev_size = SIZE_1MiB,
377 .cmd_set = P_ID_AMD_STD,
380 ERASEINFO(0x04000,1),
381 ERASEINFO(0x02000,2),
382 ERASEINFO(0x08000,1),
383 ERASEINFO(0x10000,15),
387 .mfr_id = MANUFACTURER_AMD,
388 .dev_id = AM29DL800BB,
389 .name = "AMD AM29DL800BB",
390 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
391 .uaddr = MTD_UADDR_0x0AAA_0x0555,
392 .dev_size = SIZE_1MiB,
393 .cmd_set = P_ID_AMD_STD,
396 ERASEINFO(0x04000,1),
397 ERASEINFO(0x08000,1),
398 ERASEINFO(0x02000,4),
399 ERASEINFO(0x08000,1),
400 ERASEINFO(0x04000,1),
401 ERASEINFO(0x10000,14)
404 .mfr_id = MANUFACTURER_AMD,
405 .dev_id = AM29DL800BT,
406 .name = "AMD AM29DL800BT",
407 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
408 .uaddr = MTD_UADDR_0x0AAA_0x0555,
409 .dev_size = SIZE_1MiB,
410 .cmd_set = P_ID_AMD_STD,
413 ERASEINFO(0x10000,14),
414 ERASEINFO(0x04000,1),
415 ERASEINFO(0x08000,1),
416 ERASEINFO(0x02000,4),
417 ERASEINFO(0x08000,1),
421 .mfr_id = MANUFACTURER_AMD,
422 .dev_id = AM29F800BB,
423 .name = "AMD AM29F800BB",
424 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
425 .uaddr = MTD_UADDR_0x0AAA_0x0555,
426 .dev_size = SIZE_1MiB,
427 .cmd_set = P_ID_AMD_STD,
430 ERASEINFO(0x04000,1),
431 ERASEINFO(0x02000,2),
432 ERASEINFO(0x08000,1),
433 ERASEINFO(0x10000,15),
436 .mfr_id = MANUFACTURER_AMD,
437 .dev_id = AM29LV800BT,
438 .name = "AMD AM29LV800BT",
439 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
440 .uaddr = MTD_UADDR_0x0AAA_0x0555,
441 .dev_size = SIZE_1MiB,
442 .cmd_set = P_ID_AMD_STD,
445 ERASEINFO(0x10000,15),
446 ERASEINFO(0x08000,1),
447 ERASEINFO(0x02000,2),
451 .mfr_id = MANUFACTURER_AMD,
452 .dev_id = AM29F800BT,
453 .name = "AMD AM29F800BT",
454 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
455 .uaddr = MTD_UADDR_0x0AAA_0x0555,
456 .dev_size = SIZE_1MiB,
457 .cmd_set = P_ID_AMD_STD,
460 ERASEINFO(0x10000,15),
461 ERASEINFO(0x08000,1),
462 ERASEINFO(0x02000,2),
466 .mfr_id = MANUFACTURER_AMD,
468 .name = "AMD AM29F017D",
469 .devtypes = CFI_DEVICETYPE_X8,
470 .uaddr = MTD_UADDR_DONT_CARE,
471 .dev_size = SIZE_2MiB,
472 .cmd_set = P_ID_AMD_STD,
475 ERASEINFO(0x10000,32),
478 .mfr_id = MANUFACTURER_AMD,
480 .name = "AMD AM29F016D",
481 .devtypes = CFI_DEVICETYPE_X8,
482 .uaddr = MTD_UADDR_0x0555_0x02AA,
483 .dev_size = SIZE_2MiB,
484 .cmd_set = P_ID_AMD_STD,
487 ERASEINFO(0x10000,32),
490 .mfr_id = MANUFACTURER_AMD,
492 .name = "AMD AM29F080",
493 .devtypes = CFI_DEVICETYPE_X8,
494 .uaddr = MTD_UADDR_0x0555_0x02AA,
495 .dev_size = SIZE_1MiB,
496 .cmd_set = P_ID_AMD_STD,
499 ERASEINFO(0x10000,16),
502 .mfr_id = MANUFACTURER_AMD,
504 .name = "AMD AM29F040",
505 .devtypes = CFI_DEVICETYPE_X8,
506 .uaddr = MTD_UADDR_0x0555_0x02AA,
507 .dev_size = SIZE_512KiB,
508 .cmd_set = P_ID_AMD_STD,
511 ERASEINFO(0x10000,8),
514 .mfr_id = MANUFACTURER_AMD,
515 .dev_id = AM29LV040B,
516 .name = "AMD AM29LV040B",
517 .devtypes = CFI_DEVICETYPE_X8,
518 .uaddr = MTD_UADDR_0x0555_0x02AA,
519 .dev_size = SIZE_512KiB,
520 .cmd_set = P_ID_AMD_STD,
523 ERASEINFO(0x10000,8),
526 .mfr_id = MANUFACTURER_AMD,
528 .name = "AMD AM29F002T",
529 .devtypes = CFI_DEVICETYPE_X8,
530 .uaddr = MTD_UADDR_0x0555_0x02AA,
531 .dev_size = SIZE_256KiB,
532 .cmd_set = P_ID_AMD_STD,
535 ERASEINFO(0x10000,3),
536 ERASEINFO(0x08000,1),
537 ERASEINFO(0x02000,2),
538 ERASEINFO(0x04000,1),
541 .mfr_id = MANUFACTURER_AMD,
542 .dev_id = AM29SL800DT,
543 .name = "AMD AM29SL800DT",
544 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
545 .uaddr = MTD_UADDR_0x0AAA_0x0555,
546 .dev_size = SIZE_1MiB,
547 .cmd_set = P_ID_AMD_STD,
550 ERASEINFO(0x10000,15),
551 ERASEINFO(0x08000,1),
552 ERASEINFO(0x02000,2),
553 ERASEINFO(0x04000,1),
556 .mfr_id = MANUFACTURER_AMD,
557 .dev_id = AM29SL800DB,
558 .name = "AMD AM29SL800DB",
559 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
560 .uaddr = MTD_UADDR_0x0AAA_0x0555,
561 .dev_size = SIZE_1MiB,
562 .cmd_set = P_ID_AMD_STD,
565 ERASEINFO(0x04000,1),
566 ERASEINFO(0x02000,2),
567 ERASEINFO(0x08000,1),
568 ERASEINFO(0x10000,15),
571 .mfr_id = MANUFACTURER_ATMEL,
573 .name = "Atmel AT49BV512",
574 .devtypes = CFI_DEVICETYPE_X8,
575 .uaddr = MTD_UADDR_0x5555_0x2AAA,
576 .dev_size = SIZE_64KiB,
577 .cmd_set = P_ID_AMD_STD,
583 .mfr_id = MANUFACTURER_ATMEL,
585 .name = "Atmel AT29LV512",
586 .devtypes = CFI_DEVICETYPE_X8,
587 .uaddr = MTD_UADDR_0x5555_0x2AAA,
588 .dev_size = SIZE_64KiB,
589 .cmd_set = P_ID_AMD_STD,
596 .mfr_id = MANUFACTURER_ATMEL,
598 .name = "Atmel AT49BV16X",
599 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
600 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
601 .dev_size = SIZE_2MiB,
602 .cmd_set = P_ID_AMD_STD,
605 ERASEINFO(0x02000,8),
606 ERASEINFO(0x10000,31)
609 .mfr_id = MANUFACTURER_ATMEL,
610 .dev_id = AT49BV16XT,
611 .name = "Atmel AT49BV16XT",
612 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
613 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
614 .dev_size = SIZE_2MiB,
615 .cmd_set = P_ID_AMD_STD,
618 ERASEINFO(0x10000,31),
622 .mfr_id = MANUFACTURER_ATMEL,
624 .name = "Atmel AT49BV32X",
625 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
626 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
627 .dev_size = SIZE_4MiB,
628 .cmd_set = P_ID_AMD_STD,
631 ERASEINFO(0x02000,8),
632 ERASEINFO(0x10000,63)
635 .mfr_id = MANUFACTURER_ATMEL,
636 .dev_id = AT49BV32XT,
637 .name = "Atmel AT49BV32XT",
638 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
639 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
640 .dev_size = SIZE_4MiB,
641 .cmd_set = P_ID_AMD_STD,
644 ERASEINFO(0x10000,63),
648 .mfr_id = MANUFACTURER_EON,
649 .dev_id = EN29SL800BT,
650 .name = "Eon EN29SL800BT",
651 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
652 .uaddr = MTD_UADDR_0x0AAA_0x0555,
653 .dev_size = SIZE_1MiB,
654 .cmd_set = P_ID_AMD_STD,
657 ERASEINFO(0x10000,15),
658 ERASEINFO(0x08000,1),
659 ERASEINFO(0x02000,2),
660 ERASEINFO(0x04000,1),
663 .mfr_id = MANUFACTURER_EON,
664 .dev_id = EN29SL800BB,
665 .name = "Eon EN29SL800BB",
666 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
667 .uaddr = MTD_UADDR_0x0AAA_0x0555,
668 .dev_size = SIZE_1MiB,
669 .cmd_set = P_ID_AMD_STD,
672 ERASEINFO(0x04000,1),
673 ERASEINFO(0x02000,2),
674 ERASEINFO(0x08000,1),
675 ERASEINFO(0x10000,15),
678 .mfr_id = MANUFACTURER_FUJITSU,
679 .dev_id = MBM29F040C,
680 .name = "Fujitsu MBM29F040C",
681 .devtypes = CFI_DEVICETYPE_X8,
682 .uaddr = MTD_UADDR_0x0AAA_0x0555,
683 .dev_size = SIZE_512KiB,
684 .cmd_set = P_ID_AMD_STD,
690 .mfr_id = MANUFACTURER_FUJITSU,
691 .dev_id = MBM29F800BA,
692 .name = "Fujitsu MBM29F800BA",
693 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
694 .uaddr = MTD_UADDR_0x0AAA_0x0555,
695 .dev_size = SIZE_1MiB,
696 .cmd_set = P_ID_AMD_STD,
699 ERASEINFO(0x04000,1),
700 ERASEINFO(0x02000,2),
701 ERASEINFO(0x08000,1),
702 ERASEINFO(0x10000,15),
705 .mfr_id = MANUFACTURER_FUJITSU,
706 .dev_id = MBM29LV650UE,
707 .name = "Fujitsu MBM29LV650UE",
708 .devtypes = CFI_DEVICETYPE_X8,
709 .uaddr = MTD_UADDR_DONT_CARE,
710 .dev_size = SIZE_8MiB,
711 .cmd_set = P_ID_AMD_STD,
714 ERASEINFO(0x10000,128)
717 .mfr_id = MANUFACTURER_FUJITSU,
718 .dev_id = MBM29LV320TE,
719 .name = "Fujitsu MBM29LV320TE",
720 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
721 .uaddr = MTD_UADDR_0x0AAA_0x0555,
722 .dev_size = SIZE_4MiB,
723 .cmd_set = P_ID_AMD_STD,
726 ERASEINFO(0x10000,63),
730 .mfr_id = MANUFACTURER_FUJITSU,
731 .dev_id = MBM29LV320BE,
732 .name = "Fujitsu MBM29LV320BE",
733 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
734 .uaddr = MTD_UADDR_0x0AAA_0x0555,
735 .dev_size = SIZE_4MiB,
736 .cmd_set = P_ID_AMD_STD,
739 ERASEINFO(0x02000,8),
740 ERASEINFO(0x10000,63)
743 .mfr_id = MANUFACTURER_FUJITSU,
744 .dev_id = MBM29LV160TE,
745 .name = "Fujitsu MBM29LV160TE",
746 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
747 .uaddr = MTD_UADDR_0x0AAA_0x0555,
748 .dev_size = SIZE_2MiB,
749 .cmd_set = P_ID_AMD_STD,
752 ERASEINFO(0x10000,31),
753 ERASEINFO(0x08000,1),
754 ERASEINFO(0x02000,2),
758 .mfr_id = MANUFACTURER_FUJITSU,
759 .dev_id = MBM29LV160BE,
760 .name = "Fujitsu MBM29LV160BE",
761 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
762 .uaddr = MTD_UADDR_0x0AAA_0x0555,
763 .dev_size = SIZE_2MiB,
764 .cmd_set = P_ID_AMD_STD,
767 ERASEINFO(0x04000,1),
768 ERASEINFO(0x02000,2),
769 ERASEINFO(0x08000,1),
770 ERASEINFO(0x10000,31)
773 .mfr_id = MANUFACTURER_FUJITSU,
774 .dev_id = MBM29LV800BA,
775 .name = "Fujitsu MBM29LV800BA",
776 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
777 .uaddr = MTD_UADDR_0x0AAA_0x0555,
778 .dev_size = SIZE_1MiB,
779 .cmd_set = P_ID_AMD_STD,
782 ERASEINFO(0x04000,1),
783 ERASEINFO(0x02000,2),
784 ERASEINFO(0x08000,1),
785 ERASEINFO(0x10000,15)
788 .mfr_id = MANUFACTURER_FUJITSU,
789 .dev_id = MBM29LV800TA,
790 .name = "Fujitsu MBM29LV800TA",
791 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
792 .uaddr = MTD_UADDR_0x0AAA_0x0555,
793 .dev_size = SIZE_1MiB,
794 .cmd_set = P_ID_AMD_STD,
797 ERASEINFO(0x10000,15),
798 ERASEINFO(0x08000,1),
799 ERASEINFO(0x02000,2),
803 .mfr_id = MANUFACTURER_FUJITSU,
804 .dev_id = MBM29LV400BC,
805 .name = "Fujitsu MBM29LV400BC",
806 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
807 .uaddr = MTD_UADDR_0x0AAA_0x0555,
808 .dev_size = SIZE_512KiB,
809 .cmd_set = P_ID_AMD_STD,
812 ERASEINFO(0x04000,1),
813 ERASEINFO(0x02000,2),
814 ERASEINFO(0x08000,1),
818 .mfr_id = MANUFACTURER_FUJITSU,
819 .dev_id = MBM29LV400TC,
820 .name = "Fujitsu MBM29LV400TC",
821 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
822 .uaddr = MTD_UADDR_0x0AAA_0x0555,
823 .dev_size = SIZE_512KiB,
824 .cmd_set = P_ID_AMD_STD,
827 ERASEINFO(0x10000,7),
828 ERASEINFO(0x08000,1),
829 ERASEINFO(0x02000,2),
833 .mfr_id = MANUFACTURER_HYUNDAI,
835 .name = "Hyundai HY29F002T",
836 .devtypes = CFI_DEVICETYPE_X8,
837 .uaddr = MTD_UADDR_0x0555_0x02AA,
838 .dev_size = SIZE_256KiB,
839 .cmd_set = P_ID_AMD_STD,
842 ERASEINFO(0x10000,3),
843 ERASEINFO(0x08000,1),
844 ERASEINFO(0x02000,2),
845 ERASEINFO(0x04000,1),
848 .mfr_id = MANUFACTURER_INTEL,
849 .dev_id = I28F004B3B,
850 .name = "Intel 28F004B3B",
851 .devtypes = CFI_DEVICETYPE_X8,
852 .uaddr = MTD_UADDR_UNNECESSARY,
853 .dev_size = SIZE_512KiB,
854 .cmd_set = P_ID_INTEL_STD,
857 ERASEINFO(0x02000, 8),
858 ERASEINFO(0x10000, 7),
861 .mfr_id = MANUFACTURER_INTEL,
862 .dev_id = I28F004B3T,
863 .name = "Intel 28F004B3T",
864 .devtypes = CFI_DEVICETYPE_X8,
865 .uaddr = MTD_UADDR_UNNECESSARY,
866 .dev_size = SIZE_512KiB,
867 .cmd_set = P_ID_INTEL_STD,
870 ERASEINFO(0x10000, 7),
871 ERASEINFO(0x02000, 8),
874 .mfr_id = MANUFACTURER_INTEL,
875 .dev_id = I28F400B3B,
876 .name = "Intel 28F400B3B",
877 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
878 .uaddr = MTD_UADDR_UNNECESSARY,
879 .dev_size = SIZE_512KiB,
880 .cmd_set = P_ID_INTEL_STD,
883 ERASEINFO(0x02000, 8),
884 ERASEINFO(0x10000, 7),
887 .mfr_id = MANUFACTURER_INTEL,
888 .dev_id = I28F400B3T,
889 .name = "Intel 28F400B3T",
890 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
891 .uaddr = MTD_UADDR_UNNECESSARY,
892 .dev_size = SIZE_512KiB,
893 .cmd_set = P_ID_INTEL_STD,
896 ERASEINFO(0x10000, 7),
897 ERASEINFO(0x02000, 8),
900 .mfr_id = MANUFACTURER_INTEL,
901 .dev_id = I28F008B3B,
902 .name = "Intel 28F008B3B",
903 .devtypes = CFI_DEVICETYPE_X8,
904 .uaddr = MTD_UADDR_UNNECESSARY,
905 .dev_size = SIZE_1MiB,
906 .cmd_set = P_ID_INTEL_STD,
909 ERASEINFO(0x02000, 8),
910 ERASEINFO(0x10000, 15),
913 .mfr_id = MANUFACTURER_INTEL,
914 .dev_id = I28F008B3T,
915 .name = "Intel 28F008B3T",
916 .devtypes = CFI_DEVICETYPE_X8,
917 .uaddr = MTD_UADDR_UNNECESSARY,
918 .dev_size = SIZE_1MiB,
919 .cmd_set = P_ID_INTEL_STD,
922 ERASEINFO(0x10000, 15),
923 ERASEINFO(0x02000, 8),
926 .mfr_id = MANUFACTURER_INTEL,
928 .name = "Intel 28F008S5",
929 .devtypes = CFI_DEVICETYPE_X8,
930 .uaddr = MTD_UADDR_UNNECESSARY,
931 .dev_size = SIZE_1MiB,
932 .cmd_set = P_ID_INTEL_EXT,
935 ERASEINFO(0x10000,16),
938 .mfr_id = MANUFACTURER_INTEL,
940 .name = "Intel 28F016S5",
941 .devtypes = CFI_DEVICETYPE_X8,
942 .uaddr = MTD_UADDR_UNNECESSARY,
943 .dev_size = SIZE_2MiB,
944 .cmd_set = P_ID_INTEL_EXT,
947 ERASEINFO(0x10000,32),
950 .mfr_id = MANUFACTURER_INTEL,
952 .name = "Intel 28F008SA",
953 .devtypes = CFI_DEVICETYPE_X8,
954 .uaddr = MTD_UADDR_UNNECESSARY,
955 .dev_size = SIZE_1MiB,
956 .cmd_set = P_ID_INTEL_STD,
959 ERASEINFO(0x10000, 16),
962 .mfr_id = MANUFACTURER_INTEL,
963 .dev_id = I28F800B3B,
964 .name = "Intel 28F800B3B",
965 .devtypes = CFI_DEVICETYPE_X16,
966 .uaddr = MTD_UADDR_UNNECESSARY,
967 .dev_size = SIZE_1MiB,
968 .cmd_set = P_ID_INTEL_STD,
971 ERASEINFO(0x02000, 8),
972 ERASEINFO(0x10000, 15),
975 .mfr_id = MANUFACTURER_INTEL,
976 .dev_id = I28F800B3T,
977 .name = "Intel 28F800B3T",
978 .devtypes = CFI_DEVICETYPE_X16,
979 .uaddr = MTD_UADDR_UNNECESSARY,
980 .dev_size = SIZE_1MiB,
981 .cmd_set = P_ID_INTEL_STD,
984 ERASEINFO(0x10000, 15),
985 ERASEINFO(0x02000, 8),
988 .mfr_id = MANUFACTURER_INTEL,
989 .dev_id = I28F016B3B,
990 .name = "Intel 28F016B3B",
991 .devtypes = CFI_DEVICETYPE_X8,
992 .uaddr = MTD_UADDR_UNNECESSARY,
993 .dev_size = SIZE_2MiB,
994 .cmd_set = P_ID_INTEL_STD,
997 ERASEINFO(0x02000, 8),
998 ERASEINFO(0x10000, 31),
1001 .mfr_id = MANUFACTURER_INTEL,
1002 .dev_id = I28F016S3,
1003 .name = "Intel I28F016S3",
1004 .devtypes = CFI_DEVICETYPE_X8,
1005 .uaddr = MTD_UADDR_UNNECESSARY,
1006 .dev_size = SIZE_2MiB,
1007 .cmd_set = P_ID_INTEL_STD,
1010 ERASEINFO(0x10000, 32),
1013 .mfr_id = MANUFACTURER_INTEL,
1014 .dev_id = I28F016B3T,
1015 .name = "Intel 28F016B3T",
1016 .devtypes = CFI_DEVICETYPE_X8,
1017 .uaddr = MTD_UADDR_UNNECESSARY,
1018 .dev_size = SIZE_2MiB,
1019 .cmd_set = P_ID_INTEL_STD,
1022 ERASEINFO(0x10000, 31),
1023 ERASEINFO(0x02000, 8),
1026 .mfr_id = MANUFACTURER_INTEL,
1027 .dev_id = I28F160B3B,
1028 .name = "Intel 28F160B3B",
1029 .devtypes = CFI_DEVICETYPE_X16,
1030 .uaddr = MTD_UADDR_UNNECESSARY,
1031 .dev_size = SIZE_2MiB,
1032 .cmd_set = P_ID_INTEL_STD,
1035 ERASEINFO(0x02000, 8),
1036 ERASEINFO(0x10000, 31),
1039 .mfr_id = MANUFACTURER_INTEL,
1040 .dev_id = I28F160B3T,
1041 .name = "Intel 28F160B3T",
1042 .devtypes = CFI_DEVICETYPE_X16,
1043 .uaddr = MTD_UADDR_UNNECESSARY,
1044 .dev_size = SIZE_2MiB,
1045 .cmd_set = P_ID_INTEL_STD,
1048 ERASEINFO(0x10000, 31),
1049 ERASEINFO(0x02000, 8),
1052 .mfr_id = MANUFACTURER_INTEL,
1053 .dev_id = I28F320B3B,
1054 .name = "Intel 28F320B3B",
1055 .devtypes = CFI_DEVICETYPE_X16,
1056 .uaddr = MTD_UADDR_UNNECESSARY,
1057 .dev_size = SIZE_4MiB,
1058 .cmd_set = P_ID_INTEL_STD,
1061 ERASEINFO(0x02000, 8),
1062 ERASEINFO(0x10000, 63),
1065 .mfr_id = MANUFACTURER_INTEL,
1066 .dev_id = I28F320B3T,
1067 .name = "Intel 28F320B3T",
1068 .devtypes = CFI_DEVICETYPE_X16,
1069 .uaddr = MTD_UADDR_UNNECESSARY,
1070 .dev_size = SIZE_4MiB,
1071 .cmd_set = P_ID_INTEL_STD,
1074 ERASEINFO(0x10000, 63),
1075 ERASEINFO(0x02000, 8),
1078 .mfr_id = MANUFACTURER_INTEL,
1079 .dev_id = I28F640B3B,
1080 .name = "Intel 28F640B3B",
1081 .devtypes = CFI_DEVICETYPE_X16,
1082 .uaddr = MTD_UADDR_UNNECESSARY,
1083 .dev_size = SIZE_8MiB,
1084 .cmd_set = P_ID_INTEL_STD,
1087 ERASEINFO(0x02000, 8),
1088 ERASEINFO(0x10000, 127),
1091 .mfr_id = MANUFACTURER_INTEL,
1092 .dev_id = I28F640B3T,
1093 .name = "Intel 28F640B3T",
1094 .devtypes = CFI_DEVICETYPE_X16,
1095 .uaddr = MTD_UADDR_UNNECESSARY,
1096 .dev_size = SIZE_8MiB,
1097 .cmd_set = P_ID_INTEL_STD,
1100 ERASEINFO(0x10000, 127),
1101 ERASEINFO(0x02000, 8),
1104 .mfr_id = MANUFACTURER_INTEL,
1106 .name = "Intel 82802AB",
1107 .devtypes = CFI_DEVICETYPE_X8,
1108 .uaddr = MTD_UADDR_UNNECESSARY,
1109 .dev_size = SIZE_512KiB,
1110 .cmd_set = P_ID_INTEL_EXT,
1113 ERASEINFO(0x10000,8),
1116 .mfr_id = MANUFACTURER_INTEL,
1118 .name = "Intel 82802AC",
1119 .devtypes = CFI_DEVICETYPE_X8,
1120 .uaddr = MTD_UADDR_UNNECESSARY,
1121 .dev_size = SIZE_1MiB,
1122 .cmd_set = P_ID_INTEL_EXT,
1125 ERASEINFO(0x10000,16),
1128 .mfr_id = MANUFACTURER_MACRONIX,
1129 .dev_id = MX29LV040C,
1130 .name = "Macronix MX29LV040C",
1131 .devtypes = CFI_DEVICETYPE_X8,
1132 .uaddr = MTD_UADDR_0x0555_0x02AA,
1133 .dev_size = SIZE_512KiB,
1134 .cmd_set = P_ID_AMD_STD,
1137 ERASEINFO(0x10000,8),
1140 .mfr_id = MANUFACTURER_MACRONIX,
1141 .dev_id = MX29LV160T,
1142 .name = "MXIC MX29LV160T",
1143 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1144 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1145 .dev_size = SIZE_2MiB,
1146 .cmd_set = P_ID_AMD_STD,
1149 ERASEINFO(0x10000,31),
1150 ERASEINFO(0x08000,1),
1151 ERASEINFO(0x02000,2),
1152 ERASEINFO(0x04000,1)
1155 .mfr_id = MANUFACTURER_NEC,
1156 .dev_id = UPD29F064115,
1157 .name = "NEC uPD29F064115",
1158 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1159 .uaddr = MTD_UADDR_0x0555_0x02AA, /* ???? */
1160 .dev_size = SIZE_8MiB,
1161 .cmd_set = P_ID_AMD_STD,
1164 ERASEINFO(0x2000,8),
1165 ERASEINFO(0x10000,126),
1166 ERASEINFO(0x2000,8),
1169 .mfr_id = MANUFACTURER_MACRONIX,
1170 .dev_id = MX29LV160B,
1171 .name = "MXIC MX29LV160B",
1172 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1173 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1174 .dev_size = SIZE_2MiB,
1175 .cmd_set = P_ID_AMD_STD,
1178 ERASEINFO(0x04000,1),
1179 ERASEINFO(0x02000,2),
1180 ERASEINFO(0x08000,1),
1181 ERASEINFO(0x10000,31)
1184 .mfr_id = MANUFACTURER_MACRONIX,
1186 .name = "Macronix MX29F040",
1187 .devtypes = CFI_DEVICETYPE_X8,
1188 .uaddr = MTD_UADDR_0x0555_0x02AA,
1189 .dev_size = SIZE_512KiB,
1190 .cmd_set = P_ID_AMD_STD,
1193 ERASEINFO(0x10000,8),
1196 .mfr_id = MANUFACTURER_MACRONIX,
1198 .name = "Macronix MX29F016",
1199 .devtypes = CFI_DEVICETYPE_X8,
1200 .uaddr = MTD_UADDR_0x0555_0x02AA,
1201 .dev_size = SIZE_2MiB,
1202 .cmd_set = P_ID_AMD_STD,
1205 ERASEINFO(0x10000,32),
1208 .mfr_id = MANUFACTURER_MACRONIX,
1209 .dev_id = MX29F004T,
1210 .name = "Macronix MX29F004T",
1211 .devtypes = CFI_DEVICETYPE_X8,
1212 .uaddr = MTD_UADDR_0x0555_0x02AA,
1213 .dev_size = SIZE_512KiB,
1214 .cmd_set = P_ID_AMD_STD,
1217 ERASEINFO(0x10000,7),
1218 ERASEINFO(0x08000,1),
1219 ERASEINFO(0x02000,2),
1220 ERASEINFO(0x04000,1),
1223 .mfr_id = MANUFACTURER_MACRONIX,
1224 .dev_id = MX29F004B,
1225 .name = "Macronix MX29F004B",
1226 .devtypes = CFI_DEVICETYPE_X8,
1227 .uaddr = MTD_UADDR_0x0555_0x02AA,
1228 .dev_size = SIZE_512KiB,
1229 .cmd_set = P_ID_AMD_STD,
1232 ERASEINFO(0x04000,1),
1233 ERASEINFO(0x02000,2),
1234 ERASEINFO(0x08000,1),
1235 ERASEINFO(0x10000,7),
1238 .mfr_id = MANUFACTURER_MACRONIX,
1239 .dev_id = MX29F002T,
1240 .name = "Macronix MX29F002T",
1241 .devtypes = CFI_DEVICETYPE_X8,
1242 .uaddr = MTD_UADDR_0x0555_0x02AA,
1243 .dev_size = SIZE_256KiB,
1244 .cmd_set = P_ID_AMD_STD,
1247 ERASEINFO(0x10000,3),
1248 ERASEINFO(0x08000,1),
1249 ERASEINFO(0x02000,2),
1250 ERASEINFO(0x04000,1),
1253 .mfr_id = MANUFACTURER_PMC,
1254 .dev_id = PM49FL002,
1255 .name = "PMC Pm49FL002",
1256 .devtypes = CFI_DEVICETYPE_X8,
1257 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1258 .dev_size = SIZE_256KiB,
1259 .cmd_set = P_ID_AMD_STD,
1262 ERASEINFO( 0x01000, 64 )
1265 .mfr_id = MANUFACTURER_PMC,
1266 .dev_id = PM49FL004,
1267 .name = "PMC Pm49FL004",
1268 .devtypes = CFI_DEVICETYPE_X8,
1269 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1270 .dev_size = SIZE_512KiB,
1271 .cmd_set = P_ID_AMD_STD,
1274 ERASEINFO( 0x01000, 128 )
1277 .mfr_id = MANUFACTURER_PMC,
1278 .dev_id = PM49FL008,
1279 .name = "PMC Pm49FL008",
1280 .devtypes = CFI_DEVICETYPE_X8,
1281 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1282 .dev_size = SIZE_1MiB,
1283 .cmd_set = P_ID_AMD_STD,
1286 ERASEINFO( 0x01000, 256 )
1289 .mfr_id = MANUFACTURER_SHARP,
1290 .dev_id = LH28F640BF,
1291 .name = "LH28F640BF",
1292 .devtypes = CFI_DEVICETYPE_X8,
1293 .uaddr = MTD_UADDR_UNNECESSARY,
1294 .dev_size = SIZE_4MiB,
1295 .cmd_set = P_ID_INTEL_STD,
1298 ERASEINFO(0x40000,16),
1301 .mfr_id = MANUFACTURER_SST,
1302 .dev_id = SST39LF512,
1303 .name = "SST 39LF512",
1304 .devtypes = CFI_DEVICETYPE_X8,
1305 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1306 .dev_size = SIZE_64KiB,
1307 .cmd_set = P_ID_AMD_STD,
1310 ERASEINFO(0x01000,16),
1313 .mfr_id = MANUFACTURER_SST,
1314 .dev_id = SST39LF010,
1315 .name = "SST 39LF010",
1316 .devtypes = CFI_DEVICETYPE_X8,
1317 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1318 .dev_size = SIZE_128KiB,
1319 .cmd_set = P_ID_AMD_STD,
1322 ERASEINFO(0x01000,32),
1325 .mfr_id = MANUFACTURER_SST,
1326 .dev_id = SST29EE020,
1327 .name = "SST 29EE020",
1328 .devtypes = CFI_DEVICETYPE_X8,
1329 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1330 .dev_size = SIZE_256KiB,
1331 .cmd_set = P_ID_SST_PAGE,
1333 .regions = {ERASEINFO(0x01000,64),
1336 .mfr_id = MANUFACTURER_SST,
1337 .dev_id = SST29LE020,
1338 .name = "SST 29LE020",
1339 .devtypes = CFI_DEVICETYPE_X8,
1340 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1341 .dev_size = SIZE_256KiB,
1342 .cmd_set = P_ID_SST_PAGE,
1344 .regions = {ERASEINFO(0x01000,64),
1347 .mfr_id = MANUFACTURER_SST,
1348 .dev_id = SST39LF020,
1349 .name = "SST 39LF020",
1350 .devtypes = CFI_DEVICETYPE_X8,
1351 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1352 .dev_size = SIZE_256KiB,
1353 .cmd_set = P_ID_AMD_STD,
1356 ERASEINFO(0x01000,64),
1359 .mfr_id = MANUFACTURER_SST,
1360 .dev_id = SST39LF040,
1361 .name = "SST 39LF040",
1362 .devtypes = CFI_DEVICETYPE_X8,
1363 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1364 .dev_size = SIZE_512KiB,
1365 .cmd_set = P_ID_AMD_STD,
1368 ERASEINFO(0x01000,128),
1371 .mfr_id = MANUFACTURER_SST,
1372 .dev_id = SST39SF010A,
1373 .name = "SST 39SF010A",
1374 .devtypes = CFI_DEVICETYPE_X8,
1375 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1376 .dev_size = SIZE_128KiB,
1377 .cmd_set = P_ID_AMD_STD,
1380 ERASEINFO(0x01000,32),
1383 .mfr_id = MANUFACTURER_SST,
1384 .dev_id = SST39SF020A,
1385 .name = "SST 39SF020A",
1386 .devtypes = CFI_DEVICETYPE_X8,
1387 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1388 .dev_size = SIZE_256KiB,
1389 .cmd_set = P_ID_AMD_STD,
1392 ERASEINFO(0x01000,64),
1395 .mfr_id = MANUFACTURER_SST,
1396 .dev_id = SST49LF040B,
1397 .name = "SST 49LF040B",
1398 .devtypes = CFI_DEVICETYPE_X8,
1399 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1400 .dev_size = SIZE_512KiB,
1401 .cmd_set = P_ID_AMD_STD,
1404 ERASEINFO(0x01000,128),
1408 .mfr_id = MANUFACTURER_SST,
1409 .dev_id = SST49LF004B,
1410 .name = "SST 49LF004B",
1411 .devtypes = CFI_DEVICETYPE_X8,
1412 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1413 .dev_size = SIZE_512KiB,
1414 .cmd_set = P_ID_AMD_STD,
1417 ERASEINFO(0x01000,128),
1420 .mfr_id = MANUFACTURER_SST,
1421 .dev_id = SST49LF008A,
1422 .name = "SST 49LF008A",
1423 .devtypes = CFI_DEVICETYPE_X8,
1424 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1425 .dev_size = SIZE_1MiB,
1426 .cmd_set = P_ID_AMD_STD,
1429 ERASEINFO(0x01000,256),
1432 .mfr_id = MANUFACTURER_SST,
1433 .dev_id = SST49LF030A,
1434 .name = "SST 49LF030A",
1435 .devtypes = CFI_DEVICETYPE_X8,
1436 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1437 .dev_size = SIZE_512KiB,
1438 .cmd_set = P_ID_AMD_STD,
1441 ERASEINFO(0x01000,96),
1444 .mfr_id = MANUFACTURER_SST,
1445 .dev_id = SST49LF040A,
1446 .name = "SST 49LF040A",
1447 .devtypes = CFI_DEVICETYPE_X8,
1448 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1449 .dev_size = SIZE_512KiB,
1450 .cmd_set = P_ID_AMD_STD,
1453 ERASEINFO(0x01000,128),
1456 .mfr_id = MANUFACTURER_SST,
1457 .dev_id = SST49LF080A,
1458 .name = "SST 49LF080A",
1459 .devtypes = CFI_DEVICETYPE_X8,
1460 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1461 .dev_size = SIZE_1MiB,
1462 .cmd_set = P_ID_AMD_STD,
1465 ERASEINFO(0x01000,256),
1468 .mfr_id = MANUFACTURER_SST, /* should be CFI */
1469 .dev_id = SST39LF160,
1470 .name = "SST 39LF160",
1471 .devtypes = CFI_DEVICETYPE_X16,
1472 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1473 .dev_size = SIZE_2MiB,
1474 .cmd_set = P_ID_AMD_STD,
1477 ERASEINFO(0x1000,256),
1478 ERASEINFO(0x1000,256)
1481 .mfr_id = MANUFACTURER_SST, /* should be CFI */
1482 .dev_id = SST39VF1601,
1483 .name = "SST 39VF1601",
1484 .devtypes = CFI_DEVICETYPE_X16,
1485 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1486 .dev_size = SIZE_2MiB,
1487 .cmd_set = P_ID_AMD_STD,
1490 ERASEINFO(0x1000,256),
1491 ERASEINFO(0x1000,256)
1494 .mfr_id = MANUFACTURER_SST, /* should be CFI */
1495 .dev_id = SST39VF3201,
1496 .name = "SST 39VF3201",
1497 .devtypes = CFI_DEVICETYPE_X16,
1498 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1499 .dev_size = SIZE_4MiB,
1500 .cmd_set = P_ID_AMD_STD,
1503 ERASEINFO(0x1000,256),
1504 ERASEINFO(0x1000,256),
1505 ERASEINFO(0x1000,256),
1506 ERASEINFO(0x1000,256)
1509 .mfr_id = MANUFACTURER_SST,
1510 .dev_id = SST36VF3203,
1511 .name = "SST 36VF3203",
1512 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1513 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1514 .dev_size = SIZE_4MiB,
1515 .cmd_set = P_ID_AMD_STD,
1518 ERASEINFO(0x10000,64),
1521 .mfr_id = MANUFACTURER_ST,
1522 .dev_id = M29F800AB,
1523 .name = "ST M29F800AB",
1524 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1525 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1526 .dev_size = SIZE_1MiB,
1527 .cmd_set = P_ID_AMD_STD,
1530 ERASEINFO(0x04000,1),
1531 ERASEINFO(0x02000,2),
1532 ERASEINFO(0x08000,1),
1533 ERASEINFO(0x10000,15),
1536 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1537 .dev_id = M29W800DT,
1538 .name = "ST M29W800DT",
1539 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1540 .uaddr = MTD_UADDR_0x5555_0x2AAA, /* ???? */
1541 .dev_size = SIZE_1MiB,
1542 .cmd_set = P_ID_AMD_STD,
1545 ERASEINFO(0x10000,15),
1546 ERASEINFO(0x08000,1),
1547 ERASEINFO(0x02000,2),
1548 ERASEINFO(0x04000,1)
1551 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1552 .dev_id = M29W800DB,
1553 .name = "ST M29W800DB",
1554 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1555 .uaddr = MTD_UADDR_0x5555_0x2AAA, /* ???? */
1556 .dev_size = SIZE_1MiB,
1557 .cmd_set = P_ID_AMD_STD,
1560 ERASEINFO(0x04000,1),
1561 ERASEINFO(0x02000,2),
1562 ERASEINFO(0x08000,1),
1563 ERASEINFO(0x10000,15)
1566 .mfr_id = MANUFACTURER_ST,
1567 .dev_id = M29W400DT,
1568 .name = "ST M29W400DT",
1569 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1570 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1571 .dev_size = SIZE_512KiB,
1572 .cmd_set = P_ID_AMD_STD,
1575 ERASEINFO(0x04000,7),
1576 ERASEINFO(0x02000,1),
1577 ERASEINFO(0x08000,2),
1578 ERASEINFO(0x10000,1)
1581 .mfr_id = MANUFACTURER_ST,
1582 .dev_id = M29W400DB,
1583 .name = "ST M29W400DB",
1584 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1585 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1586 .dev_size = SIZE_512KiB,
1587 .cmd_set = P_ID_AMD_STD,
1590 ERASEINFO(0x04000,1),
1591 ERASEINFO(0x02000,2),
1592 ERASEINFO(0x08000,1),
1593 ERASEINFO(0x10000,7)
1596 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1597 .dev_id = M29W160DT,
1598 .name = "ST M29W160DT",
1599 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1600 .uaddr = MTD_UADDR_0x0555_0x02AA, /* ???? */
1601 .dev_size = SIZE_2MiB,
1602 .cmd_set = P_ID_AMD_STD,
1605 ERASEINFO(0x10000,31),
1606 ERASEINFO(0x08000,1),
1607 ERASEINFO(0x02000,2),
1608 ERASEINFO(0x04000,1)
1611 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1612 .dev_id = M29W160DB,
1613 .name = "ST M29W160DB",
1614 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1615 .uaddr = MTD_UADDR_0x0555_0x02AA, /* ???? */
1616 .dev_size = SIZE_2MiB,
1617 .cmd_set = P_ID_AMD_STD,
1620 ERASEINFO(0x04000,1),
1621 ERASEINFO(0x02000,2),
1622 ERASEINFO(0x08000,1),
1623 ERASEINFO(0x10000,31)
1626 .mfr_id = MANUFACTURER_ST,
1628 .name = "ST M29W040B",
1629 .devtypes = CFI_DEVICETYPE_X8,
1630 .uaddr = MTD_UADDR_0x0555_0x02AA,
1631 .dev_size = SIZE_512KiB,
1632 .cmd_set = P_ID_AMD_STD,
1635 ERASEINFO(0x10000,8),
1638 .mfr_id = MANUFACTURER_ST,
1640 .name = "ST M50FW040",
1641 .devtypes = CFI_DEVICETYPE_X8,
1642 .uaddr = MTD_UADDR_UNNECESSARY,
1643 .dev_size = SIZE_512KiB,
1644 .cmd_set = P_ID_INTEL_EXT,
1647 ERASEINFO(0x10000,8),
1650 .mfr_id = MANUFACTURER_ST,
1652 .name = "ST M50FW080",
1653 .devtypes = CFI_DEVICETYPE_X8,
1654 .uaddr = MTD_UADDR_UNNECESSARY,
1655 .dev_size = SIZE_1MiB,
1656 .cmd_set = P_ID_INTEL_EXT,
1659 ERASEINFO(0x10000,16),
1662 .mfr_id = MANUFACTURER_ST,
1664 .name = "ST M50FW016",
1665 .devtypes = CFI_DEVICETYPE_X8,
1666 .uaddr = MTD_UADDR_UNNECESSARY,
1667 .dev_size = SIZE_2MiB,
1668 .cmd_set = P_ID_INTEL_EXT,
1671 ERASEINFO(0x10000,32),
1674 .mfr_id = MANUFACTURER_ST,
1675 .dev_id = M50LPW080,
1676 .name = "ST M50LPW080",
1677 .devtypes = CFI_DEVICETYPE_X8,
1678 .uaddr = MTD_UADDR_UNNECESSARY,
1679 .dev_size = SIZE_1MiB,
1680 .cmd_set = P_ID_INTEL_EXT,
1683 ERASEINFO(0x10000,16),
1686 .mfr_id = MANUFACTURER_ST,
1687 .dev_id = M50FLW080A,
1688 .name = "ST M50FLW080A",
1689 .devtypes = CFI_DEVICETYPE_X8,
1690 .uaddr = MTD_UADDR_UNNECESSARY,
1691 .dev_size = SIZE_1MiB,
1692 .cmd_set = P_ID_INTEL_EXT,
1695 ERASEINFO(0x1000,16),
1696 ERASEINFO(0x10000,13),
1697 ERASEINFO(0x1000,16),
1698 ERASEINFO(0x1000,16),
1701 .mfr_id = MANUFACTURER_ST,
1702 .dev_id = M50FLW080B,
1703 .name = "ST M50FLW080B",
1704 .devtypes = CFI_DEVICETYPE_X8,
1705 .uaddr = MTD_UADDR_UNNECESSARY,
1706 .dev_size = SIZE_1MiB,
1707 .cmd_set = P_ID_INTEL_EXT,
1710 ERASEINFO(0x1000,16),
1711 ERASEINFO(0x1000,16),
1712 ERASEINFO(0x10000,13),
1713 ERASEINFO(0x1000,16),
1716 .mfr_id = MANUFACTURER_TOSHIBA,
1717 .dev_id = TC58FVT160,
1718 .name = "Toshiba TC58FVT160",
1719 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1720 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1721 .dev_size = SIZE_2MiB,
1722 .cmd_set = P_ID_AMD_STD,
1725 ERASEINFO(0x10000,31),
1726 ERASEINFO(0x08000,1),
1727 ERASEINFO(0x02000,2),
1728 ERASEINFO(0x04000,1)
1731 .mfr_id = MANUFACTURER_TOSHIBA,
1732 .dev_id = TC58FVB160,
1733 .name = "Toshiba TC58FVB160",
1734 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1735 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1736 .dev_size = SIZE_2MiB,
1737 .cmd_set = P_ID_AMD_STD,
1740 ERASEINFO(0x04000,1),
1741 ERASEINFO(0x02000,2),
1742 ERASEINFO(0x08000,1),
1743 ERASEINFO(0x10000,31)
1746 .mfr_id = MANUFACTURER_TOSHIBA,
1747 .dev_id = TC58FVB321,
1748 .name = "Toshiba TC58FVB321",
1749 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1750 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1751 .dev_size = SIZE_4MiB,
1752 .cmd_set = P_ID_AMD_STD,
1755 ERASEINFO(0x02000,8),
1756 ERASEINFO(0x10000,63)
1759 .mfr_id = MANUFACTURER_TOSHIBA,
1760 .dev_id = TC58FVT321,
1761 .name = "Toshiba TC58FVT321",
1762 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1763 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1764 .dev_size = SIZE_4MiB,
1765 .cmd_set = P_ID_AMD_STD,
1768 ERASEINFO(0x10000,63),
1769 ERASEINFO(0x02000,8)
1772 .mfr_id = MANUFACTURER_TOSHIBA,
1773 .dev_id = TC58FVB641,
1774 .name = "Toshiba TC58FVB641",
1775 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1776 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1777 .dev_size = SIZE_8MiB,
1778 .cmd_set = P_ID_AMD_STD,
1781 ERASEINFO(0x02000,8),
1782 ERASEINFO(0x10000,127)
1785 .mfr_id = MANUFACTURER_TOSHIBA,
1786 .dev_id = TC58FVT641,
1787 .name = "Toshiba TC58FVT641",
1788 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1789 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1790 .dev_size = SIZE_8MiB,
1791 .cmd_set = P_ID_AMD_STD,
1794 ERASEINFO(0x10000,127),
1795 ERASEINFO(0x02000,8)
1798 .mfr_id = MANUFACTURER_WINBOND,
1800 .name = "Winbond W49V002A",
1801 .devtypes = CFI_DEVICETYPE_X8,
1802 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1803 .dev_size = SIZE_256KiB,
1804 .cmd_set = P_ID_AMD_STD,
1807 ERASEINFO(0x10000, 3),
1808 ERASEINFO(0x08000, 1),
1809 ERASEINFO(0x02000, 2),
1810 ERASEINFO(0x04000, 1),
1815 static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
1816 struct cfi_private *cfi)
1822 /* According to JEDEC "Standard Manufacturer's Identification Code"
1823 * (http://www.jedec.org/download/search/jep106W.pdf)
1824 * several first banks can contain 0x7f instead of actual ID
1827 uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
1828 mask = (1 << (cfi->device_type * 8)) - 1;
1829 result = map_read(map, base + ofs);
1831 } while ((result.x[0] & mask) == CONTINUATION_CODE);
1833 return result.x[0] & mask;
1836 static inline u32 jedec_read_id(struct map_info *map, uint32_t base,
1837 struct cfi_private *cfi)
1841 u32 ofs = cfi_build_cmd_addr(1, map, cfi);
1842 mask = (1 << (cfi->device_type * 8)) -1;
1843 result = map_read(map, base + ofs);
1844 return result.x[0] & mask;
1847 static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
1851 /* after checking the datasheets for SST, MACRONIX and ATMEL
1852 * (oh and incidentaly the jedec spec - 3.5.3.3) the reset
1853 * sequence is *supposed* to be 0xaa at 0x5555, 0x55 at
1854 * 0x2aaa, 0xF0 at 0x5555 this will not affect the AMD chips
1855 * as they will ignore the writes and dont care what address
1856 * the F0 is written to */
1857 if (cfi->addr_unlock1) {
1858 DEBUG( MTD_DEBUG_LEVEL3,
1859 "reset unlock called %x %x \n",
1860 cfi->addr_unlock1,cfi->addr_unlock2);
1861 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1862 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
1865 cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1866 /* Some misdesigned Intel chips do not respond for 0xF0 for a reset,
1867 * so ensure we're in read mode. Send both the Intel and the AMD command
1868 * for this. Intel uses 0xff for this, AMD uses 0xff for NOP, so
1869 * this should be safe.
1871 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
1872 /* FIXME - should have reset delay before continuing */
1876 static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
1878 int i,num_erase_regions;
1881 if (! (jedec_table[index].devtypes & p_cfi->device_type)) {
1882 DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n",
1883 jedec_table[index].name, 4 * (1<<p_cfi->device_type));
1887 printk(KERN_INFO "Found: %s\n",jedec_table[index].name);
1889 num_erase_regions = jedec_table[index].nr_regions;
1891 p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
1893 //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
1897 memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
1899 p_cfi->cfiq->P_ID = jedec_table[index].cmd_set;
1900 p_cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
1901 p_cfi->cfiq->DevSize = jedec_table[index].dev_size;
1902 p_cfi->cfi_mode = CFI_MODE_JEDEC;
1904 for (i=0; i<num_erase_regions; i++){
1905 p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
1907 p_cfi->cmdset_priv = NULL;
1909 /* This may be redundant for some cases, but it doesn't hurt */
1910 p_cfi->mfr = jedec_table[index].mfr_id;
1911 p_cfi->id = jedec_table[index].dev_id;
1913 uaddr = jedec_table[index].uaddr;
1915 /* The table has unlock addresses in _bytes_, and we try not to let
1916 our brains explode when we see the datasheets talking about address
1917 lines numbered from A-1 to A18. The CFI table has unlock addresses
1918 in device-words according to the mode the device is connected in */
1919 p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / p_cfi->device_type;
1920 p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / p_cfi->device_type;
1927 * There is a BIG problem properly ID'ing the JEDEC device and guaranteeing
1928 * the mapped address, unlock addresses, and proper chip ID. This function
1929 * attempts to minimize errors. It is doubtfull that this probe will ever
1930 * be perfect - consequently there should be some module parameters that
1931 * could be manually specified to force the chip info.
1933 static inline int jedec_match( uint32_t base,
1934 struct map_info *map,
1935 struct cfi_private *cfi,
1936 const struct amd_flash_info *finfo )
1938 int rc = 0; /* failure until all tests pass */
1943 * The IDs must match. For X16 and X32 devices operating in
1944 * a lower width ( X8 or X16 ), the device ID's are usually just
1945 * the lower byte(s) of the larger device ID for wider mode. If
1946 * a part is found that doesn't fit this assumption (device id for
1947 * smaller width mode is completely unrealated to full-width mode)
1948 * then the jedec_table[] will have to be augmented with the IDs
1949 * for different widths.
1951 switch (cfi->device_type) {
1952 case CFI_DEVICETYPE_X8:
1953 mfr = (uint8_t)finfo->mfr_id;
1954 id = (uint8_t)finfo->dev_id;
1956 /* bjd: it seems that if we do this, we can end up
1957 * detecting 16bit flashes as an 8bit device, even though
1960 if (finfo->dev_id > 0xff) {
1961 DEBUG( MTD_DEBUG_LEVEL3, "%s(): ID is not 8bit\n",
1966 case CFI_DEVICETYPE_X16:
1967 mfr = (uint16_t)finfo->mfr_id;
1968 id = (uint16_t)finfo->dev_id;
1970 case CFI_DEVICETYPE_X32:
1971 mfr = (uint16_t)finfo->mfr_id;
1972 id = (uint32_t)finfo->dev_id;
1976 "MTD %s(): Unsupported device type %d\n",
1977 __func__, cfi->device_type);
1980 if ( cfi->mfr != mfr || cfi->id != id ) {
1984 /* the part size must fit in the memory window */
1985 DEBUG( MTD_DEBUG_LEVEL3,
1986 "MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n",
1987 __func__, base, 1 << finfo->dev_size, base + (1 << finfo->dev_size) );
1988 if ( base + cfi_interleave(cfi) * ( 1 << finfo->dev_size ) > map->size ) {
1989 DEBUG( MTD_DEBUG_LEVEL3,
1990 "MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n",
1991 __func__, finfo->mfr_id, finfo->dev_id,
1992 1 << finfo->dev_size );
1996 if (! (finfo->devtypes & cfi->device_type))
1999 uaddr = finfo->uaddr;
2001 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): check unlock addrs 0x%.4x 0x%.4x\n",
2002 __func__, cfi->addr_unlock1, cfi->addr_unlock2 );
2003 if ( MTD_UADDR_UNNECESSARY != uaddr && MTD_UADDR_DONT_CARE != uaddr
2004 && ( unlock_addrs[uaddr].addr1 / cfi->device_type != cfi->addr_unlock1 ||
2005 unlock_addrs[uaddr].addr2 / cfi->device_type != cfi->addr_unlock2 ) ) {
2006 DEBUG( MTD_DEBUG_LEVEL3,
2007 "MTD %s(): 0x%.4x 0x%.4x did not match\n",
2009 unlock_addrs[uaddr].addr1,
2010 unlock_addrs[uaddr].addr2);
2015 * Make sure the ID's dissappear when the device is taken out of
2016 * ID mode. The only time this should fail when it should succeed
2017 * is when the ID's are written as data to the same
2018 * addresses. For this rare and unfortunate case the chip
2019 * cannot be probed correctly.
2020 * FIXME - write a driver that takes all of the chip info as
2021 * module parameters, doesn't probe but forces a load.
2023 DEBUG( MTD_DEBUG_LEVEL3,
2024 "MTD %s(): check ID's disappear when not in ID mode\n",
2026 jedec_reset( base, map, cfi );
2027 mfr = jedec_read_mfr( map, base, cfi );
2028 id = jedec_read_id( map, base, cfi );
2029 if ( mfr == cfi->mfr && id == cfi->id ) {
2030 DEBUG( MTD_DEBUG_LEVEL3,
2031 "MTD %s(): ID 0x%.2x:0x%.2x did not change after reset:\n"
2032 "You might need to manually specify JEDEC parameters.\n",
2033 __func__, cfi->mfr, cfi->id );
2037 /* all tests passed - mark as success */
2041 * Put the device back in ID mode - only need to do this if we
2042 * were truly frobbing a real device.
2044 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): return to ID mode\n", __func__ );
2045 if (cfi->addr_unlock1) {
2046 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2047 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
2049 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2050 /* FIXME - should have a delay before continuing */
2057 static int jedec_probe_chip(struct map_info *map, __u32 base,
2058 unsigned long *chip_map, struct cfi_private *cfi)
2061 enum uaddr uaddr_idx = MTD_UADDR_NOT_SUPPORTED;
2062 u32 probe_offset1, probe_offset2;
2065 if (!cfi->numchips) {
2068 if (MTD_UADDR_UNNECESSARY == uaddr_idx)
2071 cfi->addr_unlock1 = unlock_addrs[uaddr_idx].addr1 / cfi->device_type;
2072 cfi->addr_unlock2 = unlock_addrs[uaddr_idx].addr2 / cfi->device_type;
2075 /* Make certain we aren't probing past the end of map */
2076 if (base >= map->size) {
2078 "Probe at base(0x%08x) past the end of the map(0x%08lx)\n",
2079 base, map->size -1);
2083 /* Ensure the unlock addresses we try stay inside the map */
2084 probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi);
2085 probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi);
2086 if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
2087 ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
2091 jedec_reset(base, map, cfi);
2093 /* Autoselect Mode */
2094 if(cfi->addr_unlock1) {
2095 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2096 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
2098 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2099 /* FIXME - should have a delay before continuing */
2101 if (!cfi->numchips) {
2102 /* This is the first time we're called. Set up the CFI
2103 stuff accordingly and return */
2105 cfi->mfr = jedec_read_mfr(map, base, cfi);
2106 cfi->id = jedec_read_id(map, base, cfi);
2107 DEBUG(MTD_DEBUG_LEVEL3,
2108 "Search for id:(%02x %02x) interleave(%d) type(%d)\n",
2109 cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type);
2110 for (i = 0; i < ARRAY_SIZE(jedec_table); i++) {
2111 if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) {
2112 DEBUG( MTD_DEBUG_LEVEL3,
2113 "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
2114 __func__, cfi->mfr, cfi->id,
2115 cfi->addr_unlock1, cfi->addr_unlock2 );
2116 if (!cfi_jedec_setup(cfi, i))
2126 /* Make sure it is a chip of the same manufacturer and id */
2127 mfr = jedec_read_mfr(map, base, cfi);
2128 id = jedec_read_id(map, base, cfi);
2130 if ((mfr != cfi->mfr) || (id != cfi->id)) {
2131 printk(KERN_DEBUG "%s: Found different chip or no chip at all (mfr 0x%x, id 0x%x) at 0x%x\n",
2132 map->name, mfr, id, base);
2133 jedec_reset(base, map, cfi);
2138 /* Check each previous chip locations to see if it's an alias */
2139 for (i=0; i < (base >> cfi->chipshift); i++) {
2140 unsigned long start;
2141 if(!test_bit(i, chip_map)) {
2142 continue; /* Skip location; no valid chip at this address */
2144 start = i << cfi->chipshift;
2145 if (jedec_read_mfr(map, start, cfi) == cfi->mfr &&
2146 jedec_read_id(map, start, cfi) == cfi->id) {
2147 /* Eep. This chip also looks like it's in autoselect mode.
2148 Is it an alias for the new one? */
2149 jedec_reset(start, map, cfi);
2151 /* If the device IDs go away, it's an alias */
2152 if (jedec_read_mfr(map, base, cfi) != cfi->mfr ||
2153 jedec_read_id(map, base, cfi) != cfi->id) {
2154 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2155 map->name, base, start);
2159 /* Yes, it's actually got the device IDs as data. Most
2160 * unfortunate. Stick the new chip in read mode
2161 * too and if it's the same, assume it's an alias. */
2162 /* FIXME: Use other modes to do a proper check */
2163 jedec_reset(base, map, cfi);
2164 if (jedec_read_mfr(map, base, cfi) == cfi->mfr &&
2165 jedec_read_id(map, base, cfi) == cfi->id) {
2166 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2167 map->name, base, start);
2173 /* OK, if we got to here, then none of the previous chips appear to
2174 be aliases for the current one. */
2175 set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
2179 /* Put it back into Read Mode */
2180 jedec_reset(base, map, cfi);
2182 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
2183 map->name, cfi_interleave(cfi), cfi->device_type*8, base,
2189 static struct chip_probe jedec_chip_probe = {
2191 .probe_chip = jedec_probe_chip
2194 static struct mtd_info *jedec_probe(struct map_info *map)
2197 * Just use the generic probe stuff to call our CFI-specific
2198 * chip_probe routine in all the possible permutations, etc.
2200 return mtd_do_chip_probe(map, &jedec_chip_probe);
2203 static struct mtd_chip_driver jedec_chipdrv = {
2204 .probe = jedec_probe,
2205 .name = "jedec_probe",
2206 .module = THIS_MODULE
2209 static int __init jedec_probe_init(void)
2211 register_mtd_chip_driver(&jedec_chipdrv);
2215 static void __exit jedec_probe_exit(void)
2217 unregister_mtd_chip_driver(&jedec_chipdrv);
2220 module_init(jedec_probe_init);
2221 module_exit(jedec_probe_exit);
2223 MODULE_LICENSE("GPL");
2224 MODULE_AUTHOR("Erwin Authried <eauth@softsys.co.at> et al.");
2225 MODULE_DESCRIPTION("Probe code for JEDEC-compliant flash chips");