Skip to content

Commit 93f5ccd

Browse files
committed
debugcc: supports custom xo rate
Some device have a different rate for the xo debug oscillator. Add support for defining custom xo rate in the primary debug mux. Signed-off-by: Christian Marangi <[email protected]>
1 parent bde23d9 commit 93f5ccd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

debugcc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,15 @@ void mux_disable(struct debug_mux *mux)
116116
unsigned long measure_gcc(const struct measure_clk *clk,
117117
const struct debug_mux *mux)
118118
{
119+
unsigned int xo_rate = 4800000;
119120
uint64_t raw_count_short;
120121
uint64_t raw_count_full;
121122
struct gcc_mux *gcc = container_of(mux, struct gcc_mux, mux);
122123
unsigned long xo_div4;
123124

125+
if (gcc->xo_rate)
126+
xo_rate = gcc->xo_rate;
127+
124128
xo_div4 = readl(mux->base + gcc->xo_div4_reg);
125129
if (gcc->xo_div4_val)
126130
writel(xo_div4 | gcc->xo_div4_val, mux->base + gcc->xo_div4_reg);
@@ -136,7 +140,7 @@ unsigned long measure_gcc(const struct measure_clk *clk,
136140
return 0;
137141
}
138142

139-
raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
143+
raw_count_full = ((raw_count_full * 10) + 15) * xo_rate;
140144
raw_count_full = raw_count_full / ((0x10000 * 10) + 35);
141145

142146
if (mux->div_val)

debugcc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ struct debug_mux {
6565
struct gcc_mux {
6666
struct debug_mux mux;
6767

68+
unsigned int xo_rate;
69+
6870
unsigned int xo_div4_reg;
6971
unsigned int xo_div4_val;
7072

0 commit comments

Comments
 (0)