Skip to contentSkip to conversation

arm: unify interrupt init

PATCH New Jean-Christophe PLAGNIOL-VILLARD 1 participant 4 messages Apr 30, 2009

lore
Share & tools
lore
#0 lore raw

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

---
 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(-)
cpu/arm1136/cpu.c +0 -11
index e03a765..f467b7a 100644
@@ -35,21 +35,10 @@
 #include <command.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm720t/cpu.c +0 -7
index 6c40903..7a2b9c3 100644
@@ -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;
 }
 
cpu/arm720t/interrupts.c +1 -1
index ff21314..91d552c 100644
@@ -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;
 
cpu/arm920t/cpu.c +0 -11
index 87c1adc..8c4b57f 100644
@@ -34,21 +34,10 @@
 #include <arm920t.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm925t/cpu.c +0 -11
index cf6a489..c8edadf 100644
@@ -34,21 +34,10 @@
 #include <arm925t.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm926ejs/cpu.c +0 -11
index 6307e33..75b62d3 100644
@@ -34,21 +34,10 @@
 #include <arm926ejs.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm946es/cpu.c +0 -11
index ef7995d..620f7ed 100644
@@ -34,21 +34,10 @@
 #include <arm946es.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm_cortexa8/cpu.c +0 -12
index 3e1780b..e911206 100644
@@ -36,10 +36,6 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/arm_intcm/cpu.c +0 -11
index 1636ffb..9ce17f2 100644
@@ -33,19 +33,8 @@
 #include <common.h>
 #include <command.h>
 
-#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;
 }
 
cpu/ixp/cpu.c +0 -12
index 42c62f6..5cfc39d 100644
@@ -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;
 }
 
cpu/ixp/interrupts.c +1 -1
index a05e439..06a826a 100644
@@ -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;
 
cpu/lh7a40x/cpu.c +0 -11
index 93ebd13..8e08773 100644
@@ -34,21 +34,10 @@
 #include <arm920t.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/pxa/cpu.c +0 -11
index 3a1be57..8edb44e 100644
@@ -35,21 +35,10 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/system.h>
 
-#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;
 }
 
cpu/sa1100/cpu.c +0 -7
index ed1a6f7..39285a0 100644
@@ -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;
 }
 
include/asm-arm/u-boot-arm.h +1 -0
index 238d408..76f1ffa 100644
@@ -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);
lib_arm/interrupts.c +13 -0
index 4dafbfa..d26b724 100644
@@ -39,6 +39,19 @@
 #include <asm/proc-armv/ptrace.h>
 
 #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)
 {
Signature · 1 line
1.6.2.1
#1 lore raw

PATCH 2/4 arm: remove cpu_init

move s3c44b0 to arch_cpu_init and as noone use cpu_init remove it

---
 cpu/arm1136/cpu.c      |    5 -----
 cpu/arm1176/cpu.c      |    5 -----
 cpu/arm720t/cpu.c      |    5 -----
 cpu/arm920t/cpu.c      |    5 -----
 cpu/arm925t/cpu.c      |    5 -----
 cpu/arm926ejs/cpu.c    |    5 -----
 cpu/arm946es/cpu.c     |    5 -----
 cpu/arm_cortexa8/cpu.c |    5 -----
 cpu/arm_intcm/cpu.c    |    5 -----
 cpu/ixp/cpu.c          |    5 -----
 cpu/lh7a40x/cpu.c      |    5 -----
 cpu/pxa/cpu.c          |    5 -----
 cpu/s3c44b0/cpu.c      |    2 +-
 cpu/sa1100/cpu.c       |    5 -----
 include/configs/B2.h   |    1 +
 lib_arm/board.c        |    1 -
 16 files changed, 2 insertions(+), 67 deletions(-)
cpu/arm1136/cpu.c +0 -5
index f467b7a..c2110c9 100644
@@ -37,11 +37,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm1176/cpu.c +0 -5
index bfa4378..bd1e4dd 100644
@@ -38,11 +38,6 @@
 
 static void cache_flush (void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm720t/cpu.c +0 -5
index 7a2b9c3..88c71bf 100644
@@ -40,11 +40,6 @@
 static void cache_flush(void);
 #endif
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm920t/cpu.c +0 -5
index 8c4b57f..5a3822b 100644
@@ -36,11 +36,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm925t/cpu.c +0 -5
index c8edadf..877d057 100644
@@ -36,11 +36,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm926ejs/cpu.c +0 -5
index 75b62d3..2670038 100644
@@ -36,11 +36,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm946es/cpu.c +0 -5
index 620f7ed..fcefa59 100644
@@ -36,11 +36,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/arm_cortexa8/cpu.c +0 -5
index e911206..9c2d5da 100644
@@ -42,11 +42,6 @@ void l2cache_disable(void);
 
 static void cache_flush(void);
 
-int cpu_init(void)
-{
-	return 0;
-}
-
 int cleanup_before_linux(void)
 {
 	unsigned int i;
cpu/arm_intcm/cpu.c +0 -5
index 9ce17f2..1310604 100644
@@ -33,11 +33,6 @@
 #include <common.h>
 #include <command.h>
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/ixp/cpu.c +0 -5
index 5cfc39d..ce275e5 100644
@@ -75,11 +75,6 @@ int print_cpuinfo (void)
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/lh7a40x/cpu.c +0 -5
index 8e08773..7af16b9 100644
@@ -36,11 +36,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/pxa/cpu.c +0 -5
index 8edb44e..800d120 100644
@@ -37,11 +37,6 @@
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
cpu/s3c44b0/cpu.c +1 -1
index 7ef4a1f..bca38f8 100644
@@ -32,7 +32,7 @@
 #include <command.h>
 #include <asm/hardware.h>
 
-int cpu_init (void)
+int arch_cpu_init (void)
 {
 	icache_enable();
 
cpu/sa1100/cpu.c +0 -5
index 39285a0..58e90dc 100644
@@ -40,11 +40,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void cache_flush(void);
 
-int cpu_init (void)
-{
-	return 0;
-}
-
 int cleanup_before_linux (void)
 {
 	/*
include/configs/B2.h +1 -0
index 35fad5c..e5439f3 100644
@@ -39,6 +39,7 @@
 #define CONFIG_ARM_THUMB	1	/* this is an ARM7TDMI */
 #undef  CONFIG_ARM7_REVD		/* disable ARM720 REV.D Workarounds */
 #define CONFIG_SYS_NO_CP15_CACHE
+#define CONFIG_ARCH_CPU_INIT
 
 #define CONFIG_S3C44B0_CLOCK_SPEED	75 /* we have a 75Mhz S3C44B0*/
 
lib_arm/board.c +0 -1
index a5fab9a..9fbb4bf 100644
@@ -265,7 +265,6 @@ typedef int (init_fnc_t) (void);
 int print_cpuinfo (void);
 
 init_fnc_t *init_sequence[] = {
-	cpu_init,		/* basic cpu dependent setup */
 #if defined(CONFIG_ARCH_CPU_INIT)
 	arch_cpu_init,		/* basic arch cpu dependent setup */
 #endif
Signature · 1 line
1.6.2.1
#2 lore raw

PATCH 3/4 s3c4510b: move interrupts code to soc

---
 cpu/arm720t/Makefile                  |    4 +-
 cpu/arm720t/s3c4510b/Makefile         |    1 +
 cpu/arm720t/s3c4510b/interrupts.c     |   85 +++++++++++++++++++++++++++++++++
 cpu/arm720t/{interrupts.c => timer.c} |   74 ++++-------------------------
 4 files changed, 98 insertions(+), 66 deletions(-)
 create mode 100644 cpu/arm720t/s3c4510b/interrupts.c
 rename cpu/arm720t/{interrupts.c => timer.c} (78%)
cpu/arm720t/Makefile +3 -1
index d5ac7d3..3e9b45a 100644
@@ -26,7 +26,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).a
 
 START	= start.o
-COBJS	= interrupts.o cpu.o
+
+COBJS	+= cpu.o
+COBJS	+= timer.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
cpu/arm720t/s3c4510b/Makefile +1 -0
index c099036..91e27fd 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(SOC).a
 
 COBJS-y	+= cache.o
+COBJS-y	+= interrupts.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
cpu/arm720t/s3c4510b/interrupts.c new file +85 -0

85 lines not on this page · raw message

cpu/arm720t/timer.c renamed from cpu/arm720t/interrupts.c +9 -65

106 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#3 lore raw

PATCH 4/4 lpc2292: move interrupts code to soc

---
 cpu/arm720t/lpc2292/Makefile     |   15 +++++++++----
 cpu/arm720t/lpc2292/interrupts.c |   41 ++++++++++++++++++++++++++++++++++++++
 cpu/arm720t/timer.c              |   12 -----------
 3 files changed, 51 insertions(+), 17 deletions(-)
 create mode 100644 cpu/arm720t/lpc2292/interrupts.c
cpu/arm720t/lpc2292/Makefile +10 -5
index 240f1e3..296f53f 100644
@@ -25,16 +25,21 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).a
 
-COBJS	= flash.o mmc.o mmc_hw.o spi.o
 SOBJS	= $(obj)iap_entry.o
 
-SRCS	:= $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+COBJS-y	+= flash.o
+COBJS-$(CONFIG_USE_IRQ)	+= interrupts.o
+COBJS-y	+= mmc.o
+COBJS-y	+= mmc_hw.o spi.o
+COBJS-y	+= spi.o
+
+SRCS	:= $(COBJS-y:.o=.c)
+COBJS	:= $(addprefix $(obj),$(COBJS-y))
 
 all:	$(obj).depend $(LIB)
 
-$(LIB):	$(OBJS) $(SOBJS)
-	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+$(LIB):	$(COBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(COBJS) $(SOBJS)
 
 # this MUST be compiled as thumb code!
 $(SOBJS):
cpu/arm720t/lpc2292/interrupts.c new file +41 -0

41 lines not on this page · raw message

cpu/arm720t/timer.c +0 -12
index 98588af..5352c79 100644
@@ -28,7 +28,6 @@
 
 #include <common.h>
 #include <clps7111.h>
-#include <asm/proc-armv/ptrace.h>
 #include <asm/hardware.h>
 
 #ifndef CONFIG_NETARM
@@ -50,17 +49,6 @@
 #define READ_TIMER (TM2STAT & NETARM_GEN_TSTAT_CTC_MASK)
 #endif
 
-#if defined(CONFIG_USE_IRQ) && defined(CONFIG_LPC2292)
-void do_irq (struct pt_regs *pt_regs)
-{
-    void (*pfnct)(void);
-
-    pfnct = (void (*)(void))VICVectAddr;
-
-    (*pfnct)();
-}
-#endif
-
 #if defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
 	/* Use IntegratorAP routines in board/integratorap.c */
 #else
Signature · 1 line
1.6.2.1