summaryrefslogtreecommitdiffstats
path: root/arch/kvx/cpu/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/kvx/cpu/cpu.c')
-rw-r--r--arch/kvx/cpu/cpu.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/kvx/cpu/cpu.c b/arch/kvx/cpu/cpu.c
new file mode 100644
index 0000000000..4b0d4d2d96
--- /dev/null
+++ b/arch/kvx/cpu/cpu.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2019 Kalray Inc.
+ */
+
+#include <common.h>
+#include <asm/sfr.h>
+#include <asm/sys_arch.h>
+
+extern char __dtb_start[];
+
+/* Default to builtin dtb */
+void *boot_dtb = __dtb_start;
+
+void kvx_lowlevel_setup(unsigned long r0, void *dtb_ptr)
+{
+ uint64_t ev_val = (uint64_t) &_exception_start | EXCEPTION_STRIDE;
+
+ if (r0 == FSBL_PARAM_MAGIC || r0 == LINUX_BOOT_PARAM_MAGIC) {
+ boot_dtb = dtb_ptr;
+ pr_info("Using DTB provided by FSBL\n");
+ }
+
+ /* Install exception handlers */
+ kvx_sfr_set(EV, ev_val);
+
+ /* Clear exception taken bit now that we setup our handlers */
+ kvx_sfr_set_field(PS, ET, 0);
+
+ /* Finally, make sure nobody disabled hardware trap before us */
+ kvx_sfr_set_field(PS, HTD, 0);
+}