flash/nor: add support of STM32WB on top STM32L4 flash driver

Change-Id: I9fb6700085d817d35a691f6484193f67939a4e0f
Signed-off-by: Laurent LEMELE <laurent.lemele@st.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/4933
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tarek BOCHKATI
2020-01-06 17:19:31 +01:00
committed by Tomas Vanek
parent 8536306b6e
commit a6a642bf72
3 changed files with 129 additions and 4 deletions

View File

@@ -169,6 +169,10 @@ static const struct stm32l4_rev stm32_470_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x100F, "W" },
};
static const struct stm32l4_rev stm32_495_revs[] = {
{ 0x2001, "2.1" },
};
static const struct stm32l4_part_info stm32l4_parts[] = {
{
.id = 0x415,
@@ -230,6 +234,16 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
.flash_regs_base = 0x40022000,
.fsize_addr = 0x1FFF75E0,
},
{
.id = 0x495,
.revs = stm32_495_revs,
.num_revs = ARRAY_SIZE(stm32_495_revs),
.device_str = "STM32WB5x",
.max_flash_size_kb = 1024,
.has_dual_bank = false,
.flash_regs_base = 0x58004000,
.fsize_addr = 0x1FFF75E0,
},
};
/* flash bank stm32l4x <base> <size> 0 0 <target#> */
@@ -714,7 +728,7 @@ static int stm32l4_probe(struct flash_bank *bank)
}
if (!stm32l4_info->part_info) {
LOG_WARNING("Cannot identify target as an STM32L4 family device.");
LOG_WARNING("Cannot identify target as an STM32 L4 or WB family device.");
return ERROR_FAIL;
}
@@ -804,6 +818,12 @@ static int stm32l4_probe(struct flash_bank *bank)
stm32l4_info->bank1_sectors = num_pages / 2;
}
break;
case 0x495:
/* single bank flash */
page_size = 4096;
num_pages = flash_size_in_kb / 4;
stm32l4_info->bank1_sectors = num_pages;
break;
default:
LOG_ERROR("unsupported device");
return ERROR_FAIL;
@@ -881,7 +901,7 @@ static int get_stm32l4_info(struct flash_bank *bank, char *buf, int buf_size)
part_info->device_str, rev_id);
return ERROR_OK;
} else {
snprintf(buf, buf_size, "Cannot identify target as a STM32L4x device");
snprintf(buf, buf_size, "Cannot identify target as an STM32 L4 or WB device");
return ERROR_FAIL;
}