soc: nordic: nrf54h: disable IRQ before PM config

IRQs must be disabled before starting any procedures to prepare
for low-power states.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
This commit is contained in:
Adam Kondraciuk 2024-11-12 11:24:40 +01:00 committed by Fabio Baltieri
commit be1f40547f
2 changed files with 4 additions and 3 deletions

View file

@ -111,18 +111,15 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off)
{ {
int ret; int ret;
__disable_irq();
nvic_suspend(&backup_data.nvic_context); nvic_suspend(&backup_data.nvic_context);
mpu_suspend(&backup_data.mpu_context); mpu_suspend(&backup_data.mpu_context);
ret = arch_pm_s2ram_suspend(system_off); ret = arch_pm_s2ram_suspend(system_off);
if (ret < 0) { if (ret < 0) {
__enable_irq();
return ret; return ret;
} }
mpu_resume(&backup_data.mpu_context); mpu_resume(&backup_data.mpu_context);
nvic_resume(&backup_data.nvic_context); nvic_resume(&backup_data.nvic_context);
__enable_irq();
return ret; return ret;
} }

View file

@ -174,15 +174,19 @@ static void s2ram_enter(void)
void pm_state_set(enum pm_state state, uint8_t substate_id) void pm_state_set(enum pm_state state, uint8_t substate_id)
{ {
if (state == PM_STATE_SUSPEND_TO_IDLE) { if (state == PM_STATE_SUSPEND_TO_IDLE) {
__disable_irq();
s2idle_enter(substate_id); s2idle_enter(substate_id);
/* Resume here. */ /* Resume here. */
s2idle_exit(substate_id); s2idle_exit(substate_id);
__enable_irq();
} }
#if defined(CONFIG_PM_S2RAM) #if defined(CONFIG_PM_S2RAM)
else if (state == PM_STATE_SUSPEND_TO_RAM) { else if (state == PM_STATE_SUSPEND_TO_RAM) {
__disable_irq();
s2ram_enter(); s2ram_enter();
/* On resuming or error we return exactly *HERE* */ /* On resuming or error we return exactly *HERE* */
s2ram_exit(); s2ram_exit();
__enable_irq();
} }
#endif #endif
else { else {