Commit 1949c0eb authored by Rob Herring's avatar Rob Herring Committed by Stephen Boyd

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: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230327-mvebu-clk-fixes-v2-2-8333729ee45d@kernel.orgSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 1ab39168
......@@ -253,12 +253,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
*/
nclusters = 1;
for_each_of_cpu_node(dn) {
int cpu, err;
u64 cpu;
err = of_property_read_u32(dn, "reg", &cpu);
if (WARN_ON(err)) {
cpu = of_get_cpu_hwid(dn, 0);
if (WARN_ON(cpu == OF_BAD_ADDR)) {
of_node_put(dn);
return err;
return -EINVAL;
}
/* If cpu2 or cpu3 is enabled */
......@@ -288,12 +288,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
struct clk_init_data init;
const char *parent_name;
struct clk *parent;
int cpu, err;
u64 cpu;
err = of_property_read_u32(dn, "reg", &cpu);
if (WARN_ON(err)) {
cpu = of_get_cpu_hwid(dn, 0);
if (WARN_ON(cpu == OF_BAD_ADDR)) {
of_node_put(dn);
return err;
return -EINVAL;
}
cluster_index = cpu & APN806_CLUSTER_NUM_MASK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment