]> git.sur5r.net Git - openocd/commitdiff
cfi: disable buffer writes for M29W128G
authorSpencer Oliver <ntfreak@users.sourceforge.net>
Wed, 8 Dec 2010 17:11:07 +0000 (17:11 +0000)
committerSpencer Oliver <ntfreak@users.sourceforge.net>
Fri, 10 Dec 2010 13:36:09 +0000 (13:36 +0000)
For some reason buffer writes for the M29W128G do not work reliably,
so disable them.

See:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=504a3e72208fc6a65924426ff5693982590bccdc

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
src/flash/nor/cfi.c
src/flash/nor/cfi.h

index 09caa2eb637f1c11684e0dccd2e9d2f6546f5448..4165166f2b13b52b7b807b2a9b480fe9dd2ff6f7 100644 (file)
@@ -46,9 +46,10 @@ static struct cfi_unlock_addresses cfi_unlock_addresses[] =
 };
 
 /* CFI fixups foward declarations */
-static void cfi_fixup_0002_erase_regions(struct flash_bank *flash, void *param);
-static void cfi_fixup_0002_unlock_addresses(struct flash_bank *flash, void *param);
-static void cfi_fixup_reversed_erase_regions(struct flash_bank *flash, void *param);
+static void cfi_fixup_0002_erase_regions(struct flash_bank *bank, void *param);
+static void cfi_fixup_0002_unlock_addresses(struct flash_bank *bank, void *param);
+static void cfi_fixup_reversed_erase_regions(struct flash_bank *bank, void *param);
+static void cfi_fixup_0002_write_buffer(struct flash_bank *bank, void *param);
 
 /* fixup after reading cmdset 0002 primary query table */
 static const struct cfi_fixup cfi_0002_fixups[] = {
@@ -59,13 +60,14 @@ static const struct cfi_fixup cfi_0002_fixups[] = {
        {CFI_MFR_SST, 0x2780, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_5555_2AAA]},
        {CFI_MFR_SST, 0x236d, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]},
        {CFI_MFR_ATMEL, 0x00C8, cfi_fixup_reversed_erase_regions, NULL},
-       {CFI_MFR_ST,  0x22C4, cfi_fixup_reversed_erase_regions, NULL}, /* M29W160ET */
+       {CFI_MFR_ST, 0x22C4, cfi_fixup_reversed_erase_regions, NULL}, /* M29W160ET */
        {CFI_MFR_FUJITSU, 0x22ea, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]},
        {CFI_MFR_FUJITSU, 0x226b, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_5555_2AAA]},
        {CFI_MFR_AMIC, 0xb31a, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]},
        {CFI_MFR_MX, 0x225b, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]},
        {CFI_MFR_AMD, 0x225b, cfi_fixup_0002_unlock_addresses, &cfi_unlock_addresses[CFI_UNLOCK_555_2AA]},
        {CFI_MFR_ANY, CFI_ID_ANY, cfi_fixup_0002_erase_regions, NULL},
+       {CFI_MFR_ST, 0x227E, cfi_fixup_0002_write_buffer, NULL}, /* M29W128G */
        {0, 0, NULL, NULL}
 };
 
@@ -2528,6 +2530,7 @@ static int cfi_probe(struct flash_bank *bank)
                retval = cfi_query_u8(bank, 0, 0x1e, &cfi_info->vpp_max);
                if (retval != ERROR_OK)
                        return retval;
+
                retval = cfi_query_u8(bank, 0, 0x1f, &cfi_info->word_write_timeout_typ);
                if (retval != ERROR_OK)
                        return retval;
@@ -2924,6 +2927,14 @@ static int get_cfi_info(struct flash_bank *bank, char *buf, int buf_size)
        return ERROR_OK;
 }
 
+static void cfi_fixup_0002_write_buffer(struct flash_bank *bank, void *param)
+{
+       struct cfi_flash_bank *cfi_info = bank->driver_priv;
+
+       /* disable write buffer for M29W128G */
+       cfi_info->buf_write_timeout_typ = 0;
+}
+
 struct flash_driver cfi_flash = {
        .name = "cfi",
        .flash_bank_command = cfi_flash_bank_command,
index 099a61377cdd894e89611b809cbd14c76cc12162..34807ee2f49c5dc83b6d3e4dd26f05c4ec6d159c 100644 (file)
@@ -150,7 +150,7 @@ struct cfi_fixup
 {
        uint16_t mfr;
        uint16_t id;
-       void (*fixup)(struct flash_bank *flash, void *param);
+       void (*fixup)(struct flash_bank *bank, void *param);
        void *param;
 };