summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2009-09-04 10:07:20 +0800
committerFred Fan <r01011@freescale.com>2009-09-10 17:08:11 +0800
commitd293115ed756b0b2912eb62ead1ddee647ec2fee (patch)
tree512c733f1469ad5d5b863a5dd43110eb78bc2814 /cpu
parente3f5232e3d7461f9ab4fd4277db2bb91fefe12cc (diff)
downloadu-boot-imx-d293115ed756b0b2912eb62ead1ddee647ec2fee.zip
u-boot-imx-d293115ed756b0b2912eb62ead1ddee647ec2fee.tar.gz
u-boot-imx-d293115ed756b0b2912eb62ead1ddee647ec2fee.tar.bz2
ENGR00116243: I2C support for mx51 3ds board.
I2C support for mx51 3ds board. Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'cpu')
-rw-r--r--cpu/arm_cortexa8/mx51/interrupts.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/cpu/arm_cortexa8/mx51/interrupts.c b/cpu/arm_cortexa8/mx51/interrupts.c
index 1277d4e..484b961 100644
--- a/cpu/arm_cortexa8/mx51/interrupts.c
+++ b/cpu/arm_cortexa8/mx51/interrupts.c
@@ -38,17 +38,30 @@
#define GPTCR_CLKSOURCE_32 (4<<6) /* Clock source */
#define GPTCR_TEN (1) /* Timer enable */
-/* 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 = 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 interrupt_init(void)
+{
+ setup_gpt();
+
return 0;
}
@@ -84,7 +97,9 @@ void udelay(unsigned long usec)
{
ulong tmo, tmp;
- /* if "big" number, spread normalization to seconds */
+ setup_gpt();
+
+ /* if "big" number, spread normalization to seconds */
if (usec >= 1000) {
/* start to normalize for usec to ticks per sec */
tmo = usec / 1000;