tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / soc / samsung / exynos5420 / timer.c
blob8b313fff78ee45f96fb3b7e5524e309eb424b612
1 /*
2 * This file is part of the coreboot project.
4 * Copyright 2013 Google Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <arch/io.h>
17 #include <delay.h>
18 #include <soc/clk.h>
19 #include <stdint.h>
20 #include <timer.h>
22 static const uint32_t clocks_per_usec = MCT_HZ/1000000;
24 static uint64_t mct_raw_value(void)
26 uint64_t upper = read32(&exynos_mct->g_cnt_u);
27 uint64_t lower = read32(&exynos_mct->g_cnt_l);
29 return (upper << 32) | lower;
32 void init_timer(void)
34 write32(&exynos_mct->g_tcon, read32(&exynos_mct->g_tcon) | (0x1 << 8));
37 void timer_monotonic_get(struct mono_time *mt)
39 /* We don't have to call mct_start() here
40 * because it was already called in the bootblock
43 mono_time_set_usecs(mt, mct_raw_value() / clocks_per_usec);