diff options
Diffstat (limited to 'board/thead/th1520_lpi4a/spl.c')
-rw-r--r-- | board/thead/th1520_lpi4a/spl.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/board/thead/th1520_lpi4a/spl.c b/board/thead/th1520_lpi4a/spl.c new file mode 100644 index 00000000000..25dfa387c36 --- /dev/null +++ b/board/thead/th1520_lpi4a/spl.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2025, Yao Zi <ziyao@disroot.org> + */ + +#include <asm/io.h> +#include <asm/spl.h> +#include <asm/arch/cpu.h> +#include <asm/arch/spl.h> +#include <cpu_func.h> +#include <dm.h> +#include <hang.h> +#include <spl.h> + +u32 spl_boot_device(void) +{ + /* + * We don't bother to load proper U-Boot from an external device as + * it fits in the integrated SRAM nicely. + */ + return BOOT_DEVICE_RAM; +} + +void board_init_f(ulong dummy) +{ + int ret = spl_early_init(); + struct udevice *dev; + + if (ret) + panic("spl_early_init() failed %d\n", ret); + + preloader_console_init(); + + /* + * Manually bind CPU ahead of time to make sure in-core timers are + * available in SPL. + */ + ret = uclass_get_device(UCLASS_CPU, 0, &dev); + if (ret) + panic("failed to bind CPU: %d\n", ret); + + spl_dram_init(); + + icache_enable(); + dcache_enable(); + + th1520_invalidate_pmp(); +} |