summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChander Kashyap <chander.kashyap@linaro.org>2014-07-05 06:24:35 +0900
committerKukjin Kim <kgene.kim@samsung.com>2014-07-19 03:35:55 +0900
commit6ec4f8d0d91f2067870ce948fcd505620d0d2987 (patch)
tree31291b11c2b9f6034c58af4e126ca79b6f1ac2ee
parente2e54362d9c8c1e8d52ff576a4e0f6e61f569356 (diff)
ARM: EXYNOS: add generic function to calculate cpu number
The address of cpu power registers in pmu is based on cpu number offsets. This function calculate the same. This is essentially required in case of multi-cluster SoC's e.g Exynos5420. Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 1d13b08708f..aff23bd395e 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -323,4 +323,13 @@
#define EXYNOS5420_SWRESET_KFC_SEL 0x3
+#include <asm/cputype.h>
+#define MAX_CPUS_IN_CLUSTER 4
+
+static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
+{
+ return ((MPIDR_AFFINITY_LEVEL(mpidr, 1) * MAX_CPUS_IN_CLUSTER)
+ + MPIDR_AFFINITY_LEVEL(mpidr, 0));
+}
+
#endif /* __ASM_ARCH_REGS_PMU_H */