Commit 53985371 authored by Uwe Kleine-König's avatar Uwe Kleine-König

ARM: rpc: stop using <mach/timex.h>

The rpc timekeeping code uses the symbol LATCH which depends on
CLOCK_TICK_RATE which is defined in rpc's <mach/timex.h>. As this header
will go away in a later patch introduce a local variable holding the
same value as LATCH and use that instead.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent f0402f9b
......@@ -24,6 +24,9 @@
#include <asm/mach/time.h>
#define RPC_CLOCK_FREQ 2000000
#define RPC_LATCH DIV_ROUND_CLOSEST(RPC_CLOCK_FREQ, HZ)
static u32 ioc_timer_gettimeoffset(void)
{
unsigned int count1, count2, status;
......@@ -46,23 +49,23 @@ static u32 ioc_timer_gettimeoffset(void)
* and count2.
*/
if (status & (1 << 5))
offset -= LATCH;
offset -= RPC_LATCH;
} else if (count2 > count1) {
/*
* We have just had another interrupt between reading
* count1 and count2.
*/
offset -= LATCH;
offset -= RPC_LATCH;
}
offset = (LATCH - offset) * (tick_nsec / 1000);
return ((offset + LATCH/2) / LATCH) * 1000;
offset = (RPC_LATCH - offset) * (tick_nsec / 1000);
return DIV_ROUND_CLOSEST(offset, RPC_LATCH) * 1000;
}
void __init ioctime_init(void)
{
ioc_writeb(LATCH & 255, IOC_T0LTCHL);
ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
ioc_writeb(RPC_LATCH & 255, IOC_T0LTCHL);
ioc_writeb(RPC_LATCH >> 8, IOC_T0LTCHH);
ioc_writeb(0, IOC_T0GO);
}
......
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