diff options
author | Tim Kryger <tim.kryger@linaro.org> | 2014-02-04 19:15:04 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-02-06 10:01:40 -0500 |
commit | ad037c1f4ae6f9258f27fddb679ceb703ff07a88 (patch) | |
tree | d852c00a23067af1ea75384b94162ecb1aa55a31 /drivers/clocksource | |
parent | 80d767d770fd9c697e434fd080c2db7b5c60c6dd (diff) |
clocksource: Kona: Print warning rather than panic
Since there may be other clocksources available, this driver should not
trigger a panic simply because it can not determine the frequency of an
external clock. This change refactors the driver to allow a warning to
be printed in this case instead.
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>
Cc: Christian Daudt <bcm@fixthebug.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1391559304-26558-1-git-send-email-tim.kryger@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/bcm_kona_timer.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 974b2db2fe10..0595dc6c453e 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c | |||
@@ -99,31 +99,6 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw) | |||
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | 101 | ||
102 | static void __init kona_timers_init(struct device_node *node) | ||
103 | { | ||
104 | u32 freq; | ||
105 | struct clk *external_clk; | ||
106 | |||
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)) { | ||
113 | arch_timer_rate = freq; | ||
114 | } else { | ||
115 | panic("unable to determine clock-frequency"); | ||
116 | } | ||
117 | |||
118 | /* Setup IRQ numbers */ | ||
119 | timers.tmr_irq = irq_of_parse_and_map(node, 0); | ||
120 | |||
121 | /* Setup IO addresses */ | ||
122 | timers.tmr_regs = of_iomap(node, 0); | ||
123 | |||
124 | kona_timer_disable_and_clear(timers.tmr_regs); | ||
125 | } | ||
126 | |||
127 | static int kona_timer_set_next_event(unsigned long clc, | 102 | static int kona_timer_set_next_event(unsigned long clc, |
128 | struct clock_event_device *unused) | 103 | struct clock_event_device *unused) |
129 | { | 104 | { |
@@ -198,7 +173,34 @@ static struct irqaction kona_timer_irq = { | |||
198 | 173 | ||
199 | static void __init kona_timer_init(struct device_node *node) | 174 | static void __init kona_timer_init(struct device_node *node) |
200 | { | 175 | { |
201 | kona_timers_init(node); | 176 | u32 freq; |
177 | struct clk *external_clk; | ||
178 | |||
179 | if (!of_device_is_available(node)) { | ||
180 | pr_info("Kona Timer v1 marked as disabled in device tree\n"); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | external_clk = of_clk_get_by_name(node, NULL); | ||
185 | |||
186 | if (!IS_ERR(external_clk)) { | ||
187 | arch_timer_rate = clk_get_rate(external_clk); | ||
188 | clk_prepare_enable(external_clk); | ||
189 | } else if (!of_property_read_u32(node, "clock-frequency", &freq)) { | ||
190 | arch_timer_rate = freq; | ||
191 | } else { | ||
192 | pr_err("Kona Timer v1 unable to determine clock-frequency"); | ||
193 | return; | ||
194 | } | ||
195 | |||
196 | /* Setup IRQ numbers */ | ||
197 | timers.tmr_irq = irq_of_parse_and_map(node, 0); | ||
198 | |||
199 | /* Setup IO addresses */ | ||
200 | timers.tmr_regs = of_iomap(node, 0); | ||
201 | |||
202 | kona_timer_disable_and_clear(timers.tmr_regs); | ||
203 | |||
202 | kona_timer_clockevents_init(); | 204 | kona_timer_clockevents_init(); |
203 | setup_irq(timers.tmr_irq, &kona_timer_irq); | 205 | setup_irq(timers.tmr_irq, &kona_timer_irq); |
204 | kona_timer_set_next_event((arch_timer_rate / HZ), NULL); | 206 | kona_timer_set_next_event((arch_timer_rate / HZ), NULL); |