From 360769b5fcce9d3f722f2856938261e075821098 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 18 Jan 2023 07:24:57 +0200 Subject: [PATCH] debugcc: allow leaf muxes to override measurement function MCCC (memory clock controller) uses non-standard measuring process (just read the rate and return). Provide a way to override default measurement proces with the leaf cc hook. Signed-off-by: Dmitry Baryshkov --- debugcc.c | 5 ++++- debugcc.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debugcc.c b/debugcc.c index b12d62a..80aa48c 100644 --- a/debugcc.c +++ b/debugcc.c @@ -195,7 +195,10 @@ static void measure(const struct measure_clk *clk) mux_prepare_enable(clk->primary, clk->mux); - clk_rate = measure_default(clk); + if (clk->leaf && clk->leaf->measure) + clk_rate = clk->leaf->measure(clk); + else + clk_rate = measure_default(clk); mux_disable(clk->primary); diff --git a/debugcc.h b/debugcc.h index 61b11cc..e9f27f4 100644 --- a/debugcc.h +++ b/debugcc.h @@ -35,6 +35,8 @@ #define CORE_CC_BLOCK "core" +struct measure_clk; + struct debug_mux { unsigned long phys; void *base; @@ -61,6 +63,7 @@ struct debug_mux { unsigned int ahb_mask; void (*premeasure)(struct debug_mux *mux); + unsigned long (*measure)(const struct measure_clk *clk); void (*postmeasure)(struct debug_mux *mux); };