flash: efm32: Add support for EZR32LG and EZR32WG.
[openocd.git] / src / flash / nor / efm32.c
index 35c0732089a40cbcf57513801f66da81d57293d5..fa45ea131f9316793cf53d4c5b84e7831c7cac1b 100644 (file)
@@ -47,6 +47,8 @@
 #define EFM_FAMILY_ID_LEOPARD_GECKO     74
 #define EFM_FAMILY_ID_WONDER_GECKO      75
 #define EFM_FAMILY_ID_ZERO_GECKO        76
 #define EFM_FAMILY_ID_LEOPARD_GECKO     74
 #define EFM_FAMILY_ID_WONDER_GECKO      75
 #define EFM_FAMILY_ID_ZERO_GECKO        76
+#define EZR_FAMILY_ID_WONDER_GECKO             120
+#define EZR_FAMILY_ID_LEOPARD_GECKO            121
 
 #define EFM32_FLASH_ERASE_TMO           100
 #define EFM32_FLASH_WDATAREADY_TMO      100
 
 #define EFM32_FLASH_ERASE_TMO           100
 #define EFM32_FLASH_WDATAREADY_TMO      100
@@ -61,7 +63,7 @@
 #define EFM32_MSC_LOCK_BITS             (EFM32_MSC_INFO_BASE+0x4000)
 #define EFM32_MSC_DEV_INFO              (EFM32_MSC_INFO_BASE+0x8000)
 
 #define EFM32_MSC_LOCK_BITS             (EFM32_MSC_INFO_BASE+0x4000)
 #define EFM32_MSC_DEV_INFO              (EFM32_MSC_INFO_BASE+0x8000)
 
-/* PAGE_SIZE is only present in Leopard and Giant Gecko MCUs */
+/* PAGE_SIZE is only present in Leopard, Giant and Wonder Gecko MCUs */
 #define EFM32_MSC_DI_PAGE_SIZE          (EFM32_MSC_DEV_INFO+0x1e7)
 #define EFM32_MSC_DI_FLASH_SZ           (EFM32_MSC_DEV_INFO+0x1f8)
 #define EFM32_MSC_DI_RAM_SZ             (EFM32_MSC_DEV_INFO+0x1fa)
 #define EFM32_MSC_DI_PAGE_SIZE          (EFM32_MSC_DEV_INFO+0x1e7)
 #define EFM32_MSC_DI_FLASH_SZ           (EFM32_MSC_DEV_INFO+0x1f8)
 #define EFM32_MSC_DI_RAM_SZ             (EFM32_MSC_DEV_INFO+0x1fa)
@@ -202,7 +204,9 @@ static int efm32x_read_info(struct flash_bank *bank,
                        LOG_ERROR("Invalid page size %u", efm32_info->page_size);
                        return ERROR_FAIL;
                }
                        LOG_ERROR("Invalid page size %u", efm32_info->page_size);
                        return ERROR_FAIL;
                }
-       } else if (EFM_FAMILY_ID_WONDER_GECKO == efm32_info->part_family) {
+       } else if (EFM_FAMILY_ID_WONDER_GECKO == efm32_info->part_family ||
+                       EZR_FAMILY_ID_WONDER_GECKO == efm32_info->part_family ||
+                       EZR_FAMILY_ID_LEOPARD_GECKO == efm32_info->part_family) {
                uint8_t pg_size = 0;
                ret = target_read_u8(bank->target, EFM32_MSC_DI_PAGE_SIZE,
                        &pg_size);
                uint8_t pg_size = 0;
                ret = target_read_u8(bank->target, EFM32_MSC_DI_PAGE_SIZE,
                        &pg_size);
@@ -846,9 +850,11 @@ static int efm32x_probe(struct flash_bank *bank)
                        LOG_INFO("Tiny Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_LEOPARD_GECKO:
                        LOG_INFO("Tiny Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_LEOPARD_GECKO:
+               case EZR_FAMILY_ID_LEOPARD_GECKO:
                        LOG_INFO("Leopard Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_WONDER_GECKO:
                        LOG_INFO("Leopard Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_WONDER_GECKO:
+               case EZR_FAMILY_ID_WONDER_GECKO:
                        LOG_INFO("Wonder Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_ZERO_GECKO:
                        LOG_INFO("Wonder Gecko MCU detected");
                        break;
                case EFM_FAMILY_ID_ZERO_GECKO:
@@ -944,7 +950,15 @@ static int get_efm32x_info(struct flash_bank *bank, char *buf, int buf_size)
                return ret;
        }
 
                return ret;
        }
 
-       printed = snprintf(buf, buf_size, "EFM32 ");
+       switch (info.part_family) {
+               case EZR_FAMILY_ID_WONDER_GECKO:
+               case EZR_FAMILY_ID_LEOPARD_GECKO:
+                       printed = snprintf(buf, buf_size, "EZR32 ");
+                       break;
+               default:
+                       printed = snprintf(buf, buf_size, "EFM32 ");
+       }
+
        buf += printed;
        buf_size -= printed;
 
        buf += printed;
        buf_size -= printed;
 
@@ -962,9 +976,11 @@ static int get_efm32x_info(struct flash_bank *bank, char *buf, int buf_size)
                        printed = snprintf(buf, buf_size, "Tiny Gecko");
                        break;
                case EFM_FAMILY_ID_LEOPARD_GECKO:
                        printed = snprintf(buf, buf_size, "Tiny Gecko");
                        break;
                case EFM_FAMILY_ID_LEOPARD_GECKO:
+               case EZR_FAMILY_ID_LEOPARD_GECKO:
                        printed = snprintf(buf, buf_size, "Leopard Gecko");
                        break;
                case EFM_FAMILY_ID_WONDER_GECKO:
                        printed = snprintf(buf, buf_size, "Leopard Gecko");
                        break;
                case EFM_FAMILY_ID_WONDER_GECKO:
+               case EZR_FAMILY_ID_WONDER_GECKO:
                        printed = snprintf(buf, buf_size, "Wonder Gecko");
                        break;
                case EFM_FAMILY_ID_ZERO_GECKO:
                        printed = snprintf(buf, buf_size, "Wonder Gecko");
                        break;
                case EFM_FAMILY_ID_ZERO_GECKO:

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)