Blame view

arch/sandbox/lib/sandbox.c 1.32 KB
43bd194c4   Simon Glass   sandbox: Add sand...
1
2
  /*
   * Copyright (c) 2011 The Chromium OS Authors.
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
3
   * SPDX-License-Identifier:	GPL-2.0+
43bd194c4   Simon Glass   sandbox: Add sand...
4
5
6
   */
  
  #include <common.h>
86bf601d0   Simon Glass   sandbox: Plumb in...
7
  #include <cros_ec.h>
e2d8a714a   Simon Glass   sandbox: Convert ...
8
  #include <dm.h>
d99a6874f   Matthias Weisser   sandbox: Add time...
9
  #include <os.h>
7d95f2a32   Simon Glass   sandbox: Add LCD ...
10
  #include <asm/u-boot-sandbox.h>
d99a6874f   Matthias Weisser   sandbox: Add time...
11

43bd194c4   Simon Glass   sandbox: Add sand...
12
13
14
15
16
17
  /*
   * Pointer to initial global data area
   *
   * Here we initialize it.
   */
  gd_t *gd;
e2d8a714a   Simon Glass   sandbox: Convert ...
18
19
20
21
  /* Add a simple GPIO device */
  U_BOOT_DEVICE(gpio_sandbox) = {
  	.name = "gpio_sandbox",
  };
43bd194c4   Simon Glass   sandbox: Add sand...
22
23
24
  void flush_cache(unsigned long start, unsigned long size)
  {
  }
28c860b23   Rob Herring   sandbox: convert ...
25
  unsigned long timer_read_counter(void)
6994ccf86   Mike Frysinger   sandbox: add get_...
26
  {
28c860b23   Rob Herring   sandbox: convert ...
27
  	return os_get_nsec() / 1000;
43bd194c4   Simon Glass   sandbox: Add sand...
28
  }
43bd194c4   Simon Glass   sandbox: Add sand...
29
30
  int dram_init(void)
  {
a733b06b6   Simon Glass   sandbox: Switch o...
31
  	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
43bd194c4   Simon Glass   sandbox: Add sand...
32
33
  	return 0;
  }
86bf601d0   Simon Glass   sandbox: Plumb in...
34

7d95f2a32   Simon Glass   sandbox: Add LCD ...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  #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
  ");
  		return ret;
  	}
  #endif
  
  	return 0;
  }
  #endif
86bf601d0   Simon Glass   sandbox: Plumb in...
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  int arch_early_init_r(void)
  {
  #ifdef CONFIG_CROS_EC
  	if (cros_ec_board_init()) {
  		printf("%s: Failed to init EC
  ", __func__);
  		return 0;
  	}
  #endif
  
  	return 0;
  }
  
  #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
  ",
  		       cros_ec_get_error());
  		puts("
  Please reset with Power+Refresh
  
  ");
  		panic("Cannot init cros-ec device");
  		return -1;
  	}
  	return 0;
  }
  #endif