kinetis flash: use longword write when writing into pflash
[openocd.git] / src / flash / nor / non_cfi.c
index 7e73afa1c9ae8a4713ab6eda795acb0b3935760e..8acc3cc44a37fe5f10a3ab17c9c9842e175e1f15 100644 (file)
@@ -90,6 +90,20 @@ static struct non_cfi non_cfi_flashes[] = {
                        ERASE_REGION(128, 4*KB)
                }
        },
+       {
+               .mfr = CFI_MFR_AMD,             /* Spansion AM29LV040B */
+               .id = 0x4f,
+               .pri_id = 0x02,
+               .dev_size = 512*KB,
+               .interface_desc = 0x0,          /* x8 only device */
+               .max_buf_write_size = 0x0,
+               .status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
+               .num_erase_regions = 1,
+               .erase_region_info =
+               {
+                       ERASE_REGION(8, 64*KB)
+               }
+       },
        {
                .mfr = CFI_MFR_SST,
                .id = 0x2780,
@@ -187,6 +201,20 @@ static struct non_cfi non_cfi_flashes[] = {
                        ERASE_REGION(512, 4*KB)
                }
        },
+       {
+               .mfr = CFI_MFR_SST,
+               .id = 0x274b,                           /* SST39WF1601 */
+               .pri_id = 0x02,
+               .dev_size = 2*MB,
+               .interface_desc = 0x2,          /* x8 or x16 device with nBYTE */
+               .max_buf_write_size = 0x0,
+               .status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
+               .num_erase_regions = 1,
+               .erase_region_info =
+               {
+                       ERASE_REGION(512, 4*KB)
+               }
+       },
        {
                .mfr = CFI_MFR_SST,
                .id = 0x234a,                           /* SST39VF1602 */
@@ -230,6 +258,20 @@ static struct non_cfi non_cfi_flashes[] = {
                }
        },
        {
+       .mfr = CFI_MFR_SST,
+           .id = 0x236d,               /* SST39VF6401B */
+           .pri_id = 0x02,
+           .dev_size = 8*MB,
+           .interface_desc = 0x2,      /* x8 or x16 device with nBYTE */
+           .max_buf_write_size = 0x0,
+           .status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
+           .num_erase_regions = 1,
+           .erase_region_info =
+           {
+               ERASE_REGION(2048, 4*KB)
+           }
+       },
+       {
                .mfr = CFI_MFR_AMD,
                .id = 0x22ab,                           /* AM29F400BB */
                .pri_id = 0x02,
@@ -280,6 +322,40 @@ static struct non_cfi non_cfi_flashes[] = {
                        ERASE_REGION(15, 64*KB)
                }
        },
+   {
+               .mfr = CFI_MFR_FUJITSU,
+               .id = 0x22ea,                           /* MBM29SL800TE */
+               .pri_id = 0x02,
+               .dev_size = 1*MB,
+               .interface_desc = 0x2,          /* x8 or x16 device with nBYTE */
+               .max_buf_write_size = 0x0,
+               .status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
+               .num_erase_regions = 4,
+               .erase_region_info =
+               {
+                       ERASE_REGION(15, 64*KB),
+                       ERASE_REGION(1,  32*KB),
+                       ERASE_REGION(2,  8*KB),
+                       ERASE_REGION(1,  16*KB)
+               }
+       },
+       {
+               .mfr = CFI_MFR_FUJITSU,
+               .id = 0xba,                             /* 29LV400BC */
+               .pri_id = 0x02,
+               .dev_size = 512*KB,
+               .interface_desc = 0x1,          /* x8 or x16 device w/ nBYTE */
+               .max_buf_write_size = 0x00,
+               .status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
+               .num_erase_regions = 4,
+               .erase_region_info =
+               {
+                       ERASE_REGION(1, 16*KB),
+                       ERASE_REGION(2,  8*KB),
+                       ERASE_REGION(1, 32*KB),
+                       ERASE_REGION(7, 64*KB)
+               }
+       },
        {
                .mfr = CFI_MFR_AMIC,
                .id = 0xb31a,                           /* A29L800A */
@@ -349,6 +425,23 @@ static struct non_cfi non_cfi_flashes[] = {
                        ERASE_REGION(1, 16*KB)
                }
        },
+       {
+               .mfr = CFI_MFR_EON,
+               .id = 0x225b,                           /* EN29LV800BB */
+               .pri_id = 0x02,
+               .dev_size = 1*MB,
+               .interface_desc = 0x2,          /* x8 or x16 device with nBYTE */
+               .max_buf_write_size = 0x0,
+               .status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
+               .num_erase_regions = 4,
+               .erase_region_info =
+               {
+                       ERASE_REGION(1, 16*KB),
+                       ERASE_REGION(2,  8*KB),
+                       ERASE_REGION(1, 32*KB),
+                       ERASE_REGION(15, 64*KB)
+               }
+       },
        {
                .mfr = CFI_MFR_ATMEL,
                .id = 0x00c0,                           /* Atmel 49BV1614 */
@@ -406,13 +499,19 @@ static struct non_cfi non_cfi_flashes[] = {
 
 void cfi_fixup_non_cfi(struct flash_bank *bank)
 {
+       unsigned int mask;
        struct cfi_flash_bank *cfi_info = bank->driver_priv;
        struct non_cfi *non_cfi = non_cfi_flashes;
 
+       if(cfi_info->x16_as_x8)
+               mask = 0xFF;
+       else
+               mask = 0xFFFF;
+
        for (non_cfi = non_cfi_flashes; non_cfi->mfr; non_cfi++)
        {
                if ((cfi_info->manufacturer == non_cfi->mfr)
-                       && (cfi_info->device_id == non_cfi->id))
+                       && (cfi_info->device_id == (non_cfi->id & mask)))
                {
                        break;
                }
@@ -429,10 +528,12 @@ void cfi_fixup_non_cfi(struct flash_bank *bank)
        cfi_info->vcc_max = 0x0;
        cfi_info->vpp_min = 0x0;
        cfi_info->vpp_max = 0x0;
-       cfi_info->word_write_timeout_typ = 0x0;
-       cfi_info->buf_write_timeout_typ = 0x0;
-       cfi_info->block_erase_timeout_typ = 0x0;
-       cfi_info->chip_erase_timeout_typ = 0x0;
+       /* these are used for timeouts - use vales that should be long enough
+          for normal operation. */
+       cfi_info->word_write_timeout_typ = 0x0a;
+       cfi_info->buf_write_timeout_typ = 0x0d;
+       cfi_info->block_erase_timeout_typ = 0x0d;
+       cfi_info->chip_erase_timeout_typ = 0x10;
        cfi_info->word_write_timeout_max = 0x0;
        cfi_info->buf_write_timeout_max = 0x0;
        cfi_info->block_erase_timeout_max = 0x0;
@@ -452,7 +553,11 @@ void cfi_fixup_non_cfi(struct flash_bank *bank)
        cfi_info->max_buf_write_size = non_cfi->max_buf_write_size;
        cfi_info->status_poll_mask = non_cfi->status_poll_mask;
        cfi_info->num_erase_regions = non_cfi->num_erase_regions;
-       cfi_info->erase_region_info = non_cfi->erase_region_info;
+       size_t erase_region_info_size = sizeof(*cfi_info->erase_region_info) *
+                       cfi_info->num_erase_regions;
+       cfi_info->erase_region_info = malloc(erase_region_info_size);
+       memcpy(cfi_info->erase_region_info,
+                       non_cfi->erase_region_info, erase_region_info_size);
        cfi_info->dev_size = non_cfi->dev_size;
 
        if (cfi_info->pri_id == 0x2)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)