drivers: flash: stm32f7: Remove useless definition and use CMSIS

Remove useless definiton STM32F7X_SECTOR_MASK and use CMSIS instead.
By the way fix bug as '|' should be in fact '&',
but thanks to '~' inversion, '|' is now good.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
This commit is contained in:
Alexandre Bourdiol 2021-06-10 17:59:13 +02:00 committed by Kumar Gala
commit 6798135694

View file

@ -14,8 +14,6 @@
#include "flash_stm32.h"
#define STM32F7X_SECTOR_MASK ((uint32_t) 0xFFFFFF07)
bool flash_stm32_valid_range(const struct device *dev, off_t offset,
uint32_t len,
bool write)
@ -87,7 +85,7 @@ static int erase_sector(const struct device *dev, uint32_t sector)
#endif /* CONFIG_FLASH_SIZE */
#endif /* defined(FLASH_OPTCR_nDBANK) && FLASH_SECTOR_TOTAL == 24 */
regs->CR = (regs->CR & (CR_PSIZE_MASK | STM32F7X_SECTOR_MASK)) |
regs->CR = (regs->CR & ~(FLASH_CR_PSIZE | FLASH_CR_SNB)) |
FLASH_PSIZE_BYTE |
FLASH_CR_SER |
(sector << FLASH_CR_SNB_Pos) |