1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
9 static const uint32_t clocks_per_usec
= MCT_HZ
/1000000;
11 static uint64_t mct_raw_value(void)
13 uint64_t upper
= read32(&exynos_mct
->g_cnt_u
);
14 uint64_t lower
= read32(&exynos_mct
->g_cnt_l
);
16 return (upper
<< 32) | lower
;
21 write32(&exynos_mct
->g_tcon
, read32(&exynos_mct
->g_tcon
) | (0x1 << 8));
24 void timer_monotonic_get(struct mono_time
*mt
)
26 /* We don't have to call mct_start() here
27 * because it was already called in the bootblock
30 mono_time_set_usecs(mt
, mct_raw_value() / clocks_per_usec
);