mirror of
https://github.com/torvalds/linux.git
synced 2024-11-19 02:21:47 +00:00
ARM: mvebu: remove device tree parsing for cpu nodes
Currently set_secondary_cpus_clock assume the CPU logical ordering and the MPDIR in DT are same, which is incorrect. Since the CPU device nodes can be retrieved in the logical ordering using the DT helper, we can remove the devices tree parsing. This patch removes DT parsing by making use of of_get_cpu_node. Cc: Andrew Lunn <andrew@lunn.ch> Cc: Jason Cooper <jason@lakedaemon.net> Acked-by: Gregory Clement <gregory.clement@free-electrons.com> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
This commit is contained in:
parent
816a8de001
commit
f6cec7cd07
@ -29,46 +29,41 @@
|
|||||||
#include "pmsu.h"
|
#include "pmsu.h"
|
||||||
#include "coherency.h"
|
#include "coherency.h"
|
||||||
|
|
||||||
|
static struct clk *__init get_cpu_clk(int cpu)
|
||||||
|
{
|
||||||
|
struct clk *cpu_clk;
|
||||||
|
struct device_node *np = of_get_cpu_node(cpu, NULL);
|
||||||
|
|
||||||
|
if (WARN(!np, "missing cpu node\n"))
|
||||||
|
return NULL;
|
||||||
|
cpu_clk = of_clk_get(np, 0);
|
||||||
|
if (WARN_ON(IS_ERR(cpu_clk)))
|
||||||
|
return NULL;
|
||||||
|
return cpu_clk;
|
||||||
|
}
|
||||||
|
|
||||||
void __init set_secondary_cpus_clock(void)
|
void __init set_secondary_cpus_clock(void)
|
||||||
{
|
{
|
||||||
int thiscpu;
|
int thiscpu, cpu;
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
struct clk *cpu_clk = NULL;
|
struct clk *cpu_clk;
|
||||||
struct device_node *np = NULL;
|
|
||||||
|
|
||||||
thiscpu = smp_processor_id();
|
thiscpu = smp_processor_id();
|
||||||
for_each_node_by_type(np, "cpu") {
|
cpu_clk = get_cpu_clk(thiscpu);
|
||||||
int err;
|
if (!cpu_clk)
|
||||||
int cpu;
|
|
||||||
|
|
||||||
err = of_property_read_u32(np, "reg", &cpu);
|
|
||||||
if (WARN_ON(err))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (cpu == thiscpu) {
|
|
||||||
cpu_clk = of_clk_get(np, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (WARN_ON(IS_ERR(cpu_clk)))
|
|
||||||
return;
|
return;
|
||||||
clk_prepare_enable(cpu_clk);
|
clk_prepare_enable(cpu_clk);
|
||||||
rate = clk_get_rate(cpu_clk);
|
rate = clk_get_rate(cpu_clk);
|
||||||
|
|
||||||
/* set all the other CPU clk to the same rate than the boot CPU */
|
/* set all the other CPU clk to the same rate than the boot CPU */
|
||||||
for_each_node_by_type(np, "cpu") {
|
for_each_possible_cpu(cpu) {
|
||||||
int err;
|
if (cpu == thiscpu)
|
||||||
int cpu;
|
continue;
|
||||||
|
cpu_clk = get_cpu_clk(cpu);
|
||||||
err = of_property_read_u32(np, "reg", &cpu);
|
if (!cpu_clk)
|
||||||
if (WARN_ON(err))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cpu != thiscpu) {
|
|
||||||
cpu_clk = of_clk_get(np, 0);
|
|
||||||
clk_set_rate(cpu_clk, rate);
|
clk_set_rate(cpu_clk, rate);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void armada_xp_secondary_init(unsigned int cpu)
|
static void armada_xp_secondary_init(unsigned int cpu)
|
||||||
|
Loading…
Reference in New Issue
Block a user