Commit 50ac2061 authored by Tim Kryger's avatar Tim Kryger Committed by Olof Johansson

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: default avatarTim Kryger <tim.kryger@linaro.org>
Reviewed-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
Reviewed-by: default avatarMatt Porter <matt.porter@linaro.org>
Reviewed-by: default avatarChristian Daudt <bcm@fixthebug.org>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarChristian Daudt <bcm@fixthebug.org>
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parent 7c762036
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -101,11 +102,18 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw) ...@@ -101,11 +102,18 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw)
static void __init kona_timers_init(struct device_node *node) static void __init kona_timers_init(struct device_node *node)
{ {
u32 freq; u32 freq;
struct clk *external_clk;
if (!of_property_read_u32(node, "clock-frequency", &freq)) external_clk = of_clk_get_by_name(node, NULL);
if (!IS_ERR(external_clk)) {
arch_timer_rate = clk_get_rate(external_clk);
clk_prepare_enable(external_clk);
} else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
arch_timer_rate = freq; arch_timer_rate = freq;
else } else {
panic("clock-frequency not set in the .dts file"); panic("unable to determine clock-frequency");
}
/* Setup IRQ numbers */ /* Setup IRQ numbers */
timers.tmr_irq = irq_of_parse_and_map(node, 0); timers.tmr_irq = irq_of_parse_and_map(node, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment