non-CFI flash code uses data from CFI structures. Make sure that timeouts are filled...
[fw/openocd] / src / flash / nor / non_cfi.c
index b49e4415062ba9e2476d313f401bf3c0ded19486..b6739043ce969704199e2a1a9fdd4252f2a0efbc 100644 (file)
@@ -230,6 +230,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 +294,23 @@ 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 */
@@ -446,10 +477,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;
@@ -469,7 +502,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)