jedec_probe.c 56.7 KB
Newer Older
1
/*
L
Linus Torvalds 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
   Common Flash Interface probe code.
   (C) 2000 Red Hat. GPL'd.
   See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5)
   for the standard this probe goes back to.

   Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/interrupt.h>

#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/gen_probe.h>

/* AMD */
26
#define AM29DL800BB	0x22CB
L
Linus Torvalds 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#define AM29DL800BT	0x224A

#define AM29F800BB	0x2258
#define AM29F800BT	0x22D6
#define AM29LV400BB	0x22BA
#define AM29LV400BT	0x22B9
#define AM29LV800BB	0x225B
#define AM29LV800BT	0x22DA
#define AM29LV160DT	0x22C4
#define AM29LV160DB	0x2249
#define AM29F017D	0x003D
#define AM29F016D	0x00AD
#define AM29F080	0x00D5
#define AM29F040	0x00A4
#define AM29LV040B	0x004F
#define AM29F032B	0x0041
#define AM29F002T	0x00B0
44 45
#define AM29SL800DB	0x226B
#define AM29SL800DT	0x22EA
L
Linus Torvalds 已提交
46 47 48 49 50 51 52 53 54

/* Atmel */
#define AT49BV512	0x0003
#define AT29LV512	0x003d
#define AT49BV16X	0x00C0
#define AT49BV16XT	0x00C2
#define AT49BV32X	0x00C8
#define AT49BV32XT	0x00C9

55 56 57 58
/* Eon */
#define EN29SL800BB	0x226B
#define EN29SL800BT	0x22EA

L
Linus Torvalds 已提交
59 60
/* Fujitsu */
#define MBM29F040C	0x00A4
61
#define MBM29F800BA	0x2258
L
Linus Torvalds 已提交
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
#define MBM29LV650UE	0x22D7
#define MBM29LV320TE	0x22F6
#define MBM29LV320BE	0x22F9
#define MBM29LV160TE	0x22C4
#define MBM29LV160BE	0x2249
#define MBM29LV800BA	0x225B
#define MBM29LV800TA	0x22DA
#define MBM29LV400TC	0x22B9
#define MBM29LV400BC	0x22BA

/* Hyundai */
#define HY29F002T	0x00B0

/* Intel */
#define I28F004B3T	0x00d4
#define I28F004B3B	0x00d5
#define I28F400B3T	0x8894
#define I28F400B3B	0x8895
#define I28F008S5	0x00a6
#define I28F016S5	0x00a0
#define I28F008SA	0x00a2
#define I28F008B3T	0x00d2
#define I28F008B3B	0x00d3
#define I28F800B3T	0x8892
#define I28F800B3B	0x8893
#define I28F016S3	0x00aa
#define I28F016B3T	0x00d0
#define I28F016B3B	0x00d1
#define I28F160B3T	0x8890
#define I28F160B3B	0x8891
#define I28F320B3T	0x8896
#define I28F320B3B	0x8897
#define I28F640B3T	0x8898
#define I28F640B3B	0x8899
96 97 98 99 100
#define I28F640C3B	0x88CD
#define I28F160F3T	0x88F3
#define I28F160F3B	0x88F4
#define I28F160C3T	0x88C2
#define I28F160C3B	0x88C3
L
Linus Torvalds 已提交
101 102 103 104 105 106 107
#define I82802AB	0x00ad
#define I82802AC	0x00ac

/* Macronix */
#define MX29LV040C	0x004F
#define MX29LV160T	0x22C4
#define MX29LV160B	0x2249
108
#define MX29F040	0x00A4
L
Linus Torvalds 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121
#define MX29F016	0x00AD
#define MX29F002T	0x00B0
#define MX29F004T	0x0045
#define MX29F004B	0x0046

/* NEC */
#define UPD29F064115	0x221C

/* PMC */
#define PM49FL002	0x006D
#define PM49FL004	0x006E
#define PM49FL008	0x006A

122 123 124
/* Sharp */
#define LH28F640BF	0x00b0

L
Linus Torvalds 已提交
125
/* ST - www.st.com */
126
#define M29F800AB	0x0058
127 128
#define M29W800DT	0x22D7
#define M29W800DB	0x225B
129 130
#define M29W400DT	0x00EE
#define M29W400DB	0x00EF
L
Linus Torvalds 已提交
131 132 133 134 135 136 137
#define M29W160DT	0x22C4
#define M29W160DB	0x2249
#define M29W040B	0x00E3
#define M50FW040	0x002C
#define M50FW080	0x002D
#define M50FW016	0x002E
#define M50LPW080       0x002F
138 139
#define M50FLW080A	0x0080
#define M50FLW080B	0x0081
140
#define PSD4256G6V	0x00e9
L
Linus Torvalds 已提交
141 142 143 144 145 146 147 148

/* SST */
#define SST29EE020	0x0010
#define SST29LE020	0x0012
#define SST29EE512	0x005d
#define SST29LE512	0x003d
#define SST39LF800	0x2781
#define SST39LF160	0x2782
B
Ben Dooks 已提交
149
#define SST39VF1601	0x234b
150
#define SST39VF3201	0x235b
151 152
#define SST39WF1601	0x274b
#define SST39WF1602	0x274a
L
Linus Torvalds 已提交
153 154 155 156 157 158
#define SST39LF512	0x00D4
#define SST39LF010	0x00D5
#define SST39LF020	0x00D6
#define SST39LF040	0x00D7
#define SST39SF010A	0x00B5
#define SST39SF020A	0x00B6
159
#define SST39SF040	0x00B7
L
Linus Torvalds 已提交
160
#define SST49LF004B	0x0060
161
#define SST49LF040B	0x0050
L
Linus Torvalds 已提交
162 163 164 165
#define SST49LF008A	0x005a
#define SST49LF030A	0x001C
#define SST49LF040A	0x0051
#define SST49LF080A	0x005B
166
#define SST36VF3203	0x7354
L
Linus Torvalds 已提交
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

/* Toshiba */
#define TC58FVT160	0x00C2
#define TC58FVB160	0x0043
#define TC58FVT321	0x009A
#define TC58FVB321	0x009C
#define TC58FVT641	0x0093
#define TC58FVB641	0x0095

/* Winbond */
#define W49V002A	0x00b0


/*
 * Unlock address sets for AMD command sets.
 * Intel command sets use the MTD_UADDR_UNNECESSARY.
 * Each identifier, except MTD_UADDR_UNNECESSARY, and
 * MTD_UADDR_NO_SUPPORT must be defined below in unlock_addrs[].
 * MTD_UADDR_NOT_SUPPORTED must be 0 so that structure
 * initialization need not require initializing all of the
 * unlock addresses for all bit widths.
 */
enum uaddr {
	MTD_UADDR_NOT_SUPPORTED = 0,	/* data width not supported */
	MTD_UADDR_0x0555_0x02AA,
	MTD_UADDR_0x0555_0x0AAA,
	MTD_UADDR_0x5555_0x2AAA,
194
	MTD_UADDR_0x0AAA_0x0554,
L
Linus Torvalds 已提交
195
	MTD_UADDR_0x0AAA_0x0555,
196
	MTD_UADDR_0xAAAA_0x5555,
L
Linus Torvalds 已提交
197 198 199 200 201 202
	MTD_UADDR_DONT_CARE,		/* Requires an arbitrary address */
	MTD_UADDR_UNNECESSARY,		/* Does not require any address */
};


struct unlock_addr {
203 204
	uint32_t addr1;
	uint32_t addr2;
L
Linus Torvalds 已提交
205 206 207 208 209 210 211 212
};


/*
 * I don't like the fact that the first entry in unlock_addrs[]
 * exists, but is for MTD_UADDR_NOT_SUPPORTED - and, therefore,
 * should not be used.  The  problem is that structures with
 * initializers have extra fields initialized to 0.  It is _very_
D
Daniel Mack 已提交
213
 * desirable to have the unlock address entries for unsupported
L
Linus Torvalds 已提交
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
 * data widths automatically initialized - that means that
 * MTD_UADDR_NOT_SUPPORTED must be 0 and the first entry here
 * must go unused.
 */
static const struct unlock_addr  unlock_addrs[] = {
	[MTD_UADDR_NOT_SUPPORTED] = {
		.addr1 = 0xffff,
		.addr2 = 0xffff
	},

	[MTD_UADDR_0x0555_0x02AA] = {
		.addr1 = 0x0555,
		.addr2 = 0x02aa
	},

	[MTD_UADDR_0x0555_0x0AAA] = {
		.addr1 = 0x0555,
		.addr2 = 0x0aaa
	},

	[MTD_UADDR_0x5555_0x2AAA] = {
		.addr1 = 0x5555,
		.addr2 = 0x2aaa
	},

239 240 241 242 243
	[MTD_UADDR_0x0AAA_0x0554] = {
		.addr1 = 0x0AAA,
		.addr2 = 0x0554
	},

L
Linus Torvalds 已提交
244 245 246 247 248
	[MTD_UADDR_0x0AAA_0x0555] = {
		.addr1 = 0x0AAA,
		.addr2 = 0x0555
	},

249 250 251 252 253
	[MTD_UADDR_0xAAAA_0x5555] = {
		.addr1 = 0xaaaa,
		.addr2 = 0x5555
	},

L
Linus Torvalds 已提交
254 255 256 257 258 259 260 261 262 263 264 265 266
	[MTD_UADDR_DONT_CARE] = {
		.addr1 = 0x0000,      /* Doesn't matter which address */
		.addr2 = 0x0000       /* is used - must be last entry */
	},

	[MTD_UADDR_UNNECESSARY] = {
		.addr1 = 0x0000,
		.addr2 = 0x0000
	}
};

struct amd_flash_info {
	const char *name;
267 268 269 270 271 272 273 274
	const uint16_t mfr_id;
	const uint16_t dev_id;
	const uint8_t dev_size;
	const uint8_t nr_regions;
	const uint16_t cmd_set;
	const uint32_t regions[6];
	const uint8_t devtypes;		/* Bitmask for x8, x16 etc. */
	const uint8_t uaddr;		/* unlock addrs for 8, 16, 32, 64 */
L
Linus Torvalds 已提交
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
};

#define ERASEINFO(size,blocks) (size<<8)|(blocks-1)

#define SIZE_64KiB  16
#define SIZE_128KiB 17
#define SIZE_256KiB 18
#define SIZE_512KiB 19
#define SIZE_1MiB   20
#define SIZE_2MiB   21
#define SIZE_4MiB   22
#define SIZE_8MiB   23


/*
 * Please keep this list ordered by manufacturer!
 * Fortunately, the list isn't searched often and so a
 * slow, linear search isn't so bad.
 */
static const struct amd_flash_info jedec_table[] = {
	{
296
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
297 298
		.dev_id		= AM29F032B,
		.name		= "AMD AM29F032B",
299 300 301 302 303
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.devtypes	= CFI_DEVICETYPE_X8,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
304 305 306 307
		.regions	= {
			ERASEINFO(0x10000,64)
		}
	}, {
308
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
309 310
		.dev_id		= AM29LV160DT,
		.name		= "AMD AM29LV160DT",
311 312 313 314 315
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
316 317 318 319 320 321 322
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
323
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
324 325
		.dev_id		= AM29LV160DB,
		.name		= "AMD AM29LV160DB",
326 327 328 329 330
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
331 332 333 334 335 336 337
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,31)
		}
	}, {
338
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
339 340
		.dev_id		= AM29LV400BB,
		.name		= "AMD AM29LV400BB",
341 342 343 344 345
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
346 347 348 349 350 351 352
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,7)
		}
	}, {
353
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
354 355
		.dev_id		= AM29LV400BT,
		.name		= "AMD AM29LV400BT",
356 357 358 359 360
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
361 362 363 364 365 366 367
		.regions	= {
			ERASEINFO(0x10000,7),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
368
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
369 370
		.dev_id		= AM29LV800BB,
		.name		= "AMD AM29LV800BB",
371 372 373 374 375
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
376 377 378 379 380 381 382 383
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
	}, {
/* add DL */
384
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
385 386
		.dev_id		= AM29DL800BB,
		.name		= "AMD AM29DL800BB",
387 388 389 390 391
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 6,
L
Linus Torvalds 已提交
392 393 394 395 396 397 398 399 400
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,4),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x04000,1),
			ERASEINFO(0x10000,14)
		}
	}, {
401
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
402 403
		.dev_id		= AM29DL800BT,
		.name		= "AMD AM29DL800BT",
404 405 406 407 408
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 6,
L
Linus Torvalds 已提交
409 410 411 412 413 414 415 416 417
		.regions	= {
			ERASEINFO(0x10000,14),
			ERASEINFO(0x04000,1),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,4),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x04000,1)
		}
	}, {
418
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
419 420
		.dev_id		= AM29F800BB,
		.name		= "AMD AM29F800BB",
421 422 423 424 425
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
426 427 428 429 430 431 432
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
	}, {
433
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
434 435
		.dev_id		= AM29LV800BT,
		.name		= "AMD AM29LV800BT",
436 437 438 439 440
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
441 442 443 444 445 446 447
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
448
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
449 450
		.dev_id		= AM29F800BT,
		.name		= "AMD AM29F800BT",
451 452 453 454 455
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
456 457 458 459 460 461 462
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
463
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
464 465
		.dev_id		= AM29F017D,
		.name		= "AMD AM29F017D",
466 467 468 469 470
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_DONT_CARE,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
471 472 473 474
		.regions	= {
			ERASEINFO(0x10000,32),
		}
	}, {
475
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
476 477
		.dev_id		= AM29F016D,
		.name		= "AMD AM29F016D",
478 479 480 481 482
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
483 484 485 486
		.regions	= {
			ERASEINFO(0x10000,32),
		}
	}, {
487
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
488 489
		.dev_id		= AM29F080,
		.name		= "AMD AM29F080",
490 491 492 493 494
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
495 496 497 498
		.regions	= {
			ERASEINFO(0x10000,16),
		}
	}, {
499
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
500 501
		.dev_id		= AM29F040,
		.name		= "AMD AM29F040",
502 503 504 505 506
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
507 508 509 510
		.regions	= {
			ERASEINFO(0x10000,8),
		}
	}, {
511
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
512 513
		.dev_id		= AM29LV040B,
		.name		= "AMD AM29LV040B",
514 515 516 517 518
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
519 520 521 522
		.regions	= {
			ERASEINFO(0x10000,8),
		}
	}, {
523
		.mfr_id		= CFI_MFR_AMD,
L
Linus Torvalds 已提交
524 525
		.dev_id		= AM29F002T,
		.name		= "AMD AM29F002T",
526 527 528 529 530
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
531 532 533 534 535 536
		.regions	= {
			ERASEINFO(0x10000,3),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
537
	}, {
538
		.mfr_id		= CFI_MFR_AMD,
539 540 541 542 543 544 545 546 547 548 549 550 551 552
		.dev_id		= AM29SL800DT,
		.name		= "AMD AM29SL800DT",
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
	}, {
553
		.mfr_id		= CFI_MFR_AMD,
554 555 556 557 558 559 560 561 562 563 564 565 566
		.dev_id		= AM29SL800DB,
		.name		= "AMD AM29SL800DB",
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
L
Linus Torvalds 已提交
567
	}, {
568
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
569 570
		.dev_id		= AT49BV512,
		.name		= "Atmel AT49BV512",
571 572 573 574 575
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_64KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
576 577 578 579
		.regions	= {
			ERASEINFO(0x10000,1)
		}
	}, {
580
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
581 582
		.dev_id		= AT29LV512,
		.name		= "Atmel AT29LV512",
583 584 585 586 587
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_64KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
588 589 590 591 592
		.regions	= {
			ERASEINFO(0x80,256),
			ERASEINFO(0x80,256)
		}
	}, {
593
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
594 595
		.dev_id		= AT49BV16X,
		.name		= "Atmel AT49BV16X",
596
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
597
		.uaddr		= MTD_UADDR_0x0555_0x0AAA,	/* ???? */
598 599 600
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
601 602 603 604 605
		.regions	= {
			ERASEINFO(0x02000,8),
			ERASEINFO(0x10000,31)
		}
	}, {
606
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
607 608
		.dev_id		= AT49BV16XT,
		.name		= "Atmel AT49BV16XT",
609
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
610
		.uaddr		= MTD_UADDR_0x0555_0x0AAA,	/* ???? */
611 612 613
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
614 615 616 617 618
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x02000,8)
		}
	}, {
619
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
620 621
		.dev_id		= AT49BV32X,
		.name		= "Atmel AT49BV32X",
622
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
623
		.uaddr		= MTD_UADDR_0x0555_0x0AAA,	/* ???? */
624 625 626
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
627 628 629 630 631
		.regions	= {
			ERASEINFO(0x02000,8),
			ERASEINFO(0x10000,63)
		}
	}, {
632
		.mfr_id		= CFI_MFR_ATMEL,
L
Linus Torvalds 已提交
633 634
		.dev_id		= AT49BV32XT,
		.name		= "Atmel AT49BV32XT",
635
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
636
		.uaddr		= MTD_UADDR_0x0555_0x0AAA,	/* ???? */
637 638 639
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
640 641 642 643
		.regions	= {
			ERASEINFO(0x10000,63),
			ERASEINFO(0x02000,8)
		}
644
	}, {
645
		.mfr_id		= CFI_MFR_EON,
646 647 648 649 650 651 652 653 654 655 656 657 658 659
		.dev_id		= EN29SL800BT,
		.name		= "Eon EN29SL800BT",
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
	}, {
660
		.mfr_id		= CFI_MFR_EON,
661 662 663 664 665 666 667 668 669 670 671 672 673
		.dev_id		= EN29SL800BB,
		.name		= "Eon EN29SL800BB",
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
L
Linus Torvalds 已提交
674
	}, {
675
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
676 677
		.dev_id		= MBM29F040C,
		.name		= "Fujitsu MBM29F040C",
678 679 680 681 682
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
683 684 685
		.regions	= {
			ERASEINFO(0x10000,8)
		}
686
	}, {
687
		.mfr_id		= CFI_MFR_FUJITSU,
688 689
		.dev_id		= MBM29F800BA,
		.name		= "Fujitsu MBM29F800BA",
690 691 692 693 694
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
695 696 697 698 699 700
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
L
Linus Torvalds 已提交
701
	}, {
702
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
703 704
		.dev_id		= MBM29LV650UE,
		.name		= "Fujitsu MBM29LV650UE",
705 706 707 708 709
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_DONT_CARE,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
710 711 712 713
		.regions	= {
			ERASEINFO(0x10000,128)
		}
	}, {
714
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
715 716
		.dev_id		= MBM29LV320TE,
		.name		= "Fujitsu MBM29LV320TE",
717 718 719 720 721
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
722 723 724 725 726
		.regions	= {
			ERASEINFO(0x10000,63),
			ERASEINFO(0x02000,8)
		}
	}, {
727
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
728 729
		.dev_id		= MBM29LV320BE,
		.name		= "Fujitsu MBM29LV320BE",
730 731 732 733 734
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
735 736 737 738 739
		.regions	= {
			ERASEINFO(0x02000,8),
			ERASEINFO(0x10000,63)
		}
	}, {
740
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
741 742
		.dev_id		= MBM29LV160TE,
		.name		= "Fujitsu MBM29LV160TE",
743 744 745 746 747
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
748 749 750 751 752 753 754
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
755
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
756 757
		.dev_id		= MBM29LV160BE,
		.name		= "Fujitsu MBM29LV160BE",
758 759 760 761 762
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
763 764 765 766 767 768 769
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,31)
		}
	}, {
770
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
771 772
		.dev_id		= MBM29LV800BA,
		.name		= "Fujitsu MBM29LV800BA",
773 774 775 776 777
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
778 779 780 781 782 783 784
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15)
		}
	}, {
785
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
786 787
		.dev_id		= MBM29LV800TA,
		.name		= "Fujitsu MBM29LV800TA",
788 789 790 791 792
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
793 794 795 796 797 798 799
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
800
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
801 802
		.dev_id		= MBM29LV400BC,
		.name		= "Fujitsu MBM29LV400BC",
803 804 805 806 807
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
808 809 810 811 812 813 814
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,7)
		}
	}, {
815
		.mfr_id		= CFI_MFR_FUJITSU,
L
Linus Torvalds 已提交
816 817
		.dev_id		= MBM29LV400TC,
		.name		= "Fujitsu MBM29LV400TC",
818 819 820 821 822
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
823 824 825 826 827 828 829
		.regions	= {
			ERASEINFO(0x10000,7),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
830
		.mfr_id		= CFI_MFR_HYUNDAI,
L
Linus Torvalds 已提交
831 832
		.dev_id		= HY29F002T,
		.name		= "Hyundai HY29F002T",
833 834 835 836 837
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
838 839 840 841 842 843 844
		.regions	= {
			ERASEINFO(0x10000,3),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
	}, {
845
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
846 847
		.dev_id		= I28F004B3B,
		.name		= "Intel 28F004B3B",
848 849 850 851 852
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
853 854 855 856 857
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 7),
		}
	}, {
858
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
859 860
		.dev_id		= I28F004B3T,
		.name		= "Intel 28F004B3T",
861 862 863 864 865
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
866 867 868 869 870
		.regions	= {
			ERASEINFO(0x10000, 7),
			ERASEINFO(0x02000, 8),
		}
	}, {
871
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
872 873
		.dev_id		= I28F400B3B,
		.name		= "Intel 28F400B3B",
874 875 876 877 878
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
879 880 881 882 883
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 7),
		}
	}, {
884
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
885 886
		.dev_id		= I28F400B3T,
		.name		= "Intel 28F400B3T",
887 888 889 890 891
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
892 893 894 895 896
		.regions	= {
			ERASEINFO(0x10000, 7),
			ERASEINFO(0x02000, 8),
		}
	}, {
897
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
898 899
		.dev_id		= I28F008B3B,
		.name		= "Intel 28F008B3B",
900 901 902 903 904
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
905 906 907 908 909
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 15),
		}
	}, {
910
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
911 912
		.dev_id		= I28F008B3T,
		.name		= "Intel 28F008B3T",
913 914 915 916 917
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
918 919 920 921 922
		.regions	= {
			ERASEINFO(0x10000, 15),
			ERASEINFO(0x02000, 8),
		}
	}, {
923
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
924 925
		.dev_id		= I28F008S5,
		.name		= "Intel 28F008S5",
926 927 928 929 930
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
931 932 933 934
		.regions	= {
			ERASEINFO(0x10000,16),
		}
	}, {
935
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
936 937
		.dev_id		= I28F016S5,
		.name		= "Intel 28F016S5",
938 939 940 941 942
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
943 944 945 946
		.regions	= {
			ERASEINFO(0x10000,32),
		}
	}, {
947
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
948 949
		.dev_id		= I28F008SA,
		.name		= "Intel 28F008SA",
950 951 952 953 954
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
955 956 957 958
		.regions	= {
			ERASEINFO(0x10000, 16),
		}
	}, {
959
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
960 961
		.dev_id		= I28F800B3B,
		.name		= "Intel 28F800B3B",
962 963 964 965 966
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
967 968 969 970 971
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 15),
		}
	}, {
972
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
973 974
		.dev_id		= I28F800B3T,
		.name		= "Intel 28F800B3T",
975 976 977 978 979
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
980 981 982 983 984
		.regions	= {
			ERASEINFO(0x10000, 15),
			ERASEINFO(0x02000, 8),
		}
	}, {
985
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
986 987
		.dev_id		= I28F016B3B,
		.name		= "Intel 28F016B3B",
988 989 990 991 992
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
993 994 995 996 997
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 31),
		}
	}, {
998
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
999 1000
		.dev_id		= I28F016S3,
		.name		= "Intel I28F016S3",
1001 1002 1003 1004 1005
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1006 1007 1008 1009
		.regions	= {
			ERASEINFO(0x10000, 32),
		}
	}, {
1010
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1011 1012
		.dev_id		= I28F016B3T,
		.name		= "Intel 28F016B3T",
1013 1014 1015 1016 1017
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1018 1019 1020 1021 1022
		.regions	= {
			ERASEINFO(0x10000, 31),
			ERASEINFO(0x02000, 8),
		}
	}, {
1023
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1024 1025
		.dev_id		= I28F160B3B,
		.name		= "Intel 28F160B3B",
1026 1027 1028 1029 1030
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1031 1032 1033 1034 1035
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 31),
		}
	}, {
1036
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1037 1038
		.dev_id		= I28F160B3T,
		.name		= "Intel 28F160B3T",
1039 1040 1041 1042 1043
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1044 1045 1046 1047 1048
		.regions	= {
			ERASEINFO(0x10000, 31),
			ERASEINFO(0x02000, 8),
		}
	}, {
1049
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1050 1051
		.dev_id		= I28F320B3B,
		.name		= "Intel 28F320B3B",
1052 1053 1054 1055 1056
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1057 1058 1059 1060 1061
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 63),
		}
	}, {
1062
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1063 1064
		.dev_id		= I28F320B3T,
		.name		= "Intel 28F320B3T",
1065 1066 1067 1068 1069
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1070 1071 1072 1073 1074
		.regions	= {
			ERASEINFO(0x10000, 63),
			ERASEINFO(0x02000, 8),
		}
	}, {
1075
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1076 1077
		.dev_id		= I28F640B3B,
		.name		= "Intel 28F640B3B",
1078 1079 1080 1081 1082
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1083 1084 1085 1086 1087
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 127),
		}
	}, {
1088
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1089 1090
		.dev_id		= I28F640B3T,
		.name		= "Intel 28F640B3T",
1091 1092 1093 1094 1095
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1096 1097 1098 1099
		.regions	= {
			ERASEINFO(0x10000, 127),
			ERASEINFO(0x02000, 8),
		}
1100
	}, {
1101
		.mfr_id		= CFI_MFR_INTEL,
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
		.dev_id		= I28F640C3B,
		.name		= "Intel 28F640C3B",
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 2,
		.regions	= {
			ERASEINFO(0x02000, 8),
			ERASEINFO(0x10000, 127),
		}
L
Linus Torvalds 已提交
1113
	}, {
1114
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1115 1116
		.dev_id		= I82802AB,
		.name		= "Intel 82802AB",
1117 1118 1119 1120 1121
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1122 1123 1124 1125
		.regions	= {
			ERASEINFO(0x10000,8),
		}
	}, {
1126
		.mfr_id		= CFI_MFR_INTEL,
L
Linus Torvalds 已提交
1127 1128
		.dev_id		= I82802AC,
		.name		= "Intel 82802AC",
1129 1130 1131 1132 1133
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1134 1135 1136 1137
		.regions	= {
			ERASEINFO(0x10000,16),
		}
	}, {
1138
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1139 1140
		.dev_id		= MX29LV040C,
		.name		= "Macronix MX29LV040C",
1141 1142 1143 1144 1145
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1146 1147 1148 1149
		.regions	= {
			ERASEINFO(0x10000,8),
		}
	}, {
1150
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1151 1152
		.dev_id		= MX29LV160T,
		.name		= "MXIC MX29LV160T",
1153 1154 1155 1156 1157
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1158 1159 1160 1161 1162 1163 1164
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
1165
		.mfr_id		= CFI_MFR_NEC,
L
Linus Torvalds 已提交
1166 1167
		.dev_id		= UPD29F064115,
		.name		= "NEC uPD29F064115",
1168 1169
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
1170 1171 1172
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 3,
L
Linus Torvalds 已提交
1173 1174 1175 1176 1177 1178
		.regions	= {
			ERASEINFO(0x2000,8),
			ERASEINFO(0x10000,126),
			ERASEINFO(0x2000,8),
		}
	}, {
1179
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1180 1181
		.dev_id		= MX29LV160B,
		.name		= "MXIC MX29LV160B",
1182 1183 1184 1185 1186
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1187 1188 1189 1190 1191 1192 1193
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,31)
		}
	}, {
1194
		.mfr_id		= CFI_MFR_MACRONIX,
1195 1196
		.dev_id		= MX29F040,
		.name		= "Macronix MX29F040",
1197 1198 1199 1200 1201
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
1202 1203 1204
		.regions	= {
			ERASEINFO(0x10000,8),
		}
1205
	}, {
1206
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1207 1208
		.dev_id		= MX29F016,
		.name		= "Macronix MX29F016",
1209 1210 1211 1212 1213
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1214 1215 1216
		.regions	= {
			ERASEINFO(0x10000,32),
		}
1217
	}, {
1218
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1219 1220
		.dev_id		= MX29F004T,
		.name		= "Macronix MX29F004T",
1221 1222 1223 1224 1225
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1226 1227 1228 1229 1230 1231
		.regions	= {
			ERASEINFO(0x10000,7),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
1232
	}, {
1233
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1234 1235
		.dev_id		= MX29F004B,
		.name		= "Macronix MX29F004B",
1236 1237 1238 1239 1240
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1241 1242 1243 1244 1245 1246 1247
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,7),
		}
	}, {
1248
		.mfr_id		= CFI_MFR_MACRONIX,
L
Linus Torvalds 已提交
1249 1250
		.dev_id		= MX29F002T,
		.name		= "Macronix MX29F002T",
1251 1252 1253 1254 1255
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1256 1257 1258 1259 1260 1261 1262
		.regions	= {
			ERASEINFO(0x10000,3),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1),
		}
	}, {
1263
		.mfr_id		= CFI_MFR_PMC,
L
Linus Torvalds 已提交
1264 1265
		.dev_id		= PM49FL002,
		.name		= "PMC Pm49FL002",
1266 1267 1268 1269 1270
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1271 1272 1273 1274
		.regions	= {
			ERASEINFO( 0x01000, 64 )
		}
	}, {
1275
		.mfr_id		= CFI_MFR_PMC,
L
Linus Torvalds 已提交
1276 1277
		.dev_id		= PM49FL004,
		.name		= "PMC Pm49FL004",
1278 1279 1280 1281 1282
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1283 1284 1285 1286
		.regions	= {
			ERASEINFO( 0x01000, 128 )
		}
	}, {
1287
		.mfr_id		= CFI_MFR_PMC,
L
Linus Torvalds 已提交
1288 1289
		.dev_id		= PM49FL008,
		.name		= "PMC Pm49FL008",
1290 1291 1292 1293 1294
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1295 1296 1297
		.regions	= {
			ERASEINFO( 0x01000, 256 )
		}
1298
	}, {
1299
		.mfr_id		= CFI_MFR_SHARP,
1300 1301
		.dev_id		= LH28F640BF,
		.name		= "LH28F640BF",
1302 1303 1304 1305 1306 1307
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_INTEL_STD,
		.nr_regions	= 1,
		.regions	= {
1308 1309
			ERASEINFO(0x40000,16),
		}
1310
	}, {
1311
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1312 1313
		.dev_id		= SST39LF512,
		.name		= "SST 39LF512",
1314 1315 1316 1317 1318
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_64KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1319 1320 1321
		.regions	= {
			ERASEINFO(0x01000,16),
		}
1322
	}, {
1323
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1324 1325
		.dev_id		= SST39LF010,
		.name		= "SST 39LF010",
1326 1327 1328 1329 1330
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_128KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1331 1332 1333
		.regions	= {
			ERASEINFO(0x01000,32),
		}
1334
	}, {
1335
		.mfr_id		= CFI_MFR_SST,
1336
		.dev_id		= SST29EE020,
L
Linus Torvalds 已提交
1337
		.name		= "SST 29EE020",
1338 1339 1340 1341 1342 1343 1344 1345
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_SST_PAGE,
		.nr_regions	= 1,
		.regions = {ERASEINFO(0x01000,64),
		}
	}, {
1346
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1347
		.dev_id		= SST29LE020,
1348
		.name		= "SST 29LE020",
1349 1350 1351 1352 1353 1354 1355
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_SST_PAGE,
		.nr_regions	= 1,
		.regions = {ERASEINFO(0x01000,64),
		}
L
Linus Torvalds 已提交
1356
	}, {
1357
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1358 1359
		.dev_id		= SST39LF020,
		.name		= "SST 39LF020",
1360 1361 1362 1363 1364
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1365 1366 1367
		.regions	= {
			ERASEINFO(0x01000,64),
		}
1368
	}, {
1369
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1370 1371
		.dev_id		= SST39LF040,
		.name		= "SST 39LF040",
1372 1373 1374 1375 1376
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1377 1378 1379
		.regions	= {
			ERASEINFO(0x01000,128),
		}
1380
	}, {
1381
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1382 1383
		.dev_id		= SST39SF010A,
		.name		= "SST 39SF010A",
1384 1385 1386 1387 1388
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_128KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1389 1390 1391
		.regions	= {
			ERASEINFO(0x01000,32),
		}
1392
	}, {
1393
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1394 1395
		.dev_id		= SST39SF020A,
		.name		= "SST 39SF020A",
1396 1397 1398 1399 1400
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1401 1402 1403
		.regions	= {
			ERASEINFO(0x01000,64),
		}
1404
	}, {
1405
		.mfr_id		= CFI_MFR_SST,
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415
		.dev_id		= SST39SF040,
		.name		= "SST 39SF040",
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
		.regions	= {
			ERASEINFO(0x01000,128),
		}
L
Linus Torvalds 已提交
1416
	}, {
1417
		.mfr_id		= CFI_MFR_SST,
1418 1419 1420 1421 1422 1423 1424 1425
		.dev_id		= SST49LF040B,
		.name		= "SST 49LF040B",
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
		.regions	= {
1426 1427 1428 1429
			ERASEINFO(0x01000,128),
		}
	}, {

1430
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1431 1432
		.dev_id		= SST49LF004B,
		.name		= "SST 49LF004B",
1433 1434 1435 1436 1437
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1438 1439 1440 1441
		.regions	= {
			ERASEINFO(0x01000,128),
		}
	}, {
1442
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1443 1444
		.dev_id		= SST49LF008A,
		.name		= "SST 49LF008A",
1445 1446 1447 1448 1449
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1450 1451 1452 1453
		.regions	= {
			ERASEINFO(0x01000,256),
		}
	}, {
1454
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1455 1456
		.dev_id		= SST49LF030A,
		.name		= "SST 49LF030A",
1457 1458 1459 1460 1461
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1462 1463 1464 1465
		.regions	= {
			ERASEINFO(0x01000,96),
		}
	}, {
1466
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1467 1468
		.dev_id		= SST49LF040A,
		.name		= "SST 49LF040A",
1469 1470 1471 1472 1473
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1474 1475 1476 1477
		.regions	= {
			ERASEINFO(0x01000,128),
		}
	}, {
1478
		.mfr_id		= CFI_MFR_SST,
L
Linus Torvalds 已提交
1479 1480
		.dev_id		= SST49LF080A,
		.name		= "SST 49LF080A",
1481 1482 1483 1484 1485
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1486 1487 1488 1489
		.regions	= {
			ERASEINFO(0x01000,256),
		}
	}, {
1490
		.mfr_id		= CFI_MFR_SST,     /* should be CFI */
1491 1492
		.dev_id		= SST39LF160,
		.name		= "SST 39LF160",
1493 1494
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
1495 1496 1497 1498 1499 1500 1501 1502
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
		.regions	= {
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256)
		}
	}, {
1503
		.mfr_id		= CFI_MFR_SST,     /* should be CFI */
1504 1505
		.dev_id		= SST39VF1601,
		.name		= "SST 39VF1601",
1506 1507
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
1508 1509 1510 1511 1512 1513 1514
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
		.regions	= {
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256)
		}
1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
	}, {
		/* CFI is broken: reports AMD_STD, but needs custom uaddr */
		.mfr_id		= CFI_MFR_SST,
		.dev_id		= SST39WF1601,
		.name		= "SST 39WF1601",
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
		.regions	= {
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256)
		}
	}, {
		/* CFI is broken: reports AMD_STD, but needs custom uaddr */
		.mfr_id		= CFI_MFR_SST,
		.dev_id		= SST39WF1602,
		.name		= "SST 39WF1602",
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
		.regions	= {
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256)
		}
1543
	}, {
1544
		.mfr_id		= CFI_MFR_SST,     /* should be CFI */
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557
		.dev_id		= SST39VF3201,
		.name		= "SST 39VF3201",
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0xAAAA_0x5555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256),
			ERASEINFO(0x1000,256)
		}
1558
	}, {
1559
		.mfr_id		= CFI_MFR_SST,
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
		.dev_id		= SST36VF3203,
		.name		= "SST 36VF3203",
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
		.regions	= {
			ERASEINFO(0x10000,64),
		}
1570
	}, {
1571
		.mfr_id		= CFI_MFR_ST,
1572 1573
		.dev_id		= M29F800AB,
		.name		= "ST M29F800AB",
1574 1575 1576 1577 1578
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
1579 1580 1581 1582 1583 1584
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15),
		}
1585
	}, {
1586
		.mfr_id		= CFI_MFR_ST,	/* FIXME - CFI device? */
L
Linus Torvalds 已提交
1587 1588
		.dev_id		= M29W800DT,
		.name		= "ST M29W800DT",
1589
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1590
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
1591 1592 1593
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1594 1595 1596 1597 1598 1599 1600
		.regions	= {
			ERASEINFO(0x10000,15),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
1601
		.mfr_id		= CFI_MFR_ST,	/* FIXME - CFI device? */
L
Linus Torvalds 已提交
1602 1603
		.dev_id		= M29W800DB,
		.name		= "ST M29W800DB",
1604
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1605
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
1606 1607 1608
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1609 1610 1611 1612 1613 1614
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,15)
		}
1615
	},  {
1616
		.mfr_id         = CFI_MFR_ST,
1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630
		.dev_id         = M29W400DT,
		.name           = "ST M29W400DT",
		.devtypes       = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr          = MTD_UADDR_0x0AAA_0x0555,
		.dev_size       = SIZE_512KiB,
		.cmd_set        = P_ID_AMD_STD,
		.nr_regions     = 4,
		.regions        = {
			ERASEINFO(0x04000,7),
			ERASEINFO(0x02000,1),
			ERASEINFO(0x08000,2),
			ERASEINFO(0x10000,1)
		}
	}, {
1631
		.mfr_id         = CFI_MFR_ST,
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644
		.dev_id         = M29W400DB,
		.name           = "ST M29W400DB",
		.devtypes       = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr          = MTD_UADDR_0x0AAA_0x0555,
		.dev_size       = SIZE_512KiB,
		.cmd_set        = P_ID_AMD_STD,
		.nr_regions     = 4,
		.regions        = {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,7)
		}
L
Linus Torvalds 已提交
1645
	}, {
1646
		.mfr_id		= CFI_MFR_ST,	/* FIXME - CFI device? */
L
Linus Torvalds 已提交
1647 1648
		.dev_id		= M29W160DT,
		.name		= "ST M29W160DT",
1649
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1650
		.uaddr		= MTD_UADDR_0x0555_0x02AA,	/* ???? */
1651 1652 1653
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1654 1655 1656 1657 1658 1659 1660
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
1661
		.mfr_id		= CFI_MFR_ST,	/* FIXME - CFI device? */
L
Linus Torvalds 已提交
1662 1663
		.dev_id		= M29W160DB,
		.name		= "ST M29W160DB",
1664
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
1665
		.uaddr		= MTD_UADDR_0x0555_0x02AA,	/* ???? */
1666 1667 1668
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1669 1670 1671 1672 1673 1674
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,31)
		}
1675
	}, {
1676
		.mfr_id		= CFI_MFR_ST,
L
Linus Torvalds 已提交
1677 1678
		.dev_id		= M29W040B,
		.name		= "ST M29W040B",
1679 1680 1681 1682 1683
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0555_0x02AA,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1684 1685 1686
		.regions	= {
			ERASEINFO(0x10000,8),
		}
1687
	}, {
1688
		.mfr_id		= CFI_MFR_ST,
L
Linus Torvalds 已提交
1689 1690
		.dev_id		= M50FW040,
		.name		= "ST M50FW040",
1691 1692 1693 1694 1695
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_512KiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1696 1697 1698
		.regions	= {
			ERASEINFO(0x10000,8),
		}
1699
	}, {
1700
		.mfr_id		= CFI_MFR_ST,
L
Linus Torvalds 已提交
1701 1702
		.dev_id		= M50FW080,
		.name		= "ST M50FW080",
1703 1704 1705 1706 1707
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1708 1709 1710
		.regions	= {
			ERASEINFO(0x10000,16),
		}
1711
	}, {
1712
		.mfr_id		= CFI_MFR_ST,
L
Linus Torvalds 已提交
1713 1714
		.dev_id		= M50FW016,
		.name		= "ST M50FW016",
1715 1716 1717 1718 1719
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1720 1721 1722 1723
		.regions	= {
			ERASEINFO(0x10000,32),
		}
	}, {
1724
		.mfr_id		= CFI_MFR_ST,
L
Linus Torvalds 已提交
1725 1726
		.dev_id		= M50LPW080,
		.name		= "ST M50LPW080",
1727 1728 1729 1730 1731
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 1,
L
Linus Torvalds 已提交
1732 1733
		.regions	= {
			ERASEINFO(0x10000,16),
1734 1735
		},
	}, {
1736
		.mfr_id		= CFI_MFR_ST,
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750
		.dev_id		= M50FLW080A,
		.name		= "ST M50FLW080A",
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x1000,16),
			ERASEINFO(0x10000,13),
			ERASEINFO(0x1000,16),
			ERASEINFO(0x1000,16),
		}
	}, {
1751
		.mfr_id		= CFI_MFR_ST,
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763
		.dev_id		= M50FLW080B,
		.name		= "ST M50FLW080B",
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_UNNECESSARY,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_INTEL_EXT,
		.nr_regions	= 4,
		.regions	= {
			ERASEINFO(0x1000,16),
			ERASEINFO(0x1000,16),
			ERASEINFO(0x10000,13),
			ERASEINFO(0x1000,16),
L
Linus Torvalds 已提交
1764
		}
1765
	}, {
1766
		.mfr_id		= 0xff00 | CFI_MFR_ST,
1767 1768 1769 1770 1771 1772 1773 1774 1775 1776
		.dev_id		= 0xff00 | PSD4256G6V,
		.name		= "ST PSD4256G6V",
		.devtypes	= CFI_DEVICETYPE_X16,
		.uaddr		= MTD_UADDR_0x0AAA_0x0554,
		.dev_size	= SIZE_1MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 1,
		.regions	= {
			ERASEINFO(0x10000,16),
		}
L
Linus Torvalds 已提交
1777
	}, {
1778
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1779 1780
		.dev_id		= TC58FVT160,
		.name		= "Toshiba TC58FVT160",
1781 1782 1783 1784 1785
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1786 1787 1788 1789 1790 1791 1792
		.regions	= {
			ERASEINFO(0x10000,31),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x04000,1)
		}
	}, {
1793
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1794 1795
		.dev_id		= TC58FVB160,
		.name		= "Toshiba TC58FVB160",
1796 1797 1798 1799 1800
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_2MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1801 1802 1803 1804 1805 1806 1807
		.regions	= {
			ERASEINFO(0x04000,1),
			ERASEINFO(0x02000,2),
			ERASEINFO(0x08000,1),
			ERASEINFO(0x10000,31)
		}
	}, {
1808
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1809 1810
		.dev_id		= TC58FVB321,
		.name		= "Toshiba TC58FVB321",
1811 1812 1813 1814 1815
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1816 1817 1818 1819 1820
		.regions	= {
			ERASEINFO(0x02000,8),
			ERASEINFO(0x10000,63)
		}
	}, {
1821
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1822 1823
		.dev_id		= TC58FVT321,
		.name		= "Toshiba TC58FVT321",
1824 1825 1826 1827 1828
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_4MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1829 1830 1831 1832 1833
		.regions	= {
			ERASEINFO(0x10000,63),
			ERASEINFO(0x02000,8)
		}
	}, {
1834
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1835 1836
		.dev_id		= TC58FVB641,
		.name		= "Toshiba TC58FVB641",
1837 1838 1839 1840 1841
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1842 1843 1844 1845 1846
		.regions	= {
			ERASEINFO(0x02000,8),
			ERASEINFO(0x10000,127)
		}
	}, {
1847
		.mfr_id		= CFI_MFR_TOSHIBA,
L
Linus Torvalds 已提交
1848 1849
		.dev_id		= TC58FVT641,
		.name		= "Toshiba TC58FVT641",
1850 1851 1852 1853 1854
		.devtypes	= CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x0AAA_0x0555,
		.dev_size	= SIZE_8MiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 2,
L
Linus Torvalds 已提交
1855 1856 1857 1858 1859
		.regions	= {
			ERASEINFO(0x10000,127),
			ERASEINFO(0x02000,8)
		}
	}, {
1860
		.mfr_id		= CFI_MFR_WINBOND,
L
Linus Torvalds 已提交
1861 1862
		.dev_id		= W49V002A,
		.name		= "Winbond W49V002A",
1863 1864 1865 1866 1867
		.devtypes	= CFI_DEVICETYPE_X8,
		.uaddr		= MTD_UADDR_0x5555_0x2AAA,
		.dev_size	= SIZE_256KiB,
		.cmd_set	= P_ID_AMD_STD,
		.nr_regions	= 4,
L
Linus Torvalds 已提交
1868 1869 1870 1871 1872 1873 1874 1875 1876
		.regions	= {
			ERASEINFO(0x10000, 3),
			ERASEINFO(0x08000, 1),
			ERASEINFO(0x02000, 2),
			ERASEINFO(0x04000, 1),
		}
	}
};

1877
static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
L
Linus Torvalds 已提交
1878 1879 1880 1881
	struct cfi_private *cfi)
{
	map_word result;
	unsigned long mask;
1882 1883 1884 1885 1886 1887 1888
	int bank = 0;

	/* According to JEDEC "Standard Manufacturer's Identification Code"
	 * (http://www.jedec.org/download/search/jep106W.pdf)
	 * several first banks can contain 0x7f instead of actual ID
	 */
	do {
1889
		uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
1890 1891 1892
		mask = (1 << (cfi->device_type * 8)) - 1;
		result = map_read(map, base + ofs);
		bank++;
1893
	} while ((result.x[0] & mask) == CFI_MFR_CONTINUATION);
1894

L
Linus Torvalds 已提交
1895 1896 1897
	return result.x[0] & mask;
}

1898
static inline u32 jedec_read_id(struct map_info *map, uint32_t base,
L
Linus Torvalds 已提交
1899 1900 1901 1902
	struct cfi_private *cfi)
{
	map_word result;
	unsigned long mask;
1903
	u32 ofs = cfi_build_cmd_addr(1, map, cfi);
L
Linus Torvalds 已提交
1904 1905 1906 1907 1908
	mask = (1 << (cfi->device_type * 8)) -1;
	result = map_read(map, base + ofs);
	return result.x[0] & mask;
}

1909
static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
L
Linus Torvalds 已提交
1910 1911 1912 1913 1914 1915 1916 1917 1918
{
	/* Reset */

	/* after checking the datasheets for SST, MACRONIX and ATMEL
	 * (oh and incidentaly the jedec spec - 3.5.3.3) the reset
	 * sequence is *supposed* to be 0xaa at 0x5555, 0x55 at
	 * 0x2aaa, 0xF0 at 0x5555 this will not affect the AMD chips
	 * as they will ignore the writes and dont care what address
	 * the F0 is written to */
1919
	if (cfi->addr_unlock1) {
L
Linus Torvalds 已提交
1920 1921 1922 1923 1924 1925 1926 1927
		DEBUG( MTD_DEBUG_LEVEL3,
		       "reset unlock called %x %x \n",
		       cfi->addr_unlock1,cfi->addr_unlock2);
		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
	}

	cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
1928
	/* Some misdesigned Intel chips do not respond for 0xF0 for a reset,
L
Linus Torvalds 已提交
1929 1930 1931
	 * so ensure we're in read mode.  Send both the Intel and the AMD command
	 * for this.  Intel uses 0xff for this, AMD uses 0xff for NOP, so
	 * this should be safe.
1932
	 */
L
Linus Torvalds 已提交
1933 1934 1935 1936 1937
	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
	/* FIXME - should have reset delay before continuing */
}


1938
static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int index)
L
Linus Torvalds 已提交
1939 1940
{
	int i,num_erase_regions;
1941 1942
	uint8_t uaddr;

1943
	if (!(jedec_table[index].devtypes & cfi->device_type)) {
1944
		DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n",
1945
		      jedec_table[index].name, 4 * (1<<cfi->device_type));
1946 1947
		return 0;
	}
L
Linus Torvalds 已提交
1948

1949
	printk(KERN_INFO "Found: %s\n",jedec_table[index].name);
L
Linus Torvalds 已提交
1950

1951
	num_erase_regions = jedec_table[index].nr_regions;
1952

1953 1954
	cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
	if (!cfi->cfiq) {
L
Linus Torvalds 已提交
1955 1956 1957 1958
		//xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
		return 0;
	}

1959
	memset(cfi->cfiq, 0, sizeof(struct cfi_ident));
L
Linus Torvalds 已提交
1960

1961 1962 1963 1964
	cfi->cfiq->P_ID = jedec_table[index].cmd_set;
	cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
	cfi->cfiq->DevSize = jedec_table[index].dev_size;
	cfi->cfi_mode = CFI_MODE_JEDEC;
1965
	cfi->sector_erase_cmd = CMD(0x30);
L
Linus Torvalds 已提交
1966 1967

	for (i=0; i<num_erase_regions; i++){
1968
		cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
L
Linus Torvalds 已提交
1969
	}
1970
	cfi->cmdset_priv = NULL;
L
Linus Torvalds 已提交
1971 1972

	/* This may be redundant for some cases, but it doesn't hurt */
1973 1974
	cfi->mfr = jedec_table[index].mfr_id;
	cfi->id = jedec_table[index].dev_id;
L
Linus Torvalds 已提交
1975

1976
	uaddr = jedec_table[index].uaddr;
L
Linus Torvalds 已提交
1977

1978 1979 1980 1981
	/* The table has unlock addresses in _bytes_, and we try not to let
	   our brains explode when we see the datasheets talking about address
	   lines numbered from A-1 to A18. The CFI table has unlock addresses
	   in device-words according to the mode the device is connected in */
1982 1983
	cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / cfi->device_type;
	cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / cfi->device_type;
L
Linus Torvalds 已提交
1984

1985
	return 1;	/* ok */
L
Linus Torvalds 已提交
1986 1987 1988 1989
}


/*
1990
 * There is a BIG problem properly ID'ing the JEDEC device and guaranteeing
L
Linus Torvalds 已提交
1991 1992 1993 1994 1995
 * the mapped address, unlock addresses, and proper chip ID.  This function
 * attempts to minimize errors.  It is doubtfull that this probe will ever
 * be perfect - consequently there should be some module parameters that
 * could be manually specified to force the chip info.
 */
1996
static inline int jedec_match( uint32_t base,
L
Linus Torvalds 已提交
1997 1998 1999 2000 2001 2002
			       struct map_info *map,
			       struct cfi_private *cfi,
			       const struct amd_flash_info *finfo )
{
	int rc = 0;           /* failure until all tests pass */
	u32 mfr, id;
2003
	uint8_t uaddr;
L
Linus Torvalds 已提交
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015

	/*
	 * The IDs must match.  For X16 and X32 devices operating in
	 * a lower width ( X8 or X16 ), the device ID's are usually just
	 * the lower byte(s) of the larger device ID for wider mode.  If
	 * a part is found that doesn't fit this assumption (device id for
	 * smaller width mode is completely unrealated to full-width mode)
	 * then the jedec_table[] will have to be augmented with the IDs
	 * for different widths.
	 */
	switch (cfi->device_type) {
	case CFI_DEVICETYPE_X8:
2016 2017
		mfr = (uint8_t)finfo->mfr_id;
		id = (uint8_t)finfo->dev_id;
2018 2019 2020 2021 2022 2023 2024 2025 2026 2027

		/* bjd: it seems that if we do this, we can end up
		 * detecting 16bit flashes as an 8bit device, even though
		 * there aren't.
		 */
		if (finfo->dev_id > 0xff) {
			DEBUG( MTD_DEBUG_LEVEL3, "%s(): ID is not 8bit\n",
			       __func__);
			goto match_done;
		}
L
Linus Torvalds 已提交
2028 2029
		break;
	case CFI_DEVICETYPE_X16:
2030 2031
		mfr = (uint16_t)finfo->mfr_id;
		id = (uint16_t)finfo->dev_id;
L
Linus Torvalds 已提交
2032 2033
		break;
	case CFI_DEVICETYPE_X32:
2034 2035
		mfr = (uint16_t)finfo->mfr_id;
		id = (uint32_t)finfo->dev_id;
L
Linus Torvalds 已提交
2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049
		break;
	default:
		printk(KERN_WARNING
		       "MTD %s(): Unsupported device type %d\n",
		       __func__, cfi->device_type);
		goto match_done;
	}
	if ( cfi->mfr != mfr || cfi->id != id ) {
		goto match_done;
	}

	/* the part size must fit in the memory window */
	DEBUG( MTD_DEBUG_LEVEL3,
	       "MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n",
2050 2051
	       __func__, base, 1 << finfo->dev_size, base + (1 << finfo->dev_size) );
	if ( base + cfi_interleave(cfi) * ( 1 << finfo->dev_size ) > map->size ) {
L
Linus Torvalds 已提交
2052 2053 2054
		DEBUG( MTD_DEBUG_LEVEL3,
		       "MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n",
		       __func__, finfo->mfr_id, finfo->dev_id,
2055
		       1 << finfo->dev_size );
L
Linus Torvalds 已提交
2056 2057 2058
		goto match_done;
	}

2059
	if (! (finfo->devtypes & cfi->device_type))
L
Linus Torvalds 已提交
2060
		goto match_done;
2061 2062

	uaddr = finfo->uaddr;
L
Linus Torvalds 已提交
2063 2064 2065 2066

	DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): check unlock addrs 0x%.4x 0x%.4x\n",
	       __func__, cfi->addr_unlock1, cfi->addr_unlock2 );
	if ( MTD_UADDR_UNNECESSARY != uaddr && MTD_UADDR_DONT_CARE != uaddr
2067 2068
	     && ( unlock_addrs[uaddr].addr1 / cfi->device_type != cfi->addr_unlock1 ||
		  unlock_addrs[uaddr].addr2 / cfi->device_type != cfi->addr_unlock2 ) ) {
L
Linus Torvalds 已提交
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107
		DEBUG( MTD_DEBUG_LEVEL3,
			"MTD %s(): 0x%.4x 0x%.4x did not match\n",
			__func__,
			unlock_addrs[uaddr].addr1,
			unlock_addrs[uaddr].addr2);
		goto match_done;
	}

	/*
	 * Make sure the ID's dissappear when the device is taken out of
	 * ID mode.  The only time this should fail when it should succeed
	 * is when the ID's are written as data to the same
	 * addresses.  For this rare and unfortunate case the chip
	 * cannot be probed correctly.
	 * FIXME - write a driver that takes all of the chip info as
	 * module parameters, doesn't probe but forces a load.
	 */
	DEBUG( MTD_DEBUG_LEVEL3,
	       "MTD %s(): check ID's disappear when not in ID mode\n",
	       __func__ );
	jedec_reset( base, map, cfi );
	mfr = jedec_read_mfr( map, base, cfi );
	id = jedec_read_id( map, base, cfi );
	if ( mfr == cfi->mfr && id == cfi->id ) {
		DEBUG( MTD_DEBUG_LEVEL3,
		       "MTD %s(): ID 0x%.2x:0x%.2x did not change after reset:\n"
		       "You might need to manually specify JEDEC parameters.\n",
			__func__, cfi->mfr, cfi->id );
		goto match_done;
	}

	/* all tests passed - mark  as success */
	rc = 1;

	/*
	 * Put the device back in ID mode - only need to do this if we
	 * were truly frobbing a real device.
	 */
	DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): return to ID mode\n", __func__ );
2108
	if (cfi->addr_unlock1) {
L
Linus Torvalds 已提交
2109 2110 2111 2112 2113 2114
		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
	}
	cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
	/* FIXME - should have a delay before continuing */

2115
 match_done:
L
Linus Torvalds 已提交
2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133
	return rc;
}


static int jedec_probe_chip(struct map_info *map, __u32 base,
			    unsigned long *chip_map, struct cfi_private *cfi)
{
	int i;
	enum uaddr uaddr_idx = MTD_UADDR_NOT_SUPPORTED;
	u32 probe_offset1, probe_offset2;

 retry:
	if (!cfi->numchips) {
		uaddr_idx++;

		if (MTD_UADDR_UNNECESSARY == uaddr_idx)
			return 0;

2134 2135
		cfi->addr_unlock1 = unlock_addrs[uaddr_idx].addr1 / cfi->device_type;
		cfi->addr_unlock2 = unlock_addrs[uaddr_idx].addr2 / cfi->device_type;
L
Linus Torvalds 已提交
2136 2137 2138 2139 2140 2141 2142 2143
	}

	/* Make certain we aren't probing past the end of map */
	if (base >= map->size) {
		printk(KERN_NOTICE
			"Probe at base(0x%08x) past the end of the map(0x%08lx)\n",
			base, map->size -1);
		return 0;
2144

L
Linus Torvalds 已提交
2145 2146
	}
	/* Ensure the unlock addresses we try stay inside the map */
2147 2148
	probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi);
	probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi);
L
Linus Torvalds 已提交
2149 2150 2151
	if (	((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
		((base + probe_offset2 + map_bankwidth(map)) >= map->size))
		goto retry;
2152

L
Linus Torvalds 已提交
2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164
	/* Reset */
	jedec_reset(base, map, cfi);

	/* Autoselect Mode */
	if(cfi->addr_unlock1) {
		cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, cfi->device_type, NULL);
	}
	cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
	/* FIXME - should have a delay before continuing */

	if (!cfi->numchips) {
2165
		/* This is the first time we're called. Set up the CFI
L
Linus Torvalds 已提交
2166
		   stuff accordingly and return */
2167

L
Linus Torvalds 已提交
2168 2169 2170
		cfi->mfr = jedec_read_mfr(map, base, cfi);
		cfi->id = jedec_read_id(map, base, cfi);
		DEBUG(MTD_DEBUG_LEVEL3,
2171
		      "Search for id:(%02x %02x) interleave(%d) type(%d)\n",
L
Linus Torvalds 已提交
2172
			cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type);
2173
		for (i = 0; i < ARRAY_SIZE(jedec_table); i++) {
L
Linus Torvalds 已提交
2174 2175 2176 2177 2178
			if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) {
				DEBUG( MTD_DEBUG_LEVEL3,
				       "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
				       __func__, cfi->mfr, cfi->id,
				       cfi->addr_unlock1, cfi->addr_unlock2 );
2179
				if (!cfi_jedec_setup(map, cfi, i))
L
Linus Torvalds 已提交
2180 2181 2182 2183 2184 2185
					return 0;
				goto ok_out;
			}
		}
		goto retry;
	} else {
2186 2187
		uint16_t mfr;
		uint16_t id;
L
Linus Torvalds 已提交
2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199

		/* Make sure it is a chip of the same manufacturer and id */
		mfr = jedec_read_mfr(map, base, cfi);
		id = jedec_read_id(map, base, cfi);

		if ((mfr != cfi->mfr) || (id != cfi->id)) {
			printk(KERN_DEBUG "%s: Found different chip or no chip at all (mfr 0x%x, id 0x%x) at 0x%x\n",
			       map->name, mfr, id, base);
			jedec_reset(base, map, cfi);
			return 0;
		}
	}
2200

L
Linus Torvalds 已提交
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220
	/* Check each previous chip locations to see if it's an alias */
	for (i=0; i < (base >> cfi->chipshift); i++) {
		unsigned long start;
		if(!test_bit(i, chip_map)) {
			continue; /* Skip location; no valid chip at this address */
		}
		start = i << cfi->chipshift;
		if (jedec_read_mfr(map, start, cfi) == cfi->mfr &&
		    jedec_read_id(map, start, cfi) == cfi->id) {
			/* Eep. This chip also looks like it's in autoselect mode.
			   Is it an alias for the new one? */
			jedec_reset(start, map, cfi);

			/* If the device IDs go away, it's an alias */
			if (jedec_read_mfr(map, base, cfi) != cfi->mfr ||
			    jedec_read_id(map, base, cfi) != cfi->id) {
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				       map->name, base, start);
				return 0;
			}
2221

L
Linus Torvalds 已提交
2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234
			/* Yes, it's actually got the device IDs as data. Most
			 * unfortunate. Stick the new chip in read mode
			 * too and if it's the same, assume it's an alias. */
			/* FIXME: Use other modes to do a proper check */
			jedec_reset(base, map, cfi);
			if (jedec_read_mfr(map, base, cfi) == cfi->mfr &&
			    jedec_read_id(map, base, cfi) == cfi->id) {
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				       map->name, base, start);
				return 0;
			}
		}
	}
2235

L
Linus Torvalds 已提交
2236 2237 2238 2239
	/* OK, if we got to here, then none of the previous chips appear to
	   be aliases for the current one. */
	set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
	cfi->numchips++;
2240

L
Linus Torvalds 已提交
2241 2242 2243 2244 2245
ok_out:
	/* Put it back into Read Mode */
	jedec_reset(base, map, cfi);

	printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
2246
	       map->name, cfi_interleave(cfi), cfi->device_type*8, base,
L
Linus Torvalds 已提交
2247
	       map->bankwidth*8);
2248

L
Linus Torvalds 已提交
2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288
	return 1;
}

static struct chip_probe jedec_chip_probe = {
	.name = "JEDEC",
	.probe_chip = jedec_probe_chip
};

static struct mtd_info *jedec_probe(struct map_info *map)
{
	/*
	 * Just use the generic probe stuff to call our CFI-specific
	 * chip_probe routine in all the possible permutations, etc.
	 */
	return mtd_do_chip_probe(map, &jedec_chip_probe);
}

static struct mtd_chip_driver jedec_chipdrv = {
	.probe	= jedec_probe,
	.name	= "jedec_probe",
	.module	= THIS_MODULE
};

static int __init jedec_probe_init(void)
{
	register_mtd_chip_driver(&jedec_chipdrv);
	return 0;
}

static void __exit jedec_probe_exit(void)
{
	unregister_mtd_chip_driver(&jedec_chipdrv);
}

module_init(jedec_probe_init);
module_exit(jedec_probe_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Erwin Authried <eauth@softsys.co.at> et al.");
MODULE_DESCRIPTION("Probe code for JEDEC-compliant flash chips");