Merge branch 'next' of ../next
[platform/kernel/u-boot.git] / cpu / blackfin / interrupts.c
index 80c5505..921bfe0 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <config.h>
+#include <watchdog.h>
 #include <asm/blackfin.h>
 #include "cpu.h"
 
@@ -48,7 +49,7 @@ ulong get_tbclk(void)
 {
        ulong tbclk;
 
-       tbclk = CFG_HZ;
+       tbclk = CONFIG_SYS_HZ;
        return tbclk;
 }
 
@@ -63,13 +64,15 @@ int disable_interrupts(void)
        return 1;
 }
 
-void udelay(unsigned long usec)
+void __udelay(unsigned long usec)
 {
        unsigned long delay, start, stop;
        unsigned long cclk;
        cclk = (CONFIG_CCLK_HZ);
 
        while (usec > 1) {
+               WATCHDOG_RESET();
+
                /*
                 * how many clock ticks to delay?
                 *  - request(in useconds) * clock_ticks(Hz) / useconds/second
@@ -95,11 +98,12 @@ void udelay(unsigned long usec)
 int timer_init(void)
 {
        *pTCNTL = 0x1;
+       CSYNC();
        *pTSCALE = 0x0;
        *pTCOUNT = MAX_TIM_LOAD;
        *pTPERIOD = MAX_TIM_LOAD;
        *pTCNTL = 0x7;
-       asm("CSYNC;");
+       CSYNC();
 
        timestamp = 0;
        last_time = 0;
@@ -151,5 +155,5 @@ ulong get_timer(ulong base)
 
 void reset_timer(void)
 {
-       timestamp = 0;
+       timer_init();
 }