coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
clock_common.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __SOC_QUALCOMM_COMMON_CLOCK_H__
4 #define __SOC_QUALCOMM_COMMON_CLOCK_H__
5 
6 #define QCOM_CLOCK_DIV(div) (2 * div - 1)
7 
8 /* Root Clock Generator */
9 struct clock_rcg {
12 };
13 
14 /* Root Clock Generator with MND */
15 struct clock_rcg_mnd {
16  struct clock_rcg clock;
17  u32 m;
18  u32 n;
20 };
21 
22 /* DFS controlled Root Clock Generator */
25  u8 _res0[0x20 - 0x1c];
27  u8 _res1[0x60 - 0x40];
29  u8 _res2[0xa0 - 0x80];
31  u8 _res3[0xe0 - 0xc0];
33  u8 _res4[0x130 - 0x100];
34 };
35 
36 /* Clock Frequency Table */
44 };
45 
46 struct qupv3_clock {
48  struct clock_rcg_mnd clk;
49  struct clock_rcg_dfsr dfsr_clk;
50 };
51 
52 /* PLL Configuration */
54  void *reg_mode;
56  void *reg_l;
58  void *reg_cal_l;
60  void *reg_user_ctl;
72  void *reg_alpha;
74  void *reg_opmode;
76  bool fsm_enable;
77 };
78 
86 };
87 
88 enum gpll_mode {
89  PLL_LOCK_DET_BMSK = 0x80000000,
101 };
102 
107 };
108 
111 };
112 
117  CLK_CTL_OFF_BMSK = 0x80000000,
118 };
119 
124 };
125 
129 };
130 
135 };
136 
137 #define GDSC_ENABLE_BIT 0
138 
139 enum cb_err clock_enable_vote(void *cbcr_addr, void *vote_addr,
140  uint32_t vote_bit);
141 
142 enum cb_err clock_enable(void *cbcr_addr);
143 
144 enum cb_err enable_and_poll_gdsc_status(void *gdscr_addr);
145 
146 void clock_reset_bcr(void *bcr_addr, bool assert);
147 
148 /*
149  * clock_configure(): Configure the clock at the given clock speed (hz). If hz
150  * does not match any entries in the clk_cfg array, will throw and error and die().
151  *
152  * @param clk struct clock_rcg pointer (root clock generator)
153  * @param clk_cfg Array with possible clock configurations
154  * @param hz frequency of clock to set
155  * @param num_perfs size of clock array
156  */
157 enum cb_err clock_configure(struct clock_rcg *clk, struct clock_freq_config *clk_cfg,
158  uint32_t hz, uint32_t num_perfs);
159 
160 void clock_configure_dfsr_table(int qup, struct clock_freq_config *clk_cfg,
161  uint32_t num_perfs);
162 
164  bool enable, int br_enable);
166 
168 
169 struct aoss {
170  u8 _res0[0x50020];
172  u8 _res1[0x5002c - 0x50024];
174 };
175 check_member(aoss, aoss_cc_reset_status, 0x50020);
176 check_member(aoss, aoss_cc_apcs_misc, 0x5002c);
177 
178 struct shrm {
180 };
181 
182 void clock_reset_subsystem(u32 *misc, u32 shft);
183 
184 #endif
static struct apbmisc * misc
Definition: apbmisc.c:8
#define assert(statement)
Definition: assert.h:74
cb_err
coreboot error codes
Definition: cb_err.h:15
enum cb_err clock_enable(void *cbcr_addr)
Definition: clock.c:35
void clock_configure_dfsr_table(int qup, struct clock_freq_config *clk_cfg, uint32_t num_perfs)
Definition: clock.c:124
enum cb_err clock_configure(struct clock_rcg *clk, struct clock_freq_config *clk_cfg, uint32_t hz, uint32_t num_perfs)
Definition: clock.c:92
clk_ctl_gpll_user_ctl
Definition: clock_common.h:79
@ PLL_PLLOUT_EVEN_SHFT
Definition: clock_common.h:81
@ PLL_PLLOUT_MAIN_SHFT
Definition: clock_common.h:80
@ PLL_POST_DIV_EVEN_SHFT
Definition: clock_common.h:83
@ PLL_POST_DIV_ODD_SHFT
Definition: clock_common.h:84
@ PLL_PLLOUT_ODD_SHFT
Definition: clock_common.h:82
@ PLL_PLLOUT_EVEN_BMSK
Definition: clock_common.h:85
clk_ctl_dfsr
Definition: clock_common.h:131
@ CLK_CTL_CMD_DFSR_SHFT
Definition: clock_common.h:132
@ CLK_CTL_CMD_DFSR_BMSK
Definition: clock_common.h:134
@ CLK_CTL_CMD_RCG_SW_CTL_SHFT
Definition: clock_common.h:133
void clock_reset_bcr(void *bcr_addr, bool assert)
Definition: clock.c:54
check_member(aoss, aoss_cc_reset_status, 0x50020)
enum cb_err clock_configure_enable_gpll(struct alpha_pll_reg_val_config *cfg, bool enable, int br_enable)
Definition: clock.c:163
enum cb_err zonda_pll_enable(struct alpha_pll_reg_val_config *cfg)
Definition: clock.c:244
clk_ctl_bcr
Definition: clock_common.h:126
@ CLK_CTL_BCR_BLK_BMSK
Definition: clock_common.h:128
@ CLK_CTL_BCR_BLK_SHFT
Definition: clock_common.h:127
enum cb_err agera_pll_enable(struct alpha_pll_reg_val_config *cfg)
Definition: clock.c:223
clk_ctl_cbcr
Definition: clock_common.h:113
@ CLK_CTL_EN_BMSK
Definition: clock_common.h:116
@ CLK_CTL_OFF_SHFT
Definition: clock_common.h:115
@ CLK_CTL_OFF_BMSK
Definition: clock_common.h:117
@ CLK_CTL_EN_SHFT
Definition: clock_common.h:114
void clock_reset_subsystem(u32 *misc, u32 shft)
Definition: clock.c:268
clk_ctl_rcg_mnd
Definition: clock_common.h:120
@ CLK_CTL_RCG_MND_SHFT
Definition: clock_common.h:122
@ CLK_CTL_RCG_MND_BMSK
Definition: clock_common.h:123
@ RCG_MODE_DUAL_EDGE
Definition: clock_common.h:121
enum cb_err enable_and_poll_gdsc_status(void *gdscr_addr)
Definition: clock.c:63
gpll_mode
Definition: clock_common.h:88
@ PLL_RESET_SHFT
Definition: clock_common.h:98
@ PLL_RESET_N_SHFT
Definition: clock_common.h:99
@ PLL_LOCK_DET_BMSK
Definition: clock_common.h:89
@ PLL_FSM_EN_SHFT
Definition: clock_common.h:100
@ PLL_RUN_MODE
Definition: clock_common.h:94
@ PLL_OUTCTRL_SHFT
Definition: clock_common.h:96
@ PLL_BYPASSNL_BMSK
Definition: clock_common.h:90
@ PLL_OUTCTRL_BMSK
Definition: clock_common.h:91
@ PLL_STANDBY_MODE
Definition: clock_common.h:93
@ PLL_OPMODE_SHFT
Definition: clock_common.h:95
@ PLL_USERCTL_BMSK
Definition: clock_common.h:92
@ PLL_BYPASSNL_SHFT
Definition: clock_common.h:97
clk_ctl_cfg_rcgr
Definition: clock_common.h:103
@ CLK_CTL_CFG_SRC_DIV_SHFT
Definition: clock_common.h:104
@ CLK_CTL_CFG_MODE_SHFT
Definition: clock_common.h:106
@ CLK_CTL_CFG_SRC_SEL_SHFT
Definition: clock_common.h:105
clk_ctl_cmd_rcgr
Definition: clock_common.h:109
@ CLK_CTL_CMD_UPDATE_SHFT
Definition: clock_common.h:110
enum cb_err clock_enable_vote(void *cbcr_addr, void *vote_addr, uint32_t vote_bit)
Definition: clock.c:17
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
u8 _res0[0x50020]
Definition: clock_common.h:170
u8 _res1[0x5002c - 0x50024]
Definition: clock_common.h:172
u32 aoss_cc_reset_status
Definition: clock_common.h:171
u32 aoss_cc_apcs_misc
Definition: clock_common.h:173
u32 perf_d_dfsr[8]
Definition: clock_common.h:32
u8 _res1[0x60 - 0x40]
Definition: clock_common.h:27
u32 perf_dfsr[8]
Definition: clock_common.h:26
u32 perf_m_dfsr[8]
Definition: clock_common.h:28
u8 _res3[0xe0 - 0xc0]
Definition: clock_common.h:31
u8 _res4[0x130 - 0x100]
Definition: clock_common.h:33
u8 _res2[0xa0 - 0x80]
Definition: clock_common.h:29
u32 perf_n_dfsr[8]
Definition: clock_common.h:30
u8 _res0[0x20 - 0x1c]
Definition: clock_common.h:25
struct clock_rcg clock
Definition: clock_common.h:16
struct clock_rcg_mnd clk
Definition: clock_common.h:48
struct clock_rcg_dfsr dfsr_clk
Definition: clock_common.h:49
u32 shrm_sproc_ctrl
Definition: clock_common.h:179