diff options
author | Michal Simek <michal.simek@xilinx.com> | 2013-12-18 17:18:48 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2014-01-27 11:24:55 +0100 |
commit | c1120542b99a67a620cd8a298975d76dca5a13f0 (patch) | |
tree | 942aaf1e8d3d0c08a3cdbee5316f14dd4a901083 /arch/microblaze/kernel/cpu/cpuinfo.c | |
parent | microblaze: Simplify fcpu helper function (diff) | |
download | linux-c1120542b99a67a620cd8a298975d76dca5a13f0.tar.xz linux-c1120542b99a67a620cd8a298975d76dca5a13f0.zip |
microblaze: Add support for CCF
Add support for CCF for Microblaze.
Old binding:
system_timer: system-timer@41c00000 {
clock-frequency = <75000000>;
...
}
New binding:
system_timer: system-timer@41c00000 {
clocks = <&clk_bus>;
...
}
Both should be supported for a while
Microblaze clock binding:
clocks {
#address-cells = <1>;
#size-cells = <0>;
clk_bus: bus {
#clock-cells = <0>;
clock-frequency = <75000000>;
clock-output-names = "bus";
compatible = "fixed-clock";
reg = <1>;
} ;
clk_cpu: cpu {
#clock-cells = <0>;
clock-frequency = <75000000>;
clock-output-names = "cpu";
compatible = "fixed-clock";
reg = <0>;
} ;
} ;
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch/microblaze/kernel/cpu/cpuinfo.c')
-rw-r--r-- | arch/microblaze/kernel/cpu/cpuinfo.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c index c9203b1007aa..ce1cfed731ea 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo.c +++ b/arch/microblaze/kernel/cpu/cpuinfo.c @@ -8,6 +8,7 @@ * for more details. */ +#include <linux/clk.h> #include <linux/init.h> #include <asm/cpuinfo.h> #include <asm/pvr.h> @@ -68,11 +69,10 @@ const struct family_string_key family_string_lookup[] = { }; struct cpuinfo cpuinfo; +static struct device_node *cpu; void __init setup_cpuinfo(void) { - struct device_node *cpu = NULL; - cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); if (!cpu) pr_err("You don't have cpu!!!\n"); @@ -102,3 +102,22 @@ void __init setup_cpuinfo(void) pr_warn("%s: Stream instructions enabled" " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); } + +void __init setup_cpuinfo_clk(void) +{ + struct clk *clk; + + clk = of_clk_get(cpu, 0); + if (IS_ERR(clk)) { + pr_err("ERROR: CPU CCF input clock not found\n"); + /* take timebase-frequency from DTS */ + cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency"); + } else { + cpuinfo.cpu_clock_freq = clk_get_rate(clk); + } + + if (!cpuinfo.cpu_clock_freq) { + pr_err("ERROR: CPU clock frequency not setup\n"); + BUG(); + } +} |