clk: qcom: cpu-8996: skip ACD init if the setup is valid
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 13 Jan 2023 12:05:36 +0000 (14:05 +0200)
committerBjorn Andersson <andersson@kernel.org>
Thu, 19 Jan 2023 03:06:51 +0000 (21:06 -0600)
Check whether L2 registers contain correct values and skip programming
if they are valid. This follows the code present downstream.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230113120544.59320-7-dmitry.baryshkov@linaro.org
drivers/clk/qcom/clk-cpu-8996.c

index 0e0c00d..7e5246c 100644 (file)
@@ -472,10 +472,15 @@ static void __iomem *base;
 static void qcom_cpu_clk_msm8996_acd_init(void __iomem *base)
 {
        u64 hwid;
+       u32 val;
        unsigned long flags;
 
        spin_lock_irqsave(&qcom_clk_acd_lock, flags);
 
+       val = kryo_l2_get_indirect_reg(L2ACDTD_REG);
+       if (val == 0x00006a11)
+               goto out;
+
        hwid = read_cpuid_mpidr() & CPU_AFINITY_MASK;
 
        kryo_l2_set_indirect_reg(L2ACDTD_REG, 0x00006a11);
@@ -492,6 +497,7 @@ static void qcom_cpu_clk_msm8996_acd_init(void __iomem *base)
                writel(0xf, base + PERFCL_REG_OFFSET + SSSCTL_OFFSET);
        }
 
+out:
        spin_unlock_irqrestore(&qcom_clk_acd_lock, flags);
 }