177
178
cfi->cfi_mode = CFI_MODE_CFI;
180
cfi->sector_erase_cmd = CMD(0x30);
179
182
/* Read the CFI info structure */
180
183
xip_disable_qry(base, map, cfi);
181
184
for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
182
185
((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor);
184
/* Note we put the device back into Read Mode BEFORE going into Auto
185
* Select Mode, as some devices support nesting of modes, others
186
* don't. This way should always work.
187
* On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
188
* so should be treated as nops or illegal (and so put the device
189
* back into Read Mode, which is a nop in this case).
191
cfi_send_gen_cmd(0xf0, 0, base, map, cfi, cfi->device_type, NULL);
192
cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
193
cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
194
cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
195
cfi->mfr = cfi_read_query16(map, base);
196
cfi->id = cfi_read_query16(map, base + ofs_factor);
198
/* Get AMD/Spansion extended JEDEC ID */
199
if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
200
cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
201
cfi_read_query(map, base + 0xf * ofs_factor);
203
/* Put it back into Read Mode */
204
cfi_qry_mode_off(base, map, cfi);
205
xip_allowed(base, map);
207
187
/* Do any necessary byteswapping */
208
188
cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
231
printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
211
if (cfi->cfiq->P_ID == P_ID_SST_OLD) {
212
addr_unlock1 = 0x5555;
213
addr_unlock2 = 0x2AAA;
217
* Note we put the device back into Read Mode BEFORE going into Auto
218
* Select Mode, as some devices support nesting of modes, others
219
* don't. This way should always work.
220
* On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
221
* so should be treated as nops or illegal (and so put the device
222
* back into Read Mode, which is a nop in this case).
224
cfi_send_gen_cmd(0xf0, 0, base, map, cfi, cfi->device_type, NULL);
225
cfi_send_gen_cmd(0xaa, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
226
cfi_send_gen_cmd(0x55, addr_unlock2, base, map, cfi, cfi->device_type, NULL);
227
cfi_send_gen_cmd(0x90, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
228
cfi->mfr = cfi_read_query16(map, base);
229
cfi->id = cfi_read_query16(map, base + ofs_factor);
231
/* Get AMD/Spansion extended JEDEC ID */
232
if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
233
cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
234
cfi_read_query(map, base + 0xf * ofs_factor);
236
/* Put it back into Read Mode */
237
cfi_qry_mode_off(base, map, cfi);
238
xip_allowed(base, map);
240
printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank. Manufacturer ID %#08x Chip ID %#08x\n",
232
241
map->name, cfi->interleave, cfi->device_type*8, base,
242
map->bankwidth*8, cfi->mfr, cfi->id);