From bde23d9858ca5b214fbaaf5815b213ed5bf9b8d1 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 13 Jun 2023 17:00:41 +0200 Subject: [PATCH] debugcc: support setting xo_div4 custom value Some xo require special value to set it to /4 divisor. Introduce xo_div4_val to handle this special implementation. Signed-off-by: Christian Marangi --- debugcc.c | 5 ++++- debugcc.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debugcc.c b/debugcc.c index e82c841..0071647 100644 --- a/debugcc.c +++ b/debugcc.c @@ -122,7 +122,10 @@ unsigned long measure_gcc(const struct measure_clk *clk, unsigned long xo_div4; xo_div4 = readl(mux->base + gcc->xo_div4_reg); - writel(xo_div4 | 1, mux->base + gcc->xo_div4_reg); + if (gcc->xo_div4_val) + writel(xo_div4 | gcc->xo_div4_val, mux->base + gcc->xo_div4_reg); + else + writel(xo_div4 | 1, mux->base + gcc->xo_div4_reg); raw_count_short = measure_ticks(gcc, 0x1000); raw_count_full = measure_ticks(gcc, 0x10000); diff --git a/debugcc.h b/debugcc.h index 8cb220e..517a2ca 100644 --- a/debugcc.h +++ b/debugcc.h @@ -66,6 +66,8 @@ struct gcc_mux { struct debug_mux mux; unsigned int xo_div4_reg; + unsigned int xo_div4_val; + unsigned int debug_ctl_reg; unsigned int debug_status_reg; };