Without calling timer_init(), the xdelay() functions return immediately.
We need to call timer_init() early, so that these functions work and
the PHY and DDR init code works correctly.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Anton Schubert <anton.schubert@gmx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
 
        preloader_console_init();
 
+       timer_init();
+
        /* First init the serdes PHY's */
        serdes_phy_config();
 
 
 #define timestamp                      gd->arch.tbl
 #define lastdec                                gd->arch.lastinc
 
+static int init_done;
+
 /* Timer reload and current value registers */
 struct kwtmr_val {
        u32 reload;     /* Timer reload reg */
  */
 int timer_init(void)
 {
+       /* Only init the timer once */
+       if (init_done)
+               return 0;
+       init_done = 1;
+
        /* load value into timer */
        writel(TIMER_LOAD_VAL, CNTMR_RELOAD_REG(UBOOT_CNTR));
        writel(TIMER_LOAD_VAL, CNTMR_VAL_REG(UBOOT_CNTR));