]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/arm926ejs/mb86r0x/timer.c
Merge commit '7b2fac7654f7420c2787f74ec3b1540fa3b343e9'
[u-boot] / arch / arm / cpu / arm926ejs / mb86r0x / timer.c
index 9175b71d16aa17e5c75e442defb5ea4ae1625a6b..8f38056455abf2d74fb65f864600275f56ee24dd 100644 (file)
 #define TIMER_LOAD_VAL 0xffffffff
 #define TIMER_FREQ     (CONFIG_MB86R0x_IOCLK  / 256)
 
-static unsigned long long timestamp;
-static ulong lastdec;
+DECLARE_GLOBAL_DATA_PTR;
+
+#define timestamp gd->tbl
+#define lastdec gd->lastinc
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
 {
@@ -66,7 +68,9 @@ int timer_init(void)
 
        writel(ctrl, &timer->control);
 
-       reset_timer_masked();
+       /* capture current value time */
+       lastdec = readl(&timer->value);
+       timestamp = 0; /* start "advancing" time stamp from 0 */
 
        return 0;
 }
@@ -92,16 +96,6 @@ unsigned long long get_ticks(void)
        return timestamp;
 }
 
-void reset_timer_masked(void)
-{
-       struct mb86r0x_timer * timer = (struct mb86r0x_timer *)
-                                       MB86R0x_TIMER_BASE;
-
-       /* capture current value time */
-       lastdec = readl(&timer->value);
-       timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
 ulong get_timer_masked(void)
 {
        return tick_to_time(get_ticks());
@@ -119,11 +113,6 @@ void __udelay(unsigned long usec)
                 /*NOP*/;
 }
 
-void reset_timer(void)
-{
-       reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
        return get_timer_masked() - base;