diff options
-rw-r--r-- | chip/stm32/flash-f.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c index 6f334b94a2..1fa809a449 100644 --- a/chip/stm32/flash-f.c +++ b/chip/stm32/flash-f.c @@ -406,12 +406,20 @@ static void unprotect_all_blocks(void) int flash_pre_init(void) { + uint32_t reset_flags = system_get_reset_flags(); uint32_t prot_flags = flash_get_protect(); int need_reset = 0; if (flash_physical_restore_state()) return EC_SUCCESS; + /* + * If we have already jumped between images, an earlier image could + * have applied write protection. Nothing additional needs to be done. + */ + if (reset_flags & RESET_FLAG_SYSJUMP) + return EC_SUCCESS; + if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) { if ((prot_flags & EC_FLASH_PROTECT_RO_AT_BOOT) && !(prot_flags & EC_FLASH_PROTECT_RO_NOW)) { |