diff options
author | Hans-Christian Egtvedt <hcegtvedt@atmel.com> | 2007-10-30 11:33:07 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-10-30 12:06:42 -0400 |
commit | d10a39d1a580db005d206fb6527a60fd9800c9fd (patch) | |
tree | 2e984487b1a90e2269f8fc4e41b88adb95b8fadf /drivers/mtd/chips/cfi_cmdset_0001.c | |
parent | 4edaf56e0f8a6f71e3361bf74e3dc835811761e6 (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/cfi_cmdset_0001.c')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 43 |
1 files changed, 43 insertions, 0 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 | ||
54 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 55 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
55 | static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 56 | static 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 */ | ||
162 | static 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 */ |
162 | static void fixup_intel_strataflash(struct mtd_info *mtd, void* param) | 204 | static 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 | ||
236 | static struct cfi_fixup cfi_fixup_table[] = { | 278 | static 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 |