Debian Codegraph @

src/soc/mediatek/mt8173/timer.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <device/mmio.h>
4 #include <soc/mcucfg.h>
5 #include <soc/timer.h>
6
7 void timer_prepare(void)
8 {
9 /* Set XGPT_IDX to 0, then the bit field of XGPT_CTL will be programmed
10 * with following definition.
11 *
12 * [10: 8] Clock mode
13 * 100: 26Mhz / 4
14 * 010: 26Mhz / 2
15 * 001: 26Mhz
16 * [ 1: 1] Halt-on-debug enable bit
17 * [ 0: 0] XGPT enable bit
18 */
19 write32(&mt8173_mcucfg->xgpt_idx, 0);
20 /* Set clock mode to 13Mhz and enable XGPT */
21 write32(&mt8173_mcucfg->xgpt_ctl, (0x1 | ((26 / TIMER_MHZ) << 8)));
22 }