Skip to content

Commit

Permalink
drivers: flash: stm32 flash register name for the stm32h7RS serie
Browse files Browse the repository at this point in the history
Adapt the stm32 flash driver for the stm32h7rs serie where some
bit of the FLASH registers are named differently from stm32h7 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
  • Loading branch information
FRASTM authored and kartben committed Dec 19, 2024
1 parent b0416f5 commit 2000ae6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/flash/flash_stm32h7x.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ static __unused int write_optb(const struct device *dev, uint32_t mask,
}

regs->OPTCR = (regs->OPTCR & ~mask) | value;
#ifdef CONFIG_SOC_SERIES_STM32H7RSX
regs->OPTCR |= FLASH_OPTCR_PG_OPT;
#else
regs->OPTCR |= FLASH_OPTCR_OPTSTART;

#endif /* CONFIG_SOC_SERIES_STM32H7RSX */
/* Make sure previous write is completed. */
barrier_dsync_fence_full();

Expand Down Expand Up @@ -121,8 +124,13 @@ int flash_stm32_option_bytes_lock(const struct device *dev, bool enable)
if (enable) {
regs->OPTCR |= FLASH_OPTCR_OPTLOCK;
} else if (regs->OPTCR & FLASH_OPTCR_OPTLOCK) {
#ifdef CONFIG_SOC_SERIES_STM32H7RSX
regs->OPTKEYR = FLASH_OPTKEY1;
regs->OPTKEYR = FLASH_OPTKEY2;
#else
regs->OPTKEYR = FLASH_OPT_KEY1;
regs->OPTKEYR = FLASH_OPT_KEY2;
#endif /* CONFIG_SOC_SERIES_STM32H7RSX */
}

if (enable) {
Expand Down

0 comments on commit 2000ae6

Please sign in to comment.