fabb299f427776fb73a337d3a4eec71b9ef08930
[openwrt/staging/jow.git] /
1 From e5dc1a4c01510da8438dddfdf4200b79d73990dc Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Wed, 9 Nov 2022 01:56:29 +0100
4 Subject: [PATCH 4/6] clk: qcom: krait-cc: handle secondary mux sourcing out of
5 acpu_aux
6
7 Some bootloader may leave the system in an even more undefined state
8 with the secondary mux of L2 or other cores sourcing out of the acpu_aux
9 parent. This results in the clk set to the PXO rate or a PLL8 rate.
10
11 The current logic to reset the mux and set them to a defined state only
12 handle if the mux are configured to source out of QSB. Change this and
13 force a new and defined state if the current clk is lower than the aux
14 rate. This way we can handle any wrong configuration where the mux is
15 sourcing out of QSB (rate 225MHz, currently set to a virtual rate of 1),
16 PXO rate (rate 25MHz) or PLL8 (needs to be configured to run at 384Mhz).
17
18 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
19 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
20 Link: https://lore.kernel.org/r/20221109005631.3189-3-ansuelsmth@gmail.com
21 ---
22 drivers/clk/qcom/krait-cc.c | 8 ++++----
23 1 file changed, 4 insertions(+), 4 deletions(-)
24
25 --- a/drivers/clk/qcom/krait-cc.c
26 +++ b/drivers/clk/qcom/krait-cc.c
27 @@ -383,8 +383,8 @@ static int krait_cc_probe(struct platfor
28 */
29 cur_rate = clk_get_rate(l2_pri_mux_clk);
30 aux_rate = 384000000;
31 - if (cur_rate == 1) {
32 - pr_info("L2 @ QSB rate. Forcing new rate.\n");
33 + if (cur_rate < aux_rate) {
34 + pr_info("L2 @ Undefined rate. Forcing new rate.\n");
35 cur_rate = aux_rate;
36 }
37 clk_set_rate(l2_pri_mux_clk, aux_rate);
38 @@ -394,8 +394,8 @@ static int krait_cc_probe(struct platfor
39 for_each_possible_cpu(cpu) {
40 clk = clks[cpu];
41 cur_rate = clk_get_rate(clk);
42 - if (cur_rate == 1) {
43 - pr_info("CPU%d @ QSB rate. Forcing new rate.\n", cpu);
44 + if (cur_rate < aux_rate) {
45 + pr_info("CPU%d @ Undefined rate. Forcing new rate.\n", cpu);
46 cur_rate = aux_rate;
47 }
48