Skip to content

Commit 8dbaea4

Browse files
Hans-Christian EgtvedtDavid Woodhouse
authored andcommitted
mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
This patch sets the MTD_POWERUP_LOCK flag for AT49BV640D and AT49BV640DT devices, since the devices are locked when powered up and needs to be unlocked before interfaced. Quote datasheet; "At power-up and reset, all sectors have their Softlock protection mode enabled.". Tested on AVR32 hardware platform with an AT49BV640D flash device. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 35016dd commit 8dbaea4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎drivers/mtd/chips/cfi_cmdset_0001.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
#define M50LPW080 0x002F
5252
#define M50FLW080A 0x0080
5353
#define M50FLW080B 0x0081
54+
/* Atmel chips */
5455
#define AT49BV640D 0x02de
56+
#define AT49BV640DT 0x02db
5557

5658
static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
5759
static 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)
199201
cfi->cfiq->BufWriteTimeoutMax = 0;
200202
}
201203

204+
static 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+
202214
#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
203215
/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
204216
static 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)
283295

284296
static struct cfi_fixup cfi_fixup_table[] = {
285297
{ 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 },
286300
#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
287301
{ CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
288302
#endif

0 commit comments

Comments
 (0)