debugcc: preserve xo_div4 contents

Preserve the contents of the xo_div4 register. Downstream kernel
preserves the contents of the register. Writing just 1 makes the msm8996
report the value divided by 4 rather than the actual clock frequency.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Dmitry Baryshkov
2022-09-21 23:02:19 +03:00
committed by Bjorn Andersson
parent 6de6d216d7
commit 34fb8ccda7

View File

@@ -133,6 +133,7 @@ static void measure(const struct measure_clk *clk)
unsigned long raw_count_short;
unsigned long raw_count_full;
struct debug_mux *gcc = clk->primary;
unsigned long xo_div4;
if (!leaf_enabled(gcc, clk->leaf)) {
printf("%50s: skipping\n", clk->name);
@@ -144,12 +145,13 @@ static void measure(const struct measure_clk *clk)
mux_enable(clk->primary, clk->mux);
writel(1, gcc->base + gcc->xo_div4_reg);
xo_div4 = readl(gcc->base + gcc->xo_div4_reg);
writel(xo_div4 | 1, gcc->base + gcc->xo_div4_reg);
raw_count_short = measure_ticks(gcc, 0x1000);
raw_count_full = measure_ticks(gcc, 0x10000);
writel(0, gcc->base + gcc->xo_div4_reg);
writel(xo_div4, gcc->base + gcc->xo_div4_reg);
if (raw_count_full == raw_count_short) {
printf("%50s: off\n", clk->name);