sandbox.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * SPDX-License-Identifier: GPL-2.0+
  4. */
  5. #include <common.h>
  6. #include <cros_ec.h>
  7. #include <dm.h>
  8. #include <os.h>
  9. #include <asm/u-boot-sandbox.h>
  10. /*
  11. * Pointer to initial global data area
  12. *
  13. * Here we initialize it.
  14. */
  15. gd_t *gd;
  16. /* Add a simple GPIO device */
  17. U_BOOT_DEVICE(gpio_sandbox) = {
  18. .name = "gpio_sandbox",
  19. };
  20. void flush_cache(unsigned long start, unsigned long size)
  21. {
  22. }
  23. unsigned long timer_read_counter(void)
  24. {
  25. return os_get_nsec() / 1000;
  26. }
  27. int dram_init(void)
  28. {
  29. gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  30. return 0;
  31. }
  32. #ifdef CONFIG_BOARD_EARLY_INIT_F
  33. int board_early_init_f(void)
  34. {
  35. #ifdef CONFIG_VIDEO_SANDBOX_SDL
  36. int ret;
  37. ret = sandbox_lcd_sdl_early_init();
  38. if (ret) {
  39. puts("Could not init sandbox LCD emulation\n");
  40. return ret;
  41. }
  42. #endif
  43. return 0;
  44. }
  45. #endif
  46. #ifdef CONFIG_BOARD_LATE_INIT
  47. int board_late_init(void)
  48. {
  49. if (cros_ec_get_error()) {
  50. /* Force console on */
  51. gd->flags &= ~GD_FLG_SILENT;
  52. printf("cros-ec communications failure %d\n",
  53. cros_ec_get_error());
  54. puts("\nPlease reset with Power+Refresh\n\n");
  55. panic("Cannot init cros-ec device");
  56. return -1;
  57. }
  58. return 0;
  59. }
  60. #endif