flash/stm32l4x: introduce table with register offsets
authorTarek BOCHKATI <tarek.bouchkati@gmail.com>
Tue, 3 Nov 2020 00:58:59 +0000 (01:58 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Sun, 15 Nov 2020 21:42:17 +0000 (21:42 +0000)
commitdc43ecce5a7ee5722ea851707ad3acd08a42b5aa
tree567dad57f451139358c0cb9a357675ee037841aa
parent44cf202ef585ea5e2dda78e65cc5d04e08129eff
flash/stm32l4x: introduce table with register offsets

This change is a preparation for STM32L5 support on top of L4 driver
STM32L5 flash is quite similar to L4 flash, mainly register names
and offsets and some bits are changed.

flash_regs table is introduced within stm32l4_flash_bank struct in order
to get correct register offsets, by using the driver internal function
'stm32l4_get_flash_reg_by_index'.

To use efficiently register indexes, stm32l4 _[get|read|write]_flash_reg
functions are surcharged to accept register indexes.

IMPORTANT: stm32l4_write_option is not surcharged, and they always accept
the option register offset.

tested on NUCLEO-G474RE and STM32L4R9I-DISCO

Change-Id: I739d3e97d63b831af6aa569c5629db0000209551
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5509
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/flash/nor/stm32l4x.c
src/flash/nor/stm32l4x.h