[U-Boot] [PATCH 2/8] microblaze: Move timer initialization to board.c

monstr at monstr.eu monstr at monstr.eu
Fri Apr 16 12:08:58 CEST 2010


From: Michal Simek <monstr at monstr.eu>

I would like to handle case where system doesn't contain
intc that's why I need timer initialization out of intc code.

Signed-off-by: Michal Simek <monstr at monstr.eu>
---
 arch/microblaze/cpu/interrupts.c |    6 ------
 arch/microblaze/cpu/timer.c      |    3 ++-
 arch/microblaze/lib/board.c      |    7 +++++++
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index a6021c9..b8db68a 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -46,9 +46,6 @@ int disable_interrupts (void)
 }
 
 #ifdef CONFIG_SYS_INTC_0
-#ifdef CONFIG_SYS_TIMER_0
-extern void timer_init (void);
-#endif
 #ifdef CONFIG_SYS_FSL_2
 extern void fsl_init2 (void);
 #endif
@@ -142,9 +139,6 @@ int interrupts_init (void)
 	}
 	/* initialize intc controller */
 	intc_init ();
-#ifdef CONFIG_SYS_TIMER_0
-	timer_init ();
-#endif
 #ifdef CONFIG_SYS_FSL_2
 	fsl_init2 ();
 #endif
diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index a91eabc..4936c62 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -60,7 +60,7 @@ void timer_isr (void *arg)
 	tmr->control = tmr->control | TIMER_INTERRUPT;
 }
 
-void timer_init (void)
+int timer_init (void)
 {
 	tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD;
 	tmr->control = TIMER_INTERRUPT | TIMER_RESET;
@@ -68,6 +68,7 @@ void timer_init (void)
 	    TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
 	reset_timer ();
 	install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr);
+	return 0;
 }
 #endif
 #endif
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index d4baea9..7dfa71c 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -44,6 +44,10 @@ extern int interrupts_init (void);
 #if defined(CONFIG_CMD_NET)
 extern int eth_init (bd_t * bis);
 #endif
+#ifdef CONFIG_SYS_TIMER_0
+extern int timer_init (void);
+#endif
+
 
 /*
  * All attempts to come up with a "common" initialization sequence
@@ -68,6 +72,9 @@ init_fnc_t *init_sequence[] = {
 #ifdef CONFIG_SYS_INTC_0
 	interrupts_init,
 #endif
+#ifdef CONFIG_SYS_TIMER_0
+	timer_init,
+#endif
 	NULL,
 };
 
-- 
1.5.5.1



More information about the U-Boot mailing list