1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) Aspeed Technology Inc.
4  */
5 #include <common.h>
6 #include <debug_uart.h>
7 #include <dm.h>
8 #include <spl.h>
9 #include <init.h>
10 #include <asm/io.h>
11 #include <asm/arch/scu_ast2600.h>
12 #include <asm/global_data.h>
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
board_init_f(ulong dummy)16 void board_init_f(ulong dummy)
17 {
18 	spl_early_init();
19 	preloader_console_init();
20 	timer_init();
21 	dram_init();
22 }
23 
spl_boot_device(void)24 u32 spl_boot_device(void)
25 {
26 	return BOOT_DEVICE_RAM;
27 }
28 
spl_get_load_buffer(ssize_t offset,size_t size)29 struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
30 {
31 	/*
32 	 * When boot from SPI, AST2600 already remap 0x00000000 ~ 0x0fffffff
33 	 * to BMC SPI memory space 0x20000000 ~ 0x2fffffff. The next stage BL
34 	 * has been located in SPI for XIP. In this case, the load buffer for
35 	 * SPL image loading will be set to the remapped address of the next
36 	 * BL instead of the DRAM space CONFIG_SYS_LOAD_ADDR
37 	 */
38 	return (struct image_header *)(CONFIG_SYS_TEXT_BASE);
39 }
40 
41 #ifdef CONFIG_SPL_OS_BOOT
spl_start_uboot(void)42 int spl_start_uboot(void)
43 {
44 	/* boot linux */
45 	return 0;
46 }
47 #endif
48 
49 #ifdef CONFIG_SPL_LOAD_FIT
board_fit_config_name_match(const char * name)50 int board_fit_config_name_match(const char *name)
51 {
52 	/* just empty function now - can't decide what to choose */
53 	debug("%s: %s\n", __func__, name);
54 	return 0;
55 }
56 #endif
57