Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: qcom: msm8996-cpu: Use parent_data/_hws for all clocks

Replace parent_names in PLLs, secondary muxes and primary muxes with
parent_data. For primary muxes there were never any *cl_pll_acd clocks,
so instead of adding them, put the primary PLLs in both PLL_INDEX and
ACD_INDEX, then make sure ACD_INDEX is always picked over PLL_INDEX when
setting parent since we always want ACD when using the primary PLLs.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
[DB: switch to parent_hws for pmux clocks]
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20220714100351.1834711-2-dmitry.baryshkov@linaro.org

authored by

Yassine Oudjana and committed by
Bjorn Andersson
da5daae8 b4feed4a

+47 -32
+47 -32
drivers/clk/qcom/clk-cpu-8996.c
··· 112 112 .early_output_mask = BIT(3), 113 113 }; 114 114 115 + static const struct clk_parent_data pll_parent[] = { 116 + { .fw_name = "xo" }, 117 + }; 118 + 115 119 static struct clk_alpha_pll pwrcl_pll = { 116 120 .offset = PWRCL_REG_OFFSET, 117 121 .regs = prim_pll_regs, 118 122 .flags = SUPPORTS_DYNAMIC_UPDATE | SUPPORTS_FSM_MODE, 119 123 .clkr.hw.init = &(struct clk_init_data){ 120 124 .name = "pwrcl_pll", 121 - .parent_names = (const char *[]){ "xo" }, 122 - .num_parents = 1, 125 + .parent_data = pll_parent, 126 + .num_parents = ARRAY_SIZE(pll_parent), 123 127 .ops = &clk_alpha_pll_huayra_ops, 124 128 }, 125 129 }; ··· 134 130 .flags = SUPPORTS_DYNAMIC_UPDATE | SUPPORTS_FSM_MODE, 135 131 .clkr.hw.init = &(struct clk_init_data){ 136 132 .name = "perfcl_pll", 137 - .parent_names = (const char *[]){ "xo" }, 138 - .num_parents = 1, 133 + .parent_data = pll_parent, 134 + .num_parents = ARRAY_SIZE(pll_parent), 139 135 .ops = &clk_alpha_pll_huayra_ops, 140 136 }, 141 137 }; ··· 194 190 .flags = SUPPORTS_OFFLINE_REQ | SUPPORTS_FSM_MODE, 195 191 .clkr.hw.init = &(struct clk_init_data) { 196 192 .name = "pwrcl_alt_pll", 197 - .parent_names = (const char *[]){ "xo" }, 198 - .num_parents = 1, 193 + .parent_data = pll_parent, 194 + .num_parents = ARRAY_SIZE(pll_parent), 199 195 .ops = &clk_alpha_pll_hwfsm_ops, 200 196 }, 201 197 }; ··· 208 204 .flags = SUPPORTS_OFFLINE_REQ | SUPPORTS_FSM_MODE, 209 205 .clkr.hw.init = &(struct clk_init_data) { 210 206 .name = "perfcl_alt_pll", 211 - .parent_names = (const char *[]){ "xo" }, 212 - .num_parents = 1, 207 + .parent_data = pll_parent, 208 + .num_parents = ARRAY_SIZE(pll_parent), 213 209 .ops = &clk_alpha_pll_hwfsm_ops, 214 210 }, 215 211 }; ··· 256 252 u32 val; 257 253 258 254 val = index; 255 + /* We always want ACD when using the primary PLL */ 256 + if (val == PLL_INDEX) 257 + val = ACD_INDEX; 259 258 val <<= cpuclk->shift; 260 259 261 260 return regmap_update_bits(clkr->regmap, cpuclk->reg, mask, val); ··· 289 282 .determine_rate = clk_cpu_8996_pmux_determine_rate, 290 283 }; 291 284 285 + static const struct clk_parent_data pwrcl_smux_parents[] = { 286 + { .fw_name = "xo" }, 287 + { .hw = &pwrcl_pll_postdiv.hw }, 288 + }; 289 + 290 + static const struct clk_parent_data perfcl_smux_parents[] = { 291 + { .fw_name = "xo" }, 292 + { .hw = &perfcl_pll_postdiv.hw }, 293 + }; 294 + 292 295 static struct clk_regmap_mux pwrcl_smux = { 293 296 .reg = PWRCL_REG_OFFSET + MUX_OFFSET, 294 297 .shift = 2, 295 298 .width = 2, 296 299 .clkr.hw.init = &(struct clk_init_data) { 297 300 .name = "pwrcl_smux", 298 - .parent_names = (const char *[]){ 299 - "xo", 300 - "pwrcl_pll_postdiv", 301 - }, 302 - .num_parents = 2, 301 + .parent_data = pwrcl_smux_parents, 302 + .num_parents = ARRAY_SIZE(pwrcl_smux_parents), 303 303 .ops = &clk_regmap_mux_closest_ops, 304 304 .flags = CLK_SET_RATE_PARENT, 305 305 }, ··· 318 304 .width = 2, 319 305 .clkr.hw.init = &(struct clk_init_data) { 320 306 .name = "perfcl_smux", 321 - .parent_names = (const char *[]){ 322 - "xo", 323 - "perfcl_pll_postdiv", 324 - }, 325 - .num_parents = 2, 307 + .parent_data = perfcl_smux_parents, 308 + .num_parents = ARRAY_SIZE(perfcl_smux_parents), 326 309 .ops = &clk_regmap_mux_closest_ops, 327 310 .flags = CLK_SET_RATE_PARENT, 328 311 }, 312 + }; 313 + 314 + static const struct clk_hw *pwrcl_pmux_parents[] = { 315 + [SMUX_INDEX] = &pwrcl_smux.clkr.hw, 316 + [PLL_INDEX] = &pwrcl_pll.clkr.hw, 317 + [ACD_INDEX] = &pwrcl_pll.clkr.hw, 318 + [ALT_INDEX] = &pwrcl_alt_pll.clkr.hw, 319 + }; 320 + 321 + static const struct clk_hw *perfcl_pmux_parents[] = { 322 + [SMUX_INDEX] = &perfcl_smux.clkr.hw, 323 + [PLL_INDEX] = &perfcl_pll.clkr.hw, 324 + [ACD_INDEX] = &perfcl_pll.clkr.hw, 325 + [ALT_INDEX] = &perfcl_alt_pll.clkr.hw, 329 326 }; 330 327 331 328 static struct clk_cpu_8996_pmux pwrcl_pmux = { ··· 348 323 .nb.notifier_call = cpu_clk_notifier_cb, 349 324 .clkr.hw.init = &(struct clk_init_data) { 350 325 .name = "pwrcl_pmux", 351 - .parent_names = (const char *[]){ 352 - "pwrcl_smux", 353 - "pwrcl_pll", 354 - "pwrcl_pll_acd", 355 - "pwrcl_alt_pll", 356 - }, 357 - .num_parents = 4, 326 + .parent_hws = pwrcl_pmux_parents, 327 + .num_parents = ARRAY_SIZE(pwrcl_pmux_parents), 358 328 .ops = &clk_cpu_8996_pmux_ops, 359 329 /* CPU clock is critical and should never be gated */ 360 330 .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, ··· 365 345 .nb.notifier_call = cpu_clk_notifier_cb, 366 346 .clkr.hw.init = &(struct clk_init_data) { 367 347 .name = "perfcl_pmux", 368 - .parent_names = (const char *[]){ 369 - "perfcl_smux", 370 - "perfcl_pll", 371 - "perfcl_pll_acd", 372 - "perfcl_alt_pll", 373 - }, 374 - .num_parents = 4, 348 + .parent_hws = perfcl_pmux_parents, 349 + .num_parents = ARRAY_SIZE(perfcl_pmux_parents), 375 350 .ops = &clk_cpu_8996_pmux_ops, 376 351 /* CPU clock is critical and should never be gated */ 377 352 .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,