summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-08-28 11:42:09 +0200
committerSimon Glass <sjg@chromium.org>2021-10-21 12:50:48 -0600
commit737fd142de530978157d61dd732273dd61a57eee (patch)
treebaa70d70e5d684bafaccc69e4fd9f95c6bfd1ab4
parentf7832ee552b6a54f2bcbde87ff205147930035b8 (diff)
sandbox: provide /chosen/boot-hartid property
On RISC-V the sandbox must provide the /chosen/boot-hartid in the devicetree. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-rw-r--r--arch/sandbox/lib/Makefile2
-rw-r--r--arch/sandbox/lib/fdt_fixup.c25
2 files changed, 26 insertions, 1 deletions
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index b4ff717e78..a2bc5a7ee6 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -5,7 +5,7 @@
# (C) Copyright 2002-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-obj-y += interrupts.o sections.o
+obj-y += fdt_fixup.o interrupts.o sections.o
obj-$(CONFIG_PCI) += pci_io.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-$(CONFIG_CMD_BOOTZ) += bootm.o
diff --git a/arch/sandbox/lib/fdt_fixup.c b/arch/sandbox/lib/fdt_fixup.c
new file mode 100644
index 0000000000..a646f2059c
--- /dev/null
+++ b/arch/sandbox/lib/fdt_fixup.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <common.h>
+#include <fdt_support.h>
+#include <log.h>
+
+#if defined(__riscv)
+int arch_fixup_fdt(void *blob)
+{
+ int ret;
+
+ ret = fdt_find_or_add_subnode(blob, 0, "chosen");;
+ if (ret < 0)
+ goto err;
+ ret = fdt_setprop_u32(blob, ret, "boot-hartid", 1);
+ if (ret < 0)
+ goto err;
+ return 0;
+err:
+ log_err("Setting /chosen/boot-hartid failed: %s\n", fdt_strerror(ret));
+ return ret;
+}
+#endif