aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips/cfi_probe.c
diff options
context:
space:
mode:
authorGuillaume LECERF <glecerf@gmail.com>2010-04-24 11:57:52 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-05-13 20:07:42 -0400
commit8473044d644553ca3c939249490d1c5ef5f6d4e6 (patch)
treefad1fc267cd1309de9231f6988aca24e35773cc0 /drivers/mtd/chips/cfi_probe.c
parent010937ec9a550e2df97f87252a9d12d8a534c6d8 (diff)
mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members
Move the code to enter Auto Select Mode down to be able to use cfi->cfiq members to add support for chips using alternative sequence / unlock addresses. Signed-off-by: Guillaume LECERF <glecerf@gmail.com> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/chips/cfi_probe.c')
-rw-r--r--drivers/mtd/chips/cfi_probe.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index e63e6749429a..f657d16cb98c 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -181,29 +181,6 @@ static int __xipram cfi_chip_setup(struct map_info *map,
181 for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++) 181 for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
182 ((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor); 182 ((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor);
183 183
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 /* Do any necessary byteswapping */ 184 /* Do any necessary byteswapping */
208 cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID); 185 cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
209 186
@@ -228,6 +205,30 @@ static int __xipram cfi_chip_setup(struct map_info *map,
228#endif 205#endif
229 } 206 }
230 207
208 /*
209 * Note we put the device back into Read Mode BEFORE going into Auto
210 * Select Mode, as some devices support nesting of modes, others
211 * don't. This way should always work.
212 * On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
213 * so should be treated as nops or illegal (and so put the device
214 * back into Read Mode, which is a nop in this case).
215 */
216 cfi_send_gen_cmd(0xf0, 0, base, map, cfi, cfi->device_type, NULL);
217 cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
218 cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
219 cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
220 cfi->mfr = cfi_read_query16(map, base);
221 cfi->id = cfi_read_query16(map, base + ofs_factor);
222
223 /* Get AMD/Spansion extended JEDEC ID */
224 if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
225 cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
226 cfi_read_query(map, base + 0xf * ofs_factor);
227
228 /* Put it back into Read Mode */
229 cfi_qry_mode_off(base, map, cfi);
230 xip_allowed(base, map);
231
231 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n", 232 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
232 map->name, cfi->interleave, cfi->device_type*8, base, 233 map->name, cfi->interleave, cfi->device_type*8, base,
233 map->bankwidth*8); 234 map->bankwidth*8);