aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/efm32.c
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-06-14 17:02:04 -0700
committerGitHub <noreply@github.com>2017-06-14 17:02:04 -0700
commitecc181d12d3b876d39b67b354e497f1fbe514a3f (patch)
treec6e676de5faa37d52544c5fe120f747bf225d38c /src/flash/nor/efm32.c
parent7af58e6283c8e7d350b6b55c93a1d326326ed831 (diff)
parent64af05291132811288d7af32c9fd27e254778d5c (diff)
downloadriscv-openocd-ecc181d12d3b876d39b67b354e497f1fbe514a3f.zip
riscv-openocd-ecc181d12d3b876d39b67b354e497f1fbe514a3f.tar.gz
riscv-openocd-ecc181d12d3b876d39b67b354e497f1fbe514a3f.tar.bz2
Merge pull request #62 from riscv/riscv64
Merge mainline OpenOCD
Diffstat (limited to 'src/flash/nor/efm32.c')
-rw-r--r--src/flash/nor/efm32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c
index 0b33829..81c1a37 100644
--- a/src/flash/nor/efm32.c
+++ b/src/flash/nor/efm32.c
@@ -456,10 +456,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;