summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/timer.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-12-18 17:18:48 +0100
committerMichal Simek <michal.simek@xilinx.com>2014-01-27 11:24:55 +0100
commitc1120542b99a67a620cd8a298975d76dca5a13f0 (patch)
tree942aaf1e8d3d0c08a3cdbee5316f14dd4a901083 /arch/microblaze/kernel/timer.c
parent21ecc1f1d2e01ddbd75c3db208236628474a43e1 (diff)
downloadtalos-obmc-linux-c1120542b99a67a620cd8a298975d76dca5a13f0.tar.gz
talos-obmc-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/timer.c')
-rw-r--r--arch/microblaze/kernel/timer.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 3e39b1082fdf..55b19400951f 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -230,9 +230,9 @@ static int timer_initialized;
static void __init xilinx_timer_init(struct device_node *timer)
{
+ struct clk *clk;
u32 irq;
u32 timer_num = 1;
- int ret;
timer_baseaddr = of_iomap(timer, 0);
if (!timer_baseaddr) {
@@ -250,10 +250,20 @@ static void __init xilinx_timer_init(struct device_node *timer)
pr_info("%s: irq=%d\n", timer->full_name, irq);
- /* If there is clock-frequency property than use it */
- ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq);
- if (ret < 0)
+ clk = of_clk_get(timer, 0);
+ if (IS_ERR(clk)) {
+ pr_err("ERROR: timer CCF input clock not found\n");
+ /* If there is clock-frequency property than use it */
+ of_property_read_u32(timer, "clock-frequency",
+ &timer_clock_freq);
+ } else {
+ timer_clock_freq = clk_get_rate(clk);
+ }
+
+ if (!timer_clock_freq) {
+ pr_err("ERROR: Using CPU clock frequency\n");
timer_clock_freq = cpuinfo.cpu_clock_freq;
+ }
freq_div_hz = timer_clock_freq / HZ;
OpenPOWER on IntegriCloud