diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-22 18:57:19 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-22 18:57:19 -0400 |
commit | 09198f8feff1fcdf03994f35955292f85b299bd6 (patch) | |
tree | d847a584546c13d1761036a2aae8d28437550df0 /drivers/cpufreq | |
parent | 4eb5178c9cc09295111b79a99183f555c51887b4 (diff) | |
parent | 1037b2752345cc5666e90b711a913ab2ae6c5920 (diff) |
Merge branch 'cpu_of_node' of git://linux-arm.org/linux-skn into pm-cpufreq-next
Pull DT/core/cpufreq cpu_ofnode updates for v3.12 from Sudeep KarkadaNagesha.
* 'cpu_of_node' of git://linux-arm.org/linux-skn:
cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes
cpufreq: pmac64-cpufreq: remove device tree parsing for cpu nodes
cpufreq: maple-cpufreq: remove device tree parsing for cpu nodes
cpufreq: arm_big_little: remove device tree parsing for cpu nodes
cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu nodes
cpufreq: spear-cpufreq: remove device tree parsing for cpu nodes
cpufreq: highbank-cpufreq: remove device tree parsing for cpu nodes
cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes
cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes
drivers/bus: arm-cci: avoid parsing DT for cpu device nodes
ARM: mvebu: remove device tree parsing for cpu nodes
ARM: topology: remove hwid/MPIDR dependency from cpu_capacity
of/device: add helper to get cpu device node from logical cpu index
driver/core: cpu: initialize of_node in cpu's device struture
ARM: DT/kernel: define ARM specific arch_match_cpu_phys_id
of: move of_get_cpu_node implementation to DT core library
powerpc: refactor of_get_cpu_node to support other architectures
openrisc: remove undefined of_get_cpu_node declaration
microblaze: remove undefined of_get_cpu_node declaration
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/arm_big_little_dt.c | 40 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq-cpu0.c | 23 | ||||
-rw-r--r-- | drivers/cpufreq/highbank-cpufreq.c | 18 | ||||
-rw-r--r-- | drivers/cpufreq/imx6q-cpufreq.c | 4 | ||||
-rw-r--r-- | drivers/cpufreq/kirkwood-cpufreq.c | 8 | ||||
-rw-r--r-- | drivers/cpufreq/maple-cpufreq.c | 23 | ||||
-rw-r--r-- | drivers/cpufreq/pmac32-cpufreq.c | 5 | ||||
-rw-r--r-- | drivers/cpufreq/pmac64-cpufreq.c | 47 | ||||
-rw-r--r-- | drivers/cpufreq/spear-cpufreq.c | 4 |
9 files changed, 49 insertions, 123 deletions
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c index fd9e3ea6a480..480c0bd0468d 100644 --- a/drivers/cpufreq/arm_big_little_dt.c +++ b/drivers/cpufreq/arm_big_little_dt.c | |||
@@ -19,12 +19,11 @@ | |||
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
21 | 21 | ||
22 | #include <linux/cpu.h> | ||
23 | #include <linux/cpufreq.h> | 22 | #include <linux/cpufreq.h> |
24 | #include <linux/device.h> | 23 | #include <linux/device.h> |
25 | #include <linux/export.h> | 24 | #include <linux/export.h> |
26 | #include <linux/module.h> | 25 | #include <linux/module.h> |
27 | #include <linux/of.h> | 26 | #include <linux/of_device.h> |
28 | #include <linux/opp.h> | 27 | #include <linux/opp.h> |
29 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
30 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
@@ -34,27 +33,13 @@ | |||
34 | /* get cpu node with valid operating-points */ | 33 | /* get cpu node with valid operating-points */ |
35 | static struct device_node *get_cpu_node_with_valid_op(int cpu) | 34 | static struct device_node *get_cpu_node_with_valid_op(int cpu) |
36 | { | 35 | { |
37 | struct device_node *np = NULL, *parent; | 36 | struct device_node *np = of_cpu_device_node_get(cpu); |
38 | int count = 0; | ||
39 | 37 | ||
40 | parent = of_find_node_by_path("/cpus"); | 38 | if (!of_get_property(np, "operating-points", NULL)) { |
41 | if (!parent) { | 39 | of_node_put(np); |
42 | pr_err("failed to find OF /cpus\n"); | 40 | np = NULL; |
43 | return NULL; | ||
44 | } | 41 | } |
45 | 42 | ||
46 | for_each_child_of_node(parent, np) { | ||
47 | if (count++ != cpu) | ||
48 | continue; | ||
49 | if (!of_get_property(np, "operating-points", NULL)) { | ||
50 | of_node_put(np); | ||
51 | np = NULL; | ||
52 | } | ||
53 | |||
54 | break; | ||
55 | } | ||
56 | |||
57 | of_node_put(parent); | ||
58 | return np; | 43 | return np; |
59 | } | 44 | } |
60 | 45 | ||
@@ -63,11 +48,12 @@ static int dt_init_opp_table(struct device *cpu_dev) | |||
63 | struct device_node *np; | 48 | struct device_node *np; |
64 | int ret; | 49 | int ret; |
65 | 50 | ||
66 | np = get_cpu_node_with_valid_op(cpu_dev->id); | 51 | np = of_node_get(cpu_dev->of_node); |
67 | if (!np) | 52 | if (!np) { |
68 | return -ENODATA; | 53 | pr_err("failed to find cpu%d node\n", cpu_dev->id); |
54 | return -ENOENT; | ||
55 | } | ||
69 | 56 | ||
70 | cpu_dev->of_node = np; | ||
71 | ret = of_init_opp_table(cpu_dev); | 57 | ret = of_init_opp_table(cpu_dev); |
72 | of_node_put(np); | 58 | of_node_put(np); |
73 | 59 | ||
@@ -79,9 +65,11 @@ static int dt_get_transition_latency(struct device *cpu_dev) | |||
79 | struct device_node *np; | 65 | struct device_node *np; |
80 | u32 transition_latency = CPUFREQ_ETERNAL; | 66 | u32 transition_latency = CPUFREQ_ETERNAL; |
81 | 67 | ||
82 | np = get_cpu_node_with_valid_op(cpu_dev->id); | 68 | np = of_node_get(cpu_dev->of_node); |
83 | if (!np) | 69 | if (!np) { |
70 | pr_info("Failed to find cpu node. Use CPUFREQ_ETERNAL transition latency\n"); | ||
84 | return CPUFREQ_ETERNAL; | 71 | return CPUFREQ_ETERNAL; |
72 | } | ||
85 | 73 | ||
86 | of_property_read_u32(np, "clock-latency", &transition_latency); | 74 | of_property_read_u32(np, "clock-latency", &transition_latency); |
87 | of_node_put(np); | 75 | of_node_put(np); |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 09cd3a76fb2e..bad620e996e5 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver = { | |||
174 | 174 | ||
175 | static int cpu0_cpufreq_probe(struct platform_device *pdev) | 175 | static int cpu0_cpufreq_probe(struct platform_device *pdev) |
176 | { | 176 | { |
177 | struct device_node *np, *parent; | 177 | struct device_node *np; |
178 | int ret; | 178 | int ret; |
179 | 179 | ||
180 | parent = of_find_node_by_path("/cpus"); | 180 | cpu_dev = &pdev->dev; |
181 | if (!parent) { | ||
182 | pr_err("failed to find OF /cpus\n"); | ||
183 | return -ENOENT; | ||
184 | } | ||
185 | |||
186 | for_each_child_of_node(parent, np) { | ||
187 | if (of_get_property(np, "operating-points", NULL)) | ||
188 | break; | ||
189 | } | ||
190 | 181 | ||
182 | np = of_node_get(cpu_dev->of_node); | ||
191 | if (!np) { | 183 | if (!np) { |
192 | pr_err("failed to find cpu0 node\n"); | 184 | pr_err("failed to find cpu0 node\n"); |
193 | ret = -ENOENT; | 185 | return -ENOENT; |
194 | goto out_put_parent; | ||
195 | } | 186 | } |
196 | 187 | ||
197 | cpu_dev = &pdev->dev; | ||
198 | cpu_dev->of_node = np; | ||
199 | |||
200 | cpu_reg = devm_regulator_get(cpu_dev, "cpu0"); | 188 | cpu_reg = devm_regulator_get(cpu_dev, "cpu0"); |
201 | if (IS_ERR(cpu_reg)) { | 189 | if (IS_ERR(cpu_reg)) { |
202 | /* | 190 | /* |
@@ -268,15 +256,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
268 | } | 256 | } |
269 | 257 | ||
270 | of_node_put(np); | 258 | of_node_put(np); |
271 | of_node_put(parent); | ||
272 | return 0; | 259 | return 0; |
273 | 260 | ||
274 | out_free_table: | 261 | out_free_table: |
275 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 262 | opp_free_cpufreq_table(cpu_dev, &freq_table); |
276 | out_put_node: | 263 | out_put_node: |
277 | of_node_put(np); | 264 | of_node_put(np); |
278 | out_put_parent: | ||
279 | of_node_put(parent); | ||
280 | return ret; | 265 | return ret; |
281 | } | 266 | } |
282 | 267 | ||
diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c index b61b5a3fad64..794123fcf3e3 100644 --- a/drivers/cpufreq/highbank-cpufreq.c +++ b/drivers/cpufreq/highbank-cpufreq.c | |||
@@ -69,23 +69,17 @@ static int hb_cpufreq_driver_init(void) | |||
69 | if (!of_machine_is_compatible("calxeda,highbank")) | 69 | if (!of_machine_is_compatible("calxeda,highbank")) |
70 | return -ENODEV; | 70 | return -ENODEV; |
71 | 71 | ||
72 | for_each_child_of_node(of_find_node_by_path("/cpus"), np) | ||
73 | if (of_get_property(np, "operating-points", NULL)) | ||
74 | break; | ||
75 | |||
76 | if (!np) { | ||
77 | pr_err("failed to find highbank cpufreq node\n"); | ||
78 | return -ENOENT; | ||
79 | } | ||
80 | |||
81 | cpu_dev = get_cpu_device(0); | 72 | cpu_dev = get_cpu_device(0); |
82 | if (!cpu_dev) { | 73 | if (!cpu_dev) { |
83 | pr_err("failed to get highbank cpufreq device\n"); | 74 | pr_err("failed to get highbank cpufreq device\n"); |
84 | ret = -ENODEV; | 75 | return -ENODEV; |
85 | goto out_put_node; | ||
86 | } | 76 | } |
87 | 77 | ||
88 | cpu_dev->of_node = np; | 78 | np = of_node_get(cpu_dev->of_node); |
79 | if (!np) { | ||
80 | pr_err("failed to find highbank cpufreq node\n"); | ||
81 | return -ENOENT; | ||
82 | } | ||
89 | 83 | ||
90 | cpu_clk = clk_get(cpu_dev, NULL); | 84 | cpu_clk = clk_get(cpu_dev, NULL); |
91 | if (IS_ERR(cpu_clk)) { | 85 | if (IS_ERR(cpu_clk)) { |
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index e37cdaedbb5b..b16632bb5a56 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
@@ -221,14 +221,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
221 | 221 | ||
222 | cpu_dev = &pdev->dev; | 222 | cpu_dev = &pdev->dev; |
223 | 223 | ||
224 | np = of_find_node_by_path("/cpus/cpu@0"); | 224 | np = of_node_get(cpu_dev->of_node); |
225 | if (!np) { | 225 | if (!np) { |
226 | dev_err(cpu_dev, "failed to find cpu0 node\n"); | 226 | dev_err(cpu_dev, "failed to find cpu0 node\n"); |
227 | return -ENOENT; | 227 | return -ENOENT; |
228 | } | 228 | } |
229 | 229 | ||
230 | cpu_dev->of_node = np; | ||
231 | |||
232 | arm_clk = devm_clk_get(cpu_dev, "arm"); | 230 | arm_clk = devm_clk_get(cpu_dev, "arm"); |
233 | pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys"); | 231 | pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys"); |
234 | pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw"); | 232 | pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw"); |
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index 45e4d7fc261d..ba10658a9394 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/clk-provider.h> | 15 | #include <linux/clk-provider.h> |
16 | #include <linux/cpufreq.h> | 16 | #include <linux/cpufreq.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of_device.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <asm/proc-fns.h> | 20 | #include <asm/proc-fns.h> |
@@ -174,9 +174,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) | |||
174 | if (IS_ERR(priv.base)) | 174 | if (IS_ERR(priv.base)) |
175 | return PTR_ERR(priv.base); | 175 | return PTR_ERR(priv.base); |
176 | 176 | ||
177 | np = of_find_node_by_path("/cpus/cpu@0"); | 177 | np = of_cpu_device_node_get(0); |
178 | if (!np) | 178 | if (!np) { |
179 | dev_err(&pdev->dev, "failed to get cpu device node\n"); | ||
179 | return -ENODEV; | 180 | return -ENODEV; |
181 | } | ||
180 | 182 | ||
181 | priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk"); | 183 | priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk"); |
182 | if (IS_ERR(priv.cpu_clk)) { | 184 | if (IS_ERR(priv.cpu_clk)) { |
diff --git a/drivers/cpufreq/maple-cpufreq.c b/drivers/cpufreq/maple-cpufreq.c index 41c601f4631e..6168d77b296d 100644 --- a/drivers/cpufreq/maple-cpufreq.c +++ b/drivers/cpufreq/maple-cpufreq.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/completion.h> | 24 | #include <linux/completion.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/of.h> | 27 | #include <linux/of_device.h> |
28 | 28 | ||
29 | #define DBG(fmt...) pr_debug(fmt) | 29 | #define DBG(fmt...) pr_debug(fmt) |
30 | 30 | ||
@@ -200,7 +200,6 @@ static struct cpufreq_driver maple_cpufreq_driver = { | |||
200 | 200 | ||
201 | static int __init maple_cpufreq_init(void) | 201 | static int __init maple_cpufreq_init(void) |
202 | { | 202 | { |
203 | struct device_node *cpus; | ||
204 | struct device_node *cpunode; | 203 | struct device_node *cpunode; |
205 | unsigned int psize; | 204 | unsigned int psize; |
206 | unsigned long max_freq; | 205 | unsigned long max_freq; |
@@ -216,24 +215,11 @@ static int __init maple_cpufreq_init(void) | |||
216 | !of_machine_is_compatible("Momentum,Apache")) | 215 | !of_machine_is_compatible("Momentum,Apache")) |
217 | return 0; | 216 | return 0; |
218 | 217 | ||
219 | cpus = of_find_node_by_path("/cpus"); | ||
220 | if (cpus == NULL) { | ||
221 | DBG("No /cpus node !\n"); | ||
222 | return -ENODEV; | ||
223 | } | ||
224 | |||
225 | /* Get first CPU node */ | 218 | /* Get first CPU node */ |
226 | for (cpunode = NULL; | 219 | cpunode = of_cpu_device_node_get(0); |
227 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | ||
228 | const u32 *reg = of_get_property(cpunode, "reg", NULL); | ||
229 | if (reg == NULL || (*reg) != 0) | ||
230 | continue; | ||
231 | if (!strcmp(cpunode->type, "cpu")) | ||
232 | break; | ||
233 | } | ||
234 | if (cpunode == NULL) { | 220 | if (cpunode == NULL) { |
235 | printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n"); | 221 | printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n"); |
236 | goto bail_cpus; | 222 | goto bail_noprops; |
237 | } | 223 | } |
238 | 224 | ||
239 | /* Check 970FX for now */ | 225 | /* Check 970FX for now */ |
@@ -289,14 +275,11 @@ static int __init maple_cpufreq_init(void) | |||
289 | rc = cpufreq_register_driver(&maple_cpufreq_driver); | 275 | rc = cpufreq_register_driver(&maple_cpufreq_driver); |
290 | 276 | ||
291 | of_node_put(cpunode); | 277 | of_node_put(cpunode); |
292 | of_node_put(cpus); | ||
293 | 278 | ||
294 | return rc; | 279 | return rc; |
295 | 280 | ||
296 | bail_noprops: | 281 | bail_noprops: |
297 | of_node_put(cpunode); | 282 | of_node_put(cpunode); |
298 | bail_cpus: | ||
299 | of_node_put(cpus); | ||
300 | 283 | ||
301 | return rc; | 284 | return rc; |
302 | } | 285 | } |
diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index 38cdc63c38da..a096cd3fa23d 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/hardirq.h> | 27 | #include <linux/hardirq.h> |
28 | #include <linux/of_device.h> | ||
28 | #include <asm/prom.h> | 29 | #include <asm/prom.h> |
29 | #include <asm/machdep.h> | 30 | #include <asm/machdep.h> |
30 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
@@ -648,8 +649,8 @@ static int __init pmac_cpufreq_setup(void) | |||
648 | if (strstr(cmd_line, "nocpufreq")) | 649 | if (strstr(cmd_line, "nocpufreq")) |
649 | return 0; | 650 | return 0; |
650 | 651 | ||
651 | /* Assume only one CPU */ | 652 | /* Get first CPU node */ |
652 | cpunode = of_find_node_by_type(NULL, "cpu"); | 653 | cpunode = of_cpu_device_node_get(0); |
653 | if (!cpunode) | 654 | if (!cpunode) |
654 | goto out; | 655 | goto out; |
655 | 656 | ||
diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c index b6850d97f0d5..3a51ad7e47c8 100644 --- a/drivers/cpufreq/pmac64-cpufreq.c +++ b/drivers/cpufreq/pmac64-cpufreq.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/of_device.h> | ||
25 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
26 | #include <asm/machdep.h> | 27 | #include <asm/machdep.h> |
27 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
@@ -382,9 +383,8 @@ static struct cpufreq_driver g5_cpufreq_driver = { | |||
382 | 383 | ||
383 | #ifdef CONFIG_PMAC_SMU | 384 | #ifdef CONFIG_PMAC_SMU |
384 | 385 | ||
385 | static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | 386 | static int __init g5_neo2_cpufreq_init(struct device_node *cpunode) |
386 | { | 387 | { |
387 | struct device_node *cpunode; | ||
388 | unsigned int psize, ssize; | 388 | unsigned int psize, ssize; |
389 | unsigned long max_freq; | 389 | unsigned long max_freq; |
390 | char *freq_method, *volt_method; | 390 | char *freq_method, *volt_method; |
@@ -404,20 +404,6 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
404 | else | 404 | else |
405 | return -ENODEV; | 405 | return -ENODEV; |
406 | 406 | ||
407 | /* Get first CPU node */ | ||
408 | for (cpunode = NULL; | ||
409 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | ||
410 | const u32 *reg = of_get_property(cpunode, "reg", NULL); | ||
411 | if (reg == NULL || (*reg) != 0) | ||
412 | continue; | ||
413 | if (!strcmp(cpunode->type, "cpu")) | ||
414 | break; | ||
415 | } | ||
416 | if (cpunode == NULL) { | ||
417 | printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n"); | ||
418 | return -ENODEV; | ||
419 | } | ||
420 | |||
421 | /* Check 970FX for now */ | 407 | /* Check 970FX for now */ |
422 | valp = of_get_property(cpunode, "cpu-version", NULL); | 408 | valp = of_get_property(cpunode, "cpu-version", NULL); |
423 | if (!valp) { | 409 | if (!valp) { |
@@ -535,9 +521,9 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
535 | #endif /* CONFIG_PMAC_SMU */ | 521 | #endif /* CONFIG_PMAC_SMU */ |
536 | 522 | ||
537 | 523 | ||
538 | static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | 524 | static int __init g5_pm72_cpufreq_init(struct device_node *cpunode) |
539 | { | 525 | { |
540 | struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; | 526 | struct device_node *cpuid = NULL, *hwclock = NULL; |
541 | const u8 *eeprom = NULL; | 527 | const u8 *eeprom = NULL; |
542 | const u32 *valp; | 528 | const u32 *valp; |
543 | u64 max_freq, min_freq, ih, il; | 529 | u64 max_freq, min_freq, ih, il; |
@@ -546,17 +532,6 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
546 | DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and" | 532 | DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and" |
547 | " RackMac3,1...\n"); | 533 | " RackMac3,1...\n"); |
548 | 534 | ||
549 | /* Get first CPU node */ | ||
550 | for (cpunode = NULL; | ||
551 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | ||
552 | if (!strcmp(cpunode->type, "cpu")) | ||
553 | break; | ||
554 | } | ||
555 | if (cpunode == NULL) { | ||
556 | printk(KERN_ERR "cpufreq: Can't find any CPU node\n"); | ||
557 | return -ENODEV; | ||
558 | } | ||
559 | |||
560 | /* Lookup the cpuid eeprom node */ | 535 | /* Lookup the cpuid eeprom node */ |
561 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); | 536 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); |
562 | if (cpuid != NULL) | 537 | if (cpuid != NULL) |
@@ -716,25 +691,25 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
716 | 691 | ||
717 | static int __init g5_cpufreq_init(void) | 692 | static int __init g5_cpufreq_init(void) |
718 | { | 693 | { |
719 | struct device_node *cpus; | 694 | struct device_node *cpunode; |
720 | int rc = 0; | 695 | int rc = 0; |
721 | 696 | ||
722 | cpus = of_find_node_by_path("/cpus"); | 697 | /* Get first CPU node */ |
723 | if (cpus == NULL) { | 698 | cpunode = of_cpu_device_node_get(0); |
724 | DBG("No /cpus node !\n"); | 699 | if (cpunode == NULL) { |
700 | pr_err("cpufreq: Can't find any CPU node\n"); | ||
725 | return -ENODEV; | 701 | return -ENODEV; |
726 | } | 702 | } |
727 | 703 | ||
728 | if (of_machine_is_compatible("PowerMac7,2") || | 704 | if (of_machine_is_compatible("PowerMac7,2") || |
729 | of_machine_is_compatible("PowerMac7,3") || | 705 | of_machine_is_compatible("PowerMac7,3") || |
730 | of_machine_is_compatible("RackMac3,1")) | 706 | of_machine_is_compatible("RackMac3,1")) |
731 | rc = g5_pm72_cpufreq_init(cpus); | 707 | rc = g5_pm72_cpufreq_init(cpunode); |
732 | #ifdef CONFIG_PMAC_SMU | 708 | #ifdef CONFIG_PMAC_SMU |
733 | else | 709 | else |
734 | rc = g5_neo2_cpufreq_init(cpus); | 710 | rc = g5_neo2_cpufreq_init(cpunode); |
735 | #endif /* CONFIG_PMAC_SMU */ | 711 | #endif /* CONFIG_PMAC_SMU */ |
736 | 712 | ||
737 | of_node_put(cpus); | ||
738 | return rc; | 713 | return rc; |
739 | } | 714 | } |
740 | 715 | ||
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index c3efa7f2a908..19e364fa5955 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of_device.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | 24 | ||
@@ -223,7 +223,7 @@ static int spear_cpufreq_driver_init(void) | |||
223 | const __be32 *val; | 223 | const __be32 *val; |
224 | int cnt, i, ret; | 224 | int cnt, i, ret; |
225 | 225 | ||
226 | np = of_find_node_by_path("/cpus/cpu@0"); | 226 | np = of_cpu_device_node_get(0); |
227 | if (!np) { | 227 | if (!np) { |
228 | pr_err("No cpu node found"); | 228 | pr_err("No cpu node found"); |
229 | return -ENODEV; | 229 | return -ENODEV; |