aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files-2.6.32/arch/mips/ifxmips/common/pmu.c
blob: afd890bd9353ad4abe5473c375c02b239c551237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>

#include <ifxmips.h>

void
ifxmips_pmu_enable(unsigned int module)
{
	int err = 1000000;

	ifxmips_w32(ifxmips_r32(IFXMIPS_PMU_PWDCR) & ~module, IFXMIPS_PMU_PWDCR);
	while (--err && (ifxmips_r32(IFXMIPS_PMU_PWDSR) & module));

	if (!err)
		panic("activating PMU module failed!");
}
EXPORT_SYMBOL(ifxmips_pmu_enable);

void
ifxmips_pmu_disable(unsigned int module)
{
	ifxmips_w32(ifxmips_r32(IFXMIPS_PMU_PWDCR) | module, IFXMIPS_PMU_PWDCR);
}
EXPORT_SYMBOL(ifxmips_pmu_disable);