2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <device/mmio.h>
21 static const uint32_t clocks_per_usec
= MCT_HZ
/1000000;
23 static uint64_t mct_raw_value(void)
25 uint64_t upper
= read32(&exynos_mct
->g_cnt_u
);
26 uint64_t lower
= read32(&exynos_mct
->g_cnt_l
);
28 return (upper
<< 32) | lower
;
33 write32(&exynos_mct
->g_tcon
, read32(&exynos_mct
->g_tcon
) | (0x1 << 8));
36 void timer_monotonic_get(struct mono_time
*mt
)
38 /* We don't have to call mct_start() here
39 * because it was already called in the bootblock
42 mono_time_set_usecs(mt
, mct_raw_value() / clocks_per_usec
);