drivers/flash/Ambiq: Set erase capabilities, depending on SoC

The commit selects HAS_NO_EXPLICIT_ERASE for Apollo4,
with MRAM, and HAS_EXPLICIT_ERASE for Apollo3 which has Flash,
for a driver that shares code between SoCs.

In case of Apollo4 the no_explicit_erase capability is set to
true, while it remains false for Apollo3.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2024-02-02 13:47:09 +00:00 committed by Henrik Brix Andersen
parent ea627fda7e
commit 3c24e1a530
2 changed files with 7 additions and 0 deletions

View file

@ -8,6 +8,8 @@ config FLASH_AMBIQ
select AMBIQ_HAL
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
select FLASH_HAS_NO_EXPLICIT_ERASE if SOC_SERIES_APOLLO4X
select FLASH_HAS_EXPLICIT_ERASE if SOC_SERIES_APOLLO3X
help
Enables Ambiq flash driver on MRAM (e.g. Apollo4x) or
flash (e.g. Apollo3x).

View file

@ -48,6 +48,11 @@ static struct k_sem flash_ambiq_sem;
static const struct flash_parameters flash_ambiq_parameters = {
.write_block_size = FLASH_WRITE_BLOCK_SIZE,
.erase_value = FLASH_ERASE_BYTE,
#if defined(CONFIG_SOC_SERIES_APOLLO4X)
.caps = {
.no_explicit_erase = true,
},
#endif
};
static bool flash_ambiq_valid_range(off_t offset, size_t len)