coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timer.c
Go to the documentation of this file.
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  */
20  /* Set clock mode to 13Mhz and enable XGPT */
21  write32(&mt8173_mcucfg->xgpt_ctl, (0x1 | ((26 / GPT_MHZ) << 8)));
22 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static struct mt8173_mcucfg_regs *const mt8173_mcucfg
Definition: mcucfg.h:92
__weak void timer_prepare(void)
Definition: timer.c:13
#define GPT_MHZ
Definition: timer_v1.h:10