| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <arch/lib_helpers.h> |
| 4 | #include <commonlib/helpers.h> |
| 5 | #include <delay.h> |
| 6 | #include <device/mmio.h> |
| 7 | #include <soc/timer.h> |
| 8 | |
| 9 | void timer_set_compensation(void) |
| 10 | { |
| 11 | SET32_BITFIELDS(&mtk_systimer->cntcr, |
| 12 | COMP_FEATURE, COMP_FEATURE_CLR | COMP_FEATURE_20_EN, |
| 13 | COMP_FEATURE_TIE, COMP_FEATURE_TIE_CLR | COMP_FEATURE_TIE_EN); |
| 14 | } |
| 15 | |
| 16 | void init_timer(void) |
| 17 | { |
| 18 | timer_prepare(); |
| 19 | |
| 20 | raw_write_cntfrq_el0(TIMER_MHZ * MHz); |
| 21 | } |