aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/timer.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-12-18 11:18:48 -0500
committerMichal Simek <michal.simek@xilinx.com>2014-01-27 05:24:55 -0500
commitc1120542b99a67a620cd8a298975d76dca5a13f0 (patch)
tree942aaf1e8d3d0c08a3cdbee5316f14dd4a901083 /arch/microblaze/kernel/timer.c
parent21ecc1f1d2e01ddbd75c3db208236628474a43e1 (diff)
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;
230 230
231static void __init xilinx_timer_init(struct device_node *timer) 231static void __init xilinx_timer_init(struct device_node *timer)
232{ 232{
233 struct clk *clk;
233 u32 irq; 234 u32 irq;
234 u32 timer_num = 1; 235 u32 timer_num = 1;
235 int ret;
236 236
237 timer_baseaddr = of_iomap(timer, 0); 237 timer_baseaddr = of_iomap(timer, 0);
238 if (!timer_baseaddr) { 238 if (!timer_baseaddr) {
@@ -250,10 +250,20 @@ static void __init xilinx_timer_init(struct device_node *timer)
250 250
251 pr_info("%s: irq=%d\n", timer->full_name, irq); 251 pr_info("%s: irq=%d\n", timer->full_name, irq);
252 252
253 /* If there is clock-frequency property than use it */ 253 clk = of_clk_get(timer, 0);
254 ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq); 254 if (IS_ERR(clk)) {
255 if (ret < 0) 255 pr_err("ERROR: timer CCF input clock not found\n");
256 /* If there is clock-frequency property than use it */
257 of_property_read_u32(timer, "clock-frequency",
258 &timer_clock_freq);
259 } else {
260 timer_clock_freq = clk_get_rate(clk);
261 }
262
263 if (!timer_clock_freq) {
264 pr_err("ERROR: Using CPU clock frequency\n");
256 timer_clock_freq = cpuinfo.cpu_clock_freq; 265 timer_clock_freq = cpuinfo.cpu_clock_freq;
266 }
257 267
258 freq_div_hz = timer_clock_freq / HZ; 268 freq_div_hz = timer_clock_freq / HZ;
259 269