6261a940d7196d45e9db65feba954df43195824d
[openwrt/staging/svanheule.git] /
1 From 18ae57b1e8abee6c453381470f6e18991d2901a8 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Wed, 9 Nov 2022 01:56:28 +0100
4 Subject: [PATCH 3/6] clk: qcom: krait-cc: also enable secondary mux and div
5 clk
6
7 clk-krait ignore any rate change if clk is not flagged as enabled.
8 Correctly enable the secondary mux and div clk to correctly change rate
9 instead of silently ignoring the request.
10
11 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
12 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
13 Link: https://lore.kernel.org/r/20221109005631.3189-2-ansuelsmth@gmail.com
14 ---
15 drivers/clk/qcom/krait-cc.c | 21 ++++++++++++++++++++-
16 1 file changed, 20 insertions(+), 1 deletion(-)
17
18 --- a/drivers/clk/qcom/krait-cc.c
19 +++ b/drivers/clk/qcom/krait-cc.c
20 @@ -80,6 +80,7 @@ krait_add_div(struct device *dev, int id
21 };
22 const char *p_names[1];
23 struct clk *clk;
24 + int cpu;
25
26 div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL);
27 if (!div)
28 @@ -103,6 +104,17 @@ krait_add_div(struct device *dev, int id
29 }
30
31 clk = devm_clk_register(dev, &div->hw);
32 + if (IS_ERR(clk))
33 + goto err;
34 +
35 + /* clk-krait ignore any rate change if mux is not flagged as enabled */
36 + if (id < 0)
37 + for_each_online_cpu(cpu)
38 + clk_prepare_enable(div->hw.clk);
39 + else
40 + clk_prepare_enable(div->hw.clk);
41 +
42 +err:
43 kfree(p_names[0]);
44 kfree(init.name);
45
46 @@ -113,7 +125,7 @@ static int
47 krait_add_sec_mux(struct device *dev, int id, const char *s,
48 unsigned int offset, bool unique_aux)
49 {
50 - int ret;
51 + int cpu, ret;
52 struct krait_mux_clk *mux;
53 static const char *sec_mux_list[] = {
54 "qsb",
55 @@ -165,6 +177,13 @@ krait_add_sec_mux(struct device *dev, in
56 if (ret)
57 goto unique_aux;
58
59 + /* clk-krait ignore any rate change if mux is not flagged as enabled */
60 + if (id < 0)
61 + for_each_online_cpu(cpu)
62 + clk_prepare_enable(mux->hw.clk);
63 + else
64 + clk_prepare_enable(mux->hw.clk);
65 +
66 unique_aux:
67 if (unique_aux)
68 kfree(sec_mux_list[0]);