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 <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi
2023-06-13 17:02:32 +02:00
parent bde23d9858
commit 93f5ccd037
2 changed files with 7 additions and 1 deletions

View File

@@ -116,11 +116,15 @@ void mux_disable(struct debug_mux *mux)
unsigned long measure_gcc(const struct measure_clk *clk,
const struct debug_mux *mux)
{
unsigned int xo_rate = 4800000;
uint64_t raw_count_short;
uint64_t raw_count_full;
struct gcc_mux *gcc = container_of(mux, struct gcc_mux, mux);
unsigned long xo_div4;
if (gcc->xo_rate)
xo_rate = gcc->xo_rate;
xo_div4 = readl(mux->base + gcc->xo_div4_reg);
if (gcc->xo_div4_val)
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,
return 0;
}
raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
raw_count_full = ((raw_count_full * 10) + 15) * xo_rate;
raw_count_full = raw_count_full / ((0x10000 * 10) + 35);
if (mux->div_val)

View File

@@ -65,6 +65,8 @@ struct debug_mux {
struct gcc_mux {
struct debug_mux mux;
unsigned int xo_rate;
unsigned int xo_div4_reg;
unsigned int xo_div4_val;