aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hcegtvedt@atmel.com>2007-10-30 11:33:07 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-30 12:06:42 -0400
commitd10a39d1a580db005d206fb6527a60fd9800c9fd (patch)
tree2e984487b1a90e2269f8fc4e41b88adb95b8fadf /drivers/mtd/chips
parent4edaf56e0f8a6f71e3361bf74e3dc835811761e6 (diff)
[MTD] [NOR] More CFI fixups for Atmel chips
Convert CFI tables from Atmel cmdset_0001 chips to Intel format and set BufWrite timeouts to 0 for Atmel cmdset_0001 and cmdset_0002 chips. Some chips may indicate support for buffered writes even though they only support dual-word writes. The CFI fixup must run before fixup_use_write_buffers for this to work. Signed-off-by: HÃ¥vard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c43
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c6
2 files changed, 48 insertions, 1 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index a9eb1c516247..da851c217fc3 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -50,6 +50,7 @@
50#define I82802AC 0x00ac 50#define I82802AC 0x00ac
51#define MANUFACTURER_ST 0x0020 51#define MANUFACTURER_ST 0x0020
52#define M50LPW080 0x002F 52#define M50LPW080 0x002F
53#define AT49BV640D 0x02de
53 54
54static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 55static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
55static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 56static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -157,6 +158,47 @@ static void cfi_tell_features(struct cfi_pri_intelext *extp)
157} 158}
158#endif 159#endif
159 160
161/* Atmel chips don't use the same PRI format as Intel chips */
162static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
163{
164 struct map_info *map = mtd->priv;
165 struct cfi_private *cfi = map->fldrv_priv;
166 struct cfi_pri_intelext *extp = cfi->cmdset_priv;
167 struct cfi_pri_atmel atmel_pri;
168 uint32_t features = 0;
169
170 /* Reverse byteswapping */
171 extp->FeatureSupport = cpu_to_le32(extp->FeatureSupport);
172 extp->BlkStatusRegMask = cpu_to_le16(extp->BlkStatusRegMask);
173 extp->ProtRegAddr = cpu_to_le16(extp->ProtRegAddr);
174
175 memcpy(&atmel_pri, extp, sizeof(atmel_pri));
176 memset((char *)extp + 5, 0, sizeof(*extp) - 5);
177
178 printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
179
180 if (atmel_pri.Features & 0x01) /* chip erase supported */
181 features |= (1<<0);
182 if (atmel_pri.Features & 0x02) /* erase suspend supported */
183 features |= (1<<1);
184 if (atmel_pri.Features & 0x04) /* program suspend supported */
185 features |= (1<<2);
186 if (atmel_pri.Features & 0x08) /* simultaneous operations supported */
187 features |= (1<<9);
188 if (atmel_pri.Features & 0x20) /* page mode read supported */
189 features |= (1<<7);
190 if (atmel_pri.Features & 0x40) /* queued erase supported */
191 features |= (1<<4);
192 if (atmel_pri.Features & 0x80) /* Protection bits supported */
193 features |= (1<<6);
194
195 extp->FeatureSupport = features;
196
197 /* burst write mode not supported */
198 cfi->cfiq->BufWriteTimeoutTyp = 0;
199 cfi->cfiq->BufWriteTimeoutMax = 0;
200}
201
160#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE 202#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
161/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */ 203/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
162static void fixup_intel_strataflash(struct mtd_info *mtd, void* param) 204static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
@@ -234,6 +276,7 @@ static void fixup_use_powerup_lock(struct mtd_info *mtd, void *param)
234} 276}
235 277
236static struct cfi_fixup cfi_fixup_table[] = { 278static struct cfi_fixup cfi_fixup_table[] = {
279 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
237#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE 280#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
238 { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL }, 281 { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
239#endif 282#endif
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 389acc600f5e..571226eefeb8 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -185,6 +185,10 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
185 extp->TopBottom = 2; 185 extp->TopBottom = 2;
186 else 186 else
187 extp->TopBottom = 3; 187 extp->TopBottom = 3;
188
189 /* burst write mode not supported */
190 cfi->cfiq->BufWriteTimeoutTyp = 0;
191 cfi->cfiq->BufWriteTimeoutMax = 0;
188} 192}
189 193
190static void fixup_use_secsi(struct mtd_info *mtd, void *param) 194static void fixup_use_secsi(struct mtd_info *mtd, void *param)
@@ -217,6 +221,7 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
217} 221}
218 222
219static struct cfi_fixup cfi_fixup_table[] = { 223static struct cfi_fixup cfi_fixup_table[] = {
224 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
220#ifdef AMD_BOOTLOC_BUG 225#ifdef AMD_BOOTLOC_BUG
221 { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL }, 226 { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL },
222#endif 227#endif
@@ -229,7 +234,6 @@ static struct cfi_fixup cfi_fixup_table[] = {
229#if !FORCE_WORD_WRITE 234#if !FORCE_WORD_WRITE
230 { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, }, 235 { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
231#endif 236#endif
232 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
233 { 0, 0, NULL, NULL } 237 { 0, 0, NULL, NULL }
234}; 238};
235static struct cfi_fixup jedec_fixup_table[] = { 239static struct cfi_fixup jedec_fixup_table[] = {