board: spacemit-k3: SPL entrypoint

This commit is contained in:
2026-05-10 03:50:13 +08:00
parent c5afbce6f0
commit 3e2f66ea03
2 changed files with 52 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2026 Hangfan Li <lihangfan@iscas.ac.cn>
*/
#include <asm/io.h>
#include <cpu_func.h>
#include <linux/bitops.h>
#if CONFIG_IS_ENABLED(RISCV_MMODE)
void icache_enable(void)
{
csr_set(0x7c0, 0x2);
}
void dcache_enable(void)
{
csr_set(0x7c0, 0x1);
csr_set(0x7f0, 0x1);
}
int icache_status(void)
{
return (csr_read(0x7c0) & 0x2) != 0;
}
int dcache_status(void)
{
return (csr_read(0x7c0) & 0x1) != 0;
}
#endif /* CONFIG_IS_ENABLED(RISCV_MMODE) */
+21
View File
@@ -1,6 +1,20 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2026 Hangfan Li <lihangfan@iscas.ac.cn>
*/
#include <config.h>
#include <linux/types.h>
#include <asm/spl.h>
#include <spl.h>
#include <cpu_func.h>
void harts_early_init(void)
{
icache_enable();
dcache_enable();
}
void board_boot_order(u32 *spl_boot_list)
{
@@ -9,3 +23,10 @@ void board_boot_order(u32 *spl_boot_list)
spl_boot_list[1] = BOOT_DEVICE_UART;
spl_boot_list[2] = BOOT_DEVICE_NONE;
}
int spl_board_init_f(void)
{
int ret;
return 0;
}