summaryrefslogtreecommitdiff
path: root/arch/riscv/cpu
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2018-12-12 17:12:34 +0300
committerAndes <uboot@andestech.com>2018-12-18 04:56:27 +0300
commit39cad5bc0b36fca721416c28d1948c4805760f33 (patch)
treef5845da74488c47f61b8da8d3a57c79d3a630d48 /arch/riscv/cpu
parent92b64fef0580fab1c86bede68451270dc3772857 (diff)
downloadu-boot-39cad5bc0b36fca721416c28d1948c4805760f33.tar.xz
riscv: Probe cpus during boot
This calls cpu_probe_all() to probe all available cpus. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'arch/riscv/cpu')
-rw-r--r--arch/riscv/cpu/cpu.c26
-rw-r--r--arch/riscv/cpu/qemu/Kconfig1
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index d9f820c44c..8286a0c959 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -4,6 +4,8 @@
*/
#include <common.h>
+#include <cpu.h>
+#include <log.h>
#include <asm/csr.h>
/*
@@ -53,3 +55,27 @@ int print_cpuinfo(void)
return 0;
}
+
+static int riscv_cpu_probe(void)
+{
+#ifdef CONFIG_CPU
+ int ret;
+
+ /* probe cpus so that RISC-V timer can be bound */
+ ret = cpu_probe_all();
+ if (ret)
+ return log_msg_ret("RISC-V cpus probe failed\n", ret);
+#endif
+
+ return 0;
+}
+
+int arch_cpu_init_dm(void)
+{
+ return riscv_cpu_probe();
+}
+
+int arch_early_init_r(void)
+{
+ return riscv_cpu_probe();
+}
diff --git a/arch/riscv/cpu/qemu/Kconfig b/arch/riscv/cpu/qemu/Kconfig
index 2e953e172f..f48751e6de 100644
--- a/arch/riscv/cpu/qemu/Kconfig
+++ b/arch/riscv/cpu/qemu/Kconfig
@@ -4,6 +4,7 @@
config QEMU_RISCV
bool
+ select ARCH_EARLY_INIT_R
imply CPU
imply CPU_RISCV
imply RISCV_TIMER