1 From b293510f3961b90dcab59965f57779be93ceda7c Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Sat, 26 Feb 2022 14:52:32 +0100
4 Subject: [PATCH 12/14] clk: qcom: gcc-ipq806x: add CryptoEngine clocks
6 Add missing CryptoEngine clocks and pll11 required clock.
8 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
9 Reviewed-by: Stephen Boyd <sboyd@kernel.org>
10 Tested-by: Jonathan McDowell <noodles@earth.li>
11 Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
12 Link: https://lore.kernel.org/r/20220226135235.10051-13-ansuelsmth@gmail.com
14 drivers/clk/qcom/gcc-ipq806x.c | 244 +++++++++++++++++++++++++++++++++
15 1 file changed, 244 insertions(+)
17 --- a/drivers/clk/qcom/gcc-ipq806x.c
18 +++ b/drivers/clk/qcom/gcc-ipq806x.c
19 @@ -256,6 +256,24 @@ static struct clk_pll pll18 = {
23 +static struct clk_pll pll11 = {
27 + .config_reg = 0x3194,
29 + .status_reg = 0x3198,
31 + .clkr.hw.init = &(struct clk_init_data){
33 + .parent_data = &(const struct clk_parent_data){
37 + .ops = &clk_pll_ops,
44 @@ -264,6 +282,7 @@ enum {
51 static const struct parent_map gcc_pxo_pll8_map[] = {
52 @@ -331,6 +350,44 @@ static const struct clk_parent_data gcc_
53 { .hw = &pll18.clkr.hw },
56 +static const struct parent_map gcc_pxo_pll8_pll0_pll14_pll18_pll11_map[] = {
65 +static const struct clk_parent_data gcc_pxo_pll8_pll0_pll14_pll18_pll11[] = {
66 + { .fw_name = "pxo" },
67 + { .hw = &pll8_vote.hw },
68 + { .hw = &pll0_vote.hw },
69 + { .hw = &pll14.clkr.hw },
70 + { .hw = &pll18.clkr.hw },
71 + { .hw = &pll11.clkr.hw },
75 +static const struct parent_map gcc_pxo_pll3_pll0_pll14_pll18_pll11_map[] = {
84 +static const struct clk_parent_data gcc_pxo_pll3_pll0_pll14_pll18_pll11[] = {
85 + { .fw_name = "pxo" },
86 + { .hw = &pll3.clkr.hw },
87 + { .hw = &pll0_vote.hw },
88 + { .hw = &pll14.clkr.hw },
89 + { .hw = &pll18.clkr.hw },
90 + { .hw = &pll11.clkr.hw },
94 static struct freq_tbl clk_tbl_gsbi_uart[] = {
95 { 1843200, P_PLL8, 2, 6, 625 },
96 { 3686400, P_PLL8, 2, 12, 625 },
97 @@ -2824,6 +2881,186 @@ static struct clk_dyn_rcg ubi32_core2_sr
101 +static const struct freq_tbl clk_tbl_ce5_core[] = {
102 + { 150000000, P_PLL3, 8, 1, 1 },
103 + { 213200000, P_PLL11, 5, 1, 1 },
107 +static struct clk_dyn_rcg ce5_core_src = {
108 + .ns_reg[0] = 0x36C4,
109 + .ns_reg[1] = 0x36C8,
110 + .bank_reg = 0x36C0,
112 + .src_sel_shift = 0,
113 + .parent_map = gcc_pxo_pll3_pll0_pll14_pll18_pll11_map,
116 + .src_sel_shift = 0,
117 + .parent_map = gcc_pxo_pll3_pll0_pll14_pll18_pll11_map,
120 + .pre_div_shift = 3,
121 + .pre_div_width = 4,
124 + .pre_div_shift = 3,
125 + .pre_div_width = 4,
128 + .freq_tbl = clk_tbl_ce5_core,
130 + .enable_reg = 0x36C0,
131 + .enable_mask = BIT(1),
132 + .hw.init = &(struct clk_init_data){
133 + .name = "ce5_core_src",
134 + .parent_data = gcc_pxo_pll3_pll0_pll14_pll18_pll11,
135 + .num_parents = ARRAY_SIZE(gcc_pxo_pll3_pll0_pll14_pll18_pll11),
136 + .ops = &clk_dyn_rcg_ops,
141 +static struct clk_branch ce5_core_clk = {
142 + .halt_reg = 0x2FDC,
144 + .hwcg_reg = 0x36CC,
147 + .enable_reg = 0x36CC,
148 + .enable_mask = BIT(4),
149 + .hw.init = &(struct clk_init_data){
150 + .name = "ce5_core_clk",
151 + .parent_hws = (const struct clk_hw*[]){
152 + &ce5_core_src.clkr.hw,
155 + .ops = &clk_branch_ops,
156 + .flags = CLK_SET_RATE_PARENT,
161 +static const struct freq_tbl clk_tbl_ce5_a_clk[] = {
162 + { 160000000, P_PLL0, 5, 1, 1 },
163 + { 213200000, P_PLL11, 5, 1, 1 },
167 +static struct clk_dyn_rcg ce5_a_clk_src = {
168 + .ns_reg[0] = 0x3d84,
169 + .ns_reg[1] = 0x3d88,
170 + .bank_reg = 0x3d80,
172 + .src_sel_shift = 0,
173 + .parent_map = gcc_pxo_pll8_pll0_pll14_pll18_pll11_map,
176 + .src_sel_shift = 0,
177 + .parent_map = gcc_pxo_pll8_pll0_pll14_pll18_pll11_map,
180 + .pre_div_shift = 3,
181 + .pre_div_width = 4,
184 + .pre_div_shift = 3,
185 + .pre_div_width = 4,
188 + .freq_tbl = clk_tbl_ce5_a_clk,
190 + .enable_reg = 0x3d80,
191 + .enable_mask = BIT(1),
192 + .hw.init = &(struct clk_init_data){
193 + .name = "ce5_a_clk_src",
194 + .parent_data = gcc_pxo_pll8_pll0_pll14_pll18_pll11,
195 + .num_parents = ARRAY_SIZE(gcc_pxo_pll8_pll0_pll14_pll18_pll11),
196 + .ops = &clk_dyn_rcg_ops,
201 +static struct clk_branch ce5_a_clk = {
202 + .halt_reg = 0x3c20,
204 + .hwcg_reg = 0x3d8c,
207 + .enable_reg = 0x3d8c,
208 + .enable_mask = BIT(4),
209 + .hw.init = &(struct clk_init_data){
210 + .name = "ce5_a_clk",
211 + .parent_hws = (const struct clk_hw*[]){
212 + &ce5_a_clk_src.clkr.hw,
215 + .ops = &clk_branch_ops,
216 + .flags = CLK_SET_RATE_PARENT,
221 +static const struct freq_tbl clk_tbl_ce5_h_clk[] = {
222 + { 160000000, P_PLL0, 5, 1, 1 },
223 + { 213200000, P_PLL11, 5, 1, 1 },
227 +static struct clk_dyn_rcg ce5_h_clk_src = {
228 + .ns_reg[0] = 0x3c64,
229 + .ns_reg[1] = 0x3c68,
230 + .bank_reg = 0x3c60,
232 + .src_sel_shift = 0,
233 + .parent_map = gcc_pxo_pll8_pll0_pll14_pll18_pll11_map,
236 + .src_sel_shift = 0,
237 + .parent_map = gcc_pxo_pll8_pll0_pll14_pll18_pll11_map,
240 + .pre_div_shift = 3,
241 + .pre_div_width = 4,
244 + .pre_div_shift = 3,
245 + .pre_div_width = 4,
248 + .freq_tbl = clk_tbl_ce5_h_clk,
250 + .enable_reg = 0x3c60,
251 + .enable_mask = BIT(1),
252 + .hw.init = &(struct clk_init_data){
253 + .name = "ce5_h_clk_src",
254 + .parent_data = gcc_pxo_pll8_pll0_pll14_pll18_pll11,
255 + .num_parents = ARRAY_SIZE(gcc_pxo_pll8_pll0_pll14_pll18_pll11),
256 + .ops = &clk_dyn_rcg_ops,
261 +static struct clk_branch ce5_h_clk = {
262 + .halt_reg = 0x3c20,
264 + .hwcg_reg = 0x3c6c,
267 + .enable_reg = 0x3c6c,
268 + .enable_mask = BIT(4),
269 + .hw.init = &(struct clk_init_data){
270 + .name = "ce5_h_clk",
271 + .parent_hws = (const struct clk_hw*[]){
272 + &ce5_h_clk_src.clkr.hw,
275 + .ops = &clk_branch_ops,
276 + .flags = CLK_SET_RATE_PARENT,
281 static struct clk_regmap *gcc_ipq806x_clks[] = {
283 [PLL0_VOTE] = &pll0_vote,
284 @@ -2831,6 +3068,7 @@ static struct clk_regmap *gcc_ipq806x_cl
285 [PLL4_VOTE] = &pll4_vote,
287 [PLL8_VOTE] = &pll8_vote,
288 + [PLL11] = &pll11.clkr,
289 [PLL14] = &pll14.clkr,
290 [PLL14_VOTE] = &pll14_vote,
291 [PLL18] = &pll18.clkr,
292 @@ -2945,6 +3183,12 @@ static struct clk_regmap *gcc_ipq806x_cl
293 [PLL9] = &hfpll0.clkr,
294 [PLL10] = &hfpll1.clkr,
295 [PLL12] = &hfpll_l2.clkr,
296 + [CE5_A_CLK_SRC] = &ce5_a_clk_src.clkr,
297 + [CE5_A_CLK] = &ce5_a_clk.clkr,
298 + [CE5_H_CLK_SRC] = &ce5_h_clk_src.clkr,
299 + [CE5_H_CLK] = &ce5_h_clk.clkr,
300 + [CE5_CORE_CLK_SRC] = &ce5_core_src.clkr,
301 + [CE5_CORE_CLK] = &ce5_core_clk.clkr,
304 static const struct qcom_reset_map gcc_ipq806x_resets[] = {