2011-10-07 13:53:38 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 The Chromium OS Authors.
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2011-10-07 13:53:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2014-02-27 20:26:13 +00:00
|
|
|
#include <cros_ec.h>
|
2014-02-26 22:59:25 +00:00
|
|
|
#include <dm.h>
|
2011-11-29 11:16:40 +00:00
|
|
|
#include <os.h>
|
2015-04-21 18:57:18 +00:00
|
|
|
#include <asm/test.h>
|
2014-02-27 20:26:19 +00:00
|
|
|
#include <asm/u-boot-sandbox.h>
|
2011-11-29 11:16:40 +00:00
|
|
|
|
2011-10-07 13:53:38 +00:00
|
|
|
/*
|
|
|
|
* Pointer to initial global data area
|
|
|
|
*
|
|
|
|
* Here we initialize it.
|
|
|
|
*/
|
|
|
|
gd_t *gd;
|
|
|
|
|
2014-02-26 22:59:25 +00:00
|
|
|
/* Add a simple GPIO device */
|
|
|
|
U_BOOT_DEVICE(gpio_sandbox) = {
|
|
|
|
.name = "gpio_sandbox",
|
|
|
|
};
|
|
|
|
|
2011-10-07 13:53:38 +00:00
|
|
|
void flush_cache(unsigned long start, unsigned long size)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-04-21 18:57:18 +00:00
|
|
|
/* system timer offset in ms */
|
|
|
|
static unsigned long sandbox_timer_offset;
|
|
|
|
|
|
|
|
void sandbox_timer_add_offset(unsigned long offset)
|
|
|
|
{
|
|
|
|
sandbox_timer_offset += offset;
|
|
|
|
}
|
|
|
|
|
2013-11-08 14:40:44 +00:00
|
|
|
unsigned long timer_read_counter(void)
|
2012-02-21 05:21:17 +00:00
|
|
|
{
|
2015-04-21 18:57:18 +00:00
|
|
|
return os_get_nsec() / 1000 + sandbox_timer_offset * 1000;
|
2011-10-07 13:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
2013-04-26 02:53:43 +00:00
|
|
|
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
2011-10-07 13:53:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-02-27 20:26:13 +00:00
|
|
|
|
2014-02-27 20:26:19 +00:00
|
|
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_VIDEO_SANDBOX_SDL
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = sandbox_lcd_sdl_early_init();
|
|
|
|
if (ret) {
|
|
|
|
puts("Could not init sandbox LCD emulation\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-02-27 20:26:13 +00:00
|
|
|
#ifdef CONFIG_BOARD_LATE_INIT
|
|
|
|
int board_late_init(void)
|
|
|
|
{
|
|
|
|
if (cros_ec_get_error()) {
|
|
|
|
/* Force console on */
|
|
|
|
gd->flags &= ~GD_FLG_SILENT;
|
|
|
|
|
|
|
|
printf("cros-ec communications failure %d\n",
|
|
|
|
cros_ec_get_error());
|
|
|
|
puts("\nPlease reset with Power+Refresh\n\n");
|
|
|
|
panic("Cannot init cros-ec device");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|