1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2011 The Chromium OS Authors.
10 #include <env_internal.h>
14 #include <asm/global_data.h>
16 #include <asm/u-boot-sandbox.h>
19 * Pointer to initial global data area
21 * Here we initialize it.
25 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
26 /* Add a simple GPIO device */
27 U_BOOT_DRVINFO(gpio_sandbox) = {
28 .name = "sandbox_gpio",
33 /* system timer offset in ms */
34 static unsigned long sandbox_timer_offset;
36 void timer_test_add_offset(unsigned long offset)
38 sandbox_timer_offset += offset;
41 unsigned long timer_read_counter(void)
43 return os_get_nsec() / 1000 + sandbox_timer_offset * 1000;
47 /* specific order for sandbox: nowhere is the first value, used by default */
48 static enum env_location env_locations[] = {
54 enum env_location env_get_location(enum env_operation op, int prio)
56 if (prio >= ARRAY_SIZE(env_locations))
59 return env_locations[prio];
64 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
70 if (IS_ENABLED(CONFIG_LED))
76 int ft_board_setup(void *fdt, struct bd_info *bd)
78 /* Create an arbitrary reservation to allow testing OF_BOARD_SETUP.*/
79 return fdt_add_mem_rsv(fdt, 0x00d02000, 0x4000);
82 #ifdef CONFIG_BOARD_LATE_INIT
83 int board_late_init(void)
88 ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
89 if (ret && ret != -ENODEV) {
90 /* Force console on */
91 gd->flags &= ~GD_FLG_SILENT;
93 printf("cros-ec communications failure %d\n", ret);
94 puts("\nPlease reset with Power+Refresh\n\n");
95 panic("Cannot init cros-ec device");