stm32lx: fix dual-bank configuration for Cat.5 and Cat.6 devices
authorCezaryGapinski <gapa1986@gmail.com>
Mon, 20 Mar 2017 11:33:05 +0000 (12:33 +0100)
committerFreddie Chopin <freddie.chopin@gmail.com>
Mon, 24 Apr 2017 20:56:53 +0000 (21:56 +0100)
commite916bcda6435a60acaec30ce2edf9f3341c01c67
treedd71a9a45991eda7fb84fcf4f64b8b1dd1c09c00
parentca9dcc86d7d9f465950a0670a8c7a852ae2ca798
stm32lx: fix dual-bank configuration for Cat.5 and Cat.6 devices

Default values for .first_bank_size_kb and .has_dual_banks fields
described in stm32lx_parts[] do not fully describe
the real device memory layouts.

Basing on:
STM32L0x1 RM0377
STM32L0x2 RM0376
STM32L0x3 RM0367
STM32Lxxxx RM0038

correct values for memory layouts were selected:
id = 0x447 STM32L0xx (Cat.5) <- dual bank flash
for size 192 or 128 KBytes, single bank for 64 KBytes
id = 0x436 STM32L1xx (Cat.4 / Cat.3 - Medium + /
High Density) <- only one size of the bank,
default values are correct
id = 0x437 STM32L1xx (Cat.5 / Cat.6) <- always dual bank,
but size of the bank can be different

For that reason .part_info field in struct stm32lx_flash_bank
is a dynamic field with fields copied from stm32lx_parts[]
and overwriten to correct values
for specific chips and memory sizes.

Change-Id: If638cb0a9916097bfd4eda77d64feaf1ef2d2147
Signed-off-by: Cezary GapiƄski <cezary.gapinski@gmail.com>
Reviewed-on: http://openocd.zylin.com/4074
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/flash/nor/stm32lx.c