From 06af8bd61b37bbf0db93adfa9902b176d0158ea1 Mon Sep 17 00:00:00 2001 From: Ben Zong-You Xie Date: Tue, 28 Jul 2026 16:10:41 +0800 Subject: 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 Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/20260728081041.2724668-8-ben717@andestech.com Signed-off-by: Anup Patel --- platform/generic/andes/ae350.c | 8 ++++++++ platform/generic/include/andes/andes.h | 1 + 2 files changed, 9 insertions(+) (limited to 'platform') diff --git a/platform/generic/andes/ae350.c b/platform/generic/andes/ae350.c index 4a053f43..7aafe545 100644 --- a/platform/generic/andes/ae350.c +++ b/platform/generic/andes/ae350.c @@ -38,6 +38,14 @@ void ae350_non_ret_save(struct sbi_scratch *scratch) andes_hdata->saved = true; } +void ae350_non_ret_discard(struct sbi_scratch *scratch) +{ + struct andes_hart_data *andes_hdata = sbi_scratch_offset_ptr(scratch, + andes_hart_data_offset); + + andes_hdata->saved = false; +} + void ae350_non_ret_restore(struct sbi_scratch *scratch) { struct andes_hart_data *andes_hdata = sbi_scratch_offset_ptr(scratch, diff --git a/platform/generic/include/andes/andes.h b/platform/generic/include/andes/andes.h index dae112ce..dfa9f3c1 100644 --- a/platform/generic/include/andes/andes.h +++ b/platform/generic/include/andes/andes.h @@ -102,6 +102,7 @@ struct andes_hart_data { }; void ae350_non_ret_save(struct sbi_scratch *scratch); +void ae350_non_ret_discard(struct sbi_scratch *scratch); void ae350_non_ret_restore(struct sbi_scratch *scratch); void ae350_enable_coherency_warmboot(void); -- cgit v1.3.1