aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/cpuidle.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2022-02-10 11:19:40 +0530
committerPalmer Dabbelt <palmer@rivosinc.com>2022-03-10 09:29:21 -0800
commitf6e64b66629e8fff0997825ade06619f09a06583 (patch)
tree7f054cbebc4b84847e99a1aed50a84d70f5531fc /arch/riscv/include/asm/cpuidle.h
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07 (diff)
downloadlinux-f6e64b66629e8fff0997825ade06619f09a06583.tar.gz
RISC-V: Enable CPU_IDLE drivers
We force select CPU_PM and provide asm/cpuidle.h so that we can use CPU IDLE drivers for Linux RISC-V kernel. Signed-off-by: Anup Patel <anup.patel@wdc.com> Signed-off-by: Anup Patel <apatel@vetanamicro.com> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/asm/cpuidle.h')
-rw-r--r--arch/riscv/include/asm/cpuidle.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/cpuidle.h b/arch/riscv/include/asm/cpuidle.h
new file mode 100644
index 000000000000..71fdc607d4bc
--- /dev/null
+++ b/arch/riscv/include/asm/cpuidle.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2021 Allwinner Ltd
+ * Copyright (C) 2021 Western Digital Corporation or its affiliates.
+ */
+
+#ifndef _ASM_RISCV_CPUIDLE_H
+#define _ASM_RISCV_CPUIDLE_H
+
+#include <asm/barrier.h>
+#include <asm/processor.h>
+
+static inline void cpu_do_idle(void)
+{
+ /*
+ * Add mb() here to ensure that all
+ * IO/MEM accesses are completed prior
+ * to entering WFI.
+ */
+ mb();
+ wait_for_interrupt();
+}
+
+#endif