Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33996
b: refs/heads/master
c: 5b0c5c2
h: refs/heads/master
v: v3
  • Loading branch information
Haavard Skinnemoen authored and Josh Boyer committed Aug 17, 2006
1 parent 99ef5a9 commit fe794b9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b6c0bb3f9621b128011bcd5f65047c73afdde3b
refs/heads/master: 5b0c5c2c0d04c29f85abb485378ba5476c7aeec2
21 changes: 21 additions & 0 deletions trunk/drivers/mtd/chips/cfi_cmdset_0002.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
}
}

/* Atmel chips don't use the same PRI format as AMD chips */
static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
{
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
struct cfi_pri_atmel atmel_pri;

memcpy(&atmel_pri, extp, sizeof(atmel_pri));
memset(extp + 5, 0, sizeof(*extp) - 5);

if (atmel_pri.Features & 0x02)
extp->EraseSuspend = 2;

if (atmel_pri.BottomBoot)
extp->TopBottom = 2;
else
extp->TopBottom = 3;
}

static void fixup_use_secsi(struct mtd_info *mtd, void *param)
{
/* Setup for chips with a secsi area */
Expand Down Expand Up @@ -192,6 +212,7 @@ static struct cfi_fixup cfi_fixup_table[] = {
#if !FORCE_WORD_WRITE
{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
#endif
{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
{ 0, 0, NULL, NULL }
};
static struct cfi_fixup jedec_fixup_table[] = {
Expand Down
13 changes: 13 additions & 0 deletions trunk/include/linux/mtd/cfi.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@ struct cfi_pri_amdstd {
uint8_t TopBottom;
} __attribute__((packed));

/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */

struct cfi_pri_atmel {
uint8_t pri[3];
uint8_t MajorVersion;
uint8_t MinorVersion;
uint8_t Features;
uint8_t BottomBoot;
uint8_t BurstMode;
uint8_t PageMode;
} __attribute__((packed));

struct cfi_pri_query {
uint8_t NumFields;
uint32_t ProtField[1]; /* Not host ordered */
Expand Down Expand Up @@ -464,6 +476,7 @@ struct cfi_fixup {
#define CFI_ID_ANY 0xffff

#define CFI_MFR_AMD 0x0001
#define CFI_MFR_ATMEL 0x001F
#define CFI_MFR_ST 0x0020 /* STMicroelectronics */

void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
Expand Down

0 comments on commit fe794b9

Please sign in to comment.