flash/nor/efm32: Support EZR32HG devices.
[openocd.git] / src / flash / nor / efm32.c
index 5627a6276388b41c5b428df7c375f8899e441ef0..117cd8a1b89de88352d506a21678908bec10871d 100644 (file)
@@ -25,7 +25,7 @@
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program.                                              *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -48,6 +48,7 @@
 #define EFM_FAMILY_ID_HAPPY_GECKO      77
 #define EZR_FAMILY_ID_WONDER_GECKO             120
 #define EZR_FAMILY_ID_LEOPARD_GECKO            121
+#define EZR_FAMILY_ID_HAPPY_GECKO               122
 
 #define EFM32_FLASH_ERASE_TMO           100
 #define EFM32_FLASH_WDATAREADY_TMO      100
@@ -178,7 +179,8 @@ static int efm32x_read_info(struct flash_bank *bank,
                        EFM_FAMILY_ID_TINY_GECKO == efm32_info->part_family)
                efm32_info->page_size = 512;
        else if (EFM_FAMILY_ID_ZERO_GECKO == efm32_info->part_family ||
-                       EFM_FAMILY_ID_HAPPY_GECKO == efm32_info->part_family)
+                       EFM_FAMILY_ID_HAPPY_GECKO == efm32_info->part_family ||
+                       EZR_FAMILY_ID_HAPPY_GECKO == efm32_info->part_family)
                efm32_info->page_size = 1024;
        else if (EFM_FAMILY_ID_GIANT_GECKO == efm32_info->part_family ||
                        EFM_FAMILY_ID_LEOPARD_GECKO == efm32_info->part_family) {
@@ -236,6 +238,7 @@ static int efm32x_decode_info(struct efm32_info *info, char *buf, int buf_size)
        switch (info->part_family) {
                case EZR_FAMILY_ID_WONDER_GECKO:
                case EZR_FAMILY_ID_LEOPARD_GECKO:
+               case EZR_FAMILY_ID_HAPPY_GECKO:
                        printed = snprintf(buf, buf_size, "EZR32 ");
                        break;
                default:
@@ -270,6 +273,7 @@ static int efm32x_decode_info(struct efm32_info *info, char *buf, int buf_size)
                        printed = snprintf(buf, buf_size, "Zero Gecko");
                        break;
                case EFM_FAMILY_ID_HAPPY_GECKO:
+               case EZR_FAMILY_ID_HAPPY_GECKO:
                        printed = snprintf(buf, buf_size, "Happy Gecko");
                        break;
        }
@@ -456,10 +460,10 @@ static int efm32x_read_lock_data(struct flash_bank *bank)
        uint32_t *ptr = NULL;
        int ret = 0;
 
-       assert(!(bank->num_sectors & 0x1f));
+       assert(bank->num_sectors > 0);
 
-       data_size = bank->num_sectors / 8; /* number of data bytes */
-       data_size /= 4; /* ...and data dwords */
+       /* calculate the number of 32-bit words to read (one lock bit per sector) */
+       data_size = (bank->num_sectors + 31) / 32;
 
        ptr = efm32x_info->lb_page;
 

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)