aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>2013-07-17 08:42:56 -0400
committerSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>2013-08-21 05:29:56 -0400
commit760287ab90a3ca93a2f87f7e7137e06e89a26b01 (patch)
tree21f5463a71dbb07157cfd800232e0a8887d5a604 /drivers/cpufreq
parent2421d4c34d492efd8b116ce62ae5612b5b9864b2 (diff)
cpufreq: pmac64-cpufreq: remove device tree parsing for cpu nodes
Now that the cpu device registration initialises the of_node(if available) appropriately for all the cpus, parsing here is redundant. This patch removes all DT parsing and uses cpu->of_node instead. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/pmac64-cpufreq.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c
index 7ba423431cfe..97b719f5c744 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>
@@ -383,9 +384,8 @@ static struct cpufreq_driver g5_cpufreq_driver = {
383 384
384#ifdef CONFIG_PMAC_SMU 385#ifdef CONFIG_PMAC_SMU
385 386
386static int __init g5_neo2_cpufreq_init(struct device_node *cpus) 387static int __init g5_neo2_cpufreq_init(struct device_node *cpunode)
387{ 388{
388 struct device_node *cpunode;
389 unsigned int psize, ssize; 389 unsigned int psize, ssize;
390 unsigned long max_freq; 390 unsigned long max_freq;
391 char *freq_method, *volt_method; 391 char *freq_method, *volt_method;
@@ -405,20 +405,6 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
405 else 405 else
406 return -ENODEV; 406 return -ENODEV;
407 407
408 /* Get first CPU node */
409 for (cpunode = NULL;
410 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
411 const u32 *reg = of_get_property(cpunode, "reg", NULL);
412 if (reg == NULL || (*reg) != 0)
413 continue;
414 if (!strcmp(cpunode->type, "cpu"))
415 break;
416 }
417 if (cpunode == NULL) {
418 printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n");
419 return -ENODEV;
420 }
421
422 /* Check 970FX for now */ 408 /* Check 970FX for now */
423 valp = of_get_property(cpunode, "cpu-version", NULL); 409 valp = of_get_property(cpunode, "cpu-version", NULL);
424 if (!valp) { 410 if (!valp) {
@@ -537,9 +523,9 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
537#endif /* CONFIG_PMAC_SMU */ 523#endif /* CONFIG_PMAC_SMU */
538 524
539 525
540static int __init g5_pm72_cpufreq_init(struct device_node *cpus) 526static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
541{ 527{
542 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; 528 struct device_node *cpuid = NULL, *hwclock = NULL;
543 const u8 *eeprom = NULL; 529 const u8 *eeprom = NULL;
544 const u32 *valp; 530 const u32 *valp;
545 u64 max_freq, min_freq, ih, il; 531 u64 max_freq, min_freq, ih, il;
@@ -548,17 +534,6 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
548 DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and" 534 DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and"
549 " RackMac3,1...\n"); 535 " RackMac3,1...\n");
550 536
551 /* Get first CPU node */
552 for (cpunode = NULL;
553 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
554 if (!strcmp(cpunode->type, "cpu"))
555 break;
556 }
557 if (cpunode == NULL) {
558 printk(KERN_ERR "cpufreq: Can't find any CPU node\n");
559 return -ENODEV;
560 }
561
562 /* Lookup the cpuid eeprom node */ 537 /* Lookup the cpuid eeprom node */
563 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); 538 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
564 if (cpuid != NULL) 539 if (cpuid != NULL)
@@ -718,25 +693,25 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
718 693
719static int __init g5_cpufreq_init(void) 694static int __init g5_cpufreq_init(void)
720{ 695{
721 struct device_node *cpus; 696 struct device_node *cpunode;
722 int rc = 0; 697 int rc = 0;
723 698
724 cpus = of_find_node_by_path("/cpus"); 699 /* Get first CPU node */
725 if (cpus == NULL) { 700 cpunode = of_cpu_device_node_get(0);
726 DBG("No /cpus node !\n"); 701 if (cpunode == NULL) {
702 pr_err("cpufreq: Can't find any CPU node\n");
727 return -ENODEV; 703 return -ENODEV;
728 } 704 }
729 705
730 if (of_machine_is_compatible("PowerMac7,2") || 706 if (of_machine_is_compatible("PowerMac7,2") ||
731 of_machine_is_compatible("PowerMac7,3") || 707 of_machine_is_compatible("PowerMac7,3") ||
732 of_machine_is_compatible("RackMac3,1")) 708 of_machine_is_compatible("RackMac3,1"))
733 rc = g5_pm72_cpufreq_init(cpus); 709 rc = g5_pm72_cpufreq_init(cpunode);
734#ifdef CONFIG_PMAC_SMU 710#ifdef CONFIG_PMAC_SMU
735 else 711 else
736 rc = g5_neo2_cpufreq_init(cpus); 712 rc = g5_neo2_cpufreq_init(cpunode);
737#endif /* CONFIG_PMAC_SMU */ 713#endif /* CONFIG_PMAC_SMU */
738 714
739 of_node_put(cpus);
740 return rc; 715 return rc;
741} 716}
742 717