summaryrefslogtreecommitdiff
path: root/cpu/arm926ejs/mx25
diff options
context:
space:
mode:
Diffstat (limited to 'cpu/arm926ejs/mx25')
-rw-r--r--cpu/arm926ejs/mx25/Makefile2
-rw-r--r--cpu/arm926ejs/mx25/timer.c (renamed from cpu/arm926ejs/mx25/interrupts.c)24
2 files changed, 20 insertions, 6 deletions
diff --git a/cpu/arm926ejs/mx25/Makefile b/cpu/arm926ejs/mx25/Makefile
index 74add9d..48b4e7d 100644
--- a/cpu/arm926ejs/mx25/Makefile
+++ b/cpu/arm926ejs/mx25/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).a
-COBJS = interrupts.o serial.o generic.o iomux.o gpio.o
+COBJS = timer.o serial.o generic.o iomux.o gpio.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/cpu/arm926ejs/mx25/interrupts.c b/cpu/arm926ejs/mx25/timer.c
index cbd5d09..8b6a061 100644
--- a/cpu/arm926ejs/mx25/interrupts.c
+++ b/cpu/arm926ejs/mx25/timer.c
@@ -43,17 +43,29 @@
static ulong timestamp;
static ulong lastinc;
-/* nothing really to do with interrupts, just starts up a counter. */
-int interrupt_init(void)
+static inline void setup_gpt()
{
int i;
+ static int init_done;
+
+ if (init_done)
+ return;
+
+ init_done = 1;
/* setup GP Timer 1 */
GPTCR = GPTCR_SWR;
for (i = 0; i < 100; i++)
- GPTCR = 0; /* We have no udelay by now */
- GPTPR = 0; /* 32Khz */
- GPTCR |= GPTCR_CLKSOURCE_32 | GPTCR_TEN; /* Freerun Mode, PERCLK1 in */
+ GPTCR = 0; /* We have no udelay by now */
+ GPTPR = 0; /* 32Khz */
+ /* Freerun Mode, PERCLK1 input */
+ GPTCR |= GPTCR_CLKSOURCE_32 | GPTCR_TEN;
+}
+
+/* nothing really to do with interrupts, just starts up a counter. */
+int timer_init(void)
+{
+ setup_gpt();
return 0;
}
@@ -97,6 +109,8 @@ void udelay(unsigned long usec)
{
ulong tmo, tmp;
+ setup_gpt();
+
if (usec >= 1000) { /* if "big" number, spread normalize to secs */
tmo = usec / 1000; /* normalize usec to ticks per sec */
tmo *= CONFIG_SYS_HZ; /* find number of "ticks" to wait */