Skip to content

Commit 1949c0e

Browse files
robherringbebarino
authored andcommitted
clk: mvebu: Use of_get_cpu_hwid() to read CPU ID
Use of_get_cpu_hwid() rather than the open coded reading of the CPU nodes "reg" property. The existing code is in fact wrong as the "reg" address cells size is 2 cells for arm64. The existing code happens to work because the DTS files are wrong as well. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 1ab3916 commit 1949c0e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/clk/mvebu/ap-cpu-clk.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
253253
*/
254254
nclusters = 1;
255255
for_each_of_cpu_node(dn) {
256-
int cpu, err;
256+
u64 cpu;
257257

258-
err = of_property_read_u32(dn, "reg", &cpu);
259-
if (WARN_ON(err)) {
258+
cpu = of_get_cpu_hwid(dn, 0);
259+
if (WARN_ON(cpu == OF_BAD_ADDR)) {
260260
of_node_put(dn);
261-
return err;
261+
return -EINVAL;
262262
}
263263

264264
/* If cpu2 or cpu3 is enabled */
@@ -288,12 +288,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
288288
struct clk_init_data init;
289289
const char *parent_name;
290290
struct clk *parent;
291-
int cpu, err;
291+
u64 cpu;
292292

293-
err = of_property_read_u32(dn, "reg", &cpu);
294-
if (WARN_ON(err)) {
293+
cpu = of_get_cpu_hwid(dn, 0);
294+
if (WARN_ON(cpu == OF_BAD_ADDR)) {
295295
of_node_put(dn);
296-
return err;
296+
return -EINVAL;
297297
}
298298

299299
cluster_index = cpu & APN806_CLUSTER_NUM_MASK;

0 commit comments

Comments
 (0)