diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-12-19 16:22:23 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-12-20 11:17:14 -0500 |
commit | 53985371458fc17405c7fc277e6f05fe36965eab (patch) | |
tree | 09bb3e5a6aaffa9541c22e09e118debe48135641 /arch/arm/mach-rpc/time.c | |
parent | f0402f9b47112faea10541b799b61066ae322c36 (diff) |
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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-rpc/time.c')
-rw-r--r-- | arch/arm/mach-rpc/time.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/mach-rpc/time.c b/arch/arm/mach-rpc/time.c index 9a6def14df01..99363ae5cac7 100644 --- a/arch/arm/mach-rpc/time.c +++ b/arch/arm/mach-rpc/time.c | |||
@@ -24,6 +24,9 @@ | |||
24 | 24 | ||
25 | #include <asm/mach/time.h> | 25 | #include <asm/mach/time.h> |
26 | 26 | ||
27 | #define RPC_CLOCK_FREQ 2000000 | ||
28 | #define RPC_LATCH DIV_ROUND_CLOSEST(RPC_CLOCK_FREQ, HZ) | ||
29 | |||
27 | static u32 ioc_timer_gettimeoffset(void) | 30 | static u32 ioc_timer_gettimeoffset(void) |
28 | { | 31 | { |
29 | unsigned int count1, count2, status; | 32 | unsigned int count1, count2, status; |
@@ -46,23 +49,23 @@ static u32 ioc_timer_gettimeoffset(void) | |||
46 | * and count2. | 49 | * and count2. |
47 | */ | 50 | */ |
48 | if (status & (1 << 5)) | 51 | if (status & (1 << 5)) |
49 | offset -= LATCH; | 52 | offset -= RPC_LATCH; |
50 | } else if (count2 > count1) { | 53 | } else if (count2 > count1) { |
51 | /* | 54 | /* |
52 | * We have just had another interrupt between reading | 55 | * We have just had another interrupt between reading |
53 | * count1 and count2. | 56 | * count1 and count2. |
54 | */ | 57 | */ |
55 | offset -= LATCH; | 58 | offset -= RPC_LATCH; |
56 | } | 59 | } |
57 | 60 | ||
58 | offset = (LATCH - offset) * (tick_nsec / 1000); | 61 | offset = (RPC_LATCH - offset) * (tick_nsec / 1000); |
59 | return ((offset + LATCH/2) / LATCH) * 1000; | 62 | return DIV_ROUND_CLOSEST(offset, RPC_LATCH) * 1000; |
60 | } | 63 | } |
61 | 64 | ||
62 | void __init ioctime_init(void) | 65 | void __init ioctime_init(void) |
63 | { | 66 | { |
64 | ioc_writeb(LATCH & 255, IOC_T0LTCHL); | 67 | ioc_writeb(RPC_LATCH & 255, IOC_T0LTCHL); |
65 | ioc_writeb(LATCH >> 8, IOC_T0LTCHH); | 68 | ioc_writeb(RPC_LATCH >> 8, IOC_T0LTCHH); |
66 | ioc_writeb(0, IOC_T0GO); | 69 | ioc_writeb(0, IOC_T0GO); |
67 | } | 70 | } |
68 | 71 | ||