2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2011-10-07 13:53:38 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 The Chromium OS Authors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
2018-07-27 14:37:09 +00:00
|
|
|
#include <led.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-10-30 07:35:52 +00:00
|
|
|
#ifndef CONFIG_TIMER
|
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
|
|
|
}
|
2015-10-30 07:35:52 +00:00
|
|
|
#endif
|
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
|
|
|
|
2018-07-27 14:37:09 +00:00
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
if (IS_ENABLED(CONFIG_LED))
|
|
|
|
led_default_state();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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
|