aboutsummaryrefslogtreecommitdiffstats
path: root/packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch')
-rw-r--r--packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch b/packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch
new file mode 100644
index 0000000000..4884d8a0b3
--- /dev/null
+++ b/packages/linux/linux-2.6.18/mtd-fix-atmel-pri-for-cmdset-0001-and-cmdset-0002.patch
@@ -0,0 +1,99 @@
+Index: linux-2.6.18/drivers/mtd/chips/cfi_cmdset_0001.c
+===================================================================
+--- linux-2.6.18.orig/drivers/mtd/chips/cfi_cmdset_0001.c 2006-12-13 09:58:34.000000000 +0100
++++ linux-2.6.18/drivers/mtd/chips/cfi_cmdset_0001.c 2006-12-13 10:01:35.000000000 +0100
+@@ -47,6 +47,7 @@
+ #define I82802AC 0x00ac
+ #define MANUFACTURER_ST 0x0020
+ #define M50LPW080 0x002F
++#define AT49BV640D 0x02de
+
+ static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
+ static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
+@@ -153,6 +154,47 @@
+ }
+ #endif
+
++/* Atmel chips don't use the same PRI format as Intel 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_intelext *extp = cfi->cmdset_priv;
++ struct cfi_pri_atmel atmel_pri;
++ uint32_t features = 0;
++
++ /* Reverse byteswapping */
++ extp->FeatureSupport = cpu_to_le32(extp->FeatureSupport);
++ extp->BlkStatusRegMask = cpu_to_le16(extp->BlkStatusRegMask);
++ extp->ProtRegAddr = cpu_to_le16(extp->ProtRegAddr);
++
++ memcpy(&atmel_pri, extp, sizeof(atmel_pri));
++ memset((char *)extp + 5, 0, sizeof(*extp) - 5);
++
++ printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
++
++ if (atmel_pri.Features & 0x01) /* chip erase supported */
++ features |= (1<<0);
++ if (atmel_pri.Features & 0x02) /* erase suspend supported */
++ features |= (1<<1);
++ if (atmel_pri.Features & 0x04) /* program suspend supported */
++ features |= (1<<2);
++ if (atmel_pri.Features & 0x08) /* simultaneous operations supported */
++ features |= (1<<9);
++ if (atmel_pri.Features & 0x20) /* page mode read supported */
++ features |= (1<<7);
++ if (atmel_pri.Features & 0x40) /* queued erase supported */
++ features |= (1<<4);
++ if (atmel_pri.Features & 0x80) /* Protection bits supported */
++ features |= (1<<6);
++
++ extp->FeatureSupport = features;
++
++ /* burst write mode not supported */
++ cfi->cfiq->BufWriteTimeoutTyp = 0;
++ cfi->cfiq->BufWriteTimeoutMax = 0;
++}
++
+ #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
+ /* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
+ static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
+@@ -221,6 +263,7 @@
+ }
+
+ static struct cfi_fixup cfi_fixup_table[] = {
++ { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
+ #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
+ { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
+ #endif
+Index: linux-2.6.18/drivers/mtd/chips/cfi_cmdset_0002.c
+===================================================================
+--- linux-2.6.18.orig/drivers/mtd/chips/cfi_cmdset_0002.c 2006-12-13 10:01:34.000000000 +0100
++++ linux-2.6.18/drivers/mtd/chips/cfi_cmdset_0002.c 2006-12-15 10:19:22.000000000 +0100
+@@ -184,6 +184,10 @@
+ extp->TopBottom = 2;
+ else
+ extp->TopBottom = 3;
++
++ /* burst write mode not supported */
++ cfi->cfiq->BufWriteTimeoutTyp = 0;
++ cfi->cfiq->BufWriteTimeoutMax = 0;
+ }
+
+ static void fixup_use_secsi(struct mtd_info *mtd, void *param)
+@@ -216,6 +220,7 @@
+ }
+
+ static struct cfi_fixup cfi_fixup_table[] = {
++ { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
+ #ifdef AMD_BOOTLOC_BUG
+ { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL },
+ #endif
+@@ -228,7 +233,6 @@
+ #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[] = {