diff mbox series

[11/16] clk: qcom: krait-cc: force sec_mux to QSB

Message ID 20220313190419.2207-12-ansuelsmth@gmail.com
State Superseded
Headers show
Series None | expand

Commit Message

Christian Marangi March 13, 2022, 7:04 p.m. UTC
Now that we have converted every driver to parent_data, it was
notice that the bootloader can't really leave the system in a
strange state where l2 or the cpu0/1 can be sourced in a number of ways
for example cpu1 sourcing out of qsb, l2 sourcing out of pxo.
To correctly reset the mux and the HFPLL force the sec_mux to QSB.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 drivers/clk/qcom/krait-cc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Stephen Boyd March 15, 2022, 10:47 p.m. UTC | #1
Quoting Ansuel Smith (2022-03-13 12:04:14)
> Now that we have converted every driver to parent_data, it was
> notice that the bootloader can't really leave the system in a
> strange state where l2 or the cpu0/1 can be sourced in a number of ways
> for example cpu1 sourcing out of qsb, l2 sourcing out of pxo.
> To correctly reset the mux and the HFPLL force the sec_mux to QSB.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
>  drivers/clk/qcom/krait-cc.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/qcom/krait-cc.c b/drivers/clk/qcom/krait-cc.c
> index 6530f10a546f..1bdc89c097e6 100644
> --- a/drivers/clk/qcom/krait-cc.c
> +++ b/drivers/clk/qcom/krait-cc.c
> @@ -15,6 +15,8 @@
>  
>  #include "clk-krait.h"
>  
> +#define QSB_RATE       1
> +
>  static unsigned int sec_mux_map[] = {
>         2,
>         0,
> @@ -178,6 +180,12 @@ krait_add_sec_mux(struct device *dev, struct clk *qsb, int id,
>         if (ret)
>                 clk = ERR_PTR(ret);
>  
> +       /* Force the sec_mux to be set to QSB rate.

The comment start should be on a line alone

	/*
	 * Force the ...

> +        * This is needed to correctly set the parents and
> +        * to later reset mux and HFPLL to a known freq.
> +        */
> +       clk_set_rate(clk, QSB_RATE);
> +
>  err_clk:
>         if (unique_aux)
>                 kfree(parent_name);
diff mbox series

Patch

diff --git a/drivers/clk/qcom/krait-cc.c b/drivers/clk/qcom/krait-cc.c
index 6530f10a546f..1bdc89c097e6 100644
--- a/drivers/clk/qcom/krait-cc.c
+++ b/drivers/clk/qcom/krait-cc.c
@@ -15,6 +15,8 @@ 
 
 #include "clk-krait.h"
 
+#define QSB_RATE	1
+
 static unsigned int sec_mux_map[] = {
 	2,
 	0,
@@ -178,6 +180,12 @@  krait_add_sec_mux(struct device *dev, struct clk *qsb, int id,
 	if (ret)
 		clk = ERR_PTR(ret);
 
+	/* Force the sec_mux to be set to QSB rate.
+	 * This is needed to correctly set the parents and
+	 * to later reset mux and HFPLL to a known freq.
+	 */
+	clk_set_rate(clk, QSB_RATE);
+
 err_clk:
 	if (unique_aux)
 		kfree(parent_name);
@@ -374,7 +382,7 @@  static int krait_cc_probe(struct platform_device *pdev)
 	 */
 	cur_rate = clk_get_rate(l2_pri_mux_clk);
 	aux_rate = 384000000;
-	if (cur_rate == 1) {
+	if (cur_rate == QSB_RATE) {
 		dev_info(dev, "L2 @ QSB rate. Forcing new rate.\n");
 		cur_rate = aux_rate;
 	}
@@ -385,7 +393,7 @@  static int krait_cc_probe(struct platform_device *pdev)
 	for_each_possible_cpu(cpu) {
 		clk = clks[cpu];
 		cur_rate = clk_get_rate(clk);
-		if (cur_rate == 1) {
+		if (cur_rate == QSB_RATE) {
 			dev_info(dev, "CPU%d @ QSB rate. Forcing new rate.\n", cpu);
 			cur_rate = aux_rate;
 		}