1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved. */
4 #ifndef __QCOM_CLK_ALPHA_PLL_H__
5 #define __QCOM_CLK_ALPHA_PLL_H__
7 #include <linux/clk-provider.h>
8 #include "clk-regmap.h"
12 CLK_ALPHA_PLL_TYPE_DEFAULT,
13 CLK_ALPHA_PLL_TYPE_HUAYRA,
14 CLK_ALPHA_PLL_TYPE_BRAMMO,
15 CLK_ALPHA_PLL_TYPE_FABIA,
16 CLK_ALPHA_PLL_TYPE_TRION,
17 CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
18 CLK_ALPHA_PLL_TYPE_AGERA,
19 CLK_ALPHA_PLL_TYPE_ZONDA,
20 CLK_ALPHA_PLL_TYPE_LUCID_EVO,
21 CLK_ALPHA_PLL_TYPE_RIVIAN_EVO,
22 CLK_ALPHA_PLL_TYPE_MAX,
35 PLL_OFF_CONFIG_CTL_U1,
46 extern const u8 clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_MAX][PLL_OFF_MAX_REGS];
49 unsigned long min_freq;
50 unsigned long max_freq;
54 #define VCO(a, b, c) { \
61 * struct clk_alpha_pll - phase locked loop (PLL)
62 * @offset: base address of registers
63 * @vco_table: array of VCO settings
64 * @regs: alpha pll register map (see @clk_alpha_pll_regs)
65 * @clkr: regmap clock handle
67 struct clk_alpha_pll {
71 const struct pll_vco *vco_table;
73 #define SUPPORTS_OFFLINE_REQ BIT(0)
74 #define SUPPORTS_FSM_MODE BIT(2)
75 #define SUPPORTS_DYNAMIC_UPDATE BIT(3)
78 struct clk_regmap clkr;
82 * struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider
83 * @offset: base address of registers
84 * @regs: alpha pll register map (see @clk_alpha_pll_regs)
85 * @width: width of post-divider
86 * @post_div_shift: shift to differentiate between odd & even post-divider
87 * @post_div_table: table with PLL odd and even post-divider settings
88 * @num_post_div: Number of PLL post-divider settings
90 * @clkr: regmap clock handle
92 struct clk_alpha_pll_postdiv {
97 struct clk_regmap clkr;
99 const struct clk_div_table *post_div_table;
103 struct alpha_pll_config {
108 u32 config_ctl_hi_val;
109 u32 config_ctl_hi1_val;
112 u32 user_ctl_hi1_val;
115 u32 test_ctl_hi1_val;
116 u32 main_output_mask;
118 u32 aux2_output_mask;
119 u32 early_output_mask;
130 extern const struct clk_ops clk_alpha_pll_ops;
131 extern const struct clk_ops clk_alpha_pll_fixed_ops;
132 extern const struct clk_ops clk_alpha_pll_hwfsm_ops;
133 extern const struct clk_ops clk_alpha_pll_postdiv_ops;
134 extern const struct clk_ops clk_alpha_pll_huayra_ops;
135 extern const struct clk_ops clk_alpha_pll_postdiv_ro_ops;
137 extern const struct clk_ops clk_alpha_pll_fabia_ops;
138 extern const struct clk_ops clk_alpha_pll_fixed_fabia_ops;
139 extern const struct clk_ops clk_alpha_pll_postdiv_fabia_ops;
141 extern const struct clk_ops clk_alpha_pll_trion_ops;
142 extern const struct clk_ops clk_alpha_pll_fixed_trion_ops;
143 extern const struct clk_ops clk_alpha_pll_postdiv_trion_ops;
145 extern const struct clk_ops clk_alpha_pll_lucid_ops;
146 #define clk_alpha_pll_fixed_lucid_ops clk_alpha_pll_fixed_trion_ops
147 extern const struct clk_ops clk_alpha_pll_postdiv_lucid_ops;
148 extern const struct clk_ops clk_alpha_pll_agera_ops;
150 extern const struct clk_ops clk_alpha_pll_lucid_5lpe_ops;
151 extern const struct clk_ops clk_alpha_pll_fixed_lucid_5lpe_ops;
152 extern const struct clk_ops clk_alpha_pll_postdiv_lucid_5lpe_ops;
154 extern const struct clk_ops clk_alpha_pll_zonda_ops;
155 #define clk_alpha_pll_postdiv_zonda_ops clk_alpha_pll_postdiv_fabia_ops
157 extern const struct clk_ops clk_alpha_pll_lucid_evo_ops;
158 extern const struct clk_ops clk_alpha_pll_fixed_lucid_evo_ops;
159 extern const struct clk_ops clk_alpha_pll_postdiv_lucid_evo_ops;
161 extern const struct clk_ops clk_alpha_pll_rivian_evo_ops;
162 #define clk_alpha_pll_postdiv_rivian_evo_ops clk_alpha_pll_postdiv_fabia_ops
164 void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
165 const struct alpha_pll_config *config);
166 void clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
167 const struct alpha_pll_config *config);
168 void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
169 const struct alpha_pll_config *config);
170 void clk_agera_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
171 const struct alpha_pll_config *config);
172 #define clk_lucid_pll_configure(pll, regmap, config) \
173 clk_trion_pll_configure(pll, regmap, config)
175 void clk_zonda_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
176 const struct alpha_pll_config *config);
177 void clk_lucid_evo_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
178 const struct alpha_pll_config *config);
179 void clk_rivian_evo_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
180 const struct alpha_pll_config *config);