drivers/bus: arm-cci: avoid parsing DT for cpu device nodes
Since the CPU device nodes can be retrieved using arch_of_get_cpu_node, we can use it to avoid parsing the cpus node searching the cpu nodes and mapping to logical index. This patch removes parsing DT for cpu nodes by using of_get_cpu_node. Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
This commit is contained in:
parent
f6cec7cd07
commit
78b4d6e0fd
@ -122,17 +122,8 @@ EXPORT_SYMBOL_GPL(cci_ace_get_port);
|
|||||||
|
|
||||||
static void __init cci_ace_init_ports(void)
|
static void __init cci_ace_init_ports(void)
|
||||||
{
|
{
|
||||||
int port, ac, cpu;
|
int port, cpu;
|
||||||
u64 hwid;
|
struct device_node *cpun;
|
||||||
const u32 *cell;
|
|
||||||
struct device_node *cpun, *cpus;
|
|
||||||
|
|
||||||
cpus = of_find_node_by_path("/cpus");
|
|
||||||
if (WARN(!cpus, "Missing cpus node, bailing out\n"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (WARN_ON(of_property_read_u32(cpus, "#address-cells", &ac)))
|
|
||||||
ac = of_n_addr_cells(cpus);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Port index look-up speeds up the function disabling ports by CPU,
|
* Port index look-up speeds up the function disabling ports by CPU,
|
||||||
@ -141,18 +132,13 @@ static void __init cci_ace_init_ports(void)
|
|||||||
* The stashed index array is initialized for all possible CPUs
|
* The stashed index array is initialized for all possible CPUs
|
||||||
* at probe time.
|
* at probe time.
|
||||||
*/
|
*/
|
||||||
for_each_child_of_node(cpus, cpun) {
|
for_each_possible_cpu(cpu) {
|
||||||
if (of_node_cmp(cpun->type, "cpu"))
|
/* too early to use cpu->of_node */
|
||||||
continue;
|
cpun = of_get_cpu_node(cpu, NULL);
|
||||||
cell = of_get_property(cpun, "reg", NULL);
|
|
||||||
if (WARN(!cell, "%s: missing reg property\n", cpun->full_name))
|
if (WARN(!cpun, "Missing cpu device node\n"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hwid = of_read_number(cell, ac);
|
|
||||||
cpu = get_logical_index(hwid & MPIDR_HWID_BITMASK);
|
|
||||||
|
|
||||||
if (cpu < 0 || !cpu_possible(cpu))
|
|
||||||
continue;
|
|
||||||
port = __cci_ace_get_port(cpun, ACE_PORT);
|
port = __cci_ace_get_port(cpun, ACE_PORT);
|
||||||
if (port < 0)
|
if (port < 0)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user