Skip to content

Commit

Permalink
flash/stm32l4x: support STM32WBAx devices
Browse files Browse the repository at this point in the history
Change-Id: I176624dd848556dfc49590d23f8a8bd0c6b3c1d3
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
  • Loading branch information
tarek-bochkati committed Apr 28, 2023
1 parent aece197 commit 54c8f87
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/flash/nor/stm32l4x.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ static const struct stm32l4_rev stm32u57_u58xx_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x2000, "B" }, { 0x2001, "X" },
};


static const struct stm32l4_rev stm32wbaxx_revs[] = {
{ 0x1000, "A" },
};

static const struct stm32l4_rev stm32wb1xx_revs[] = {
{ 0x1000, "A" }, { 0x2000, "B" },
};
Expand Down Expand Up @@ -591,6 +596,18 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
.otp_base = 0x0BFA0000,
.otp_size = 512,
},
{
.id = DEVID_STM32WBAXX,
.revs = stm32wbaxx_revs,
.num_revs = ARRAY_SIZE(stm32wbaxx_revs),
.device_str = "STM32WBAx",
.max_flash_size_kb = 1024,
.flags = F_QUAD_WORD_PROG | F_HAS_TZ | F_HAS_L5_FLASH_REGS,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x0FF907A0,
.otp_base = 0x0FF90000,
.otp_size = 512,
},
{
.id = DEVID_STM32WB1XX,
.revs = stm32wb1xx_revs,
Expand Down Expand Up @@ -2080,6 +2097,19 @@ static int stm32l4_probe(struct flash_bank *bank)
stm32l4_info->bank1_sectors = num_pages / 2;
}
break;
case DEVID_STM32WBAXX:
/* single bank flash */
page_size_kb = 8;
num_pages = flash_size_kb / page_size_kb;
stm32l4_info->bank1_sectors = num_pages;

/**
* by default use the non-secure registers,
* switch secure registers if TZ is enabled and RDP is LEVEL_0
*/
if (stm32l4_info->tzen && stm32l4_info->rdp == RDP_LEVEL_0)
stm32l4_info->flash_regs = stm32l5_s_flash_regs;
break;
case DEVID_STM32WB5XX:
case DEVID_STM32WB3XX:
/* single bank flash */
Expand Down
1 change: 1 addition & 0 deletions src/flash/nor/stm32l4x.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
#define DEVID_STM32G49_G4AXX 0x479
#define DEVID_STM32U59_U5AXX 0x481
#define DEVID_STM32U57_U58XX 0x482
#define DEVID_STM32WBAXX 0x492
#define DEVID_STM32WB1XX 0x494
#define DEVID_STM32WB5XX 0x495
#define DEVID_STM32WB3XX 0x496
Expand Down

0 comments on commit 54c8f87

Please sign in to comment.