diff options
author | wdenk <wdenk> | 2005-04-04 12:08:28 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2005-04-04 12:08:28 +0000 |
commit | 101e8dfa2a8b045c6655bf2b3d6fba8d378453cd (patch) | |
tree | 1c39acefbaf435ddc2e9f42540eb64ea267cb530 /cpu/at91rm9200 | |
parent | 50712ba16e7e469e90952a7f197efa46e2f8e311 (diff) | |
download | u-boot-imx-101e8dfa2a8b045c6655bf2b3d6fba8d378453cd.zip u-boot-imx-101e8dfa2a8b045c6655bf2b3d6fba8d378453cd.tar.gz u-boot-imx-101e8dfa2a8b045c6655bf2b3d6fba8d378453cd.tar.bz2 |
Fix timer code for ARM systems: make sure that udelay() does not
reset timers so it's save to use udelay() in timeout code.
Diffstat (limited to 'cpu/at91rm9200')
-rw-r--r-- | cpu/at91rm9200/interrupts.c | 15 | ||||
-rw-r--r-- | cpu/at91rm9200/start.S | 6 |
2 files changed, 10 insertions, 11 deletions
diff --git a/cpu/at91rm9200/interrupts.c b/cpu/at91rm9200/interrupts.c index f15c583..cccc405 100644 --- a/cpu/at91rm9200/interrupts.c +++ b/cpu/at91rm9200/interrupts.c @@ -231,20 +231,19 @@ ulong get_timer_masked (void) void udelay_masked (unsigned long usec) { ulong tmo; + ulong endtime; + signed long diff; -#if 0 /* doesn't work for usec < 1000 */ - tmo = usec / 1000; - tmo *= CFG_HZ_CLOCK; -#else tmo = CFG_HZ_CLOCK / 1000; tmo *= usec; -#endif tmo /= 1000; - reset_timer_masked (); + endtime = get_timer_raw () + tmo; - while (get_timer_raw () < tmo) - /*NOP*/; + do { + ulong now = get_timer_raw (); + diff = endtime - now; + } while (diff >= 0); } /* diff --git a/cpu/at91rm9200/start.S b/cpu/at91rm9200/start.S index e897e6b..1881ab1 100644 --- a/cpu/at91rm9200/start.S +++ b/cpu/at91rm9200/start.S @@ -117,11 +117,11 @@ reset: #ifdef CONFIG_INIT_CRITICAL /* scratch stack */ - ldr r1, =0x00204000 +/**** ldr r1, =0x00204000 ****/ /* Insure word alignment */ - bic r1, r1, #3 +/**** bic r1, r1, #3 ****/ /* Init stack SYS */ - mov sp, r1 +/**** mov sp, r1 ****/ /* * This does a lot more than just set up the memory, which * is why it's called lowlevelinit |