summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/clocksource.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-10-07 16:32:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2007-10-07 16:32:20 +0200
commitb4fc7b84b0e99aa46a479c09bb4dec0d4c05520d (patch)
tree2e41c865b566e4a51037469a6e956857eb5eb86f /arch/arm/mach-imx/clocksource.c
parentb5656a41e0f7069b30143486fd3c31da2695bc2a (diff)
downloadbarebox-b4fc7b84b0e99aa46a479c09bb4dec0d4c05520d.tar.gz
barebox-b4fc7b84b0e99aa46a479c09bb4dec0d4c05520d.tar.xz
make independent of timer base
Diffstat (limited to 'arch/arm/mach-imx/clocksource.c')
-rw-r--r--arch/arm/mach-imx/clocksource.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c
index dc95cf1d46..c7bd730c90 100644
--- a/arch/arm/mach-imx/clocksource.c
+++ b/arch/arm/mach-imx/clocksource.c
@@ -35,9 +35,11 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
+#define GPT(x) __REG(IMX_TIM1_BASE + (x))
+
uint64_t imx_clocksource_read(void)
{
- return TCN1;
+ return GPT(GPT_TCN);
}
static struct clocksource cs = {
@@ -50,13 +52,16 @@ static int clocksource_init (void)
{
int i;
/* setup GP Timer 1 */
- TCTL1 = TCTL_SWR;
- for ( i=0; i<100; i++) TCTL1 = 0; /* We have no udelay by now */
- TPRER1 = 0;
- TCTL1 |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
+ GPT(GPT_TCTL) = TCTL_SWR;
+
+ for (i = 0; i < 100; i++)
+ GPT(GPT_TCTL) = 0; /* We have no udelay by now */
+
+ GPT(GPT_TPRER) = 0;
+ GPT(GPT_TCTL) |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
- TCTL1 &= ~TCTL_TEN;
- TCTL1 |= TCTL_TEN; /* Enable timer */
+ GPT(GPT_TCTL) &= ~TCTL_TEN;
+ GPT(GPT_TCTL) |= TCTL_TEN; /* Enable timer */
cs.mult = clocksource_hz2mult(get_PERCLK1(), cs.shift);