aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips/cfi_cmdset_0001.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/chips/cfi_cmdset_0001.c')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e7563a9872d0..5fbf29e1e64f 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -43,15 +43,17 @@
43// debugging, turns off buffer write mode if set to 1 43// debugging, turns off buffer write mode if set to 1
44#define FORCE_WORD_WRITE 0 44#define FORCE_WORD_WRITE 0
45 45
46#define MANUFACTURER_INTEL 0x0089 46/* Intel chips */
47#define I82802AB 0x00ad 47#define I82802AB 0x00ad
48#define I82802AC 0x00ac 48#define I82802AC 0x00ac
49#define PF38F4476 0x881c 49#define PF38F4476 0x881c
50#define MANUFACTURER_ST 0x0020 50/* STMicroelectronics chips */
51#define M50LPW080 0x002F 51#define M50LPW080 0x002F
52#define M50FLW080A 0x0080 52#define M50FLW080A 0x0080
53#define M50FLW080B 0x0081 53#define M50FLW080B 0x0081
54/* Atmel chips */
54#define AT49BV640D 0x02de 55#define AT49BV640D 0x02de
56#define AT49BV640DT 0x02db
55 57
56static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 58static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
57static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 59static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -199,6 +201,16 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
199 cfi->cfiq->BufWriteTimeoutMax = 0; 201 cfi->cfiq->BufWriteTimeoutMax = 0;
200} 202}
201 203
204static void fixup_at49bv640dx_lock(struct mtd_info *mtd, void *param)
205{
206 struct map_info *map = mtd->priv;
207 struct cfi_private *cfi = map->fldrv_priv;
208 struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
209
210 cfip->FeatureSupport |= (1 << 5);
211 mtd->flags |= MTD_POWERUP_LOCK;
212}
213
202#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE 214#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
203/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */ 215/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
204static void fixup_intel_strataflash(struct mtd_info *mtd, void* param) 216static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
@@ -283,6 +295,8 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd, void *param)
283 295
284static struct cfi_fixup cfi_fixup_table[] = { 296static struct cfi_fixup cfi_fixup_table[] = {
285 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL }, 297 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
298 { CFI_MFR_ATMEL, AT49BV640D, fixup_at49bv640dx_lock, NULL },
299 { CFI_MFR_ATMEL, AT49BV640DT, fixup_at49bv640dx_lock, NULL },
286#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE 300#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
287 { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL }, 301 { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
288#endif 302#endif
@@ -294,16 +308,16 @@ static struct cfi_fixup cfi_fixup_table[] = {
294#endif 308#endif
295 { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct, NULL }, 309 { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct, NULL },
296 { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb, NULL }, 310 { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb, NULL },
297 { MANUFACTURER_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock, NULL, }, 311 { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock, NULL, },
298 { 0, 0, NULL, NULL } 312 { 0, 0, NULL, NULL }
299}; 313};
300 314
301static struct cfi_fixup jedec_fixup_table[] = { 315static struct cfi_fixup jedec_fixup_table[] = {
302 { MANUFACTURER_INTEL, I82802AB, fixup_use_fwh_lock, NULL, }, 316 { CFI_MFR_INTEL, I82802AB, fixup_use_fwh_lock, NULL, },
303 { MANUFACTURER_INTEL, I82802AC, fixup_use_fwh_lock, NULL, }, 317 { CFI_MFR_INTEL, I82802AC, fixup_use_fwh_lock, NULL, },
304 { MANUFACTURER_ST, M50LPW080, fixup_use_fwh_lock, NULL, }, 318 { CFI_MFR_ST, M50LPW080, fixup_use_fwh_lock, NULL, },
305 { MANUFACTURER_ST, M50FLW080A, fixup_use_fwh_lock, NULL, }, 319 { CFI_MFR_ST, M50FLW080A, fixup_use_fwh_lock, NULL, },
306 { MANUFACTURER_ST, M50FLW080B, fixup_use_fwh_lock, NULL, }, 320 { CFI_MFR_ST, M50FLW080B, fixup_use_fwh_lock, NULL, },
307 { 0, 0, NULL, NULL } 321 { 0, 0, NULL, NULL }
308}; 322};
309static struct cfi_fixup fixup_table[] = { 323static struct cfi_fixup fixup_table[] = {
@@ -319,7 +333,7 @@ static struct cfi_fixup fixup_table[] = {
319static void cfi_fixup_major_minor(struct cfi_private *cfi, 333static void cfi_fixup_major_minor(struct cfi_private *cfi,
320 struct cfi_pri_intelext *extp) 334 struct cfi_pri_intelext *extp)
321{ 335{
322 if (cfi->mfr == MANUFACTURER_INTEL && 336 if (cfi->mfr == CFI_MFR_INTEL &&
323 cfi->id == PF38F4476 && extp->MinorVersion == '3') 337 cfi->id == PF38F4476 && extp->MinorVersion == '3')
324 extp->MinorVersion = '1'; 338 extp->MinorVersion = '1';
325} 339}
@@ -2235,7 +2249,7 @@ static int cfi_intelext_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
2235 2249
2236 /* Some chips have OTP located in the _top_ partition only. 2250 /* Some chips have OTP located in the _top_ partition only.
2237 For example: Intel 28F256L18T (T means top-parameter device) */ 2251 For example: Intel 28F256L18T (T means top-parameter device) */
2238 if (cfi->mfr == MANUFACTURER_INTEL) { 2252 if (cfi->mfr == CFI_MFR_INTEL) {
2239 switch (cfi->id) { 2253 switch (cfi->id) {
2240 case 0x880b: 2254 case 0x880b:
2241 case 0x880c: 2255 case 0x880c:
@@ -2564,6 +2578,7 @@ static int cfi_intelext_reset(struct mtd_info *mtd)
2564 if (!ret) { 2578 if (!ret) {
2565 map_write(map, CMD(0xff), chip->start); 2579 map_write(map, CMD(0xff), chip->start);
2566 chip->state = FL_SHUTDOWN; 2580 chip->state = FL_SHUTDOWN;
2581 put_chip(map, chip, chip->start);
2567 } 2582 }
2568 spin_unlock(chip->mutex); 2583 spin_unlock(chip->mutex);
2569 } 2584 }