xref: /aosp_15_r20/external/coreboot/src/soc/mediatek/common/include/soc/timer_v1.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SOC_MEDIATEK_COMMON_TIMER_V1_H
4 #define SOC_MEDIATEK_COMMON_TIMER_V1_H
5 
6 #include <device/mmio.h>
7 #include <soc/timer_common.h>
8 #include <types.h>
9 
10 #define GPT_MHZ	13
11 
12 struct mtk_gpt_regs {
13 	u32 reserved1[24];
14 	u32 gpt6_con;
15 	u32 gpt6_clk;
16 	u32 gpt6_cnt_l;
17 	u32 reserved2[3];
18 	u32 gpt6_cnt_h;
19 };
20 
21 check_member(mtk_gpt_regs, gpt6_con, 0x0060);
22 check_member(mtk_gpt_regs, gpt6_clk, 0x0064);
23 check_member(mtk_gpt_regs, gpt6_cnt_l, 0x0068);
24 check_member(mtk_gpt_regs, gpt6_cnt_h, 0x0078);
25 
26 DEFINE_BIT(GPT6_CON_EN6, 0)
27 DEFINE_BIT(GPT6_CON_CLR6, 1)
28 DEFINE_BITFIELD(GPT6_CON_MODE6, 5, 4)
29 
30 #define GPT6_CLOCK_REG(x) x->gpt6_clk
31 DEFINE_BITFIELD(GPT6_CLK_CLKDIV6, 3, 0)
32 DEFINE_BIT(GPT6_CLK_CLK6, 4)
33 
34 #endif
35