Commit 7d633975 authored by Linus Walleij's avatar Linus Walleij Committed by Russell King

ARM: 6159/1: Move IOP to use common mult/shift calculation code

Since the infrastructure for determining shift/mult values from a
clock rate and a minimum programmable rate is now in the kernel,
lets remove this custom code.

Cc: Deepak Saxena <dsaxena@plexity.net>
Acked-by: default avatarMikael Pettersson <mikpe@it.uu.se>
Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent cd5b8f87
......@@ -28,6 +28,11 @@
#include <asm/mach/time.h>
#include <mach/time.h>
/*
* Minimum clocksource/clockevent timer range in seconds
*/
#define IOP_MIN_RANGE 4
/*
* IOP clocksource (free-running timer 1).
*/
......@@ -44,27 +49,6 @@ static struct clocksource iop_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
static void __init iop_clocksource_set_hz(struct clocksource *cs, unsigned int hz)
{
u64 temp;
u32 shift;
/* Find shift and mult values for hz. */
shift = 32;
do {
temp = (u64) NSEC_PER_SEC << shift;
do_div(temp, hz);
if ((temp >> 32) == 0)
break;
} while (--shift != 0);
cs->shift = shift;
cs->mult = (u32) temp;
printk(KERN_INFO "clocksource: %s uses shift %u mult %#x\n",
cs->name, cs->shift, cs->mult);
}
/*
* IOP sched_clock() implementation via its clocksource.
*/
......@@ -130,27 +114,6 @@ static struct clock_event_device iop_clockevent = {
.set_mode = iop_set_mode,
};
static void __init iop_clockevent_set_hz(struct clock_event_device *ce, unsigned int hz)
{
u64 temp;
u32 shift;
/* Find shift and mult values for hz. */
shift = 32;
do {
temp = (u64) hz << shift;
do_div(temp, NSEC_PER_SEC);
if ((temp >> 32) == 0)
break;
} while (--shift != 0);
ce->shift = shift;
ce->mult = (u32) temp;
printk(KERN_INFO "clockevent: %s uses shift %u mult %#lx\n",
ce->name, ce->shift, ce->mult);
}
static irqreturn_t
iop_timer_interrupt(int irq, void *dev_id)
{
......@@ -190,7 +153,8 @@ void __init iop_init_time(unsigned long tick_rate)
*/
write_tmr0(timer_ctl & ~IOP_TMR_EN);
setup_irq(IRQ_IOP_TIMER0, &iop_timer_irq);
iop_clockevent_set_hz(&iop_clockevent, tick_rate);
clockevents_calc_mult_shift(&iop_clockevent,
tick_rate, IOP_MIN_RANGE);
iop_clockevent.max_delta_ns =
clockevent_delta2ns(0xfffffffe, &iop_clockevent);
iop_clockevent.min_delta_ns =
......@@ -207,6 +171,7 @@ void __init iop_init_time(unsigned long tick_rate)
write_trr1(0xffffffff);
write_tcr1(0xffffffff);
write_tmr1(timer_ctl);
iop_clocksource_set_hz(&iop_clocksource, tick_rate);
clocksource_calc_mult_shift(&iop_clocksource, tick_rate,
IOP_MIN_RANGE);
clocksource_register(&iop_clocksource);
}
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