coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timer.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/mmio.h>
4 #include <delay.h>
5 #include <soc/clk.h>
6 #include <stdint.h>
7 #include <timer.h>
8 
9 static const uint32_t clocks_per_usec = MCT_HZ/1000000;
10 
11 static uint64_t mct_raw_value(void)
12 {
13  uint64_t upper = read32(&exynos_mct->g_cnt_u);
14  uint64_t lower = read32(&exynos_mct->g_cnt_l);
15 
16  return (upper << 32) | lower;
17 }
18 
19 void init_timer(void)
20 {
21  write32(&exynos_mct->g_tcon, read32(&exynos_mct->g_tcon) | (0x1 << 8));
22 }
23 
25 {
26  /* We don't have to call mct_start() here
27  * because it was already called in the bootblock
28  */
29 
31 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static uint32_t read32(const void *addr)
Definition: mmio.h:22
#define MCT_HZ
Definition: clk.h:52
static struct exynos5_mct *const exynos_mct
Definition: clk.h:507
static void mono_time_set_usecs(struct mono_time *mt, long us)
Definition: timer.h:53
__weak void init_timer(void)
Definition: timer.c:7
void timer_monotonic_get(struct mono_time *mt)
Definition: timer.c:7
static const uint32_t clocks_per_usec
Definition: timer.c:9
static uint64_t mct_raw_value(void)
Definition: timer.c:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned long long uint64_t
Definition: stdint.h:17
uint32_t g_tcon
Definition: clk.h:472
uint32_t g_cnt_l
Definition: clk.h:451
uint32_t g_cnt_u
Definition: clk.h:452