mirror of
https://github.com/linux-msm/debugcc.git
synced 2026-02-25 13:12:32 -08:00
debugcc: allow customizing the measurement process
MSM8996 requires additional setup to measure CPU clocks. Add hooks to customize the mux enable/disable and measurement process. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
committed by
Bjorn Andersson
parent
7c544f0c40
commit
783b4ffdd2
29
debugcc.c
29
debugcc.c
@@ -84,7 +84,7 @@ static unsigned int measure_ticks(struct debug_mux *gcc, unsigned int ticks)
|
||||
return val;
|
||||
}
|
||||
|
||||
static void mux_enable(struct debug_mux *mux, int selector)
|
||||
static void mux_prepare_enable(struct debug_mux *mux, int selector)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
@@ -100,15 +100,28 @@ static void mux_enable(struct debug_mux *mux, int selector)
|
||||
writel(val, mux->base + mux->div_reg);
|
||||
}
|
||||
|
||||
mux_enable(mux);
|
||||
}
|
||||
|
||||
void mux_enable(struct debug_mux *mux)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
val = readl(mux->base + mux->enable_reg);
|
||||
val |= mux->enable_mask;
|
||||
writel(val, mux->base + mux->enable_reg);
|
||||
|
||||
if (mux->premeasure)
|
||||
mux->premeasure(mux);
|
||||
}
|
||||
|
||||
static void mux_disable(struct debug_mux *mux)
|
||||
void mux_disable(struct debug_mux *mux)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
if (mux->postmeasure)
|
||||
mux->postmeasure(mux);
|
||||
|
||||
val = readl(mux->base + mux->enable_reg);
|
||||
val &= ~mux->enable_mask;
|
||||
writel(val, mux->base + mux->enable_reg);
|
||||
@@ -142,9 +155,9 @@ static void measure(const struct measure_clk *clk)
|
||||
}
|
||||
|
||||
if (clk->leaf)
|
||||
mux_enable(clk->leaf, clk->leaf_mux);
|
||||
mux_prepare_enable(clk->leaf, clk->leaf_mux);
|
||||
|
||||
mux_enable(clk->primary, clk->mux);
|
||||
mux_prepare_enable(clk->primary, clk->mux);
|
||||
|
||||
xo_div4 = readl(gcc->base + gcc->xo_div4_reg);
|
||||
writel(xo_div4 | 1, gcc->base + gcc->xo_div4_reg);
|
||||
@@ -252,7 +265,7 @@ static void list_clocks_block(const struct debugcc_platform *platform, const cha
|
||||
}
|
||||
}
|
||||
|
||||
static int mmap_mux(int devmem, struct debug_mux *mux)
|
||||
int mmap_mux(int devmem, struct debug_mux *mux)
|
||||
{
|
||||
/* Do nothing if this mux has already been mapped */
|
||||
if (!mux || mux->base)
|
||||
@@ -364,6 +377,12 @@ int main(int argc, char **argv)
|
||||
if (devmem < 0)
|
||||
err(1, "failed to open /dev/mem");
|
||||
|
||||
if (platform->premap) {
|
||||
ret = platform->premap(devmem);
|
||||
if (ret < 0)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
ret = mmap_hardware(devmem, platform);
|
||||
if (ret < 0)
|
||||
exit(1);
|
||||
|
||||
@@ -59,6 +59,9 @@ struct debug_mux {
|
||||
|
||||
unsigned int ahb_reg;
|
||||
unsigned int ahb_mask;
|
||||
|
||||
void (*premeasure)(struct debug_mux *mux);
|
||||
void (*postmeasure)(struct debug_mux *mux);
|
||||
};
|
||||
|
||||
struct measure_clk {
|
||||
@@ -75,8 +78,13 @@ struct measure_clk {
|
||||
struct debugcc_platform {
|
||||
const char *name;
|
||||
const struct measure_clk *clocks;
|
||||
int (*premap)(int devmem);
|
||||
};
|
||||
|
||||
int mmap_mux(int devmem, struct debug_mux *mux);
|
||||
void mux_enable(struct debug_mux *mux);
|
||||
void mux_disable(struct debug_mux *mux);
|
||||
|
||||
extern struct debugcc_platform msm8936_debugcc;
|
||||
extern struct debugcc_platform msm8996_debugcc;
|
||||
extern struct debugcc_platform qcs404_debugcc;
|
||||
|
||||
Reference in New Issue
Block a user