]>
Commit | Line | Data |
---|---|---|
e961a66d SG |
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> | |
a091a8f0 | 9 | #include <spl.h> |
e961a66d SG |
10 | #include <asm/spl.h> |
11 | #include <asm/state.h> | |
12 | ||
13 | DECLARE_GLOBAL_DATA_PTR; | |
14 | ||
15 | void board_init_f(ulong flag) | |
16 | { | |
17 | struct sandbox_state *state = state_get_current(); | |
18 | ||
19 | gd->arch.ram_buf = state->ram_buf; | |
20 | gd->ram_size = state->ram_size; | |
21 | } | |
22 | ||
23 | u32 spl_boot_device(void) | |
24 | { | |
25 | return BOOT_DEVICE_BOARD; | |
26 | } | |
27 | ||
2a2ee2ac SG |
28 | static int spl_board_load_image(struct spl_image_info *spl_image, |
29 | struct spl_boot_device *bootdev) | |
e961a66d SG |
30 | { |
31 | char fname[256]; | |
32 | int ret; | |
33 | ||
34 | ret = os_find_u_boot(fname, sizeof(fname)); | |
f831b8e4 SG |
35 | if (ret) { |
36 | printf("(%s not found, error %d)\n", fname, ret); | |
e961a66d | 37 | return ret; |
f831b8e4 | 38 | } |
e961a66d SG |
39 | |
40 | /* Hopefully this will not return */ | |
41 | return os_spl_to_uboot(fname); | |
42 | } | |
ebc4ef61 | 43 | SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image); |
a091a8f0 SG |
44 | |
45 | void spl_board_init(void) | |
46 | { | |
47 | struct udevice *dev; | |
48 | ||
49 | preloader_console_init(); | |
50 | ||
51 | /* | |
52 | * Scan all the devices so that we can output their platform data. See | |
53 | * sandbox_spl_probe(). | |
54 | */ | |
55 | for (uclass_first_device(UCLASS_MISC, &dev); | |
56 | dev; | |
57 | uclass_next_device(&dev)) | |
58 | ; | |
59 | } |