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 AM29DL800BB 0x22CB
27 #define AM29DL800BT 0x224A
29 #define AM29F800BB 0x2258
30 #define AM29F800BT 0x22D6
31 #define AM29LV400BB 0x22BA
32 #define AM29LV400BT 0x22B9
33 #define AM29LV800BB 0x225B
34 #define AM29LV800BT 0x22DA
35 #define AM29LV160DT 0x22C4
36 #define AM29LV160DB 0x2249
37 #define AM29F017D 0x003D
38 #define AM29F016D 0x00AD
39 #define AM29F080 0x00D5
40 #define AM29F040 0x00A4
41 #define AM29LV040B 0x004F
42 #define AM29F032B 0x0041
43 #define AM29F002T 0x00B0
44 #define AM29SL800DB 0x226B
45 #define AM29SL800DT 0x22EA
48 #define AT49BV512 0x0003
49 #define AT29LV512 0x003d
50 #define AT49BV16X 0x00C0
51 #define AT49BV16XT 0x00C2
52 #define AT49BV32X 0x00C8
53 #define AT49BV32XT 0x00C9
56 #define EN29SL800BB 0x226B
57 #define EN29SL800BT 0x22EA
60 #define MBM29F040C 0x00A4
61 #define MBM29F800BA 0x2258
62 #define MBM29LV650UE 0x22D7
63 #define MBM29LV320TE 0x22F6
64 #define MBM29LV320BE 0x22F9
65 #define MBM29LV160TE 0x22C4
66 #define MBM29LV160BE 0x2249
67 #define MBM29LV800BA 0x225B
68 #define MBM29LV800TA 0x22DA
69 #define MBM29LV400TC 0x22B9
70 #define MBM29LV400BC 0x22BA
73 #define HY29F002T 0x00B0
76 #define I28F004B3T 0x00d4
77 #define I28F004B3B 0x00d5
78 #define I28F400B3T 0x8894
79 #define I28F400B3B 0x8895
80 #define I28F008S5 0x00a6
81 #define I28F016S5 0x00a0
82 #define I28F008SA 0x00a2
83 #define I28F008B3T 0x00d2
84 #define I28F008B3B 0x00d3
85 #define I28F800B3T 0x8892
86 #define I28F800B3B 0x8893
87 #define I28F016S3 0x00aa
88 #define I28F016B3T 0x00d0
89 #define I28F016B3B 0x00d1
90 #define I28F160B3T 0x8890
91 #define I28F160B3B 0x8891
92 #define I28F320B3T 0x8896
93 #define I28F320B3B 0x8897
94 #define I28F640B3T 0x8898
95 #define I28F640B3B 0x8899
96 #define I28F640C3B 0x88CD
97 #define I28F160F3T 0x88F3
98 #define I28F160F3B 0x88F4
99 #define I28F160C3T 0x88C2
100 #define I28F160C3B 0x88C3
101 #define I82802AB 0x00ad
102 #define I82802AC 0x00ac
105 #define MX29LV040C 0x004F
106 #define MX29LV160T 0x22C4
107 #define MX29LV160B 0x2249
108 #define MX29F040 0x00A4
109 #define MX29F016 0x00AD
110 #define MX29F002T 0x00B0
111 #define MX29F004T 0x0045
112 #define MX29F004B 0x0046
115 #define UPD29F064115 0x221C
118 #define PM49FL002 0x006D
119 #define PM49FL004 0x006E
120 #define PM49FL008 0x006A
123 #define LH28F640BF 0x00b0
125 /* ST - www.st.com */
126 #define M29F800AB 0x0058
127 #define M29W800DT 0x22D7
128 #define M29W800DB 0x225B
129 #define M29W400DT 0x00EE
130 #define M29W400DB 0x00EF
131 #define M29W160DT 0x22C4
132 #define M29W160DB 0x2249
133 #define M29W040B 0x00E3
134 #define M50FW040 0x002C
135 #define M50FW080 0x002D
136 #define M50FW016 0x002E
137 #define M50LPW080 0x002F
138 #define M50FLW080A 0x0080
139 #define M50FLW080B 0x0081
140 #define PSD4256G6V 0x00e9
143 #define SST29EE020 0x0010
144 #define SST29LE020 0x0012
145 #define SST29EE512 0x005d
146 #define SST29LE512 0x003d
147 #define SST39LF800 0x2781
148 #define SST39LF160 0x2782
149 #define SST39VF1601 0x234b
150 #define SST39VF3201 0x235b
151 #define SST39LF512 0x00D4
152 #define SST39LF010 0x00D5
153 #define SST39LF020 0x00D6
154 #define SST39LF040 0x00D7
155 #define SST39SF010A 0x00B5
156 #define SST39SF020A 0x00B6
157 #define SST39SF040 0x00B7
158 #define SST49LF004B 0x0060
159 #define SST49LF040B 0x0050
160 #define SST49LF008A 0x005a
161 #define SST49LF030A 0x001C
162 #define SST49LF040A 0x0051
163 #define SST49LF080A 0x005B
164 #define SST36VF3203 0x7354
167 #define TC58FVT160 0x00C2
168 #define TC58FVB160 0x0043
169 #define TC58FVT321 0x009A
170 #define TC58FVB321 0x009C
171 #define TC58FVT641 0x0093
172 #define TC58FVB641 0x0095
175 #define W49V002A 0x00b0
179 * Unlock address sets for AMD command sets.
180 * Intel command sets use the MTD_UADDR_UNNECESSARY.
181 * Each identifier, except MTD_UADDR_UNNECESSARY, and
182 * MTD_UADDR_NO_SUPPORT must be defined below in unlock_addrs[].
183 * MTD_UADDR_NOT_SUPPORTED must be 0 so that structure
184 * initialization need not require initializing all of the
185 * unlock addresses for all bit widths.
188 MTD_UADDR_NOT_SUPPORTED = 0, /* data width not supported */
189 MTD_UADDR_0x0555_0x02AA,
190 MTD_UADDR_0x0555_0x0AAA,
191 MTD_UADDR_0x5555_0x2AAA,
192 MTD_UADDR_0x0AAA_0x0554,
193 MTD_UADDR_0x0AAA_0x0555,
194 MTD_UADDR_0xAAAA_0x5555,
195 MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */
196 MTD_UADDR_UNNECESSARY, /* Does not require any address */
207 * I don't like the fact that the first entry in unlock_addrs[]
208 * exists, but is for MTD_UADDR_NOT_SUPPORTED - and, therefore,
209 * should not be used. The problem is that structures with
210 * initializers have extra fields initialized to 0. It is _very_
211 * desirable to have the unlock address entries for unsupported
212 * data widths automatically initialized - that means that
213 * MTD_UADDR_NOT_SUPPORTED must be 0 and the first entry here
216 static const struct unlock_addr unlock_addrs[] = {
217 [MTD_UADDR_NOT_SUPPORTED] = {
222 [MTD_UADDR_0x0555_0x02AA] = {
227 [MTD_UADDR_0x0555_0x0AAA] = {
232 [MTD_UADDR_0x5555_0x2AAA] = {
237 [MTD_UADDR_0x0AAA_0x0554] = {
242 [MTD_UADDR_0x0AAA_0x0555] = {
247 [MTD_UADDR_0xAAAA_0x5555] = {
252 [MTD_UADDR_DONT_CARE] = {
253 .addr1 = 0x0000, /* Doesn't matter which address */
254 .addr2 = 0x0000 /* is used - must be last entry */
257 [MTD_UADDR_UNNECESSARY] = {
263 struct amd_flash_info {
265 const uint16_t mfr_id;
266 const uint16_t dev_id;
267 const uint8_t dev_size;
268 const uint8_t nr_regions;
269 const uint16_t cmd_set;
270 const uint32_t regions[6];
271 const uint8_t devtypes; /* Bitmask for x8, x16 etc. */
272 const uint8_t uaddr; /* unlock addrs for 8, 16, 32, 64 */
275 #define ERASEINFO(size,blocks) (size<<8)|(blocks-1)
277 #define SIZE_64KiB 16
278 #define SIZE_128KiB 17
279 #define SIZE_256KiB 18
280 #define SIZE_512KiB 19
288 * Please keep this list ordered by manufacturer!
289 * Fortunately, the list isn't searched often and so a
290 * slow, linear search isn't so bad.
292 static const struct amd_flash_info jedec_table[] = {
294 .mfr_id = CFI_MFR_AMD,
296 .name = "AMD AM29F032B",
297 .uaddr = MTD_UADDR_0x0555_0x02AA,
298 .devtypes = CFI_DEVICETYPE_X8,
299 .dev_size = SIZE_4MiB,
300 .cmd_set = P_ID_AMD_STD,
303 ERASEINFO(0x10000,64)
306 .mfr_id = CFI_MFR_AMD,
307 .dev_id = AM29LV160DT,
308 .name = "AMD AM29LV160DT",
309 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
310 .uaddr = MTD_UADDR_0x0AAA_0x0555,
311 .dev_size = SIZE_2MiB,
312 .cmd_set = P_ID_AMD_STD,
315 ERASEINFO(0x10000,31),
316 ERASEINFO(0x08000,1),
317 ERASEINFO(0x02000,2),
321 .mfr_id = CFI_MFR_AMD,
322 .dev_id = AM29LV160DB,
323 .name = "AMD AM29LV160DB",
324 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
325 .uaddr = MTD_UADDR_0x0AAA_0x0555,
326 .dev_size = SIZE_2MiB,
327 .cmd_set = P_ID_AMD_STD,
330 ERASEINFO(0x04000,1),
331 ERASEINFO(0x02000,2),
332 ERASEINFO(0x08000,1),
333 ERASEINFO(0x10000,31)
336 .mfr_id = CFI_MFR_AMD,
337 .dev_id = AM29LV400BB,
338 .name = "AMD AM29LV400BB",
339 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
340 .uaddr = MTD_UADDR_0x0AAA_0x0555,
341 .dev_size = SIZE_512KiB,
342 .cmd_set = P_ID_AMD_STD,
345 ERASEINFO(0x04000,1),
346 ERASEINFO(0x02000,2),
347 ERASEINFO(0x08000,1),
351 .mfr_id = CFI_MFR_AMD,
352 .dev_id = AM29LV400BT,
353 .name = "AMD AM29LV400BT",
354 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
355 .uaddr = MTD_UADDR_0x0AAA_0x0555,
356 .dev_size = SIZE_512KiB,
357 .cmd_set = P_ID_AMD_STD,
360 ERASEINFO(0x10000,7),
361 ERASEINFO(0x08000,1),
362 ERASEINFO(0x02000,2),
366 .mfr_id = CFI_MFR_AMD,
367 .dev_id = AM29LV800BB,
368 .name = "AMD AM29LV800BB",
369 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
370 .uaddr = MTD_UADDR_0x0AAA_0x0555,
371 .dev_size = SIZE_1MiB,
372 .cmd_set = P_ID_AMD_STD,
375 ERASEINFO(0x04000,1),
376 ERASEINFO(0x02000,2),
377 ERASEINFO(0x08000,1),
378 ERASEINFO(0x10000,15),
382 .mfr_id = CFI_MFR_AMD,
383 .dev_id = AM29DL800BB,
384 .name = "AMD AM29DL800BB",
385 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
386 .uaddr = MTD_UADDR_0x0AAA_0x0555,
387 .dev_size = SIZE_1MiB,
388 .cmd_set = P_ID_AMD_STD,
391 ERASEINFO(0x04000,1),
392 ERASEINFO(0x08000,1),
393 ERASEINFO(0x02000,4),
394 ERASEINFO(0x08000,1),
395 ERASEINFO(0x04000,1),
396 ERASEINFO(0x10000,14)
399 .mfr_id = CFI_MFR_AMD,
400 .dev_id = AM29DL800BT,
401 .name = "AMD AM29DL800BT",
402 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
403 .uaddr = MTD_UADDR_0x0AAA_0x0555,
404 .dev_size = SIZE_1MiB,
405 .cmd_set = P_ID_AMD_STD,
408 ERASEINFO(0x10000,14),
409 ERASEINFO(0x04000,1),
410 ERASEINFO(0x08000,1),
411 ERASEINFO(0x02000,4),
412 ERASEINFO(0x08000,1),
416 .mfr_id = CFI_MFR_AMD,
417 .dev_id = AM29F800BB,
418 .name = "AMD AM29F800BB",
419 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
420 .uaddr = MTD_UADDR_0x0AAA_0x0555,
421 .dev_size = SIZE_1MiB,
422 .cmd_set = P_ID_AMD_STD,
425 ERASEINFO(0x04000,1),
426 ERASEINFO(0x02000,2),
427 ERASEINFO(0x08000,1),
428 ERASEINFO(0x10000,15),
431 .mfr_id = CFI_MFR_AMD,
432 .dev_id = AM29LV800BT,
433 .name = "AMD AM29LV800BT",
434 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
435 .uaddr = MTD_UADDR_0x0AAA_0x0555,
436 .dev_size = SIZE_1MiB,
437 .cmd_set = P_ID_AMD_STD,
440 ERASEINFO(0x10000,15),
441 ERASEINFO(0x08000,1),
442 ERASEINFO(0x02000,2),
446 .mfr_id = CFI_MFR_AMD,
447 .dev_id = AM29F800BT,
448 .name = "AMD AM29F800BT",
449 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
450 .uaddr = MTD_UADDR_0x0AAA_0x0555,
451 .dev_size = SIZE_1MiB,
452 .cmd_set = P_ID_AMD_STD,
455 ERASEINFO(0x10000,15),
456 ERASEINFO(0x08000,1),
457 ERASEINFO(0x02000,2),
461 .mfr_id = CFI_MFR_AMD,
463 .name = "AMD AM29F017D",
464 .devtypes = CFI_DEVICETYPE_X8,
465 .uaddr = MTD_UADDR_DONT_CARE,
466 .dev_size = SIZE_2MiB,
467 .cmd_set = P_ID_AMD_STD,
470 ERASEINFO(0x10000,32),
473 .mfr_id = CFI_MFR_AMD,
475 .name = "AMD AM29F016D",
476 .devtypes = CFI_DEVICETYPE_X8,
477 .uaddr = MTD_UADDR_0x0555_0x02AA,
478 .dev_size = SIZE_2MiB,
479 .cmd_set = P_ID_AMD_STD,
482 ERASEINFO(0x10000,32),
485 .mfr_id = CFI_MFR_AMD,
487 .name = "AMD AM29F080",
488 .devtypes = CFI_DEVICETYPE_X8,
489 .uaddr = MTD_UADDR_0x0555_0x02AA,
490 .dev_size = SIZE_1MiB,
491 .cmd_set = P_ID_AMD_STD,
494 ERASEINFO(0x10000,16),
497 .mfr_id = CFI_MFR_AMD,
499 .name = "AMD AM29F040",
500 .devtypes = CFI_DEVICETYPE_X8,
501 .uaddr = MTD_UADDR_0x0555_0x02AA,
502 .dev_size = SIZE_512KiB,
503 .cmd_set = P_ID_AMD_STD,
506 ERASEINFO(0x10000,8),
509 .mfr_id = CFI_MFR_AMD,
510 .dev_id = AM29LV040B,
511 .name = "AMD AM29LV040B",
512 .devtypes = CFI_DEVICETYPE_X8,
513 .uaddr = MTD_UADDR_0x0555_0x02AA,
514 .dev_size = SIZE_512KiB,
515 .cmd_set = P_ID_AMD_STD,
518 ERASEINFO(0x10000,8),
521 .mfr_id = CFI_MFR_AMD,
523 .name = "AMD AM29F002T",
524 .devtypes = CFI_DEVICETYPE_X8,
525 .uaddr = MTD_UADDR_0x0555_0x02AA,
526 .dev_size = SIZE_256KiB,
527 .cmd_set = P_ID_AMD_STD,
530 ERASEINFO(0x10000,3),
531 ERASEINFO(0x08000,1),
532 ERASEINFO(0x02000,2),
533 ERASEINFO(0x04000,1),
536 .mfr_id = CFI_MFR_AMD,
537 .dev_id = AM29SL800DT,
538 .name = "AMD AM29SL800DT",
539 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
540 .uaddr = MTD_UADDR_0x0AAA_0x0555,
541 .dev_size = SIZE_1MiB,
542 .cmd_set = P_ID_AMD_STD,
545 ERASEINFO(0x10000,15),
546 ERASEINFO(0x08000,1),
547 ERASEINFO(0x02000,2),
548 ERASEINFO(0x04000,1),
551 .mfr_id = CFI_MFR_AMD,
552 .dev_id = AM29SL800DB,
553 .name = "AMD AM29SL800DB",
554 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
555 .uaddr = MTD_UADDR_0x0AAA_0x0555,
556 .dev_size = SIZE_1MiB,
557 .cmd_set = P_ID_AMD_STD,
560 ERASEINFO(0x04000,1),
561 ERASEINFO(0x02000,2),
562 ERASEINFO(0x08000,1),
563 ERASEINFO(0x10000,15),
566 .mfr_id = CFI_MFR_ATMEL,
568 .name = "Atmel AT49BV512",
569 .devtypes = CFI_DEVICETYPE_X8,
570 .uaddr = MTD_UADDR_0x5555_0x2AAA,
571 .dev_size = SIZE_64KiB,
572 .cmd_set = P_ID_AMD_STD,
578 .mfr_id = CFI_MFR_ATMEL,
580 .name = "Atmel AT29LV512",
581 .devtypes = CFI_DEVICETYPE_X8,
582 .uaddr = MTD_UADDR_0x5555_0x2AAA,
583 .dev_size = SIZE_64KiB,
584 .cmd_set = P_ID_AMD_STD,
591 .mfr_id = CFI_MFR_ATMEL,
593 .name = "Atmel AT49BV16X",
594 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
595 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
596 .dev_size = SIZE_2MiB,
597 .cmd_set = P_ID_AMD_STD,
600 ERASEINFO(0x02000,8),
601 ERASEINFO(0x10000,31)
604 .mfr_id = CFI_MFR_ATMEL,
605 .dev_id = AT49BV16XT,
606 .name = "Atmel AT49BV16XT",
607 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
608 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
609 .dev_size = SIZE_2MiB,
610 .cmd_set = P_ID_AMD_STD,
613 ERASEINFO(0x10000,31),
617 .mfr_id = CFI_MFR_ATMEL,
619 .name = "Atmel AT49BV32X",
620 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
621 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
622 .dev_size = SIZE_4MiB,
623 .cmd_set = P_ID_AMD_STD,
626 ERASEINFO(0x02000,8),
627 ERASEINFO(0x10000,63)
630 .mfr_id = CFI_MFR_ATMEL,
631 .dev_id = AT49BV32XT,
632 .name = "Atmel AT49BV32XT",
633 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
634 .uaddr = MTD_UADDR_0x0555_0x0AAA, /* ???? */
635 .dev_size = SIZE_4MiB,
636 .cmd_set = P_ID_AMD_STD,
639 ERASEINFO(0x10000,63),
643 .mfr_id = CFI_MFR_EON,
644 .dev_id = EN29SL800BT,
645 .name = "Eon EN29SL800BT",
646 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
647 .uaddr = MTD_UADDR_0x0AAA_0x0555,
648 .dev_size = SIZE_1MiB,
649 .cmd_set = P_ID_AMD_STD,
652 ERASEINFO(0x10000,15),
653 ERASEINFO(0x08000,1),
654 ERASEINFO(0x02000,2),
655 ERASEINFO(0x04000,1),
658 .mfr_id = CFI_MFR_EON,
659 .dev_id = EN29SL800BB,
660 .name = "Eon EN29SL800BB",
661 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
662 .uaddr = MTD_UADDR_0x0AAA_0x0555,
663 .dev_size = SIZE_1MiB,
664 .cmd_set = P_ID_AMD_STD,
667 ERASEINFO(0x04000,1),
668 ERASEINFO(0x02000,2),
669 ERASEINFO(0x08000,1),
670 ERASEINFO(0x10000,15),
673 .mfr_id = CFI_MFR_FUJITSU,
674 .dev_id = MBM29F040C,
675 .name = "Fujitsu MBM29F040C",
676 .devtypes = CFI_DEVICETYPE_X8,
677 .uaddr = MTD_UADDR_0x0AAA_0x0555,
678 .dev_size = SIZE_512KiB,
679 .cmd_set = P_ID_AMD_STD,
685 .mfr_id = CFI_MFR_FUJITSU,
686 .dev_id = MBM29F800BA,
687 .name = "Fujitsu MBM29F800BA",
688 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
689 .uaddr = MTD_UADDR_0x0AAA_0x0555,
690 .dev_size = SIZE_1MiB,
691 .cmd_set = P_ID_AMD_STD,
694 ERASEINFO(0x04000,1),
695 ERASEINFO(0x02000,2),
696 ERASEINFO(0x08000,1),
697 ERASEINFO(0x10000,15),
700 .mfr_id = CFI_MFR_FUJITSU,
701 .dev_id = MBM29LV650UE,
702 .name = "Fujitsu MBM29LV650UE",
703 .devtypes = CFI_DEVICETYPE_X8,
704 .uaddr = MTD_UADDR_DONT_CARE,
705 .dev_size = SIZE_8MiB,
706 .cmd_set = P_ID_AMD_STD,
709 ERASEINFO(0x10000,128)
712 .mfr_id = CFI_MFR_FUJITSU,
713 .dev_id = MBM29LV320TE,
714 .name = "Fujitsu MBM29LV320TE",
715 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
716 .uaddr = MTD_UADDR_0x0AAA_0x0555,
717 .dev_size = SIZE_4MiB,
718 .cmd_set = P_ID_AMD_STD,
721 ERASEINFO(0x10000,63),
725 .mfr_id = CFI_MFR_FUJITSU,
726 .dev_id = MBM29LV320BE,
727 .name = "Fujitsu MBM29LV320BE",
728 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
729 .uaddr = MTD_UADDR_0x0AAA_0x0555,
730 .dev_size = SIZE_4MiB,
731 .cmd_set = P_ID_AMD_STD,
734 ERASEINFO(0x02000,8),
735 ERASEINFO(0x10000,63)
738 .mfr_id = CFI_MFR_FUJITSU,
739 .dev_id = MBM29LV160TE,
740 .name = "Fujitsu MBM29LV160TE",
741 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
742 .uaddr = MTD_UADDR_0x0AAA_0x0555,
743 .dev_size = SIZE_2MiB,
744 .cmd_set = P_ID_AMD_STD,
747 ERASEINFO(0x10000,31),
748 ERASEINFO(0x08000,1),
749 ERASEINFO(0x02000,2),
753 .mfr_id = CFI_MFR_FUJITSU,
754 .dev_id = MBM29LV160BE,
755 .name = "Fujitsu MBM29LV160BE",
756 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
757 .uaddr = MTD_UADDR_0x0AAA_0x0555,
758 .dev_size = SIZE_2MiB,
759 .cmd_set = P_ID_AMD_STD,
762 ERASEINFO(0x04000,1),
763 ERASEINFO(0x02000,2),
764 ERASEINFO(0x08000,1),
765 ERASEINFO(0x10000,31)
768 .mfr_id = CFI_MFR_FUJITSU,
769 .dev_id = MBM29LV800BA,
770 .name = "Fujitsu MBM29LV800BA",
771 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
772 .uaddr = MTD_UADDR_0x0AAA_0x0555,
773 .dev_size = SIZE_1MiB,
774 .cmd_set = P_ID_AMD_STD,
777 ERASEINFO(0x04000,1),
778 ERASEINFO(0x02000,2),
779 ERASEINFO(0x08000,1),
780 ERASEINFO(0x10000,15)
783 .mfr_id = CFI_MFR_FUJITSU,
784 .dev_id = MBM29LV800TA,
785 .name = "Fujitsu MBM29LV800TA",
786 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
787 .uaddr = MTD_UADDR_0x0AAA_0x0555,
788 .dev_size = SIZE_1MiB,
789 .cmd_set = P_ID_AMD_STD,
792 ERASEINFO(0x10000,15),
793 ERASEINFO(0x08000,1),
794 ERASEINFO(0x02000,2),
798 .mfr_id = CFI_MFR_FUJITSU,
799 .dev_id = MBM29LV400BC,
800 .name = "Fujitsu MBM29LV400BC",
801 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
802 .uaddr = MTD_UADDR_0x0AAA_0x0555,
803 .dev_size = SIZE_512KiB,
804 .cmd_set = P_ID_AMD_STD,
807 ERASEINFO(0x04000,1),
808 ERASEINFO(0x02000,2),
809 ERASEINFO(0x08000,1),
813 .mfr_id = CFI_MFR_FUJITSU,
814 .dev_id = MBM29LV400TC,
815 .name = "Fujitsu MBM29LV400TC",
816 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
817 .uaddr = MTD_UADDR_0x0AAA_0x0555,
818 .dev_size = SIZE_512KiB,
819 .cmd_set = P_ID_AMD_STD,
822 ERASEINFO(0x10000,7),
823 ERASEINFO(0x08000,1),
824 ERASEINFO(0x02000,2),
828 .mfr_id = CFI_MFR_HYUNDAI,
830 .name = "Hyundai HY29F002T",
831 .devtypes = CFI_DEVICETYPE_X8,
832 .uaddr = MTD_UADDR_0x0555_0x02AA,
833 .dev_size = SIZE_256KiB,
834 .cmd_set = P_ID_AMD_STD,
837 ERASEINFO(0x10000,3),
838 ERASEINFO(0x08000,1),
839 ERASEINFO(0x02000,2),
840 ERASEINFO(0x04000,1),
843 .mfr_id = CFI_MFR_INTEL,
844 .dev_id = I28F004B3B,
845 .name = "Intel 28F004B3B",
846 .devtypes = CFI_DEVICETYPE_X8,
847 .uaddr = MTD_UADDR_UNNECESSARY,
848 .dev_size = SIZE_512KiB,
849 .cmd_set = P_ID_INTEL_STD,
852 ERASEINFO(0x02000, 8),
853 ERASEINFO(0x10000, 7),
856 .mfr_id = CFI_MFR_INTEL,
857 .dev_id = I28F004B3T,
858 .name = "Intel 28F004B3T",
859 .devtypes = CFI_DEVICETYPE_X8,
860 .uaddr = MTD_UADDR_UNNECESSARY,
861 .dev_size = SIZE_512KiB,
862 .cmd_set = P_ID_INTEL_STD,
865 ERASEINFO(0x10000, 7),
866 ERASEINFO(0x02000, 8),
869 .mfr_id = CFI_MFR_INTEL,
870 .dev_id = I28F400B3B,
871 .name = "Intel 28F400B3B",
872 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
873 .uaddr = MTD_UADDR_UNNECESSARY,
874 .dev_size = SIZE_512KiB,
875 .cmd_set = P_ID_INTEL_STD,
878 ERASEINFO(0x02000, 8),
879 ERASEINFO(0x10000, 7),
882 .mfr_id = CFI_MFR_INTEL,
883 .dev_id = I28F400B3T,
884 .name = "Intel 28F400B3T",
885 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
886 .uaddr = MTD_UADDR_UNNECESSARY,
887 .dev_size = SIZE_512KiB,
888 .cmd_set = P_ID_INTEL_STD,
891 ERASEINFO(0x10000, 7),
892 ERASEINFO(0x02000, 8),
895 .mfr_id = CFI_MFR_INTEL,
896 .dev_id = I28F008B3B,
897 .name = "Intel 28F008B3B",
898 .devtypes = CFI_DEVICETYPE_X8,
899 .uaddr = MTD_UADDR_UNNECESSARY,
900 .dev_size = SIZE_1MiB,
901 .cmd_set = P_ID_INTEL_STD,
904 ERASEINFO(0x02000, 8),
905 ERASEINFO(0x10000, 15),
908 .mfr_id = CFI_MFR_INTEL,
909 .dev_id = I28F008B3T,
910 .name = "Intel 28F008B3T",
911 .devtypes = CFI_DEVICETYPE_X8,
912 .uaddr = MTD_UADDR_UNNECESSARY,
913 .dev_size = SIZE_1MiB,
914 .cmd_set = P_ID_INTEL_STD,
917 ERASEINFO(0x10000, 15),
918 ERASEINFO(0x02000, 8),
921 .mfr_id = CFI_MFR_INTEL,
923 .name = "Intel 28F008S5",
924 .devtypes = CFI_DEVICETYPE_X8,
925 .uaddr = MTD_UADDR_UNNECESSARY,
926 .dev_size = SIZE_1MiB,
927 .cmd_set = P_ID_INTEL_EXT,
930 ERASEINFO(0x10000,16),
933 .mfr_id = CFI_MFR_INTEL,
935 .name = "Intel 28F016S5",
936 .devtypes = CFI_DEVICETYPE_X8,
937 .uaddr = MTD_UADDR_UNNECESSARY,
938 .dev_size = SIZE_2MiB,
939 .cmd_set = P_ID_INTEL_EXT,
942 ERASEINFO(0x10000,32),
945 .mfr_id = CFI_MFR_INTEL,
947 .name = "Intel 28F008SA",
948 .devtypes = CFI_DEVICETYPE_X8,
949 .uaddr = MTD_UADDR_UNNECESSARY,
950 .dev_size = SIZE_1MiB,
951 .cmd_set = P_ID_INTEL_STD,
954 ERASEINFO(0x10000, 16),
957 .mfr_id = CFI_MFR_INTEL,
958 .dev_id = I28F800B3B,
959 .name = "Intel 28F800B3B",
960 .devtypes = CFI_DEVICETYPE_X16,
961 .uaddr = MTD_UADDR_UNNECESSARY,
962 .dev_size = SIZE_1MiB,
963 .cmd_set = P_ID_INTEL_STD,
966 ERASEINFO(0x02000, 8),
967 ERASEINFO(0x10000, 15),
970 .mfr_id = CFI_MFR_INTEL,
971 .dev_id = I28F800B3T,
972 .name = "Intel 28F800B3T",
973 .devtypes = CFI_DEVICETYPE_X16,
974 .uaddr = MTD_UADDR_UNNECESSARY,
975 .dev_size = SIZE_1MiB,
976 .cmd_set = P_ID_INTEL_STD,
979 ERASEINFO(0x10000, 15),
980 ERASEINFO(0x02000, 8),
983 .mfr_id = CFI_MFR_INTEL,
984 .dev_id = I28F016B3B,
985 .name = "Intel 28F016B3B",
986 .devtypes = CFI_DEVICETYPE_X8,
987 .uaddr = MTD_UADDR_UNNECESSARY,
988 .dev_size = SIZE_2MiB,
989 .cmd_set = P_ID_INTEL_STD,
992 ERASEINFO(0x02000, 8),
993 ERASEINFO(0x10000, 31),
996 .mfr_id = CFI_MFR_INTEL,
998 .name = "Intel I28F016S3",
999 .devtypes = CFI_DEVICETYPE_X8,
1000 .uaddr = MTD_UADDR_UNNECESSARY,
1001 .dev_size = SIZE_2MiB,
1002 .cmd_set = P_ID_INTEL_STD,
1005 ERASEINFO(0x10000, 32),
1008 .mfr_id = CFI_MFR_INTEL,
1009 .dev_id = I28F016B3T,
1010 .name = "Intel 28F016B3T",
1011 .devtypes = CFI_DEVICETYPE_X8,
1012 .uaddr = MTD_UADDR_UNNECESSARY,
1013 .dev_size = SIZE_2MiB,
1014 .cmd_set = P_ID_INTEL_STD,
1017 ERASEINFO(0x10000, 31),
1018 ERASEINFO(0x02000, 8),
1021 .mfr_id = CFI_MFR_INTEL,
1022 .dev_id = I28F160B3B,
1023 .name = "Intel 28F160B3B",
1024 .devtypes = CFI_DEVICETYPE_X16,
1025 .uaddr = MTD_UADDR_UNNECESSARY,
1026 .dev_size = SIZE_2MiB,
1027 .cmd_set = P_ID_INTEL_STD,
1030 ERASEINFO(0x02000, 8),
1031 ERASEINFO(0x10000, 31),
1034 .mfr_id = CFI_MFR_INTEL,
1035 .dev_id = I28F160B3T,
1036 .name = "Intel 28F160B3T",
1037 .devtypes = CFI_DEVICETYPE_X16,
1038 .uaddr = MTD_UADDR_UNNECESSARY,
1039 .dev_size = SIZE_2MiB,
1040 .cmd_set = P_ID_INTEL_STD,
1043 ERASEINFO(0x10000, 31),
1044 ERASEINFO(0x02000, 8),
1047 .mfr_id = CFI_MFR_INTEL,
1048 .dev_id = I28F320B3B,
1049 .name = "Intel 28F320B3B",
1050 .devtypes = CFI_DEVICETYPE_X16,
1051 .uaddr = MTD_UADDR_UNNECESSARY,
1052 .dev_size = SIZE_4MiB,
1053 .cmd_set = P_ID_INTEL_STD,
1056 ERASEINFO(0x02000, 8),
1057 ERASEINFO(0x10000, 63),
1060 .mfr_id = CFI_MFR_INTEL,
1061 .dev_id = I28F320B3T,
1062 .name = "Intel 28F320B3T",
1063 .devtypes = CFI_DEVICETYPE_X16,
1064 .uaddr = MTD_UADDR_UNNECESSARY,
1065 .dev_size = SIZE_4MiB,
1066 .cmd_set = P_ID_INTEL_STD,
1069 ERASEINFO(0x10000, 63),
1070 ERASEINFO(0x02000, 8),
1073 .mfr_id = CFI_MFR_INTEL,
1074 .dev_id = I28F640B3B,
1075 .name = "Intel 28F640B3B",
1076 .devtypes = CFI_DEVICETYPE_X16,
1077 .uaddr = MTD_UADDR_UNNECESSARY,
1078 .dev_size = SIZE_8MiB,
1079 .cmd_set = P_ID_INTEL_STD,
1082 ERASEINFO(0x02000, 8),
1083 ERASEINFO(0x10000, 127),
1086 .mfr_id = CFI_MFR_INTEL,
1087 .dev_id = I28F640B3T,
1088 .name = "Intel 28F640B3T",
1089 .devtypes = CFI_DEVICETYPE_X16,
1090 .uaddr = MTD_UADDR_UNNECESSARY,
1091 .dev_size = SIZE_8MiB,
1092 .cmd_set = P_ID_INTEL_STD,
1095 ERASEINFO(0x10000, 127),
1096 ERASEINFO(0x02000, 8),
1099 .mfr_id = CFI_MFR_INTEL,
1100 .dev_id = I28F640C3B,
1101 .name = "Intel 28F640C3B",
1102 .devtypes = CFI_DEVICETYPE_X16,
1103 .uaddr = MTD_UADDR_UNNECESSARY,
1104 .dev_size = SIZE_8MiB,
1105 .cmd_set = P_ID_INTEL_STD,
1108 ERASEINFO(0x02000, 8),
1109 ERASEINFO(0x10000, 127),
1112 .mfr_id = CFI_MFR_INTEL,
1114 .name = "Intel 82802AB",
1115 .devtypes = CFI_DEVICETYPE_X8,
1116 .uaddr = MTD_UADDR_UNNECESSARY,
1117 .dev_size = SIZE_512KiB,
1118 .cmd_set = P_ID_INTEL_EXT,
1121 ERASEINFO(0x10000,8),
1124 .mfr_id = CFI_MFR_INTEL,
1126 .name = "Intel 82802AC",
1127 .devtypes = CFI_DEVICETYPE_X8,
1128 .uaddr = MTD_UADDR_UNNECESSARY,
1129 .dev_size = SIZE_1MiB,
1130 .cmd_set = P_ID_INTEL_EXT,
1133 ERASEINFO(0x10000,16),
1136 .mfr_id = CFI_MFR_MACRONIX,
1137 .dev_id = MX29LV040C,
1138 .name = "Macronix MX29LV040C",
1139 .devtypes = CFI_DEVICETYPE_X8,
1140 .uaddr = MTD_UADDR_0x0555_0x02AA,
1141 .dev_size = SIZE_512KiB,
1142 .cmd_set = P_ID_AMD_STD,
1145 ERASEINFO(0x10000,8),
1148 .mfr_id = CFI_MFR_MACRONIX,
1149 .dev_id = MX29LV160T,
1150 .name = "MXIC MX29LV160T",
1151 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1152 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1153 .dev_size = SIZE_2MiB,
1154 .cmd_set = P_ID_AMD_STD,
1157 ERASEINFO(0x10000,31),
1158 ERASEINFO(0x08000,1),
1159 ERASEINFO(0x02000,2),
1160 ERASEINFO(0x04000,1)
1163 .mfr_id = CFI_MFR_NEC,
1164 .dev_id = UPD29F064115,
1165 .name = "NEC uPD29F064115",
1166 .devtypes = CFI_DEVICETYPE_X16,
1167 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1168 .dev_size = SIZE_8MiB,
1169 .cmd_set = P_ID_AMD_STD,
1172 ERASEINFO(0x2000,8),
1173 ERASEINFO(0x10000,126),
1174 ERASEINFO(0x2000,8),
1177 .mfr_id = CFI_MFR_MACRONIX,
1178 .dev_id = MX29LV160B,
1179 .name = "MXIC MX29LV160B",
1180 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1181 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1182 .dev_size = SIZE_2MiB,
1183 .cmd_set = P_ID_AMD_STD,
1186 ERASEINFO(0x04000,1),
1187 ERASEINFO(0x02000,2),
1188 ERASEINFO(0x08000,1),
1189 ERASEINFO(0x10000,31)
1192 .mfr_id = CFI_MFR_MACRONIX,
1194 .name = "Macronix MX29F040",
1195 .devtypes = CFI_DEVICETYPE_X8,
1196 .uaddr = MTD_UADDR_0x0555_0x02AA,
1197 .dev_size = SIZE_512KiB,
1198 .cmd_set = P_ID_AMD_STD,
1201 ERASEINFO(0x10000,8),
1204 .mfr_id = CFI_MFR_MACRONIX,
1206 .name = "Macronix MX29F016",
1207 .devtypes = CFI_DEVICETYPE_X8,
1208 .uaddr = MTD_UADDR_0x0555_0x02AA,
1209 .dev_size = SIZE_2MiB,
1210 .cmd_set = P_ID_AMD_STD,
1213 ERASEINFO(0x10000,32),
1216 .mfr_id = CFI_MFR_MACRONIX,
1217 .dev_id = MX29F004T,
1218 .name = "Macronix MX29F004T",
1219 .devtypes = CFI_DEVICETYPE_X8,
1220 .uaddr = MTD_UADDR_0x0555_0x02AA,
1221 .dev_size = SIZE_512KiB,
1222 .cmd_set = P_ID_AMD_STD,
1225 ERASEINFO(0x10000,7),
1226 ERASEINFO(0x08000,1),
1227 ERASEINFO(0x02000,2),
1228 ERASEINFO(0x04000,1),
1231 .mfr_id = CFI_MFR_MACRONIX,
1232 .dev_id = MX29F004B,
1233 .name = "Macronix MX29F004B",
1234 .devtypes = CFI_DEVICETYPE_X8,
1235 .uaddr = MTD_UADDR_0x0555_0x02AA,
1236 .dev_size = SIZE_512KiB,
1237 .cmd_set = P_ID_AMD_STD,
1240 ERASEINFO(0x04000,1),
1241 ERASEINFO(0x02000,2),
1242 ERASEINFO(0x08000,1),
1243 ERASEINFO(0x10000,7),
1246 .mfr_id = CFI_MFR_MACRONIX,
1247 .dev_id = MX29F002T,
1248 .name = "Macronix MX29F002T",
1249 .devtypes = CFI_DEVICETYPE_X8,
1250 .uaddr = MTD_UADDR_0x0555_0x02AA,
1251 .dev_size = SIZE_256KiB,
1252 .cmd_set = P_ID_AMD_STD,
1255 ERASEINFO(0x10000,3),
1256 ERASEINFO(0x08000,1),
1257 ERASEINFO(0x02000,2),
1258 ERASEINFO(0x04000,1),
1261 .mfr_id = CFI_MFR_PMC,
1262 .dev_id = PM49FL002,
1263 .name = "PMC Pm49FL002",
1264 .devtypes = CFI_DEVICETYPE_X8,
1265 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1266 .dev_size = SIZE_256KiB,
1267 .cmd_set = P_ID_AMD_STD,
1270 ERASEINFO( 0x01000, 64 )
1273 .mfr_id = CFI_MFR_PMC,
1274 .dev_id = PM49FL004,
1275 .name = "PMC Pm49FL004",
1276 .devtypes = CFI_DEVICETYPE_X8,
1277 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1278 .dev_size = SIZE_512KiB,
1279 .cmd_set = P_ID_AMD_STD,
1282 ERASEINFO( 0x01000, 128 )
1285 .mfr_id = CFI_MFR_PMC,
1286 .dev_id = PM49FL008,
1287 .name = "PMC Pm49FL008",
1288 .devtypes = CFI_DEVICETYPE_X8,
1289 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1290 .dev_size = SIZE_1MiB,
1291 .cmd_set = P_ID_AMD_STD,
1294 ERASEINFO( 0x01000, 256 )
1297 .mfr_id = CFI_MFR_SHARP,
1298 .dev_id = LH28F640BF,
1299 .name = "LH28F640BF",
1300 .devtypes = CFI_DEVICETYPE_X8,
1301 .uaddr = MTD_UADDR_UNNECESSARY,
1302 .dev_size = SIZE_4MiB,
1303 .cmd_set = P_ID_INTEL_STD,
1306 ERASEINFO(0x40000,16),
1309 .mfr_id = CFI_MFR_SST,
1310 .dev_id = SST39LF512,
1311 .name = "SST 39LF512",
1312 .devtypes = CFI_DEVICETYPE_X8,
1313 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1314 .dev_size = SIZE_64KiB,
1315 .cmd_set = P_ID_AMD_STD,
1318 ERASEINFO(0x01000,16),
1321 .mfr_id = CFI_MFR_SST,
1322 .dev_id = SST39LF010,
1323 .name = "SST 39LF010",
1324 .devtypes = CFI_DEVICETYPE_X8,
1325 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1326 .dev_size = SIZE_128KiB,
1327 .cmd_set = P_ID_AMD_STD,
1330 ERASEINFO(0x01000,32),
1333 .mfr_id = CFI_MFR_SST,
1334 .dev_id = SST29EE020,
1335 .name = "SST 29EE020",
1336 .devtypes = CFI_DEVICETYPE_X8,
1337 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1338 .dev_size = SIZE_256KiB,
1339 .cmd_set = P_ID_SST_PAGE,
1341 .regions = {ERASEINFO(0x01000,64),
1344 .mfr_id = CFI_MFR_SST,
1345 .dev_id = SST29LE020,
1346 .name = "SST 29LE020",
1347 .devtypes = CFI_DEVICETYPE_X8,
1348 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1349 .dev_size = SIZE_256KiB,
1350 .cmd_set = P_ID_SST_PAGE,
1352 .regions = {ERASEINFO(0x01000,64),
1355 .mfr_id = CFI_MFR_SST,
1356 .dev_id = SST39LF020,
1357 .name = "SST 39LF020",
1358 .devtypes = CFI_DEVICETYPE_X8,
1359 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1360 .dev_size = SIZE_256KiB,
1361 .cmd_set = P_ID_AMD_STD,
1364 ERASEINFO(0x01000,64),
1367 .mfr_id = CFI_MFR_SST,
1368 .dev_id = SST39LF040,
1369 .name = "SST 39LF040",
1370 .devtypes = CFI_DEVICETYPE_X8,
1371 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1372 .dev_size = SIZE_512KiB,
1373 .cmd_set = P_ID_AMD_STD,
1376 ERASEINFO(0x01000,128),
1379 .mfr_id = CFI_MFR_SST,
1380 .dev_id = SST39SF010A,
1381 .name = "SST 39SF010A",
1382 .devtypes = CFI_DEVICETYPE_X8,
1383 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1384 .dev_size = SIZE_128KiB,
1385 .cmd_set = P_ID_AMD_STD,
1388 ERASEINFO(0x01000,32),
1391 .mfr_id = CFI_MFR_SST,
1392 .dev_id = SST39SF020A,
1393 .name = "SST 39SF020A",
1394 .devtypes = CFI_DEVICETYPE_X8,
1395 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1396 .dev_size = SIZE_256KiB,
1397 .cmd_set = P_ID_AMD_STD,
1400 ERASEINFO(0x01000,64),
1403 .mfr_id = CFI_MFR_SST,
1404 .dev_id = SST39SF040,
1405 .name = "SST 39SF040",
1406 .devtypes = CFI_DEVICETYPE_X8,
1407 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1408 .dev_size = SIZE_512KiB,
1409 .cmd_set = P_ID_AMD_STD,
1412 ERASEINFO(0x01000,128),
1415 .mfr_id = CFI_MFR_SST,
1416 .dev_id = SST49LF040B,
1417 .name = "SST 49LF040B",
1418 .devtypes = CFI_DEVICETYPE_X8,
1419 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1420 .dev_size = SIZE_512KiB,
1421 .cmd_set = P_ID_AMD_STD,
1424 ERASEINFO(0x01000,128),
1428 .mfr_id = CFI_MFR_SST,
1429 .dev_id = SST49LF004B,
1430 .name = "SST 49LF004B",
1431 .devtypes = CFI_DEVICETYPE_X8,
1432 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1433 .dev_size = SIZE_512KiB,
1434 .cmd_set = P_ID_AMD_STD,
1437 ERASEINFO(0x01000,128),
1440 .mfr_id = CFI_MFR_SST,
1441 .dev_id = SST49LF008A,
1442 .name = "SST 49LF008A",
1443 .devtypes = CFI_DEVICETYPE_X8,
1444 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1445 .dev_size = SIZE_1MiB,
1446 .cmd_set = P_ID_AMD_STD,
1449 ERASEINFO(0x01000,256),
1452 .mfr_id = CFI_MFR_SST,
1453 .dev_id = SST49LF030A,
1454 .name = "SST 49LF030A",
1455 .devtypes = CFI_DEVICETYPE_X8,
1456 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1457 .dev_size = SIZE_512KiB,
1458 .cmd_set = P_ID_AMD_STD,
1461 ERASEINFO(0x01000,96),
1464 .mfr_id = CFI_MFR_SST,
1465 .dev_id = SST49LF040A,
1466 .name = "SST 49LF040A",
1467 .devtypes = CFI_DEVICETYPE_X8,
1468 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1469 .dev_size = SIZE_512KiB,
1470 .cmd_set = P_ID_AMD_STD,
1473 ERASEINFO(0x01000,128),
1476 .mfr_id = CFI_MFR_SST,
1477 .dev_id = SST49LF080A,
1478 .name = "SST 49LF080A",
1479 .devtypes = CFI_DEVICETYPE_X8,
1480 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1481 .dev_size = SIZE_1MiB,
1482 .cmd_set = P_ID_AMD_STD,
1485 ERASEINFO(0x01000,256),
1488 .mfr_id = CFI_MFR_SST, /* should be CFI */
1489 .dev_id = SST39LF160,
1490 .name = "SST 39LF160",
1491 .devtypes = CFI_DEVICETYPE_X16,
1492 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1493 .dev_size = SIZE_2MiB,
1494 .cmd_set = P_ID_AMD_STD,
1497 ERASEINFO(0x1000,256),
1498 ERASEINFO(0x1000,256)
1501 .mfr_id = CFI_MFR_SST, /* should be CFI */
1502 .dev_id = SST39VF1601,
1503 .name = "SST 39VF1601",
1504 .devtypes = CFI_DEVICETYPE_X16,
1505 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1506 .dev_size = SIZE_2MiB,
1507 .cmd_set = P_ID_AMD_STD,
1510 ERASEINFO(0x1000,256),
1511 ERASEINFO(0x1000,256)
1514 .mfr_id = CFI_MFR_SST, /* should be CFI */
1515 .dev_id = SST39VF3201,
1516 .name = "SST 39VF3201",
1517 .devtypes = CFI_DEVICETYPE_X16,
1518 .uaddr = MTD_UADDR_0xAAAA_0x5555,
1519 .dev_size = SIZE_4MiB,
1520 .cmd_set = P_ID_AMD_STD,
1523 ERASEINFO(0x1000,256),
1524 ERASEINFO(0x1000,256),
1525 ERASEINFO(0x1000,256),
1526 ERASEINFO(0x1000,256)
1529 .mfr_id = CFI_MFR_SST,
1530 .dev_id = SST36VF3203,
1531 .name = "SST 36VF3203",
1532 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1533 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1534 .dev_size = SIZE_4MiB,
1535 .cmd_set = P_ID_AMD_STD,
1538 ERASEINFO(0x10000,64),
1541 .mfr_id = CFI_MFR_ST,
1542 .dev_id = M29F800AB,
1543 .name = "ST M29F800AB",
1544 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1545 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1546 .dev_size = SIZE_1MiB,
1547 .cmd_set = P_ID_AMD_STD,
1550 ERASEINFO(0x04000,1),
1551 ERASEINFO(0x02000,2),
1552 ERASEINFO(0x08000,1),
1553 ERASEINFO(0x10000,15),
1556 .mfr_id = CFI_MFR_ST, /* FIXME - CFI device? */
1557 .dev_id = M29W800DT,
1558 .name = "ST M29W800DT",
1559 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1560 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1561 .dev_size = SIZE_1MiB,
1562 .cmd_set = P_ID_AMD_STD,
1565 ERASEINFO(0x10000,15),
1566 ERASEINFO(0x08000,1),
1567 ERASEINFO(0x02000,2),
1568 ERASEINFO(0x04000,1)
1571 .mfr_id = CFI_MFR_ST, /* FIXME - CFI device? */
1572 .dev_id = M29W800DB,
1573 .name = "ST M29W800DB",
1574 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1575 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1576 .dev_size = SIZE_1MiB,
1577 .cmd_set = P_ID_AMD_STD,
1580 ERASEINFO(0x04000,1),
1581 ERASEINFO(0x02000,2),
1582 ERASEINFO(0x08000,1),
1583 ERASEINFO(0x10000,15)
1586 .mfr_id = CFI_MFR_ST,
1587 .dev_id = M29W400DT,
1588 .name = "ST M29W400DT",
1589 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1590 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1591 .dev_size = SIZE_512KiB,
1592 .cmd_set = P_ID_AMD_STD,
1595 ERASEINFO(0x04000,7),
1596 ERASEINFO(0x02000,1),
1597 ERASEINFO(0x08000,2),
1598 ERASEINFO(0x10000,1)
1601 .mfr_id = CFI_MFR_ST,
1602 .dev_id = M29W400DB,
1603 .name = "ST M29W400DB",
1604 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1605 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1606 .dev_size = SIZE_512KiB,
1607 .cmd_set = P_ID_AMD_STD,
1610 ERASEINFO(0x04000,1),
1611 ERASEINFO(0x02000,2),
1612 ERASEINFO(0x08000,1),
1613 ERASEINFO(0x10000,7)
1616 .mfr_id = CFI_MFR_ST, /* FIXME - CFI device? */
1617 .dev_id = M29W160DT,
1618 .name = "ST M29W160DT",
1619 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1620 .uaddr = MTD_UADDR_0x0555_0x02AA, /* ???? */
1621 .dev_size = SIZE_2MiB,
1622 .cmd_set = P_ID_AMD_STD,
1625 ERASEINFO(0x10000,31),
1626 ERASEINFO(0x08000,1),
1627 ERASEINFO(0x02000,2),
1628 ERASEINFO(0x04000,1)
1631 .mfr_id = CFI_MFR_ST, /* FIXME - CFI device? */
1632 .dev_id = M29W160DB,
1633 .name = "ST M29W160DB",
1634 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1635 .uaddr = MTD_UADDR_0x0555_0x02AA, /* ???? */
1636 .dev_size = SIZE_2MiB,
1637 .cmd_set = P_ID_AMD_STD,
1640 ERASEINFO(0x04000,1),
1641 ERASEINFO(0x02000,2),
1642 ERASEINFO(0x08000,1),
1643 ERASEINFO(0x10000,31)
1646 .mfr_id = CFI_MFR_ST,
1648 .name = "ST M29W040B",
1649 .devtypes = CFI_DEVICETYPE_X8,
1650 .uaddr = MTD_UADDR_0x0555_0x02AA,
1651 .dev_size = SIZE_512KiB,
1652 .cmd_set = P_ID_AMD_STD,
1655 ERASEINFO(0x10000,8),
1658 .mfr_id = CFI_MFR_ST,
1660 .name = "ST M50FW040",
1661 .devtypes = CFI_DEVICETYPE_X8,
1662 .uaddr = MTD_UADDR_UNNECESSARY,
1663 .dev_size = SIZE_512KiB,
1664 .cmd_set = P_ID_INTEL_EXT,
1667 ERASEINFO(0x10000,8),
1670 .mfr_id = CFI_MFR_ST,
1672 .name = "ST M50FW080",
1673 .devtypes = CFI_DEVICETYPE_X8,
1674 .uaddr = MTD_UADDR_UNNECESSARY,
1675 .dev_size = SIZE_1MiB,
1676 .cmd_set = P_ID_INTEL_EXT,
1679 ERASEINFO(0x10000,16),
1682 .mfr_id = CFI_MFR_ST,
1684 .name = "ST M50FW016",
1685 .devtypes = CFI_DEVICETYPE_X8,
1686 .uaddr = MTD_UADDR_UNNECESSARY,
1687 .dev_size = SIZE_2MiB,
1688 .cmd_set = P_ID_INTEL_EXT,
1691 ERASEINFO(0x10000,32),
1694 .mfr_id = CFI_MFR_ST,
1695 .dev_id = M50LPW080,
1696 .name = "ST M50LPW080",
1697 .devtypes = CFI_DEVICETYPE_X8,
1698 .uaddr = MTD_UADDR_UNNECESSARY,
1699 .dev_size = SIZE_1MiB,
1700 .cmd_set = P_ID_INTEL_EXT,
1703 ERASEINFO(0x10000,16),
1706 .mfr_id = CFI_MFR_ST,
1707 .dev_id = M50FLW080A,
1708 .name = "ST M50FLW080A",
1709 .devtypes = CFI_DEVICETYPE_X8,
1710 .uaddr = MTD_UADDR_UNNECESSARY,
1711 .dev_size = SIZE_1MiB,
1712 .cmd_set = P_ID_INTEL_EXT,
1715 ERASEINFO(0x1000,16),
1716 ERASEINFO(0x10000,13),
1717 ERASEINFO(0x1000,16),
1718 ERASEINFO(0x1000,16),
1721 .mfr_id = CFI_MFR_ST,
1722 .dev_id = M50FLW080B,
1723 .name = "ST M50FLW080B",
1724 .devtypes = CFI_DEVICETYPE_X8,
1725 .uaddr = MTD_UADDR_UNNECESSARY,
1726 .dev_size = SIZE_1MiB,
1727 .cmd_set = P_ID_INTEL_EXT,
1730 ERASEINFO(0x1000,16),
1731 ERASEINFO(0x1000,16),
1732 ERASEINFO(0x10000,13),
1733 ERASEINFO(0x1000,16),
1736 .mfr_id = 0xff00 | CFI_MFR_ST,
1737 .dev_id = 0xff00 | PSD4256G6V,
1738 .name = "ST PSD4256G6V",
1739 .devtypes = CFI_DEVICETYPE_X16,
1740 .uaddr = MTD_UADDR_0x0AAA_0x0554,
1741 .dev_size = SIZE_1MiB,
1742 .cmd_set = P_ID_AMD_STD,
1745 ERASEINFO(0x10000,16),
1748 .mfr_id = CFI_MFR_TOSHIBA,
1749 .dev_id = TC58FVT160,
1750 .name = "Toshiba TC58FVT160",
1751 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1752 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1753 .dev_size = SIZE_2MiB,
1754 .cmd_set = P_ID_AMD_STD,
1757 ERASEINFO(0x10000,31),
1758 ERASEINFO(0x08000,1),
1759 ERASEINFO(0x02000,2),
1760 ERASEINFO(0x04000,1)
1763 .mfr_id = CFI_MFR_TOSHIBA,
1764 .dev_id = TC58FVB160,
1765 .name = "Toshiba TC58FVB160",
1766 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1767 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1768 .dev_size = SIZE_2MiB,
1769 .cmd_set = P_ID_AMD_STD,
1772 ERASEINFO(0x04000,1),
1773 ERASEINFO(0x02000,2),
1774 ERASEINFO(0x08000,1),
1775 ERASEINFO(0x10000,31)
1778 .mfr_id = CFI_MFR_TOSHIBA,
1779 .dev_id = TC58FVB321,
1780 .name = "Toshiba TC58FVB321",
1781 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1782 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1783 .dev_size = SIZE_4MiB,
1784 .cmd_set = P_ID_AMD_STD,
1787 ERASEINFO(0x02000,8),
1788 ERASEINFO(0x10000,63)
1791 .mfr_id = CFI_MFR_TOSHIBA,
1792 .dev_id = TC58FVT321,
1793 .name = "Toshiba TC58FVT321",
1794 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1795 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1796 .dev_size = SIZE_4MiB,
1797 .cmd_set = P_ID_AMD_STD,
1800 ERASEINFO(0x10000,63),
1801 ERASEINFO(0x02000,8)
1804 .mfr_id = CFI_MFR_TOSHIBA,
1805 .dev_id = TC58FVB641,
1806 .name = "Toshiba TC58FVB641",
1807 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1808 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1809 .dev_size = SIZE_8MiB,
1810 .cmd_set = P_ID_AMD_STD,
1813 ERASEINFO(0x02000,8),
1814 ERASEINFO(0x10000,127)
1817 .mfr_id = CFI_MFR_TOSHIBA,
1818 .dev_id = TC58FVT641,
1819 .name = "Toshiba TC58FVT641",
1820 .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1821 .uaddr = MTD_UADDR_0x0AAA_0x0555,
1822 .dev_size = SIZE_8MiB,
1823 .cmd_set = P_ID_AMD_STD,
1826 ERASEINFO(0x10000,127),
1827 ERASEINFO(0x02000,8)
1830 .mfr_id = CFI_MFR_WINBOND,
1832 .name = "Winbond W49V002A",
1833 .devtypes = CFI_DEVICETYPE_X8,
1834 .uaddr = MTD_UADDR_0x5555_0x2AAA,
1835 .dev_size = SIZE_256KiB,
1836 .cmd_set = P_ID_AMD_STD,
1839 ERASEINFO(0x10000, 3),
1840 ERASEINFO(0x08000, 1),
1841 ERASEINFO(0x02000, 2),
1842 ERASEINFO(0x04000, 1),
1847 static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
1848 struct cfi_private *cfi)
1854 /* According to JEDEC "Standard Manufacturer's Identification Code"
1855 * (http://www.jedec.org/download/search/jep106W.pdf)
1856 * several first banks can contain 0x7f instead of actual ID
1859 uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
1860 mask = (1 << (cfi->device_type * 8)) - 1;
1861 result = map_read(map, base + ofs);
1863 } while ((result.x[0] & mask) == CFI_MFR_CONTINUATION);
1865 return result.x[0] & mask;
1868 static inline u32 jedec_read_id(struct map_info *map, uint32_t base,
1869 struct cfi_private *cfi)
1873 u32 ofs = cfi_build_cmd_addr(1, map, cfi);
1874 mask = (1 << (cfi->device_type * 8)) -1;
1875 result = map_read(map, base + ofs);
1876 return result.x[0] & mask;
1879 static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
1883 /* after checking the datasheets for SST, MACRONIX and ATMEL
1884 * (oh and incidentaly the jedec spec - 3.5.3.3) the reset
1885 * sequence is *supposed* to be 0xaa at 0x5555, 0x55 at
1886 * 0x2aaa, 0xF0 at 0x5555 this will not affect the AMD chips
1887 * as they will ignore the writes and dont care what address
1888 * the F0 is written to */
1889 if (cfi->addr_unlock1) {
1890 DEBUG( MTD_DEBUG_LEVEL3,
1891 "reset unlock called %x %x \n",
1892 cfi->addr_unlock1,cfi->addr_unlock2);
1893 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1894 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
1897 cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1898 /* Some misdesigned Intel chips do not respond for 0xF0 for a reset,
1899 * so ensure we're in read mode. Send both the Intel and the AMD command
1900 * for this. Intel uses 0xff for this, AMD uses 0xff for NOP, so
1901 * this should be safe.
1903 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
1904 /* FIXME - should have reset delay before continuing */
1908 static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
1910 int i,num_erase_regions;
1913 if (! (jedec_table[index].devtypes & p_cfi->device_type)) {
1914 DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n",
1915 jedec_table[index].name, 4 * (1<<p_cfi->device_type));
1919 printk(KERN_INFO "Found: %s\n",jedec_table[index].name);
1921 num_erase_regions = jedec_table[index].nr_regions;
1923 p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
1925 //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
1929 memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
1931 p_cfi->cfiq->P_ID = jedec_table[index].cmd_set;
1932 p_cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
1933 p_cfi->cfiq->DevSize = jedec_table[index].dev_size;
1934 p_cfi->cfi_mode = CFI_MODE_JEDEC;
1936 for (i=0; i<num_erase_regions; i++){
1937 p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
1939 p_cfi->cmdset_priv = NULL;
1941 /* This may be redundant for some cases, but it doesn't hurt */
1942 p_cfi->mfr = jedec_table[index].mfr_id;
1943 p_cfi->id = jedec_table[index].dev_id;
1945 uaddr = jedec_table[index].uaddr;
1947 /* The table has unlock addresses in _bytes_, and we try not to let
1948 our brains explode when we see the datasheets talking about address
1949 lines numbered from A-1 to A18. The CFI table has unlock addresses
1950 in device-words according to the mode the device is connected in */
1951 p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / p_cfi->device_type;
1952 p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / p_cfi->device_type;
1959 * There is a BIG problem properly ID'ing the JEDEC device and guaranteeing
1960 * the mapped address, unlock addresses, and proper chip ID. This function
1961 * attempts to minimize errors. It is doubtfull that this probe will ever
1962 * be perfect - consequently there should be some module parameters that
1963 * could be manually specified to force the chip info.
1965 static inline int jedec_match( uint32_t base,
1966 struct map_info *map,
1967 struct cfi_private *cfi,
1968 const struct amd_flash_info *finfo )
1970 int rc = 0; /* failure until all tests pass */
1975 * The IDs must match. For X16 and X32 devices operating in
1976 * a lower width ( X8 or X16 ), the device ID's are usually just
1977 * the lower byte(s) of the larger device ID for wider mode. If
1978 * a part is found that doesn't fit this assumption (device id for
1979 * smaller width mode is completely unrealated to full-width mode)
1980 * then the jedec_table[] will have to be augmented with the IDs
1981 * for different widths.
1983 switch (cfi->device_type) {
1984 case CFI_DEVICETYPE_X8:
1985 mfr = (uint8_t)finfo->mfr_id;
1986 id = (uint8_t)finfo->dev_id;
1988 /* bjd: it seems that if we do this, we can end up
1989 * detecting 16bit flashes as an 8bit device, even though
1992 if (finfo->dev_id > 0xff) {
1993 DEBUG( MTD_DEBUG_LEVEL3, "%s(): ID is not 8bit\n",
1998 case CFI_DEVICETYPE_X16:
1999 mfr = (uint16_t)finfo->mfr_id;
2000 id = (uint16_t)finfo->dev_id;
2002 case CFI_DEVICETYPE_X32:
2003 mfr = (uint16_t)finfo->mfr_id;
2004 id = (uint32_t)finfo->dev_id;
2008 "MTD %s(): Unsupported device type %d\n",
2009 __func__, cfi->device_type);
2012 if ( cfi->mfr != mfr || cfi->id != id ) {
2016 /* the part size must fit in the memory window */
2017 DEBUG( MTD_DEBUG_LEVEL3,
2018 "MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n",
2019 __func__, base, 1 << finfo->dev_size, base + (1 << finfo->dev_size) );
2020 if ( base + cfi_interleave(cfi) * ( 1 << finfo->dev_size ) > map->size ) {
2021 DEBUG( MTD_DEBUG_LEVEL3,
2022 "MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n",
2023 __func__, finfo->mfr_id, finfo->dev_id,
2024 1 << finfo->dev_size );
2028 if (! (finfo->devtypes & cfi->device_type))
2031 uaddr = finfo->uaddr;
2033 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): check unlock addrs 0x%.4x 0x%.4x\n",
2034 __func__, cfi->addr_unlock1, cfi->addr_unlock2 );
2035 if ( MTD_UADDR_UNNECESSARY != uaddr && MTD_UADDR_DONT_CARE != uaddr
2036 && ( unlock_addrs[uaddr].addr1 / cfi->device_type != cfi->addr_unlock1 ||
2037 unlock_addrs[uaddr].addr2 / cfi->device_type != cfi->addr_unlock2 ) ) {
2038 DEBUG( MTD_DEBUG_LEVEL3,
2039 "MTD %s(): 0x%.4x 0x%.4x did not match\n",
2041 unlock_addrs[uaddr].addr1,
2042 unlock_addrs[uaddr].addr2);
2047 * Make sure the ID's dissappear when the device is taken out of
2048 * ID mode. The only time this should fail when it should succeed
2049 * is when the ID's are written as data to the same
2050 * addresses. For this rare and unfortunate case the chip
2051 * cannot be probed correctly.
2052 * FIXME - write a driver that takes all of the chip info as
2053 * module parameters, doesn't probe but forces a load.
2055 DEBUG( MTD_DEBUG_LEVEL3,
2056 "MTD %s(): check ID's disappear when not in ID mode\n",
2058 jedec_reset( base, map, cfi );
2059 mfr = jedec_read_mfr( map, base, cfi );
2060 id = jedec_read_id( map, base, cfi );
2061 if ( mfr == cfi->mfr && id == cfi->id ) {
2062 DEBUG( MTD_DEBUG_LEVEL3,
2063 "MTD %s(): ID 0x%.2x:0x%.2x did not change after reset:\n"
2064 "You might need to manually specify JEDEC parameters.\n",
2065 __func__, cfi->mfr, cfi->id );
2069 /* all tests passed - mark as success */
2073 * Put the device back in ID mode - only need to do this if we
2074 * were truly frobbing a real device.
2076 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): return to ID mode\n", __func__ );
2077 if (cfi->addr_unlock1) {
2078 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2079 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
2081 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2082 /* FIXME - should have a delay before continuing */
2089 static int jedec_probe_chip(struct map_info *map, __u32 base,
2090 unsigned long *chip_map, struct cfi_private *cfi)
2093 enum uaddr uaddr_idx = MTD_UADDR_NOT_SUPPORTED;
2094 u32 probe_offset1, probe_offset2;
2097 if (!cfi->numchips) {
2100 if (MTD_UADDR_UNNECESSARY == uaddr_idx)
2103 cfi->addr_unlock1 = unlock_addrs[uaddr_idx].addr1 / cfi->device_type;
2104 cfi->addr_unlock2 = unlock_addrs[uaddr_idx].addr2 / cfi->device_type;
2107 /* Make certain we aren't probing past the end of map */
2108 if (base >= map->size) {
2110 "Probe at base(0x%08x) past the end of the map(0x%08lx)\n",
2111 base, map->size -1);
2115 /* Ensure the unlock addresses we try stay inside the map */
2116 probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi);
2117 probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi);
2118 if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
2119 ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
2123 jedec_reset(base, map, cfi);
2125 /* Autoselect Mode */
2126 if(cfi->addr_unlock1) {
2127 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2128 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
2130 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2131 /* FIXME - should have a delay before continuing */
2133 if (!cfi->numchips) {
2134 /* This is the first time we're called. Set up the CFI
2135 stuff accordingly and return */
2137 cfi->mfr = jedec_read_mfr(map, base, cfi);
2138 cfi->id = jedec_read_id(map, base, cfi);
2139 DEBUG(MTD_DEBUG_LEVEL3,
2140 "Search for id:(%02x %02x) interleave(%d) type(%d)\n",
2141 cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type);
2142 for (i = 0; i < ARRAY_SIZE(jedec_table); i++) {
2143 if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) {
2144 DEBUG( MTD_DEBUG_LEVEL3,
2145 "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
2146 __func__, cfi->mfr, cfi->id,
2147 cfi->addr_unlock1, cfi->addr_unlock2 );
2148 if (!cfi_jedec_setup(cfi, i))
2158 /* Make sure it is a chip of the same manufacturer and id */
2159 mfr = jedec_read_mfr(map, base, cfi);
2160 id = jedec_read_id(map, base, cfi);
2162 if ((mfr != cfi->mfr) || (id != cfi->id)) {
2163 printk(KERN_DEBUG "%s: Found different chip or no chip at all (mfr 0x%x, id 0x%x) at 0x%x\n",
2164 map->name, mfr, id, base);
2165 jedec_reset(base, map, cfi);
2170 /* Check each previous chip locations to see if it's an alias */
2171 for (i=0; i < (base >> cfi->chipshift); i++) {
2172 unsigned long start;
2173 if(!test_bit(i, chip_map)) {
2174 continue; /* Skip location; no valid chip at this address */
2176 start = i << cfi->chipshift;
2177 if (jedec_read_mfr(map, start, cfi) == cfi->mfr &&
2178 jedec_read_id(map, start, cfi) == cfi->id) {
2179 /* Eep. This chip also looks like it's in autoselect mode.
2180 Is it an alias for the new one? */
2181 jedec_reset(start, map, cfi);
2183 /* If the device IDs go away, it's an alias */
2184 if (jedec_read_mfr(map, base, cfi) != cfi->mfr ||
2185 jedec_read_id(map, base, cfi) != cfi->id) {
2186 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2187 map->name, base, start);
2191 /* Yes, it's actually got the device IDs as data. Most
2192 * unfortunate. Stick the new chip in read mode
2193 * too and if it's the same, assume it's an alias. */
2194 /* FIXME: Use other modes to do a proper check */
2195 jedec_reset(base, map, cfi);
2196 if (jedec_read_mfr(map, base, cfi) == cfi->mfr &&
2197 jedec_read_id(map, base, cfi) == cfi->id) {
2198 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2199 map->name, base, start);
2205 /* OK, if we got to here, then none of the previous chips appear to
2206 be aliases for the current one. */
2207 set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
2211 /* Put it back into Read Mode */
2212 jedec_reset(base, map, cfi);
2214 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
2215 map->name, cfi_interleave(cfi), cfi->device_type*8, base,
2221 static struct chip_probe jedec_chip_probe = {
2223 .probe_chip = jedec_probe_chip
2226 static struct mtd_info *jedec_probe(struct map_info *map)
2229 * Just use the generic probe stuff to call our CFI-specific
2230 * chip_probe routine in all the possible permutations, etc.
2232 return mtd_do_chip_probe(map, &jedec_chip_probe);
2235 static struct mtd_chip_driver jedec_chipdrv = {
2236 .probe = jedec_probe,
2237 .name = "jedec_probe",
2238 .module = THIS_MODULE
2241 static int __init jedec_probe_init(void)
2243 register_mtd_chip_driver(&jedec_chipdrv);
2247 static void __exit jedec_probe_exit(void)
2249 unregister_mtd_chip_driver(&jedec_chipdrv);
2252 module_init(jedec_probe_init);
2253 module_exit(jedec_probe_exit);
2255 MODULE_LICENSE("GPL");
2256 MODULE_AUTHOR("Erwin Authried <eauth@softsys.co.at> et al.");
2257 MODULE_DESCRIPTION("Probe code for JEDEC-compliant flash chips");