X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fefm32.c;h=37cb79b40d6a2dd40c123b47bc0c5e579f67e0d2;hp=57566499908e54d74c7946ca136e5e8e7838e2bd;hb=3ad078cb60760a5a716c1ede0689540e9d01132a;hpb=7ae9154846f6e268c4fbc0c237c1b2c6301da2ce diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c index 5756649990..37cb79b40d 100644 --- a/src/flash/nor/efm32.c +++ b/src/flash/nor/efm32.c @@ -169,14 +169,22 @@ static int efm32x_read_info(struct flash_bank *bank, efm32_info->page_size = 512; else if (EFM_FAMILY_ID_GIANT_GECKO == efm32_info->part_family || EFM_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); - if (ERROR_OK != ret) - return ret; - - efm32_info->page_size = (1 << ((pg_size+10) & 0xff)); + if (efm32_info->prod_rev >= 18) { + uint8_t pg_size = 0; + ret = target_read_u8(bank->target, EFM32_MSC_DI_PAGE_SIZE, + &pg_size); + if (ERROR_OK != ret) + return ret; + + efm32_info->page_size = (1 << ((pg_size+10) & 0xff)); + } else { + /* EFM32 GG/LG errata: MEM_INFO_PAGE_SIZE is invalid + for MCUs with PROD_REV < 18 */ + if (efm32_info->flash_sz_kib < 512) + efm32_info->page_size = 2048; + else + efm32_info->page_size = 4096; + } if ((2048 != efm32_info->page_size) && (4096 != efm32_info->page_size)) {