drivers: flash: stm32f7: Flush ART cache before Flash erase
Similar to #32218 and #34032 Flush ART cache before erase operation (preparing ART activation) Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
This commit is contained in:
parent
5e11fbfbe1
commit
64d2449185
1 changed files with 14 additions and 0 deletions
|
@ -23,6 +23,20 @@ bool flash_stm32_valid_range(const struct device *dev, off_t offset,
|
|||
return flash_stm32_range_exists(dev, offset, len);
|
||||
}
|
||||
|
||||
static inline void flush_cache(FLASH_TypeDef *regs)
|
||||
{
|
||||
if (regs->ACR & FLASH_ACR_ARTEN) {
|
||||
regs->ACR &= ~FLASH_ACR_ARTEN;
|
||||
/* Refernce manual:
|
||||
* The ART cache can be flushed only if the ART accelerator
|
||||
* is disabled (ARTEN = 0).
|
||||
*/
|
||||
regs->ACR |= FLASH_ACR_ARTRST;
|
||||
regs->ACR &= ~FLASH_ACR_ARTRST;
|
||||
regs->ACR |= FLASH_ACR_ARTEN;
|
||||
}
|
||||
}
|
||||
|
||||
static int write_byte(const struct device *dev, off_t offset, uint8_t val)
|
||||
{
|
||||
FLASH_TypeDef *regs = FLASH_STM32_REGS(dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue