From: Colin Cross Date: Sat, 29 Oct 2011 21:06:07 +0000 (-0700) Subject: ARM: smp_twd: use clockevents_update_freq to update frequency X-Git-Tag: firefly_0821_release~9595^2~130^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=702f53a01986ff6c4dea1c15de51d34f386e85e7;p=firefly-linux-kernel-4.4.55.git ARM: smp_twd: use clockevents_update_freq to update frequency clockevents_reconfigure was an older api that doesn't handle updating the max time between ticks when the frequency changes. Under some conditions, the boot value of max_delta_ns scaled by the mult/shift values for the current frequency can result in a value of 0x200000004 selected as the number of cycles to program for a long tick, which gets wrapped to 0x4. Also switch to the matching clockevents_config_and_register function to register the clockevent, which handles converting the min/max ticks to ns during init. Change-Id: I6ca659c309e7bb031cdb1954767b5aa7a022ff44 Signed-off-by: Colin Cross --- diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 27761cacd7b0..350a125f8cd6 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -25,8 +25,6 @@ #include #include -#define TWD_MIN_RANGE 4 - /* set up by the platform code */ void __iomem *twd_base; @@ -96,8 +94,7 @@ static void twd_update_frequency(void *data) { twd_timer_rate = clk_get_rate(twd_clk); - clockevents_reconfigure(__get_cpu_var(twd_ce), twd_timer_rate, - TWD_MIN_RANGE); + clockevents_update_freq(__get_cpu_var(twd_ce), twd_timer_rate); } static int twd_cpufreq_transition(struct notifier_block *nb, @@ -193,15 +190,10 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) clk->set_mode = twd_set_mode; clk->set_next_event = twd_set_next_event; - clockevents_calc_mult_shift(clk, twd_timer_rate, TWD_MIN_RANGE); - - clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk); - clk->min_delta_ns = clockevent_delta2ns(0xf, clk); - /* Make sure our local interrupt controller has this enabled */ gic_enable_ppi(clk->irq); __get_cpu_var(twd_ce) = clk; - clockevents_register_device(clk); + clockevents_config_and_register(clk, twd_timer_rate, 0xf, 0xffffffff); }