summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-08-18 18:48:37 +0300
committerAnup Patel <anup@brainfault.org>2020-08-20 12:37:52 +0300
commitd7f87d99a33b71b20af527c62e7ef95dcb61ee22 (patch)
tree931cd3e6fb6c48c6769ea100c81c3404a3afcdd3 /platform
parent9d56961b2314f31f9d66e53204c02e01fada7c32 (diff)
downloadopensbi-d7f87d99a33b71b20af527c62e7ef95dcb61ee22.tar.xz
platform: kendryte/k210: fixup FDT
When passing the device tree to the next stage we should apply necessary device tree fix-ups first. These include: * fix up the CPU node in the device tree * fix up the PLIC node in the device tree * fix up the reserved memory node in the device tree Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/kendryte/k210/platform.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c
index 5c28fd9..75883ed 100644
--- a/platform/kendryte/k210/platform.c
+++ b/platform/kendryte/k210/platform.c
@@ -12,6 +12,7 @@
#include <sbi/sbi_console.h>
#include <sbi/sbi_const.h>
#include <sbi/sbi_platform.h>
+#include <sbi_utils/fdt/fdt_fixup.h>
#include <sbi_utils/irqchip/plic.h>
#include <sbi_utils/serial/sifive-uart.h>
#include <sbi_utils/sys/clint.h>
@@ -67,6 +68,21 @@ static u32 k210_get_clk_freq(void)
return pll0_freq / div;
}
+static int k210_final_init(bool cold_boot)
+{
+ void *fdt;
+
+ if (!cold_boot)
+ return 0;
+
+ fdt = sbi_scratch_thishart_arg1_ptr();
+
+ fdt_cpu_fixup(fdt);
+ fdt_fixups(fdt);
+
+ return 0;
+}
+
static int k210_console_init(void)
{
return sifive_uart_init(K210_UART_BASE_ADDR, k210_get_clk_freq(),
@@ -122,6 +138,8 @@ static int k210_system_reset(u32 type)
}
const struct sbi_platform_operations platform_ops = {
+ .final_init = k210_final_init,
+
.console_init = k210_console_init,
.console_putc = sifive_uart_putc,
.console_getc = sifive_uart_getc,