flash/stm32l4x: support STM32U59/U5Ax devices

STM32U59/U5Ax devices are similar to U57/U58x devices
with 2 flash banks up to 2 MB each

while at there update STM32U57x/U58x revisions

Change-Id: I7e5c1700acf8c9fda34f660c9274bfd8bcb1381b
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6875
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tarek BOCHKATI 2021-12-03 13:16:50 +01:00 committed by Tomas Vanek
parent 7f2d3e2925
commit 6554d176e9
2 changed files with 27 additions and 3 deletions

View File

@ -120,6 +120,12 @@
* http://www.st.com/resource/en/reference_manual/dm00346336.pdf
*/
/* STM32U5xxx series for reference.
*
* RM0456 (STM32U5xx)
* http://www.st.com/resource/en/reference_manual/dm00477635.pdf
*/
/* Erase time can be as high as 25ms, 10x this and assume it's toast... */
#define FLASH_ERASE_TIMEOUT 250
@ -346,7 +352,11 @@ static const struct stm32l4_rev stm32g49_g4axx_revs[] = {
static const struct stm32l4_rev stm32u57_u58xx_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x2000, "B" },
{ 0x2001, "X" }, { 0x3000, "C" },
{ 0x2001, "X" }, { 0x3000, "C" }, { 0x3001, "W" },
};
static const struct stm32l4_rev stm32u59_u5axx_revs[] = {
{ 0x3001, "X" },
};
static const struct stm32l4_rev stm32wba5x_revs[] = {
@ -574,6 +584,18 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
.otp_base = 0x1FFF7000,
.otp_size = 1024,
},
{
.id = DEVID_STM32U59_U5AXX,
.revs = stm32u59_u5axx_revs,
.num_revs = ARRAY_SIZE(stm32u59_u5axx_revs),
.device_str = "STM32U59/U5Axx",
.max_flash_size_kb = 4096,
.flags = F_HAS_DUAL_BANK | F_QUAD_WORD_PROG | F_HAS_TZ | F_HAS_L5_FLASH_REGS,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x0BFA07A0,
.otp_base = 0x0BFA0000,
.otp_size = 512,
},
{
.id = DEVID_STM32U57_U58XX,
.revs = stm32u57_u58xx_revs,
@ -2000,9 +2022,10 @@ static int stm32l4_probe(struct flash_bank *bank)
stm32l4_info->bank1_sectors = num_pages / 2;
}
break;
case DEVID_STM32U59_U5AXX:
case DEVID_STM32U57_U58XX:
/* if flash size is max (2M) the device is always dual bank
* otherwise check DUALBANK
/* if flash size is more than 1M the device is always dual bank
* otherwise check DUALBANK bit
*/
page_size_kb = 8;
num_pages = flash_size_kb / page_size_kb;

View File

@ -102,6 +102,7 @@
#define DEVID_STM32L4P_L4QXX 0x471
#define DEVID_STM32L55_L56XX 0x472
#define DEVID_STM32G49_G4AXX 0x479
#define DEVID_STM32U59_U5AXX 0x481
#define DEVID_STM32U57_U58XX 0x482
#define DEVID_STM32WBA5X 0x492
#define DEVID_STM32WB1XX 0x494