aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>2013-10-30 09:47:16 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2013-10-30 13:54:49 -0400
commit248f0e7f5f0012fb9c1954e582196aa7f32a0c81 (patch)
treef33927d4fc1540baa0a8e0c17a25ff676e6cff52
parent6e15d0e04bfeaa5662a289ee915273307326e45a (diff)
ARM64: simplify cpu_read_bootcpu_ops using OF/DT helper
Once the cpu_logical_map for any logical cpu is populated with the corresponding physical identifier(i.e. mpidr), it's device node can be retrieved using the DT helper 'of_get_cpu_node'. Currently the device tree parsing code to get boot cpu node is duplicated in 'cpu_read_bootcpu_ops'. This patch replaces the code parsing the device tree for the boot cpu with of_get_cpu_node. Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/cpu_ops.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index aa0c9e78dbe1..e2ba274612cf 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -78,22 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
78 78
79void __init cpu_read_bootcpu_ops(void) 79void __init cpu_read_bootcpu_ops(void)
80{ 80{
81 struct device_node *dn = NULL; 81 struct device_node *dn = of_get_cpu_node(0, NULL);
82 u64 mpidr = cpu_logical_map(0); 82 if (!dn) {
83 83 pr_err("Failed to find device node for boot cpu\n");
84 while ((dn = of_find_node_by_type(dn, "cpu"))) { 84 return;
85 u64 hwid;
86 const __be32 *prop;
87
88 prop = of_get_property(dn, "reg", NULL);
89 if (!prop)
90 continue;
91
92 hwid = of_read_number(prop, of_n_addr_cells(dn));
93 if (hwid == mpidr) {
94 cpu_read_ops(dn, 0);
95 of_node_put(dn);
96 return;
97 }
98 } 85 }
86 cpu_read_ops(dn, 0);
99} 87}