mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-09-09 02:21:58 +01:00
lib: utils/andes: arm the SMU sleep command last
Once the sleep command is written, the next WFI puts the core to sleep, so everything that can fail has to run before it. Also, use writel() so the command store cannot still be in flight at the WFI. Signed-off-by: Ben Zong-You Xie <ben717@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260728081041.2724668-8-ben717@andestech.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
committed by
Anup Patel
parent
0fb4799307
commit
06af8bd61b
@@ -56,7 +56,7 @@ bool atcsmu_support_sleep_mode(u32 sleep_type, u32 hartid)
|
||||
|
||||
void atcsmu_set_command(u32 pcs_ctl, u32 hartid)
|
||||
{
|
||||
writel_relaxed(pcs_ctl, (char *)atcsmu_base + PCSm_CTL_OFFSET(hartid));
|
||||
writel(pcs_ctl, (char *)atcsmu_base + PCSm_CTL_OFFSET(hartid));
|
||||
}
|
||||
|
||||
int atcsmu_set_reset_vector(u64 wakeup_addr, u32 hartid)
|
||||
@@ -141,12 +141,12 @@ static int ae350_hart_stop(void)
|
||||
atcsmu_set_command(LIGHT_SLEEP_CMD, hartid);
|
||||
} else if (sleep_type == SBI_SUSP_SLEEP_TYPE_SUSPEND) {
|
||||
/* Power-gated: SMU wakes it via cold reset, interrupts not needed */
|
||||
atcsmu_set_command(DEEP_SLEEP_CMD, hartid);
|
||||
rc = atcsmu_set_reset_vector((ulong)ae350_enable_coherency_warmboot, hartid);
|
||||
if (rc)
|
||||
return SBI_EFAIL;
|
||||
|
||||
ae350_non_ret_save(sbi_scratch_thishart_ptr());
|
||||
atcsmu_set_command(DEEP_SLEEP_CMD, hartid);
|
||||
}
|
||||
|
||||
ae350_disable_coherency();
|
||||
|
||||
Reference in New Issue
Block a user