summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c')
-rw-r--r--target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c
new file mode 100644
index 000000000..afd890bd9
--- /dev/null
+++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/pmu.c
@@ -0,0 +1,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);