mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-06 11:28:36 +07:00
drivers/perf: fsl_imx8_ddr: Correct the CLEAR bit definition
When disabling a counter from ddr_perf_event_stop(), the counter value is reset to 0 at the same time. Preserve the counter value by performing a read-modify-write of the PMU register and clearing only the enable bit. Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
dcde237319
commit
049d919168
@ -388,9 +388,10 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
|
|||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/*
|
/*
|
||||||
* must disable first, then enable again
|
* cycle counter is special which should firstly write 0 then
|
||||||
* otherwise, cycle counter will not work
|
* write 1 into CLEAR bit to clear it. Other counters only
|
||||||
* if previous state is enabled.
|
* need write 0 into CLEAR bit and it turns out to be 1 by
|
||||||
|
* hardware. Below enable flow is harmless for all counters.
|
||||||
*/
|
*/
|
||||||
writel(0, pmu->base + reg);
|
writel(0, pmu->base + reg);
|
||||||
val = CNTL_EN | CNTL_CLEAR;
|
val = CNTL_EN | CNTL_CLEAR;
|
||||||
@ -398,7 +399,8 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
|
|||||||
writel(val, pmu->base + reg);
|
writel(val, pmu->base + reg);
|
||||||
} else {
|
} else {
|
||||||
/* Disable counter */
|
/* Disable counter */
|
||||||
writel(0, pmu->base + reg);
|
val = readl_relaxed(pmu->base + reg) & CNTL_EN_MASK;
|
||||||
|
writel(val, pmu->base + reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user