diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-01-12 06:50:05 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-01-14 13:12:42 -0500 |
commit | 838a2ae80a6ab52139fb1bf0a93ea8c5eff94488 (patch) | |
tree | 5e5fbbc2005b012318b7474f9c6057b9ff3f3814 /arch/arm/mach-mxs | |
parent | c35ef95c273c06471818f9245a05ac5a6e3ffa34 (diff) |
ARM: use clockevents_config_and_register() where possible
The clockevent core is able to figure out the best mult and shift,
calculate min_delta_ns and max_delta_ns, with the necessary info passed
into clockevents_config_and_register(). Use this combined configure
and register function where possible to make the codes less error prone
and gain some positive diff stat.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Reviewed-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Tested-by: Roland Stigge <stigge@antcom.de>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: David Brown <davidb@codeaurora.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Barry Song <baohua.song@csr.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r-- | arch/arm/mach-mxs/timer.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c index 856f4c796061..27451b1ba3f1 100644 --- a/arch/arm/mach-mxs/timer.c +++ b/arch/arm/mach-mxs/timer.c | |||
@@ -195,7 +195,6 @@ static void mxs_set_mode(enum clock_event_mode mode, | |||
195 | static struct clock_event_device mxs_clockevent_device = { | 195 | static struct clock_event_device mxs_clockevent_device = { |
196 | .name = "mxs_timrot", | 196 | .name = "mxs_timrot", |
197 | .features = CLOCK_EVT_FEAT_ONESHOT, | 197 | .features = CLOCK_EVT_FEAT_ONESHOT, |
198 | .shift = 32, | ||
199 | .set_mode = mxs_set_mode, | 198 | .set_mode = mxs_set_mode, |
200 | .set_next_event = timrotv2_set_next_event, | 199 | .set_next_event = timrotv2_set_next_event, |
201 | .rating = 200, | 200 | .rating = 200, |
@@ -203,25 +202,12 @@ static struct clock_event_device mxs_clockevent_device = { | |||
203 | 202 | ||
204 | static int __init mxs_clockevent_init(struct clk *timer_clk) | 203 | static int __init mxs_clockevent_init(struct clk *timer_clk) |
205 | { | 204 | { |
206 | unsigned int c = clk_get_rate(timer_clk); | 205 | if (timrot_is_v1()) |
207 | |||
208 | mxs_clockevent_device.mult = | ||
209 | div_sc(c, NSEC_PER_SEC, mxs_clockevent_device.shift); | ||
210 | mxs_clockevent_device.cpumask = cpumask_of(0); | ||
211 | if (timrot_is_v1()) { | ||
212 | mxs_clockevent_device.set_next_event = timrotv1_set_next_event; | 206 | mxs_clockevent_device.set_next_event = timrotv1_set_next_event; |
213 | mxs_clockevent_device.max_delta_ns = | 207 | mxs_clockevent_device.cpumask = cpumask_of(0); |
214 | clockevent_delta2ns(0xfffe, &mxs_clockevent_device); | 208 | clockevents_config_and_register(&mxs_clockevent_device, |
215 | mxs_clockevent_device.min_delta_ns = | 209 | clk_get_rate(timer_clk), 0xf, |
216 | clockevent_delta2ns(0xf, &mxs_clockevent_device); | 210 | timrot_is_v1() ? 0xfffe : 0xfffffffe); |
217 | } else { | ||
218 | mxs_clockevent_device.max_delta_ns = | ||
219 | clockevent_delta2ns(0xfffffffe, &mxs_clockevent_device); | ||
220 | mxs_clockevent_device.min_delta_ns = | ||
221 | clockevent_delta2ns(0xf, &mxs_clockevent_device); | ||
222 | } | ||
223 | |||
224 | clockevents_register_device(&mxs_clockevent_device); | ||
225 | 211 | ||
226 | return 0; | 212 | return 0; |
227 | } | 213 | } |