summaryrefslogtreecommitdiff
path: root/cpu/arm926ejs/mx25
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2009-10-29 19:19:00 +0800
committerTerry Lv <r65388@freescale.com>2009-11-03 18:22:03 +0800
commitba816f983f5dac44d9f4461906b9bc0101237ac8 (patch)
tree52d3b83aa1cc146b88933f75b0a65c2dc813ea28 /cpu/arm926ejs/mx25
parent3227c278048e6b13397d9d0793e77e703649d7de (diff)
downloadu-boot-imx-ba816f983f5dac44d9f4461906b9bc0101237ac8.zip
u-boot-imx-ba816f983f5dac44d9f4461906b9bc0101237ac8.tar.gz
u-boot-imx-ba816f983f5dac44d9f4461906b9bc0101237ac8.tar.bz2
u-boot v2009.08 sd/mmc support.
Signed-off-by: Terry Lv <r65388@freescale.com>
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 */