summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/stm32/flash-stm32h7.c3
-rw-r--r--core/cortex-m/panic.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/chip/stm32/flash-stm32h7.c b/chip/stm32/flash-stm32h7.c
index 2797720b8f..b539717158 100644
--- a/chip/stm32/flash-stm32h7.c
+++ b/chip/stm32/flash-stm32h7.c
@@ -90,7 +90,6 @@ static int unlock(int bank)
STM32_FLASH_KEYR(bank) = FLASH_KEYR_KEY1;
STM32_FLASH_KEYR(bank) = FLASH_KEYR_KEY2;
- asm volatile("dsb; isb");
ignore_bus_fault(0);
}
@@ -125,7 +124,6 @@ static int unlock_optb(void)
STM32_FLASH_OPTKEYR(0) = FLASH_OPTKEYR_KEY1;
STM32_FLASH_OPTKEYR(0) = FLASH_OPTKEYR_KEY2;
- asm volatile("dsb; isb");
ignore_bus_fault(0);
}
@@ -422,7 +420,6 @@ int flash_physical_protect_now(int all)
/* cannot modify the WP bits in the option bytes until reboot */
STM32_FLASH_OPTKEYR(0) = 0xffffffff;
option_disabled = 1;
- asm volatile("dsb; isb");
ignore_bus_fault(0);
return EC_SUCCESS;
diff --git a/core/cortex-m/panic.c b/core/cortex-m/panic.c
index 8fabaf4b21..2052656410 100644
--- a/core/cortex-m/panic.c
+++ b/core/cortex-m/panic.c
@@ -418,6 +418,11 @@ void bus_fault_handler(void)
void ignore_bus_fault(int ignored)
{
+ if (IS_ENABLED(CHIP_FAMILY_STM32H7)) {
+ if (ignored == 0)
+ asm volatile("dsb; isb");
+ }
+
/*
* Flash code might call this before cpu_init(),
* ensure that the bus faults really go through our handler.