Skip to contentSkip to conversation

arm: mvebu: Call timer_init early before PHY and DDR init

PATCH New Stefan Roese 2 participants 2 messages Jul 15, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Anton Schubert <[email protected]>
Cc Luka Perkov <[email protected]>
---
 arch/arm/mach-mvebu/spl.c   | 2 ++
 arch/arm/mach-mvebu/timer.c | 7 +++++++
 2 files changed, 9 insertions(+)
arch/arm/mach-mvebu/spl.c +2 -0
index 2df25aa..e65f6ca 100644
@@ -35,6 +35,8 @@ void board_init_f(ulong dummy)
 
 	preloader_console_init();
 
+	timer_init();
+
 	/* First init the serdes PHY's */
 	serdes_phy_config();
 
arch/arm/mach-mvebu/timer.c +7 -0
index 40c4bc2..c516c41 100644
@@ -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));
Signature · 1 line
2.4.5