From: Stefan Roese Date: Wed, 15 Jul 2015 13:36:52 +0000 (+0200) Subject: arm: mvebu: Call timer_init early before PHY and DDR init X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=ade741b3896b1a3872ff74437f04b50762d05849;p=u-boot.git arm: mvebu: Call timer_init early before PHY and DDR init 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 Cc: Anton Schubert Cc: Luka Perkov --- diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 402e520ea9..ab045b01b7 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -28,6 +28,8 @@ void board_init_f(ulong dummy) preloader_console_init(); + timer_init(); + /* First init the serdes PHY's */ serdes_phy_config(); diff --git a/arch/arm/mach-mvebu/timer.c b/arch/arm/mach-mvebu/timer.c index 40c4bc2da1..c516c419ed 100644 --- a/arch/arm/mach-mvebu/timer.c +++ b/arch/arm/mach-mvebu/timer.c @@ -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));