From 78d32dc63994e20376fe35dfbc3f98b2a34346eb Mon Sep 17 00:00:00 2001 From: Rohit Khanna Date: Wed, 8 Feb 2017 11:45:45 -0800 Subject: arm64: platform: tegra: detect cpu using MIDR This patch modifies the CPU detection macros so that CPUs are identified by reading the MIDR register value from per_cpu cpuinfo struct rather than determining based on which cluster they belong to. Bug 1827294 Change-Id: I82eb452d6fc80db9ddaa5cfa9afdee50e3079a10 Signed-off-by: Rohit Khanna Reviewed-on: http://git-master/r/1301621 GVS: Gerrit_Virtual_Submit Reviewed-by: Alexander Van Brunt --- include/linux/platform/tegra/tegra18_cpu_map.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/platform/tegra/tegra18_cpu_map.h b/include/linux/platform/tegra/tegra18_cpu_map.h index 826498c20..77773e8e8 100644 --- a/include/linux/platform/tegra/tegra18_cpu_map.h +++ b/include/linux/platform/tegra/tegra18_cpu_map.h @@ -2,6 +2,12 @@ #include #include #include +#include + +/* MIDR Variant and Revision masked*/ +#define MIDR_CPU_MASK 0xFF0FFFF0 +#define MIDR_CPU_DENVER2 0x4E0F0030 +#define MIDR_CPU_A57 0x410FD070 static inline u8 tegra18_logical_to_cluster(u8 cpu) { return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1); @@ -11,14 +17,18 @@ static inline u8 tegra18_logical_to_cpu(u8 cpu) { return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0); } +/* check if CPU is Denver2 */ static inline int tegra18_is_cpu_denver(u8 cpu) { - return tegra18_logical_to_cluster(cpu) == 0; + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, cpu); + return ((cpuinfo->reg_midr & MIDR_CPU_MASK) == MIDR_CPU_DENVER2); } +/* check if CPU is A57 */ static inline int tegra18_is_cpu_arm(u8 cpu) { - return tegra18_logical_to_cluster(cpu) == 1; + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, cpu); + return ((cpuinfo->reg_midr & MIDR_CPU_MASK) == MIDR_CPU_A57); } static inline int tegra18_logical_to_physical_cpu(u8 cpu) -- cgit v1.2.2