diff options
Diffstat (limited to 'chip/stm32/flash-f.c')
-rw-r--r-- | chip/stm32/flash-f.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c index 0c99ec398d..2ab05859fa 100644 --- a/chip/stm32/flash-f.c +++ b/chip/stm32/flash-f.c @@ -356,6 +356,10 @@ int flash_physical_protect_at_boot(uint32_t new_flags) if (block >= WP_BANK_OFFSET && block < WP_BANK_OFFSET + WP_BANK_COUNT) protect |= new_flags & EC_FLASH_PROTECT_RO_AT_BOOT; +#ifdef CONFIG_FLASH_PROTECT_RW + else + protect |= new_flags & EC_FLASH_PROTECT_RW_AT_BOOT; +#endif if (protect) val[byte_off] = val[byte_off] & (~(1 << (block % 8))); @@ -476,6 +480,15 @@ int flash_pre_init(void) need_reset = 1; } +#ifdef CONFIG_FLASH_PROTECT_RW + if ((flash_physical_get_valid_flags() & EC_FLASH_PROTECT_RW_AT_BOOT) && + (!!(prot_flags & EC_FLASH_PROTECT_RW_AT_BOOT) != + !!(prot_flags & EC_FLASH_PROTECT_RW_NOW))) { + /* RW_AT_BOOT and RW_NOW do not match. */ + need_reset = 1; + } +#endif + if (need_reset) system_reset(SYSTEM_RESET_HARD | SYSTEM_RESET_PRESERVE_FLAGS); |