From: Tim Kryger Date: Thu, 5 Dec 2013 19:20:43 +0000 (-0800) Subject: clocksource: kona: Add basic use of external clock X-Git-Tag: MMI-PSA29.97-13-9~12790^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=50ac206102660fe29e75d8a685178db95c530f4f;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Reviewed-by: Markus Mayer Reviewed-by: Matt Porter Reviewed-by: Christian Daudt Acked-by: Daniel Lezcano Signed-off-by: Christian Daudt Signed-off-by: Olof Johansson --- 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 @@ #include #include #include +#include #include #include @@ -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) { 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; - else - panic("clock-frequency not set in the .dts file"); + } else { + panic("unable to determine clock-frequency"); + } /* Setup IRQ numbers */ timers.tmr_irq = irq_of_parse_and_map(node, 0);