aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorTim Kryger <tim.kryger@linaro.org>2013-12-05 14:20:43 -0500
committerOlof Johansson <olof@lixom.net>2014-02-01 00:04:01 -0500
commit50ac206102660fe29e75d8a685178db95c530f4f (patch)
treed033fa45dffe2d34260feefe9d8bce9b14610a75 /drivers/clocksource
parent7c762036e2480bfd43e62ed872b82e372fe92474 (diff)
clocksource: kona: Add basic use of external clock
When an clock is specified in the device tree, enable it and use it to determine the external clock frequency. Signed-off-by: Tim Kryger <tim.kryger@linaro.org> Reviewed-by: Markus Mayer <markus.mayer@linaro.org> Reviewed-by: Matt Porter <matt.porter@linaro.org> Reviewed-by: Christian Daudt <bcm@fixthebug.org> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Christian Daudt <bcm@fixthebug.org> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/bcm_kona_timer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index 5176e761166b..974b2db2fe10 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -17,6 +17,7 @@
17#include <linux/jiffies.h> 17#include <linux/jiffies.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/clk.h>
20 21
21#include <linux/io.h> 22#include <linux/io.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
@@ -101,11 +102,18 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw)
101static void __init kona_timers_init(struct device_node *node) 102static void __init kona_timers_init(struct device_node *node)
102{ 103{
103 u32 freq; 104 u32 freq;
105 struct clk *external_clk;
104 106
105 if (!of_property_read_u32(node, "clock-frequency", &freq)) 107 external_clk = of_clk_get_by_name(node, NULL);
108
109 if (!IS_ERR(external_clk)) {
110 arch_timer_rate = clk_get_rate(external_clk);
111 clk_prepare_enable(external_clk);
112 } else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
106 arch_timer_rate = freq; 113 arch_timer_rate = freq;
107 else 114 } else {
108 panic("clock-frequency not set in the .dts file"); 115 panic("unable to determine clock-frequency");
116 }
109 117
110 /* Setup IRQ numbers */ 118 /* Setup IRQ numbers */
111 timers.tmr_irq = irq_of_parse_and_map(node, 0); 119 timers.tmr_irq = irq_of_parse_and_map(node, 0);