From b54384e3ba6b5535751f317fcd3940a53eed0d3a Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 15 May 2009 23:47:02 +0200 Subject: arm: timer and interrupt init rework actually the timer init use the interrupt_init as init callback which make the interrupt and timer implementation difficult to follow so now rename it as int timer_init(void) and use interrupt_init for interrupt btw also remane the corresponding file to the functionnality implemented as ixp arch implement two timer - one based on interrupt - so all the timer related code is moved to timer.c Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- cpu/arm720t/interrupts.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'cpu/arm720t/interrupts.c') diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c index 39ed345bb..ff21314d8 100644 --- a/cpu/arm720t/interrupts.c +++ b/cpu/arm720t/interrupts.c @@ -110,9 +110,34 @@ static void timer_isr( void *data) { static ulong timestamp; static ulong lastdec; +#if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C4510B) int interrupt_init (void) { + int i; + + /* install default interrupt handlers */ + for ( i = 0; i < N_IRQS; i++) { + IRQ_HANDLER[i].m_data = (void *)i; + IRQ_HANDLER[i].m_func = default_isr; + } + + /* configure interrupts for IRQ mode */ + PUT_REG( REG_INTMODE, 0x0); + /* clear any pending interrupts */ + PUT_REG( REG_INTPEND, 0x1FFFFF); + + lastdec = 0; + + /* install interrupt handler for timer */ + IRQ_HANDLER[INT_TIMER0].m_data = (void *)×tamp; + IRQ_HANDLER[INT_TIMER0].m_func = timer_isr; + + return 0; +} +#endif +int timer_init (void) +{ #if defined(CONFIG_NETARM) /* disable all interrupts */ IRQEN = 0; @@ -137,25 +162,6 @@ int interrupt_init (void) /* set timer 1 counter */ lastdec = IO_TC1D = TIMER_LOAD_VAL; #elif defined(CONFIG_S3C4510B) - int i; - - /* install default interrupt handlers */ - for ( i = 0; i < N_IRQS; i++) { - IRQ_HANDLER[i].m_data = (void *)i; - IRQ_HANDLER[i].m_func = default_isr; - } - - /* configure interrupts for IRQ mode */ - PUT_REG( REG_INTMODE, 0x0); - /* clear any pending interrupts */ - PUT_REG( REG_INTPEND, 0x1FFFFF); - - lastdec = 0; - - /* install interrupt handler for timer */ - IRQ_HANDLER[INT_TIMER0].m_data = (void *)×tamp; - IRQ_HANDLER[INT_TIMER0].m_func = timer_isr; - /* configure free running timer 0 */ PUT_REG( REG_TMOD, 0x0); /* Stop timer 0 */ @@ -187,7 +193,7 @@ int interrupt_init (void) PUT32(T0TCR, 1); /* enable timer0 */ #else -#error No interrupt_init() defined for this CPU type +#error No timer_init() defined for this CPU type #endif timestamp = 0; -- cgit v1.2.3 From c358d9c3f16571e8f825e81b75eaf32e228cb669 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 9 May 2009 13:21:18 +0200 Subject: arm: unify interrupt init all arm init the IRQ stack the same way so unify it in lib_arm/interrupts.c and then call arch specific interrupt init Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- cpu/arm1136/cpu.c | 11 ----------- cpu/arm720t/cpu.c | 7 ------- cpu/arm720t/interrupts.c | 2 +- cpu/arm920t/cpu.c | 11 ----------- cpu/arm925t/cpu.c | 11 ----------- cpu/arm926ejs/cpu.c | 11 ----------- cpu/arm946es/cpu.c | 11 ----------- cpu/arm_cortexa8/cpu.c | 12 ------------ cpu/arm_intcm/cpu.c | 11 ----------- cpu/ixp/cpu.c | 12 ------------ cpu/ixp/interrupts.c | 2 +- cpu/lh7a40x/cpu.c | 11 ----------- cpu/pxa/cpu.c | 11 ----------- cpu/sa1100/cpu.c | 7 ------- include/asm-arm/u-boot-arm.h | 1 + lib_arm/interrupts.c | 13 +++++++++++++ 16 files changed, 16 insertions(+), 128 deletions(-) (limited to 'cpu/arm720t/interrupts.c') diff --git a/cpu/arm1136/cpu.c b/cpu/arm1136/cpu.c index 7381da092..6104f9e38 100644 --- a/cpu/arm1136/cpu.c +++ b/cpu/arm1136/cpu.c @@ -35,21 +35,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c index 6c40903b7..7a2b9c37b 100644 --- a/cpu/arm720t/cpu.c +++ b/cpu/arm720t/cpu.c @@ -42,13 +42,6 @@ static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c index ff21314d8..91d552cd2 100644 --- a/cpu/arm720t/interrupts.c +++ b/cpu/arm720t/interrupts.c @@ -111,7 +111,7 @@ static ulong timestamp; static ulong lastdec; #if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C4510B) -int interrupt_init (void) +int arch_interrupt_init (void) { int i; diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c index b6ef6bb8f..e4a8adb2d 100644 --- a/cpu/arm920t/cpu.c +++ b/cpu/arm920t/cpu.c @@ -33,21 +33,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm925t/cpu.c b/cpu/arm925t/cpu.c index 62828b174..e48f34151 100644 --- a/cpu/arm925t/cpu.c +++ b/cpu/arm925t/cpu.c @@ -34,21 +34,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c index 1f70a3603..0a3267385 100644 --- a/cpu/arm926ejs/cpu.c +++ b/cpu/arm926ejs/cpu.c @@ -33,21 +33,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm946es/cpu.c b/cpu/arm946es/cpu.c index d3195f9a2..e0f91d36c 100644 --- a/cpu/arm946es/cpu.c +++ b/cpu/arm946es/cpu.c @@ -33,21 +33,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm_cortexa8/cpu.c b/cpu/arm_cortexa8/cpu.c index ca6bf4f23..b91cc4f3b 100644 --- a/cpu/arm_cortexa8/cpu.c +++ b/cpu/arm_cortexa8/cpu.c @@ -36,10 +36,6 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - #ifndef CONFIG_L2_OFF void l2cache_disable(void); #endif @@ -48,14 +44,6 @@ static void cache_flush(void); int cpu_init(void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = - _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/arm_intcm/cpu.c b/cpu/arm_intcm/cpu.c index b137f7664..488bd0c5a 100644 --- a/cpu/arm_intcm/cpu.c +++ b/cpu/arm_intcm/cpu.c @@ -33,19 +33,8 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/ixp/cpu.c b/cpu/ixp/cpu.c index 42c62f6e3..5cfc39daf 100644 --- a/cpu/ixp/cpu.c +++ b/cpu/ixp/cpu.c @@ -38,10 +38,6 @@ ulong loops_per_jiffy; -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); #if defined(CONFIG_DISPLAY_CPUINFO) @@ -81,14 +77,6 @@ int print_cpuinfo (void) int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif - return 0; } diff --git a/cpu/ixp/interrupts.c b/cpu/ixp/interrupts.c index a05e439fd..06a826af6 100644 --- a/cpu/ixp/interrupts.c +++ b/cpu/ixp/interrupts.c @@ -67,7 +67,7 @@ void irq_install_handler (int irq, interrupt_handler_t handle_irq, void *data) IRQ_HANDLER[irq].m_func = handle_irq; } -int interrupt_init (void) +int arch_interrupt_init (void) { int i; diff --git a/cpu/lh7a40x/cpu.c b/cpu/lh7a40x/cpu.c index be92f708b..3cf0824c4 100644 --- a/cpu/lh7a40x/cpu.c +++ b/cpu/lh7a40x/cpu.c @@ -33,21 +33,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c index 3a1be57f4..8edb44eb4 100644 --- a/cpu/pxa/cpu.c +++ b/cpu/pxa/cpu.c @@ -35,21 +35,10 @@ #include #include -#ifdef CONFIG_USE_IRQ -DECLARE_GLOBAL_DATA_PTR; -#endif - static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c index ed1a6f7cd..39285a0cc 100644 --- a/cpu/sa1100/cpu.c +++ b/cpu/sa1100/cpu.c @@ -42,13 +42,6 @@ static void cache_flush(void); int cpu_init (void) { - /* - * setup up stacks if necessary - */ -#ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; - FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; -#endif return 0; } diff --git a/include/asm-arm/u-boot-arm.h b/include/asm-arm/u-boot-arm.h index 238d40854..76f1ffa5a 100644 --- a/include/asm-arm/u-boot-arm.h +++ b/include/asm-arm/u-boot-arm.h @@ -58,6 +58,7 @@ void setup_revision_tag (struct tag **params); int setenv (char *, char *); /* cpu/.../interrupt.c */ +int arch_interrupt_init (void); void reset_timer_masked (void); ulong get_timer_masked (void); void udelay_masked (unsigned long usec); diff --git a/lib_arm/interrupts.c b/lib_arm/interrupts.c index 8bb950b12..1f2b81561 100644 --- a/lib_arm/interrupts.c +++ b/lib_arm/interrupts.c @@ -39,6 +39,19 @@ #include #ifdef CONFIG_USE_IRQ +DECLARE_GLOBAL_DATA_PTR; + +int interrupt_init (void) +{ + /* + * setup up stacks if necessary + */ + IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; + + return arch_interrupt_init(); +} + /* enable IRQ interrupts */ void enable_interrupts (void) { -- cgit v1.2.3