Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx
[oweals/u-boot.git] / board / integratorcp / integratorcp.c
index 216876b469db2bc18dad073f52dd0f160279b182..220513f32947bfb492c2e8274b35d6d33242a52c 100644 (file)
@@ -34,6 +34,9 @@
  */
 
 #include <common.h>
+#include <div64.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 void flash__init (void);
 void ether__init (void);
@@ -54,8 +57,6 @@ void show_boot_progress(int progress)
 
 int board_init (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        /* arch number of Integrator Board */
        gd->bd->bi_arch_number = MACH_TYPE_CINTEGRATOR;
 
@@ -105,8 +106,6 @@ void ether__init (void)
 ******************************/
 int dram_init (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
        gd->bd->bi_dram[0].size  = PHYS_SDRAM_1_SIZE;
 
@@ -246,7 +245,11 @@ ulong get_timer_masked (void)
                total_count += lastdec - now;
        }
        lastdec   = now;
-       timestamp = (ulong)(total_count/div_timer);
+
+       /* Reuse "now" */
+       now = total_count;
+       do_div(now, div_timer);
+       timestamp = now;
 
        return timestamp;
 }