2 Common Flash Interface probe code.
3 (C) 2000 Red Hat. GPL'd.
4 $Id: jedec_probe.c,v 1.66 2005/11/07 11:14:23 gleixner Exp $
5 See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5)
6 for the standard this probe goes back to.
8 Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/types.h>
14 #include <linux/kernel.h>
16 #include <asm/byteorder.h>
17 #include <linux/errno.h>
18 #include <linux/slab.h>
19 #include <linux/interrupt.h>
20 #include <linux/init.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/map.h>
24 #include <linux/mtd/cfi.h>
25 #include <linux/mtd/gen_probe.h>
28 #define MANUFACTURER_AMD 0x0001
29 #define MANUFACTURER_ATMEL 0x001f
30 #define MANUFACTURER_FUJITSU 0x0004
31 #define MANUFACTURER_HYUNDAI 0x00AD
32 #define MANUFACTURER_INTEL 0x0089
33 #define MANUFACTURER_MACRONIX 0x00C2
34 #define MANUFACTURER_NEC 0x0010
35 #define MANUFACTURER_PMC 0x009D
36 #define MANUFACTURER_SHARP 0x00b0
37 #define MANUFACTURER_SST 0x00BF
38 #define MANUFACTURER_ST 0x0020
39 #define MANUFACTURER_TOSHIBA 0x0098
40 #define MANUFACTURER_WINBOND 0x00da
44 #define AM29DL800BB 0x22C8
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
64 #define AT49BV512 0x0003
65 #define AT29LV512 0x003d
66 #define AT49BV16X 0x00C0
67 #define AT49BV16XT 0x00C2
68 #define AT49BV32X 0x00C8
69 #define AT49BV32XT 0x00C9
72 #define MBM29F040C 0x00A4
73 #define MBM29LV650UE 0x22D7
74 #define MBM29LV320TE 0x22F6
75 #define MBM29LV320BE 0x22F9
76 #define MBM29LV160TE 0x22C4
77 #define MBM29LV160BE 0x2249
78 #define MBM29LV800BA 0x225B
79 #define MBM29LV800TA 0x22DA
80 #define MBM29LV400TC 0x22B9
81 #define MBM29LV400BC 0x22BA
84 #define HY29F002T 0x00B0
87 #define I28F004B3T 0x00d4
88 #define I28F004B3B 0x00d5
89 #define I28F400B3T 0x8894
90 #define I28F400B3B 0x8895
91 #define I28F008S5 0x00a6
92 #define I28F016S5 0x00a0
93 #define I28F008SA 0x00a2
94 #define I28F008B3T 0x00d2
95 #define I28F008B3B 0x00d3
96 #define I28F800B3T 0x8892
97 #define I28F800B3B 0x8893
98 #define I28F016S3 0x00aa
99 #define I28F016B3T 0x00d0
100 #define I28F016B3B 0x00d1
101 #define I28F160B3T 0x8890
102 #define I28F160B3B 0x8891
103 #define I28F320B3T 0x8896
104 #define I28F320B3B 0x8897
105 #define I28F640B3T 0x8898
106 #define I28F640B3B 0x8899
107 #define I82802AB 0x00ad
108 #define I82802AC 0x00ac
111 #define MX29LV040C 0x004F
112 #define MX29LV160T 0x22C4
113 #define MX29LV160B 0x2249
114 #define MX29F016 0x00AD
115 #define MX29F002T 0x00B0
116 #define MX29F004T 0x0045
117 #define MX29F004B 0x0046
120 #define UPD29F064115 0x221C
123 #define PM49FL002 0x006D
124 #define PM49FL004 0x006E
125 #define PM49FL008 0x006A
128 #define LH28F640BF 0x00b0
130 /* ST - www.st.com */
131 #define M29W800DT 0x00D7
132 #define M29W800DB 0x005B
133 #define M29W160DT 0x22C4
134 #define M29W160DB 0x2249
135 #define M29W040B 0x00E3
136 #define M50FW040 0x002C
137 #define M50FW080 0x002D
138 #define M50FW016 0x002E
139 #define M50LPW080 0x002F
142 #define SST29EE020 0x0010
143 #define SST29LE020 0x0012
144 #define SST29EE512 0x005d
145 #define SST29LE512 0x003d
146 #define SST39LF800 0x2781
147 #define SST39LF160 0x2782
148 #define SST39VF1601 0x234b
149 #define SST39LF512 0x00D4
150 #define SST39LF010 0x00D5
151 #define SST39LF020 0x00D6
152 #define SST39LF040 0x00D7
153 #define SST39SF010A 0x00B5
154 #define SST39SF020A 0x00B6
155 #define SST49LF004B 0x0060
156 #define SST49LF008A 0x005a
157 #define SST49LF030A 0x001C
158 #define SST49LF040A 0x0051
159 #define SST49LF080A 0x005B
162 #define TC58FVT160 0x00C2
163 #define TC58FVB160 0x0043
164 #define TC58FVT321 0x009A
165 #define TC58FVB321 0x009C
166 #define TC58FVT641 0x0093
167 #define TC58FVB641 0x0095
170 #define W49V002A 0x00b0
174 * Unlock address sets for AMD command sets.
175 * Intel command sets use the MTD_UADDR_UNNECESSARY.
176 * Each identifier, except MTD_UADDR_UNNECESSARY, and
177 * MTD_UADDR_NO_SUPPORT must be defined below in unlock_addrs[].
178 * MTD_UADDR_NOT_SUPPORTED must be 0 so that structure
179 * initialization need not require initializing all of the
180 * unlock addresses for all bit widths.
183 MTD_UADDR_NOT_SUPPORTED = 0, /* data width not supported */
184 MTD_UADDR_0x0555_0x02AA,
185 MTD_UADDR_0x0555_0x0AAA,
186 MTD_UADDR_0x5555_0x2AAA,
187 MTD_UADDR_0x0AAA_0x0555,
188 MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */
189 MTD_UADDR_UNNECESSARY, /* Does not require any address */
200 * I don't like the fact that the first entry in unlock_addrs[]
201 * exists, but is for MTD_UADDR_NOT_SUPPORTED - and, therefore,
202 * should not be used. The problem is that structures with
203 * initializers have extra fields initialized to 0. It is _very_
204 * desireable to have the unlock address entries for unsupported
205 * data widths automatically initialized - that means that
206 * MTD_UADDR_NOT_SUPPORTED must be 0 and the first entry here
209 static const struct unlock_addr unlock_addrs[] = {
210 [MTD_UADDR_NOT_SUPPORTED] = {
215 [MTD_UADDR_0x0555_0x02AA] = {
220 [MTD_UADDR_0x0555_0x0AAA] = {
225 [MTD_UADDR_0x5555_0x2AAA] = {
230 [MTD_UADDR_0x0AAA_0x0555] = {
235 [MTD_UADDR_DONT_CARE] = {
236 .addr1 = 0x0000, /* Doesn't matter which address */
237 .addr2 = 0x0000 /* is used - must be last entry */
240 [MTD_UADDR_UNNECESSARY] = {
247 struct amd_flash_info {
252 const int NumEraseRegions;
254 const __u8 uaddr[4]; /* unlock addrs for 8, 16, 32, 64 */
255 const ulong regions[6];
258 #define ERASEINFO(size,blocks) (size<<8)|(blocks-1)
260 #define SIZE_64KiB 16
261 #define SIZE_128KiB 17
262 #define SIZE_256KiB 18
263 #define SIZE_512KiB 19
271 * Please keep this list ordered by manufacturer!
272 * Fortunately, the list isn't searched often and so a
273 * slow, linear search isn't so bad.
275 static const struct amd_flash_info jedec_table[] = {
277 .mfr_id = MANUFACTURER_AMD,
279 .name = "AMD AM29F032B",
281 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
283 .DevSize = SIZE_4MiB,
284 .CmdSet = P_ID_AMD_STD,
287 ERASEINFO(0x10000,64)
290 .mfr_id = MANUFACTURER_AMD,
291 .dev_id = AM29LV160DT,
292 .name = "AMD AM29LV160DT",
294 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
295 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
297 .DevSize = SIZE_2MiB,
298 .CmdSet = P_ID_AMD_STD,
301 ERASEINFO(0x10000,31),
302 ERASEINFO(0x08000,1),
303 ERASEINFO(0x02000,2),
307 .mfr_id = MANUFACTURER_AMD,
308 .dev_id = AM29LV160DB,
309 .name = "AMD AM29LV160DB",
311 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
312 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
314 .DevSize = SIZE_2MiB,
315 .CmdSet = P_ID_AMD_STD,
318 ERASEINFO(0x04000,1),
319 ERASEINFO(0x02000,2),
320 ERASEINFO(0x08000,1),
321 ERASEINFO(0x10000,31)
324 .mfr_id = MANUFACTURER_AMD,
325 .dev_id = AM29LV400BB,
326 .name = "AMD AM29LV400BB",
328 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
329 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
331 .DevSize = SIZE_512KiB,
332 .CmdSet = P_ID_AMD_STD,
335 ERASEINFO(0x04000,1),
336 ERASEINFO(0x02000,2),
337 ERASEINFO(0x08000,1),
341 .mfr_id = MANUFACTURER_AMD,
342 .dev_id = AM29LV400BT,
343 .name = "AMD AM29LV400BT",
345 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
346 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
348 .DevSize = SIZE_512KiB,
349 .CmdSet = P_ID_AMD_STD,
352 ERASEINFO(0x10000,7),
353 ERASEINFO(0x08000,1),
354 ERASEINFO(0x02000,2),
358 .mfr_id = MANUFACTURER_AMD,
359 .dev_id = AM29LV800BB,
360 .name = "AMD AM29LV800BB",
362 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
363 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
365 .DevSize = SIZE_1MiB,
366 .CmdSet = P_ID_AMD_STD,
369 ERASEINFO(0x04000,1),
370 ERASEINFO(0x02000,2),
371 ERASEINFO(0x08000,1),
372 ERASEINFO(0x10000,15),
376 .mfr_id = MANUFACTURER_AMD,
377 .dev_id = AM29DL800BB,
378 .name = "AMD AM29DL800BB",
380 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
381 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
383 .DevSize = SIZE_1MiB,
384 .CmdSet = P_ID_AMD_STD,
387 ERASEINFO(0x04000,1),
388 ERASEINFO(0x08000,1),
389 ERASEINFO(0x02000,4),
390 ERASEINFO(0x08000,1),
391 ERASEINFO(0x04000,1),
392 ERASEINFO(0x10000,14)
395 .mfr_id = MANUFACTURER_AMD,
396 .dev_id = AM29DL800BT,
397 .name = "AMD AM29DL800BT",
399 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
400 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
402 .DevSize = SIZE_1MiB,
403 .CmdSet = P_ID_AMD_STD,
406 ERASEINFO(0x10000,14),
407 ERASEINFO(0x04000,1),
408 ERASEINFO(0x08000,1),
409 ERASEINFO(0x02000,4),
410 ERASEINFO(0x08000,1),
414 .mfr_id = MANUFACTURER_AMD,
415 .dev_id = AM29F800BB,
416 .name = "AMD AM29F800BB",
418 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
419 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
421 .DevSize = SIZE_1MiB,
422 .CmdSet = P_ID_AMD_STD,
425 ERASEINFO(0x04000,1),
426 ERASEINFO(0x02000,2),
427 ERASEINFO(0x08000,1),
428 ERASEINFO(0x10000,15),
431 .mfr_id = MANUFACTURER_AMD,
432 .dev_id = AM29LV800BT,
433 .name = "AMD AM29LV800BT",
435 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
436 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
438 .DevSize = SIZE_1MiB,
439 .CmdSet = P_ID_AMD_STD,
442 ERASEINFO(0x10000,15),
443 ERASEINFO(0x08000,1),
444 ERASEINFO(0x02000,2),
448 .mfr_id = MANUFACTURER_AMD,
449 .dev_id = AM29F800BT,
450 .name = "AMD AM29F800BT",
452 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
453 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
455 .DevSize = SIZE_1MiB,
456 .CmdSet = P_ID_AMD_STD,
459 ERASEINFO(0x10000,15),
460 ERASEINFO(0x08000,1),
461 ERASEINFO(0x02000,2),
465 .mfr_id = MANUFACTURER_AMD,
467 .name = "AMD AM29F017D",
469 [0] = MTD_UADDR_DONT_CARE /* x8 */
471 .DevSize = SIZE_2MiB,
472 .CmdSet = P_ID_AMD_STD,
475 ERASEINFO(0x10000,32),
478 .mfr_id = MANUFACTURER_AMD,
480 .name = "AMD AM29F016D",
482 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
484 .DevSize = SIZE_2MiB,
485 .CmdSet = P_ID_AMD_STD,
488 ERASEINFO(0x10000,32),
491 .mfr_id = MANUFACTURER_AMD,
493 .name = "AMD AM29F080",
495 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
497 .DevSize = SIZE_1MiB,
498 .CmdSet = P_ID_AMD_STD,
501 ERASEINFO(0x10000,16),
504 .mfr_id = MANUFACTURER_AMD,
506 .name = "AMD AM29F040",
508 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
510 .DevSize = SIZE_512KiB,
511 .CmdSet = P_ID_AMD_STD,
514 ERASEINFO(0x10000,8),
517 .mfr_id = MANUFACTURER_AMD,
518 .dev_id = AM29LV040B,
519 .name = "AMD AM29LV040B",
521 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
523 .DevSize = SIZE_512KiB,
524 .CmdSet = P_ID_AMD_STD,
527 ERASEINFO(0x10000,8),
530 .mfr_id = MANUFACTURER_AMD,
532 .name = "AMD AM29F002T",
534 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
536 .DevSize = SIZE_256KiB,
537 .CmdSet = P_ID_AMD_STD,
540 ERASEINFO(0x10000,3),
541 ERASEINFO(0x08000,1),
542 ERASEINFO(0x02000,2),
543 ERASEINFO(0x04000,1),
546 .mfr_id = MANUFACTURER_ATMEL,
548 .name = "Atmel AT49BV512",
550 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
552 .DevSize = SIZE_64KiB,
553 .CmdSet = P_ID_AMD_STD,
559 .mfr_id = MANUFACTURER_ATMEL,
561 .name = "Atmel AT29LV512",
563 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
565 .DevSize = SIZE_64KiB,
566 .CmdSet = P_ID_AMD_STD,
573 .mfr_id = MANUFACTURER_ATMEL,
575 .name = "Atmel AT49BV16X",
577 [0] = MTD_UADDR_0x0555_0x0AAA, /* x8 */
578 [1] = MTD_UADDR_0x0555_0x0AAA /* x16 */
580 .DevSize = SIZE_2MiB,
581 .CmdSet = P_ID_AMD_STD,
584 ERASEINFO(0x02000,8),
585 ERASEINFO(0x10000,31)
588 .mfr_id = MANUFACTURER_ATMEL,
589 .dev_id = AT49BV16XT,
590 .name = "Atmel AT49BV16XT",
592 [0] = MTD_UADDR_0x0555_0x0AAA, /* x8 */
593 [1] = MTD_UADDR_0x0555_0x0AAA /* x16 */
595 .DevSize = SIZE_2MiB,
596 .CmdSet = P_ID_AMD_STD,
599 ERASEINFO(0x10000,31),
603 .mfr_id = MANUFACTURER_ATMEL,
605 .name = "Atmel AT49BV32X",
607 [0] = MTD_UADDR_0x0555_0x0AAA, /* x8 */
608 [1] = MTD_UADDR_0x0555_0x0AAA /* x16 */
610 .DevSize = SIZE_4MiB,
611 .CmdSet = P_ID_AMD_STD,
614 ERASEINFO(0x02000,8),
615 ERASEINFO(0x10000,63)
618 .mfr_id = MANUFACTURER_ATMEL,
619 .dev_id = AT49BV32XT,
620 .name = "Atmel AT49BV32XT",
622 [0] = MTD_UADDR_0x0555_0x0AAA, /* x8 */
623 [1] = MTD_UADDR_0x0555_0x0AAA /* x16 */
625 .DevSize = SIZE_4MiB,
626 .CmdSet = P_ID_AMD_STD,
629 ERASEINFO(0x10000,63),
633 .mfr_id = MANUFACTURER_FUJITSU,
634 .dev_id = MBM29F040C,
635 .name = "Fujitsu MBM29F040C",
637 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
639 .DevSize = SIZE_512KiB,
640 .CmdSet = P_ID_AMD_STD,
646 .mfr_id = MANUFACTURER_FUJITSU,
647 .dev_id = MBM29LV650UE,
648 .name = "Fujitsu MBM29LV650UE",
650 [0] = MTD_UADDR_DONT_CARE /* x16 */
652 .DevSize = SIZE_8MiB,
653 .CmdSet = P_ID_AMD_STD,
656 ERASEINFO(0x10000,128)
659 .mfr_id = MANUFACTURER_FUJITSU,
660 .dev_id = MBM29LV320TE,
661 .name = "Fujitsu MBM29LV320TE",
663 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
664 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
666 .DevSize = SIZE_4MiB,
667 .CmdSet = P_ID_AMD_STD,
670 ERASEINFO(0x10000,63),
674 .mfr_id = MANUFACTURER_FUJITSU,
675 .dev_id = MBM29LV320BE,
676 .name = "Fujitsu MBM29LV320BE",
678 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
679 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
681 .DevSize = SIZE_4MiB,
682 .CmdSet = P_ID_AMD_STD,
685 ERASEINFO(0x02000,8),
686 ERASEINFO(0x10000,63)
689 .mfr_id = MANUFACTURER_FUJITSU,
690 .dev_id = MBM29LV160TE,
691 .name = "Fujitsu MBM29LV160TE",
693 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
694 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
696 .DevSize = SIZE_2MiB,
697 .CmdSet = P_ID_AMD_STD,
700 ERASEINFO(0x10000,31),
701 ERASEINFO(0x08000,1),
702 ERASEINFO(0x02000,2),
706 .mfr_id = MANUFACTURER_FUJITSU,
707 .dev_id = MBM29LV160BE,
708 .name = "Fujitsu MBM29LV160BE",
710 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
711 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
713 .DevSize = SIZE_2MiB,
714 .CmdSet = P_ID_AMD_STD,
717 ERASEINFO(0x04000,1),
718 ERASEINFO(0x02000,2),
719 ERASEINFO(0x08000,1),
720 ERASEINFO(0x10000,31)
723 .mfr_id = MANUFACTURER_FUJITSU,
724 .dev_id = MBM29LV800BA,
725 .name = "Fujitsu MBM29LV800BA",
727 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
728 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
730 .DevSize = SIZE_1MiB,
731 .CmdSet = P_ID_AMD_STD,
734 ERASEINFO(0x04000,1),
735 ERASEINFO(0x02000,2),
736 ERASEINFO(0x08000,1),
737 ERASEINFO(0x10000,15)
740 .mfr_id = MANUFACTURER_FUJITSU,
741 .dev_id = MBM29LV800TA,
742 .name = "Fujitsu MBM29LV800TA",
744 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
745 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
747 .DevSize = SIZE_1MiB,
748 .CmdSet = P_ID_AMD_STD,
751 ERASEINFO(0x10000,15),
752 ERASEINFO(0x08000,1),
753 ERASEINFO(0x02000,2),
757 .mfr_id = MANUFACTURER_FUJITSU,
758 .dev_id = MBM29LV400BC,
759 .name = "Fujitsu MBM29LV400BC",
761 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
762 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
764 .DevSize = SIZE_512KiB,
765 .CmdSet = P_ID_AMD_STD,
768 ERASEINFO(0x04000,1),
769 ERASEINFO(0x02000,2),
770 ERASEINFO(0x08000,1),
774 .mfr_id = MANUFACTURER_FUJITSU,
775 .dev_id = MBM29LV400TC,
776 .name = "Fujitsu MBM29LV400TC",
778 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
779 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
781 .DevSize = SIZE_512KiB,
782 .CmdSet = P_ID_AMD_STD,
785 ERASEINFO(0x10000,7),
786 ERASEINFO(0x08000,1),
787 ERASEINFO(0x02000,2),
791 .mfr_id = MANUFACTURER_HYUNDAI,
793 .name = "Hyundai HY29F002T",
795 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
797 .DevSize = SIZE_256KiB,
798 .CmdSet = P_ID_AMD_STD,
801 ERASEINFO(0x10000,3),
802 ERASEINFO(0x08000,1),
803 ERASEINFO(0x02000,2),
804 ERASEINFO(0x04000,1),
807 .mfr_id = MANUFACTURER_INTEL,
808 .dev_id = I28F004B3B,
809 .name = "Intel 28F004B3B",
811 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
813 .DevSize = SIZE_512KiB,
814 .CmdSet = P_ID_INTEL_STD,
817 ERASEINFO(0x02000, 8),
818 ERASEINFO(0x10000, 7),
821 .mfr_id = MANUFACTURER_INTEL,
822 .dev_id = I28F004B3T,
823 .name = "Intel 28F004B3T",
825 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
827 .DevSize = SIZE_512KiB,
828 .CmdSet = P_ID_INTEL_STD,
831 ERASEINFO(0x10000, 7),
832 ERASEINFO(0x02000, 8),
835 .mfr_id = MANUFACTURER_INTEL,
836 .dev_id = I28F400B3B,
837 .name = "Intel 28F400B3B",
839 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
840 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
842 .DevSize = SIZE_512KiB,
843 .CmdSet = P_ID_INTEL_STD,
846 ERASEINFO(0x02000, 8),
847 ERASEINFO(0x10000, 7),
850 .mfr_id = MANUFACTURER_INTEL,
851 .dev_id = I28F400B3T,
852 .name = "Intel 28F400B3T",
854 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
855 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
857 .DevSize = SIZE_512KiB,
858 .CmdSet = P_ID_INTEL_STD,
861 ERASEINFO(0x10000, 7),
862 ERASEINFO(0x02000, 8),
865 .mfr_id = MANUFACTURER_INTEL,
866 .dev_id = I28F008B3B,
867 .name = "Intel 28F008B3B",
869 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
871 .DevSize = SIZE_1MiB,
872 .CmdSet = P_ID_INTEL_STD,
875 ERASEINFO(0x02000, 8),
876 ERASEINFO(0x10000, 15),
879 .mfr_id = MANUFACTURER_INTEL,
880 .dev_id = I28F008B3T,
881 .name = "Intel 28F008B3T",
883 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
885 .DevSize = SIZE_1MiB,
886 .CmdSet = P_ID_INTEL_STD,
889 ERASEINFO(0x10000, 15),
890 ERASEINFO(0x02000, 8),
893 .mfr_id = MANUFACTURER_INTEL,
895 .name = "Intel 28F008S5",
897 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
899 .DevSize = SIZE_1MiB,
900 .CmdSet = P_ID_INTEL_EXT,
903 ERASEINFO(0x10000,16),
906 .mfr_id = MANUFACTURER_INTEL,
908 .name = "Intel 28F016S5",
910 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
912 .DevSize = SIZE_2MiB,
913 .CmdSet = P_ID_INTEL_EXT,
916 ERASEINFO(0x10000,32),
919 .mfr_id = MANUFACTURER_INTEL,
921 .name = "Intel 28F008SA",
923 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
925 .DevSize = SIZE_1MiB,
926 .CmdSet = P_ID_INTEL_STD,
929 ERASEINFO(0x10000, 16),
932 .mfr_id = MANUFACTURER_INTEL,
933 .dev_id = I28F800B3B,
934 .name = "Intel 28F800B3B",
936 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
938 .DevSize = SIZE_1MiB,
939 .CmdSet = P_ID_INTEL_STD,
942 ERASEINFO(0x02000, 8),
943 ERASEINFO(0x10000, 15),
946 .mfr_id = MANUFACTURER_INTEL,
947 .dev_id = I28F800B3T,
948 .name = "Intel 28F800B3T",
950 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
952 .DevSize = SIZE_1MiB,
953 .CmdSet = P_ID_INTEL_STD,
956 ERASEINFO(0x10000, 15),
957 ERASEINFO(0x02000, 8),
960 .mfr_id = MANUFACTURER_INTEL,
961 .dev_id = I28F016B3B,
962 .name = "Intel 28F016B3B",
964 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
966 .DevSize = SIZE_2MiB,
967 .CmdSet = P_ID_INTEL_STD,
970 ERASEINFO(0x02000, 8),
971 ERASEINFO(0x10000, 31),
974 .mfr_id = MANUFACTURER_INTEL,
976 .name = "Intel I28F016S3",
978 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
980 .DevSize = SIZE_2MiB,
981 .CmdSet = P_ID_INTEL_STD,
984 ERASEINFO(0x10000, 32),
987 .mfr_id = MANUFACTURER_INTEL,
988 .dev_id = I28F016B3T,
989 .name = "Intel 28F016B3T",
991 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
993 .DevSize = SIZE_2MiB,
994 .CmdSet = P_ID_INTEL_STD,
997 ERASEINFO(0x10000, 31),
998 ERASEINFO(0x02000, 8),
1001 .mfr_id = MANUFACTURER_INTEL,
1002 .dev_id = I28F160B3B,
1003 .name = "Intel 28F160B3B",
1005 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1007 .DevSize = SIZE_2MiB,
1008 .CmdSet = P_ID_INTEL_STD,
1009 .NumEraseRegions= 2,
1011 ERASEINFO(0x02000, 8),
1012 ERASEINFO(0x10000, 31),
1015 .mfr_id = MANUFACTURER_INTEL,
1016 .dev_id = I28F160B3T,
1017 .name = "Intel 28F160B3T",
1019 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1021 .DevSize = SIZE_2MiB,
1022 .CmdSet = P_ID_INTEL_STD,
1023 .NumEraseRegions= 2,
1025 ERASEINFO(0x10000, 31),
1026 ERASEINFO(0x02000, 8),
1029 .mfr_id = MANUFACTURER_INTEL,
1030 .dev_id = I28F320B3B,
1031 .name = "Intel 28F320B3B",
1033 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1035 .DevSize = SIZE_4MiB,
1036 .CmdSet = P_ID_INTEL_STD,
1037 .NumEraseRegions= 2,
1039 ERASEINFO(0x02000, 8),
1040 ERASEINFO(0x10000, 63),
1043 .mfr_id = MANUFACTURER_INTEL,
1044 .dev_id = I28F320B3T,
1045 .name = "Intel 28F320B3T",
1047 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1049 .DevSize = SIZE_4MiB,
1050 .CmdSet = P_ID_INTEL_STD,
1051 .NumEraseRegions= 2,
1053 ERASEINFO(0x10000, 63),
1054 ERASEINFO(0x02000, 8),
1057 .mfr_id = MANUFACTURER_INTEL,
1058 .dev_id = I28F640B3B,
1059 .name = "Intel 28F640B3B",
1061 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1063 .DevSize = SIZE_8MiB,
1064 .CmdSet = P_ID_INTEL_STD,
1065 .NumEraseRegions= 2,
1067 ERASEINFO(0x02000, 8),
1068 ERASEINFO(0x10000, 127),
1071 .mfr_id = MANUFACTURER_INTEL,
1072 .dev_id = I28F640B3T,
1073 .name = "Intel 28F640B3T",
1075 [1] = MTD_UADDR_UNNECESSARY, /* x16 */
1077 .DevSize = SIZE_8MiB,
1078 .CmdSet = P_ID_INTEL_STD,
1079 .NumEraseRegions= 2,
1081 ERASEINFO(0x10000, 127),
1082 ERASEINFO(0x02000, 8),
1085 .mfr_id = MANUFACTURER_INTEL,
1087 .name = "Intel 82802AB",
1089 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1091 .DevSize = SIZE_512KiB,
1092 .CmdSet = P_ID_INTEL_EXT,
1093 .NumEraseRegions= 1,
1095 ERASEINFO(0x10000,8),
1098 .mfr_id = MANUFACTURER_INTEL,
1100 .name = "Intel 82802AC",
1102 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1104 .DevSize = SIZE_1MiB,
1105 .CmdSet = P_ID_INTEL_EXT,
1106 .NumEraseRegions= 1,
1108 ERASEINFO(0x10000,16),
1111 .mfr_id = MANUFACTURER_MACRONIX,
1112 .dev_id = MX29LV040C,
1113 .name = "Macronix MX29LV040C",
1115 [0] = MTD_UADDR_0x0555_0x02AA, /* x8 */
1117 .DevSize = SIZE_512KiB,
1118 .CmdSet = P_ID_AMD_STD,
1119 .NumEraseRegions= 1,
1121 ERASEINFO(0x10000,8),
1124 .mfr_id = MANUFACTURER_MACRONIX,
1125 .dev_id = MX29LV160T,
1126 .name = "MXIC MX29LV160T",
1128 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1129 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1131 .DevSize = SIZE_2MiB,
1132 .CmdSet = P_ID_AMD_STD,
1133 .NumEraseRegions= 4,
1135 ERASEINFO(0x10000,31),
1136 ERASEINFO(0x08000,1),
1137 ERASEINFO(0x02000,2),
1138 ERASEINFO(0x04000,1)
1141 .mfr_id = MANUFACTURER_NEC,
1142 .dev_id = UPD29F064115,
1143 .name = "NEC uPD29F064115",
1145 [0] = MTD_UADDR_0x0555_0x02AA, /* x8 */
1146 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1148 .DevSize = SIZE_8MiB,
1149 .CmdSet = P_ID_AMD_STD,
1150 .NumEraseRegions= 3,
1152 ERASEINFO(0x2000,8),
1153 ERASEINFO(0x10000,126),
1154 ERASEINFO(0x2000,8),
1157 .mfr_id = MANUFACTURER_MACRONIX,
1158 .dev_id = MX29LV160B,
1159 .name = "MXIC MX29LV160B",
1161 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1162 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1164 .DevSize = SIZE_2MiB,
1165 .CmdSet = P_ID_AMD_STD,
1166 .NumEraseRegions= 4,
1168 ERASEINFO(0x04000,1),
1169 ERASEINFO(0x02000,2),
1170 ERASEINFO(0x08000,1),
1171 ERASEINFO(0x10000,31)
1174 .mfr_id = MANUFACTURER_MACRONIX,
1176 .name = "Macronix MX29F016",
1178 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
1180 .DevSize = SIZE_2MiB,
1181 .CmdSet = P_ID_AMD_STD,
1182 .NumEraseRegions= 1,
1184 ERASEINFO(0x10000,32),
1187 .mfr_id = MANUFACTURER_MACRONIX,
1188 .dev_id = MX29F004T,
1189 .name = "Macronix MX29F004T",
1191 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
1193 .DevSize = SIZE_512KiB,
1194 .CmdSet = P_ID_AMD_STD,
1195 .NumEraseRegions= 4,
1197 ERASEINFO(0x10000,7),
1198 ERASEINFO(0x08000,1),
1199 ERASEINFO(0x02000,2),
1200 ERASEINFO(0x04000,1),
1203 .mfr_id = MANUFACTURER_MACRONIX,
1204 .dev_id = MX29F004B,
1205 .name = "Macronix MX29F004B",
1207 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
1209 .DevSize = SIZE_512KiB,
1210 .CmdSet = P_ID_AMD_STD,
1211 .NumEraseRegions= 4,
1213 ERASEINFO(0x04000,1),
1214 ERASEINFO(0x02000,2),
1215 ERASEINFO(0x08000,1),
1216 ERASEINFO(0x10000,7),
1219 .mfr_id = MANUFACTURER_MACRONIX,
1220 .dev_id = MX29F002T,
1221 .name = "Macronix MX29F002T",
1223 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
1225 .DevSize = SIZE_256KiB,
1226 .CmdSet = P_ID_AMD_STD,
1227 .NumEraseRegions= 4,
1229 ERASEINFO(0x10000,3),
1230 ERASEINFO(0x08000,1),
1231 ERASEINFO(0x02000,2),
1232 ERASEINFO(0x04000,1),
1235 .mfr_id = MANUFACTURER_PMC,
1236 .dev_id = PM49FL002,
1237 .name = "PMC Pm49FL002",
1239 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1241 .DevSize = SIZE_256KiB,
1242 .CmdSet = P_ID_AMD_STD,
1243 .NumEraseRegions= 1,
1245 ERASEINFO( 0x01000, 64 )
1248 .mfr_id = MANUFACTURER_PMC,
1249 .dev_id = PM49FL004,
1250 .name = "PMC Pm49FL004",
1252 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1254 .DevSize = SIZE_512KiB,
1255 .CmdSet = P_ID_AMD_STD,
1256 .NumEraseRegions= 1,
1258 ERASEINFO( 0x01000, 128 )
1261 .mfr_id = MANUFACTURER_PMC,
1262 .dev_id = PM49FL008,
1263 .name = "PMC Pm49FL008",
1265 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1267 .DevSize = SIZE_1MiB,
1268 .CmdSet = P_ID_AMD_STD,
1269 .NumEraseRegions= 1,
1271 ERASEINFO( 0x01000, 256 )
1274 .mfr_id = MANUFACTURER_SHARP,
1275 .dev_id = LH28F640BF,
1276 .name = "LH28F640BF",
1278 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1280 .DevSize = SIZE_4MiB,
1281 .CmdSet = P_ID_INTEL_STD,
1282 .NumEraseRegions= 1,
1284 ERASEINFO(0x40000,16),
1287 .mfr_id = MANUFACTURER_SST,
1288 .dev_id = SST39LF512,
1289 .name = "SST 39LF512",
1291 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1293 .DevSize = SIZE_64KiB,
1294 .CmdSet = P_ID_AMD_STD,
1295 .NumEraseRegions= 1,
1297 ERASEINFO(0x01000,16),
1300 .mfr_id = MANUFACTURER_SST,
1301 .dev_id = SST39LF010,
1302 .name = "SST 39LF010",
1304 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1306 .DevSize = SIZE_128KiB,
1307 .CmdSet = P_ID_AMD_STD,
1308 .NumEraseRegions= 1,
1310 ERASEINFO(0x01000,32),
1313 .mfr_id = MANUFACTURER_SST,
1314 .dev_id = SST29EE020,
1315 .name = "SST 29EE020",
1317 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1319 .DevSize = SIZE_256KiB,
1320 .CmdSet = P_ID_SST_PAGE,
1321 .NumEraseRegions= 1,
1322 .regions = {ERASEINFO(0x01000,64),
1325 .mfr_id = MANUFACTURER_SST,
1326 .dev_id = SST29LE020,
1327 .name = "SST 29LE020",
1329 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1331 .DevSize = SIZE_256KiB,
1332 .CmdSet = P_ID_SST_PAGE,
1333 .NumEraseRegions= 1,
1334 .regions = {ERASEINFO(0x01000,64),
1337 .mfr_id = MANUFACTURER_SST,
1338 .dev_id = SST39LF020,
1339 .name = "SST 39LF020",
1341 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1343 .DevSize = SIZE_256KiB,
1344 .CmdSet = P_ID_AMD_STD,
1345 .NumEraseRegions= 1,
1347 ERASEINFO(0x01000,64),
1350 .mfr_id = MANUFACTURER_SST,
1351 .dev_id = SST39LF040,
1352 .name = "SST 39LF040",
1354 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1356 .DevSize = SIZE_512KiB,
1357 .CmdSet = P_ID_AMD_STD,
1358 .NumEraseRegions= 1,
1360 ERASEINFO(0x01000,128),
1363 .mfr_id = MANUFACTURER_SST,
1364 .dev_id = SST39SF010A,
1365 .name = "SST 39SF010A",
1367 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1369 .DevSize = SIZE_128KiB,
1370 .CmdSet = P_ID_AMD_STD,
1371 .NumEraseRegions= 1,
1373 ERASEINFO(0x01000,32),
1376 .mfr_id = MANUFACTURER_SST,
1377 .dev_id = SST39SF020A,
1378 .name = "SST 39SF020A",
1380 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1382 .DevSize = SIZE_256KiB,
1383 .CmdSet = P_ID_AMD_STD,
1384 .NumEraseRegions= 1,
1386 ERASEINFO(0x01000,64),
1389 .mfr_id = MANUFACTURER_SST,
1390 .dev_id = SST49LF004B,
1391 .name = "SST 49LF004B",
1393 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1395 .DevSize = SIZE_512KiB,
1396 .CmdSet = P_ID_AMD_STD,
1397 .NumEraseRegions= 1,
1399 ERASEINFO(0x01000,128),
1402 .mfr_id = MANUFACTURER_SST,
1403 .dev_id = SST49LF008A,
1404 .name = "SST 49LF008A",
1406 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1408 .DevSize = SIZE_1MiB,
1409 .CmdSet = P_ID_AMD_STD,
1410 .NumEraseRegions= 1,
1412 ERASEINFO(0x01000,256),
1415 .mfr_id = MANUFACTURER_SST,
1416 .dev_id = SST49LF030A,
1417 .name = "SST 49LF030A",
1419 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1421 .DevSize = SIZE_512KiB,
1422 .CmdSet = P_ID_AMD_STD,
1423 .NumEraseRegions= 1,
1425 ERASEINFO(0x01000,96),
1428 .mfr_id = MANUFACTURER_SST,
1429 .dev_id = SST49LF040A,
1430 .name = "SST 49LF040A",
1432 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1434 .DevSize = SIZE_512KiB,
1435 .CmdSet = P_ID_AMD_STD,
1436 .NumEraseRegions= 1,
1438 ERASEINFO(0x01000,128),
1441 .mfr_id = MANUFACTURER_SST,
1442 .dev_id = SST49LF080A,
1443 .name = "SST 49LF080A",
1445 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1447 .DevSize = SIZE_1MiB,
1448 .CmdSet = P_ID_AMD_STD,
1449 .NumEraseRegions= 1,
1451 ERASEINFO(0x01000,256),
1454 .mfr_id = MANUFACTURER_SST, /* should be CFI */
1455 .dev_id = SST39LF160,
1456 .name = "SST 39LF160",
1458 [0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */
1459 [1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
1461 .DevSize = SIZE_2MiB,
1462 .CmdSet = P_ID_AMD_STD,
1463 .NumEraseRegions= 2,
1465 ERASEINFO(0x1000,256),
1466 ERASEINFO(0x1000,256)
1469 .mfr_id = MANUFACTURER_SST, /* should be CFI */
1470 .dev_id = SST39VF1601,
1471 .name = "SST 39VF1601",
1473 [0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */
1474 [1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
1476 .DevSize = SIZE_2MiB,
1477 .CmdSet = P_ID_AMD_STD,
1478 .NumEraseRegions= 2,
1480 ERASEINFO(0x1000,256),
1481 ERASEINFO(0x1000,256)
1485 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1486 .dev_id = M29W800DT,
1487 .name = "ST M29W800DT",
1489 [0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */
1490 [1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
1492 .DevSize = SIZE_1MiB,
1493 .CmdSet = P_ID_AMD_STD,
1494 .NumEraseRegions= 4,
1496 ERASEINFO(0x10000,15),
1497 ERASEINFO(0x08000,1),
1498 ERASEINFO(0x02000,2),
1499 ERASEINFO(0x04000,1)
1502 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1503 .dev_id = M29W800DB,
1504 .name = "ST M29W800DB",
1506 [0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */
1507 [1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
1509 .DevSize = SIZE_1MiB,
1510 .CmdSet = P_ID_AMD_STD,
1511 .NumEraseRegions= 4,
1513 ERASEINFO(0x04000,1),
1514 ERASEINFO(0x02000,2),
1515 ERASEINFO(0x08000,1),
1516 ERASEINFO(0x10000,15)
1519 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1520 .dev_id = M29W160DT,
1521 .name = "ST M29W160DT",
1523 [0] = MTD_UADDR_0x0555_0x02AA, /* x8 */
1524 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1526 .DevSize = SIZE_2MiB,
1527 .CmdSet = P_ID_AMD_STD,
1528 .NumEraseRegions= 4,
1530 ERASEINFO(0x10000,31),
1531 ERASEINFO(0x08000,1),
1532 ERASEINFO(0x02000,2),
1533 ERASEINFO(0x04000,1)
1536 .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
1537 .dev_id = M29W160DB,
1538 .name = "ST M29W160DB",
1540 [0] = MTD_UADDR_0x0555_0x02AA, /* x8 */
1541 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1543 .DevSize = SIZE_2MiB,
1544 .CmdSet = P_ID_AMD_STD,
1545 .NumEraseRegions= 4,
1547 ERASEINFO(0x04000,1),
1548 ERASEINFO(0x02000,2),
1549 ERASEINFO(0x08000,1),
1550 ERASEINFO(0x10000,31)
1553 .mfr_id = MANUFACTURER_ST,
1555 .name = "ST M29W040B",
1557 [0] = MTD_UADDR_0x0555_0x02AA /* x8 */
1559 .DevSize = SIZE_512KiB,
1560 .CmdSet = P_ID_AMD_STD,
1561 .NumEraseRegions= 1,
1563 ERASEINFO(0x10000,8),
1566 .mfr_id = MANUFACTURER_ST,
1568 .name = "ST M50FW040",
1570 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1572 .DevSize = SIZE_512KiB,
1573 .CmdSet = P_ID_INTEL_EXT,
1574 .NumEraseRegions= 1,
1576 ERASEINFO(0x10000,8),
1579 .mfr_id = MANUFACTURER_ST,
1581 .name = "ST M50FW080",
1583 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1585 .DevSize = SIZE_1MiB,
1586 .CmdSet = P_ID_INTEL_EXT,
1587 .NumEraseRegions= 1,
1589 ERASEINFO(0x10000,16),
1592 .mfr_id = MANUFACTURER_ST,
1594 .name = "ST M50FW016",
1596 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1598 .DevSize = SIZE_2MiB,
1599 .CmdSet = P_ID_INTEL_EXT,
1600 .NumEraseRegions= 1,
1602 ERASEINFO(0x10000,32),
1605 .mfr_id = MANUFACTURER_ST,
1606 .dev_id = M50LPW080,
1607 .name = "ST M50LPW080",
1609 [0] = MTD_UADDR_UNNECESSARY, /* x8 */
1611 .DevSize = SIZE_1MiB,
1612 .CmdSet = P_ID_INTEL_EXT,
1613 .NumEraseRegions= 1,
1615 ERASEINFO(0x10000,16),
1618 .mfr_id = MANUFACTURER_TOSHIBA,
1619 .dev_id = TC58FVT160,
1620 .name = "Toshiba TC58FVT160",
1622 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1623 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
1625 .DevSize = SIZE_2MiB,
1626 .CmdSet = P_ID_AMD_STD,
1627 .NumEraseRegions= 4,
1629 ERASEINFO(0x10000,31),
1630 ERASEINFO(0x08000,1),
1631 ERASEINFO(0x02000,2),
1632 ERASEINFO(0x04000,1)
1635 .mfr_id = MANUFACTURER_TOSHIBA,
1636 .dev_id = TC58FVB160,
1637 .name = "Toshiba TC58FVB160",
1639 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1640 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
1642 .DevSize = SIZE_2MiB,
1643 .CmdSet = P_ID_AMD_STD,
1644 .NumEraseRegions= 4,
1646 ERASEINFO(0x04000,1),
1647 ERASEINFO(0x02000,2),
1648 ERASEINFO(0x08000,1),
1649 ERASEINFO(0x10000,31)
1652 .mfr_id = MANUFACTURER_TOSHIBA,
1653 .dev_id = TC58FVB321,
1654 .name = "Toshiba TC58FVB321",
1656 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1657 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
1659 .DevSize = SIZE_4MiB,
1660 .CmdSet = P_ID_AMD_STD,
1661 .NumEraseRegions= 2,
1663 ERASEINFO(0x02000,8),
1664 ERASEINFO(0x10000,63)
1667 .mfr_id = MANUFACTURER_TOSHIBA,
1668 .dev_id = TC58FVT321,
1669 .name = "Toshiba TC58FVT321",
1671 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1672 [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
1674 .DevSize = SIZE_4MiB,
1675 .CmdSet = P_ID_AMD_STD,
1676 .NumEraseRegions= 2,
1678 ERASEINFO(0x10000,63),
1679 ERASEINFO(0x02000,8)
1682 .mfr_id = MANUFACTURER_TOSHIBA,
1683 .dev_id = TC58FVB641,
1684 .name = "Toshiba TC58FVB641",
1686 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1687 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1689 .DevSize = SIZE_8MiB,
1690 .CmdSet = P_ID_AMD_STD,
1691 .NumEraseRegions= 2,
1693 ERASEINFO(0x02000,8),
1694 ERASEINFO(0x10000,127)
1697 .mfr_id = MANUFACTURER_TOSHIBA,
1698 .dev_id = TC58FVT641,
1699 .name = "Toshiba TC58FVT641",
1701 [0] = MTD_UADDR_0x0AAA_0x0555, /* x8 */
1702 [1] = MTD_UADDR_0x0555_0x02AA, /* x16 */
1704 .DevSize = SIZE_8MiB,
1705 .CmdSet = P_ID_AMD_STD,
1706 .NumEraseRegions= 2,
1708 ERASEINFO(0x10000,127),
1709 ERASEINFO(0x02000,8)
1712 .mfr_id = MANUFACTURER_WINBOND,
1714 .name = "Winbond W49V002A",
1716 [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
1718 .DevSize = SIZE_256KiB,
1719 .CmdSet = P_ID_AMD_STD,
1720 .NumEraseRegions= 4,
1722 ERASEINFO(0x10000, 3),
1723 ERASEINFO(0x08000, 1),
1724 ERASEINFO(0x02000, 2),
1725 ERASEINFO(0x04000, 1),
1731 static int cfi_jedec_setup(struct cfi_private *p_cfi, int index);
1733 static int jedec_probe_chip(struct map_info *map, __u32 base,
1734 unsigned long *chip_map, struct cfi_private *cfi);
1736 static struct mtd_info *jedec_probe(struct map_info *map);
1738 static inline u32 jedec_read_mfr(struct map_info *map, __u32 base,
1739 struct cfi_private *cfi)
1743 u32 ofs = cfi_build_cmd_addr(0, cfi_interleave(cfi), cfi->device_type);
1744 mask = (1 << (cfi->device_type * 8)) -1;
1745 result = map_read(map, base + ofs);
1746 return result.x[0] & mask;
1749 static inline u32 jedec_read_id(struct map_info *map, __u32 base,
1750 struct cfi_private *cfi)
1754 u32 ofs = cfi_build_cmd_addr(1, cfi_interleave(cfi), cfi->device_type);
1755 mask = (1 << (cfi->device_type * 8)) -1;
1756 result = map_read(map, base + ofs);
1757 return result.x[0] & mask;
1760 static inline void jedec_reset(u32 base, struct map_info *map,
1761 struct cfi_private *cfi)
1765 /* after checking the datasheets for SST, MACRONIX and ATMEL
1766 * (oh and incidentaly the jedec spec - 3.5.3.3) the reset
1767 * sequence is *supposed* to be 0xaa at 0x5555, 0x55 at
1768 * 0x2aaa, 0xF0 at 0x5555 this will not affect the AMD chips
1769 * as they will ignore the writes and dont care what address
1770 * the F0 is written to */
1771 if(cfi->addr_unlock1) {
1772 DEBUG( MTD_DEBUG_LEVEL3,
1773 "reset unlock called %x %x \n",
1774 cfi->addr_unlock1,cfi->addr_unlock2);
1775 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1776 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
1779 cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1780 /* Some misdesigned intel chips do not respond for 0xF0 for a reset,
1781 * so ensure we're in read mode. Send both the Intel and the AMD command
1782 * for this. Intel uses 0xff for this, AMD uses 0xff for NOP, so
1783 * this should be safe.
1785 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
1786 /* FIXME - should have reset delay before continuing */
1790 static inline __u8 finfo_uaddr(const struct amd_flash_info *finfo, int device_type)
1793 __u8 uaddr = MTD_UADDR_NOT_SUPPORTED;
1795 switch ( device_type ) {
1796 case CFI_DEVICETYPE_X8: uaddr_idx = 0; break;
1797 case CFI_DEVICETYPE_X16: uaddr_idx = 1; break;
1798 case CFI_DEVICETYPE_X32: uaddr_idx = 2; break;
1800 printk(KERN_NOTICE "MTD: %s(): unknown device_type %d\n",
1801 __func__, device_type);
1805 uaddr = finfo->uaddr[uaddr_idx];
1807 if (uaddr != MTD_UADDR_NOT_SUPPORTED ) {
1808 /* ASSERT("The unlock addresses for non-8-bit mode
1809 are bollocks. We don't really need an array."); */
1810 uaddr = finfo->uaddr[0];
1818 static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
1820 int i,num_erase_regions;
1823 printk("Found: %s\n",jedec_table[index].name);
1825 num_erase_regions = jedec_table[index].NumEraseRegions;
1827 p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
1829 //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
1833 memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
1835 p_cfi->cfiq->P_ID = jedec_table[index].CmdSet;
1836 p_cfi->cfiq->NumEraseRegions = jedec_table[index].NumEraseRegions;
1837 p_cfi->cfiq->DevSize = jedec_table[index].DevSize;
1838 p_cfi->cfi_mode = CFI_MODE_JEDEC;
1840 for (i=0; i<num_erase_regions; i++){
1841 p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
1843 p_cfi->cmdset_priv = NULL;
1845 /* This may be redundant for some cases, but it doesn't hurt */
1846 p_cfi->mfr = jedec_table[index].mfr_id;
1847 p_cfi->id = jedec_table[index].dev_id;
1849 uaddr = finfo_uaddr(&jedec_table[index], p_cfi->device_type);
1850 if ( uaddr == MTD_UADDR_NOT_SUPPORTED ) {
1851 kfree( p_cfi->cfiq );
1855 p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1;
1856 p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2;
1863 * There is a BIG problem properly ID'ing the JEDEC devic and guaranteeing
1864 * the mapped address, unlock addresses, and proper chip ID. This function
1865 * attempts to minimize errors. It is doubtfull that this probe will ever
1866 * be perfect - consequently there should be some module parameters that
1867 * could be manually specified to force the chip info.
1869 static inline int jedec_match( __u32 base,
1870 struct map_info *map,
1871 struct cfi_private *cfi,
1872 const struct amd_flash_info *finfo )
1874 int rc = 0; /* failure until all tests pass */
1879 * The IDs must match. For X16 and X32 devices operating in
1880 * a lower width ( X8 or X16 ), the device ID's are usually just
1881 * the lower byte(s) of the larger device ID for wider mode. If
1882 * a part is found that doesn't fit this assumption (device id for
1883 * smaller width mode is completely unrealated to full-width mode)
1884 * then the jedec_table[] will have to be augmented with the IDs
1885 * for different widths.
1887 switch (cfi->device_type) {
1888 case CFI_DEVICETYPE_X8:
1889 mfr = (__u8)finfo->mfr_id;
1890 id = (__u8)finfo->dev_id;
1892 /* bjd: it seems that if we do this, we can end up
1893 * detecting 16bit flashes as an 8bit device, even though
1896 if (finfo->dev_id > 0xff) {
1897 DEBUG( MTD_DEBUG_LEVEL3, "%s(): ID is not 8bit\n",
1902 case CFI_DEVICETYPE_X16:
1903 mfr = (__u16)finfo->mfr_id;
1904 id = (__u16)finfo->dev_id;
1906 case CFI_DEVICETYPE_X32:
1907 mfr = (__u16)finfo->mfr_id;
1908 id = (__u32)finfo->dev_id;
1912 "MTD %s(): Unsupported device type %d\n",
1913 __func__, cfi->device_type);
1916 if ( cfi->mfr != mfr || cfi->id != id ) {
1920 /* the part size must fit in the memory window */
1921 DEBUG( MTD_DEBUG_LEVEL3,
1922 "MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n",
1923 __func__, base, 1 << finfo->DevSize, base + (1 << finfo->DevSize) );
1924 if ( base + cfi_interleave(cfi) * ( 1 << finfo->DevSize ) > map->size ) {
1925 DEBUG( MTD_DEBUG_LEVEL3,
1926 "MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n",
1927 __func__, finfo->mfr_id, finfo->dev_id,
1928 1 << finfo->DevSize );
1932 uaddr = finfo_uaddr(finfo, cfi->device_type);
1933 if ( uaddr == MTD_UADDR_NOT_SUPPORTED ) {
1937 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): check unlock addrs 0x%.4x 0x%.4x\n",
1938 __func__, cfi->addr_unlock1, cfi->addr_unlock2 );
1939 if ( MTD_UADDR_UNNECESSARY != uaddr && MTD_UADDR_DONT_CARE != uaddr
1940 && ( unlock_addrs[uaddr].addr1 != cfi->addr_unlock1 ||
1941 unlock_addrs[uaddr].addr2 != cfi->addr_unlock2 ) ) {
1942 DEBUG( MTD_DEBUG_LEVEL3,
1943 "MTD %s(): 0x%.4x 0x%.4x did not match\n",
1945 unlock_addrs[uaddr].addr1,
1946 unlock_addrs[uaddr].addr2);
1951 * Make sure the ID's dissappear when the device is taken out of
1952 * ID mode. The only time this should fail when it should succeed
1953 * is when the ID's are written as data to the same
1954 * addresses. For this rare and unfortunate case the chip
1955 * cannot be probed correctly.
1956 * FIXME - write a driver that takes all of the chip info as
1957 * module parameters, doesn't probe but forces a load.
1959 DEBUG( MTD_DEBUG_LEVEL3,
1960 "MTD %s(): check ID's disappear when not in ID mode\n",
1962 jedec_reset( base, map, cfi );
1963 mfr = jedec_read_mfr( map, base, cfi );
1964 id = jedec_read_id( map, base, cfi );
1965 if ( mfr == cfi->mfr && id == cfi->id ) {
1966 DEBUG( MTD_DEBUG_LEVEL3,
1967 "MTD %s(): ID 0x%.2x:0x%.2x did not change after reset:\n"
1968 "You might need to manually specify JEDEC parameters.\n",
1969 __func__, cfi->mfr, cfi->id );
1973 /* all tests passed - mark as success */
1977 * Put the device back in ID mode - only need to do this if we
1978 * were truly frobbing a real device.
1980 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): return to ID mode\n", __func__ );
1981 if(cfi->addr_unlock1) {
1982 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1983 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
1985 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1986 /* FIXME - should have a delay before continuing */
1993 static int jedec_probe_chip(struct map_info *map, __u32 base,
1994 unsigned long *chip_map, struct cfi_private *cfi)
1997 enum uaddr uaddr_idx = MTD_UADDR_NOT_SUPPORTED;
1998 u32 probe_offset1, probe_offset2;
2001 if (!cfi->numchips) {
2004 if (MTD_UADDR_UNNECESSARY == uaddr_idx)
2007 cfi->addr_unlock1 = unlock_addrs[uaddr_idx].addr1;
2008 cfi->addr_unlock2 = unlock_addrs[uaddr_idx].addr2;
2011 /* Make certain we aren't probing past the end of map */
2012 if (base >= map->size) {
2014 "Probe at base(0x%08x) past the end of the map(0x%08lx)\n",
2015 base, map->size -1);
2019 /* Ensure the unlock addresses we try stay inside the map */
2020 probe_offset1 = cfi_build_cmd_addr(
2022 cfi_interleave(cfi),
2024 probe_offset2 = cfi_build_cmd_addr(
2026 cfi_interleave(cfi),
2028 if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
2029 ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
2035 jedec_reset(base, map, cfi);
2037 /* Autoselect Mode */
2038 if(cfi->addr_unlock1) {
2039 cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2040 cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
2042 cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
2043 /* FIXME - should have a delay before continuing */
2045 if (!cfi->numchips) {
2046 /* This is the first time we're called. Set up the CFI
2047 stuff accordingly and return */
2049 cfi->mfr = jedec_read_mfr(map, base, cfi);
2050 cfi->id = jedec_read_id(map, base, cfi);
2051 DEBUG(MTD_DEBUG_LEVEL3,
2052 "Search for id:(%02x %02x) interleave(%d) type(%d)\n",
2053 cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type);
2054 for (i = 0; i < ARRAY_SIZE(jedec_table); i++) {
2055 if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) {
2056 DEBUG( MTD_DEBUG_LEVEL3,
2057 "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
2058 __func__, cfi->mfr, cfi->id,
2059 cfi->addr_unlock1, cfi->addr_unlock2 );
2060 if (!cfi_jedec_setup(cfi, i))
2070 /* Make sure it is a chip of the same manufacturer and id */
2071 mfr = jedec_read_mfr(map, base, cfi);
2072 id = jedec_read_id(map, base, cfi);
2074 if ((mfr != cfi->mfr) || (id != cfi->id)) {
2075 printk(KERN_DEBUG "%s: Found different chip or no chip at all (mfr 0x%x, id 0x%x) at 0x%x\n",
2076 map->name, mfr, id, base);
2077 jedec_reset(base, map, cfi);
2082 /* Check each previous chip locations to see if it's an alias */
2083 for (i=0; i < (base >> cfi->chipshift); i++) {
2084 unsigned long start;
2085 if(!test_bit(i, chip_map)) {
2086 continue; /* Skip location; no valid chip at this address */
2088 start = i << cfi->chipshift;
2089 if (jedec_read_mfr(map, start, cfi) == cfi->mfr &&
2090 jedec_read_id(map, start, cfi) == cfi->id) {
2091 /* Eep. This chip also looks like it's in autoselect mode.
2092 Is it an alias for the new one? */
2093 jedec_reset(start, map, cfi);
2095 /* If the device IDs go away, it's an alias */
2096 if (jedec_read_mfr(map, base, cfi) != cfi->mfr ||
2097 jedec_read_id(map, base, cfi) != cfi->id) {
2098 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2099 map->name, base, start);
2103 /* Yes, it's actually got the device IDs as data. Most
2104 * unfortunate. Stick the new chip in read mode
2105 * too and if it's the same, assume it's an alias. */
2106 /* FIXME: Use other modes to do a proper check */
2107 jedec_reset(base, map, cfi);
2108 if (jedec_read_mfr(map, base, cfi) == cfi->mfr &&
2109 jedec_read_id(map, base, cfi) == cfi->id) {
2110 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
2111 map->name, base, start);
2117 /* OK, if we got to here, then none of the previous chips appear to
2118 be aliases for the current one. */
2119 set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
2123 /* Put it back into Read Mode */
2124 jedec_reset(base, map, cfi);
2126 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
2127 map->name, cfi_interleave(cfi), cfi->device_type*8, base,
2133 static struct chip_probe jedec_chip_probe = {
2135 .probe_chip = jedec_probe_chip
2138 static struct mtd_info *jedec_probe(struct map_info *map)
2141 * Just use the generic probe stuff to call our CFI-specific
2142 * chip_probe routine in all the possible permutations, etc.
2144 return mtd_do_chip_probe(map, &jedec_chip_probe);
2147 static struct mtd_chip_driver jedec_chipdrv = {
2148 .probe = jedec_probe,
2149 .name = "jedec_probe",
2150 .module = THIS_MODULE
2153 static int __init jedec_probe_init(void)
2155 register_mtd_chip_driver(&jedec_chipdrv);
2159 static void __exit jedec_probe_exit(void)
2161 unregister_mtd_chip_driver(&jedec_chipdrv);
2164 module_init(jedec_probe_init);
2165 module_exit(jedec_probe_exit);
2167 MODULE_LICENSE("GPL");
2168 MODULE_AUTHOR("Erwin Authried <eauth@softsys.co.at> et al.");
2169 MODULE_DESCRIPTION("Probe code for JEDEC-compliant flash chips");