]> git.sur5r.net Git - u-boot/commitdiff
arm: mvebu: Call timer_init early before PHY and DDR init
authorStefan Roese <sr@denx.de>
Wed, 15 Jul 2015 13:36:52 +0000 (15:36 +0200)
committerLuka Perkov <luka.perkov@sartura.hr>
Thu, 23 Jul 2015 06:30:58 +0000 (08:30 +0200)
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>
arch/arm/mach-mvebu/spl.c
arch/arm/mach-mvebu/timer.c

index 402e520ea996edf44d487b2c41a802af2482208b..ab045b01b7fcf1c05cbc98c8787eaad0a0352e32 100644 (file)
@@ -28,6 +28,8 @@ void board_init_f(ulong dummy)
 
        preloader_console_init();
 
+       timer_init();
+
        /* First init the serdes PHY's */
        serdes_phy_config();
 
index 40c4bc2da1b233732f69821dec23ccd90495bba9..c516c419edaf2cc75c5403939eb27fd9f8dd33b4 100644 (file)
@@ -41,6 +41,8 @@
 #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 */
@@ -112,6 +114,11 @@ void __udelay(unsigned long usec)
  */
 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));