~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/mtd/chips/cfi_probe.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
        __u32 base = 0;
159
159
        int num_erase_regions = cfi_read_query(map, base + (0x10 + 28)*ofs_factor);
160
160
        int i;
 
161
        int addr_unlock1 = 0x555, addr_unlock2 = 0x2AA;
161
162
 
162
163
        xip_enable(base, map, cfi);
163
164
#ifdef DEBUG_CFI
176
177
 
177
178
        cfi->cfi_mode = CFI_MODE_CFI;
178
179
 
 
180
        cfi->sector_erase_cmd = CMD(0x30);
 
181
 
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);
183
186
 
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).
190
 
         */
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);
197
 
 
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);
202
 
 
203
 
        /* Put it back into Read Mode */
204
 
        cfi_qry_mode_off(base, map, cfi);
205
 
        xip_allowed(base, map);
206
 
 
207
187
        /* Do any necessary byteswapping */
208
188
        cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
209
189
 
228
208
#endif
229
209
        }
230
210
 
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;
 
214
        }
 
215
 
 
216
        /*
 
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).
 
223
         */
 
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);
 
230
 
 
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);
 
235
 
 
236
        /* Put it back into Read Mode */
 
237
        cfi_qry_mode_off(base, map, cfi);
 
238
        xip_allowed(base, map);
 
239
 
 
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,
233
 
               map->bankwidth*8);
 
242
               map->bankwidth*8, cfi->mfr, cfi->id);
234
243
 
235
244
        return 1;
236
245
}
269
278
        case P_ID_SST_PAGE:
270
279
                return "SST Page Write";
271
280
 
 
281
        case P_ID_SST_OLD:
 
282
                return "SST 39VF160x/39VF320x";
 
283
 
272
284
        case P_ID_INTEL_PERFORMANCE:
273
285
                return "Intel Performance Code";
274
286