xref: /rk3399_rockchip-uboot/arch/sandbox/cpu/spl.c (revision e961a66df91ea4cbf9b6978995f1ba6c8d67aa33)
1 /*
2  * Copyright (c) 2016 Google, Inc
3  * SPDX-License-Identifier:	GPL-2.0+
4  */
5 
6 #include <common.h>
7 #include <dm.h>
8 #include <os.h>
9 #include <asm/spl.h>
10 #include <asm/state.h>
11 
12 DECLARE_GLOBAL_DATA_PTR;
13 
14 void board_init_f(ulong flag)
15 {
16 	struct sandbox_state *state = state_get_current();
17 
18 	gd->arch.ram_buf = state->ram_buf;
19 	gd->ram_size = state->ram_size;
20 }
21 
22 u32 spl_boot_device(void)
23 {
24 	return BOOT_DEVICE_BOARD;
25 }
26 
27 void spl_board_announce_boot_device(void)
28 {
29 	char fname[256];
30 	int ret;
31 
32 	ret = os_find_u_boot(fname, sizeof(fname));
33 	if (ret) {
34 		printf("(%s not found, error %d)\n", fname, ret);
35 		return;
36 	}
37 	printf("%s\n", fname);
38 }
39 
40 int spl_board_load_image(void)
41 {
42 	char fname[256];
43 	int ret;
44 
45 	ret = os_find_u_boot(fname, sizeof(fname));
46 	if (ret)
47 		return ret;
48 
49 	/* Hopefully this will not return */
50 	return os_spl_to_uboot(fname);
51 }
52