Skip to content

Commit 50ac206

Browse files
Tim Krygerolofj
authored andcommitted
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>
1 parent 7c76203 commit 50ac206

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/clocksource/bcm_kona_timer.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/jiffies.h>
1818
#include <linux/clockchips.h>
1919
#include <linux/types.h>
20+
#include <linux/clk.h>
2021

2122
#include <linux/io.h>
2223
#include <asm/mach/time.h>
@@ -101,11 +102,18 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw)
101102
static void __init kona_timers_init(struct device_node *node)
102103
{
103104
u32 freq;
105+
struct clk *external_clk;
104106

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)) {
106113
arch_timer_rate = freq;
107-
else
108-
panic("clock-frequency not set in the .dts file");
114+
} else {
115+
panic("unable to determine clock-frequency");
116+
}
109117

110118
/* Setup IRQ numbers */
111119
timers.tmr_irq = irq_of_parse_and_map(node, 0);

0 commit comments

Comments
 (0)