Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6855ed3 authored by Srinivas Ramana's avatar Srinivas Ramana Committed by Kyle Yan
Browse files

arm: cpu: read all address cells in dt for cpuid



For v8/arm64 platforms the number of address-cells can be 2.
If the same device tree is used on 32-bit platforms,it is
currently reading only one cell of 32-bits.

Fix this by reading both cells for getting the hwid.

Change-Id: Id281b6b8ac3c9312848c39e11019284f970caced
Signed-off-by: default avatarSrinivas Ramana <sramana@codeaurora.org>
parent 5f47a783
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ void __init arm_dt_init_cpu_maps(void)

	for_each_child_of_node(cpus, cpu) {
		u32 hwid;
		const __be32 *cell;

		if (of_node_cmp(cpu->type, "cpu"))
			continue;
@@ -98,13 +99,13 @@ void __init arm_dt_init_cpu_maps(void)
		 * properties is considered invalid to build the
		 * cpu_logical_map.
		 */
		if (of_property_read_u32(cpu, "reg", &hwid)) {
			pr_debug(" * %s missing reg property\n",
				     cpu->full_name);
		cell = of_get_property(cpu, "reg", NULL);
		if (!cell) {
			pr_err("%s: missing reg property\n", cpu->full_name);
			of_node_put(cpu);
			return;
		}

		hwid = of_read_number(cell, of_n_addr_cells(cpu));
		/*
		 * 8 MSBs must be set to 0 in the DT since the reg property
		 * defines the MPIDR[23:0].