1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2011 The Chromium OS Authors.
10 #include <env_internal.h>
15 #include <asm/u-boot-sandbox.h>
18 * Pointer to initial global data area
20 * Here we initialize it.
24 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
25 /* Add a simple GPIO device */
26 U_BOOT_DEVICE(gpio_sandbox) = {
27 .name = "sandbox_gpio",
32 /* system timer offset in ms */
33 static unsigned long sandbox_timer_offset;
35 void timer_test_add_offset(unsigned long offset)
37 sandbox_timer_offset += offset;
40 unsigned long timer_read_counter(void)
42 return os_get_nsec() / 1000 + sandbox_timer_offset * 1000;
46 /* specific order for sandbox: nowhere is the first value, used by default */
47 static enum env_location env_locations[] = {
52 enum env_location env_get_location(enum env_operation op, int prio)
54 if (prio >= ARRAY_SIZE(env_locations))
57 return env_locations[prio];
62 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
68 if (IS_ENABLED(CONFIG_LED))
74 int ft_board_setup(void *fdt, struct bd_info *bd)
76 /* Create an arbitrary reservation to allow testing OF_BOARD_SETUP.*/
77 return fdt_add_mem_rsv(fdt, 0x00d02000, 0x4000);
80 #ifdef CONFIG_BOARD_LATE_INIT
81 int board_late_init(void)
86 ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
87 if (ret && ret != -ENODEV) {
88 /* Force console on */
89 gd->flags &= ~GD_FLG_SILENT;
91 printf("cros-ec communications failure %d\n", ret);
92 puts("\nPlease reset with Power+Refresh\n\n");
93 panic("Cannot init cros-ec device");