mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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
This commit is contained in:
commit
09198f8fef
23 changed files with 226 additions and 266 deletions
|
|
@ -19,12 +19,11 @@
|
|||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/opp.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -34,27 +33,13 @@
|
|||
/* get cpu node with valid operating-points */
|
||||
static struct device_node *get_cpu_node_with_valid_op(int cpu)
|
||||
{
|
||||
struct device_node *np = NULL, *parent;
|
||||
int count = 0;
|
||||
struct device_node *np = of_cpu_device_node_get(cpu);
|
||||
|
||||
parent = of_find_node_by_path("/cpus");
|
||||
if (!parent) {
|
||||
pr_err("failed to find OF /cpus\n");
|
||||
return NULL;
|
||||
if (!of_get_property(np, "operating-points", NULL)) {
|
||||
of_node_put(np);
|
||||
np = NULL;
|
||||
}
|
||||
|
||||
for_each_child_of_node(parent, np) {
|
||||
if (count++ != cpu)
|
||||
continue;
|
||||
if (!of_get_property(np, "operating-points", NULL)) {
|
||||
of_node_put(np);
|
||||
np = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
of_node_put(parent);
|
||||
return np;
|
||||
}
|
||||
|
||||
|
|
@ -63,11 +48,12 @@ static int dt_init_opp_table(struct device *cpu_dev)
|
|||
struct device_node *np;
|
||||
int ret;
|
||||
|
||||
np = get_cpu_node_with_valid_op(cpu_dev->id);
|
||||
if (!np)
|
||||
return -ENODATA;
|
||||
np = of_node_get(cpu_dev->of_node);
|
||||
if (!np) {
|
||||
pr_err("failed to find cpu%d node\n", cpu_dev->id);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
cpu_dev->of_node = np;
|
||||
ret = of_init_opp_table(cpu_dev);
|
||||
of_node_put(np);
|
||||
|
||||
|
|
@ -79,9 +65,11 @@ static int dt_get_transition_latency(struct device *cpu_dev)
|
|||
struct device_node *np;
|
||||
u32 transition_latency = CPUFREQ_ETERNAL;
|
||||
|
||||
np = get_cpu_node_with_valid_op(cpu_dev->id);
|
||||
if (!np)
|
||||
np = of_node_get(cpu_dev->of_node);
|
||||
if (!np) {
|
||||
pr_info("Failed to find cpu node. Use CPUFREQ_ETERNAL transition latency\n");
|
||||
return CPUFREQ_ETERNAL;
|
||||
}
|
||||
|
||||
of_property_read_u32(np, "clock-latency", &transition_latency);
|
||||
of_node_put(np);
|
||||
|
|
|
|||
|
|
@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
|
|||
|
||||
static int cpu0_cpufreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np, *parent;
|
||||
struct device_node *np;
|
||||
int ret;
|
||||
|
||||
parent = of_find_node_by_path("/cpus");
|
||||
if (!parent) {
|
||||
pr_err("failed to find OF /cpus\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
for_each_child_of_node(parent, np) {
|
||||
if (of_get_property(np, "operating-points", NULL))
|
||||
break;
|
||||
}
|
||||
cpu_dev = &pdev->dev;
|
||||
|
||||
np = of_node_get(cpu_dev->of_node);
|
||||
if (!np) {
|
||||
pr_err("failed to find cpu0 node\n");
|
||||
ret = -ENOENT;
|
||||
goto out_put_parent;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
cpu_dev = &pdev->dev;
|
||||
cpu_dev->of_node = np;
|
||||
|
||||
cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
|
||||
if (IS_ERR(cpu_reg)) {
|
||||
/*
|
||||
|
|
@ -268,15 +256,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
of_node_put(np);
|
||||
of_node_put(parent);
|
||||
return 0;
|
||||
|
||||
out_free_table:
|
||||
opp_free_cpufreq_table(cpu_dev, &freq_table);
|
||||
out_put_node:
|
||||
of_node_put(np);
|
||||
out_put_parent:
|
||||
of_node_put(parent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,24 +69,18 @@ static int hb_cpufreq_driver_init(void)
|
|||
if (!of_machine_is_compatible("calxeda,highbank"))
|
||||
return -ENODEV;
|
||||
|
||||
for_each_child_of_node(of_find_node_by_path("/cpus"), np)
|
||||
if (of_get_property(np, "operating-points", NULL))
|
||||
break;
|
||||
cpu_dev = get_cpu_device(0);
|
||||
if (!cpu_dev) {
|
||||
pr_err("failed to get highbank cpufreq device\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
np = of_node_get(cpu_dev->of_node);
|
||||
if (!np) {
|
||||
pr_err("failed to find highbank cpufreq node\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
cpu_dev = get_cpu_device(0);
|
||||
if (!cpu_dev) {
|
||||
pr_err("failed to get highbank cpufreq device\n");
|
||||
ret = -ENODEV;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
cpu_dev->of_node = np;
|
||||
|
||||
cpu_clk = clk_get(cpu_dev, NULL);
|
||||
if (IS_ERR(cpu_clk)) {
|
||||
ret = PTR_ERR(cpu_clk);
|
||||
|
|
|
|||
|
|
@ -221,14 +221,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
|
|||
|
||||
cpu_dev = &pdev->dev;
|
||||
|
||||
np = of_find_node_by_path("/cpus/cpu@0");
|
||||
np = of_node_get(cpu_dev->of_node);
|
||||
if (!np) {
|
||||
dev_err(cpu_dev, "failed to find cpu0 node\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
cpu_dev->of_node = np;
|
||||
|
||||
arm_clk = devm_clk_get(cpu_dev, "arm");
|
||||
pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys");
|
||||
pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw");
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <asm/proc-fns.h>
|
||||
|
|
@ -174,9 +174,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(priv.base))
|
||||
return PTR_ERR(priv.base);
|
||||
|
||||
np = of_find_node_by_path("/cpus/cpu@0");
|
||||
if (!np)
|
||||
np = of_cpu_device_node_get(0);
|
||||
if (!np) {
|
||||
dev_err(&pdev->dev, "failed to get cpu device node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk");
|
||||
if (IS_ERR(priv.cpu_clk)) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <linux/completion.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#define DBG(fmt...) pr_debug(fmt)
|
||||
|
||||
|
|
@ -200,7 +200,6 @@ static struct cpufreq_driver maple_cpufreq_driver = {
|
|||
|
||||
static int __init maple_cpufreq_init(void)
|
||||
{
|
||||
struct device_node *cpus;
|
||||
struct device_node *cpunode;
|
||||
unsigned int psize;
|
||||
unsigned long max_freq;
|
||||
|
|
@ -216,24 +215,11 @@ static int __init maple_cpufreq_init(void)
|
|||
!of_machine_is_compatible("Momentum,Apache"))
|
||||
return 0;
|
||||
|
||||
cpus = of_find_node_by_path("/cpus");
|
||||
if (cpus == NULL) {
|
||||
DBG("No /cpus node !\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Get first CPU node */
|
||||
for (cpunode = NULL;
|
||||
(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
|
||||
const u32 *reg = of_get_property(cpunode, "reg", NULL);
|
||||
if (reg == NULL || (*reg) != 0)
|
||||
continue;
|
||||
if (!strcmp(cpunode->type, "cpu"))
|
||||
break;
|
||||
}
|
||||
cpunode = of_cpu_device_node_get(0);
|
||||
if (cpunode == NULL) {
|
||||
printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n");
|
||||
goto bail_cpus;
|
||||
goto bail_noprops;
|
||||
}
|
||||
|
||||
/* Check 970FX for now */
|
||||
|
|
@ -289,14 +275,11 @@ static int __init maple_cpufreq_init(void)
|
|||
rc = cpufreq_register_driver(&maple_cpufreq_driver);
|
||||
|
||||
of_node_put(cpunode);
|
||||
of_node_put(cpus);
|
||||
|
||||
return rc;
|
||||
|
||||
bail_noprops:
|
||||
of_node_put(cpunode);
|
||||
bail_cpus:
|
||||
of_node_put(cpus);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/irq.h>
|
||||
|
|
@ -648,8 +649,8 @@ static int __init pmac_cpufreq_setup(void)
|
|||
if (strstr(cmd_line, "nocpufreq"))
|
||||
return 0;
|
||||
|
||||
/* Assume only one CPU */
|
||||
cpunode = of_find_node_by_type(NULL, "cpu");
|
||||
/* Get first CPU node */
|
||||
cpunode = of_cpu_device_node_get(0);
|
||||
if (!cpunode)
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/irq.h>
|
||||
|
|
@ -382,9 +383,8 @@ static struct cpufreq_driver g5_cpufreq_driver = {
|
|||
|
||||
#ifdef CONFIG_PMAC_SMU
|
||||
|
||||
static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
|
||||
static int __init g5_neo2_cpufreq_init(struct device_node *cpunode)
|
||||
{
|
||||
struct device_node *cpunode;
|
||||
unsigned int psize, ssize;
|
||||
unsigned long max_freq;
|
||||
char *freq_method, *volt_method;
|
||||
|
|
@ -404,20 +404,6 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
|
|||
else
|
||||
return -ENODEV;
|
||||
|
||||
/* Get first CPU node */
|
||||
for (cpunode = NULL;
|
||||
(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
|
||||
const u32 *reg = of_get_property(cpunode, "reg", NULL);
|
||||
if (reg == NULL || (*reg) != 0)
|
||||
continue;
|
||||
if (!strcmp(cpunode->type, "cpu"))
|
||||
break;
|
||||
}
|
||||
if (cpunode == NULL) {
|
||||
printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Check 970FX for now */
|
||||
valp = of_get_property(cpunode, "cpu-version", NULL);
|
||||
if (!valp) {
|
||||
|
|
@ -535,9 +521,9 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
|
|||
#endif /* CONFIG_PMAC_SMU */
|
||||
|
||||
|
||||
static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
|
||||
static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
|
||||
{
|
||||
struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
|
||||
struct device_node *cpuid = NULL, *hwclock = NULL;
|
||||
const u8 *eeprom = NULL;
|
||||
const u32 *valp;
|
||||
u64 max_freq, min_freq, ih, il;
|
||||
|
|
@ -546,17 +532,6 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
|
|||
DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and"
|
||||
" RackMac3,1...\n");
|
||||
|
||||
/* Get first CPU node */
|
||||
for (cpunode = NULL;
|
||||
(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
|
||||
if (!strcmp(cpunode->type, "cpu"))
|
||||
break;
|
||||
}
|
||||
if (cpunode == NULL) {
|
||||
printk(KERN_ERR "cpufreq: Can't find any CPU node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Lookup the cpuid eeprom node */
|
||||
cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
|
||||
if (cpuid != NULL)
|
||||
|
|
@ -716,25 +691,25 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
|
|||
|
||||
static int __init g5_cpufreq_init(void)
|
||||
{
|
||||
struct device_node *cpus;
|
||||
struct device_node *cpunode;
|
||||
int rc = 0;
|
||||
|
||||
cpus = of_find_node_by_path("/cpus");
|
||||
if (cpus == NULL) {
|
||||
DBG("No /cpus node !\n");
|
||||
/* Get first CPU node */
|
||||
cpunode = of_cpu_device_node_get(0);
|
||||
if (cpunode == NULL) {
|
||||
pr_err("cpufreq: Can't find any CPU node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (of_machine_is_compatible("PowerMac7,2") ||
|
||||
of_machine_is_compatible("PowerMac7,3") ||
|
||||
of_machine_is_compatible("RackMac3,1"))
|
||||
rc = g5_pm72_cpufreq_init(cpus);
|
||||
rc = g5_pm72_cpufreq_init(cpunode);
|
||||
#ifdef CONFIG_PMAC_SMU
|
||||
else
|
||||
rc = g5_neo2_cpufreq_init(cpus);
|
||||
rc = g5_neo2_cpufreq_init(cpunode);
|
||||
#endif /* CONFIG_PMAC_SMU */
|
||||
|
||||
of_node_put(cpus);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ static int spear_cpufreq_driver_init(void)
|
|||
const __be32 *val;
|
||||
int cnt, i, ret;
|
||||
|
||||
np = of_find_node_by_path("/cpus/cpu@0");
|
||||
np = of_cpu_device_node_get(0);
|
||||
if (!np) {
|
||||
pr_err("No cpu node found");
|
||||
return -ENODEV;
|
||||
|
|
|
|||
Loading…
Reference in a new issue