2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-07-04 17:57:51 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <dm.h>
|
|
|
|
#include <os.h>
|
2016-07-04 17:57:55 +00:00
|
|
|
#include <spl.h>
|
2016-07-04 17:57:51 +00:00
|
|
|
#include <asm/spl.h>
|
|
|
|
#include <asm/state.h>
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
void board_init_f(ulong flag)
|
|
|
|
{
|
|
|
|
struct sandbox_state *state = state_get_current();
|
|
|
|
|
|
|
|
gd->arch.ram_buf = state->ram_buf;
|
|
|
|
gd->ram_size = state->ram_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 spl_boot_device(void)
|
|
|
|
{
|
|
|
|
return BOOT_DEVICE_BOARD;
|
|
|
|
}
|
|
|
|
|
2016-09-25 00:20:13 +00:00
|
|
|
static int spl_board_load_image(struct spl_image_info *spl_image,
|
|
|
|
struct spl_boot_device *bootdev)
|
2016-07-04 17:57:51 +00:00
|
|
|
{
|
|
|
|
char fname[256];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = os_find_u_boot(fname, sizeof(fname));
|
2016-11-30 22:30:56 +00:00
|
|
|
if (ret) {
|
|
|
|
printf("(%s not found, error %d)\n", fname, ret);
|
2016-07-04 17:57:51 +00:00
|
|
|
return ret;
|
2016-11-30 22:30:56 +00:00
|
|
|
}
|
2016-07-04 17:57:51 +00:00
|
|
|
|
|
|
|
/* Hopefully this will not return */
|
|
|
|
return os_spl_to_uboot(fname);
|
|
|
|
}
|
2016-11-30 22:30:50 +00:00
|
|
|
SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
|
2016-07-04 17:57:55 +00:00
|
|
|
|
|
|
|
void spl_board_init(void)
|
|
|
|
{
|
|
|
|
preloader_console_init();
|
|
|
|
}
|