diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2006-08-09 04:54:44 -0400 |
---|---|---|
committer | Josh Boyer <jwboyer@gmail.com> | 2006-08-16 21:13:06 -0400 |
commit | 5b0c5c2c0d04c29f85abb485378ba5476c7aeec2 (patch) | |
tree | c83b1e4f3947b23c24b6cacb2cc1ac8f2f0cd012 /drivers/mtd/chips/cfi_cmdset_0002.c | |
parent | 0b6c0bb3f9621b128011bcd5f65047c73afdde3b (diff) |
MTD: Convert Atmel PRI information to AMD format
Atmel flash chips don't have PRI information in the same format as
AMD flash chips. This patch installs a fixup for all Atmel chips that
converts the relevant PRI fields into AMD format.
Only the fields that are actually used by the command set is actually
converted. The rest are initialized to zero (which should be safe)
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
Diffstat (limited to 'drivers/mtd/chips/cfi_cmdset_0002.c')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 9885726a16e4..8901c4412daf 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -161,6 +161,26 @@ static void fixup_use_write_buffers(struct mtd_info *mtd, void *param) | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | /* Atmel chips don't use the same PRI format as AMD chips */ | ||
165 | static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param) | ||
166 | { | ||
167 | struct map_info *map = mtd->priv; | ||
168 | struct cfi_private *cfi = map->fldrv_priv; | ||
169 | struct cfi_pri_amdstd *extp = cfi->cmdset_priv; | ||
170 | struct cfi_pri_atmel atmel_pri; | ||
171 | |||
172 | memcpy(&atmel_pri, extp, sizeof(atmel_pri)); | ||
173 | memset(extp + 5, 0, sizeof(*extp) - 5); | ||
174 | |||
175 | if (atmel_pri.Features & 0x02) | ||
176 | extp->EraseSuspend = 2; | ||
177 | |||
178 | if (atmel_pri.BottomBoot) | ||
179 | extp->TopBottom = 2; | ||
180 | else | ||
181 | extp->TopBottom = 3; | ||
182 | } | ||
183 | |||
164 | static void fixup_use_secsi(struct mtd_info *mtd, void *param) | 184 | static void fixup_use_secsi(struct mtd_info *mtd, void *param) |
165 | { | 185 | { |
166 | /* Setup for chips with a secsi area */ | 186 | /* Setup for chips with a secsi area */ |
@@ -192,6 +212,7 @@ static struct cfi_fixup cfi_fixup_table[] = { | |||
192 | #if !FORCE_WORD_WRITE | 212 | #if !FORCE_WORD_WRITE |
193 | { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, }, | 213 | { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, }, |
194 | #endif | 214 | #endif |
215 | { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL }, | ||
195 | { 0, 0, NULL, NULL } | 216 | { 0, 0, NULL, NULL } |
196 | }; | 217 | }; |
197 | static struct cfi_fixup jedec_fixup_table[] = { | 218 | static struct cfi_fixup jedec_fixup_table[] = { |