arm: timer and interrupt init rework
PATCH v3 1/1 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
---
v3 do not move the board_init after the time
board/armltd/integratorap/integratorap.c | 2 +-
board/armltd/integratorcp/integratorcp.c | 2 +-
board/atmel/at91cap9adk/at91cap9adk.c | 1 -
board/davinci/common/misc.h | 1 -
board/m501sk/m501sk.c | 2 +-
board/netstar/netstar.c | 2 +-
board/voiceblue/voiceblue.c | 2 +-
cpu/arm1136/mx31/Makefile | 3 +-
cpu/arm1136/mx31/{interrupts.c => timer.c} | 3 +-
cpu/arm1136/omap24xx/Makefile | 3 +-
cpu/arm1136/omap24xx/{interrupts.c => timer.c} | 3 +-
cpu/arm1176/s3c64xx/Makefile | 2 +-
cpu/arm1176/s3c64xx/{interrupts.c => timer.c} | 2 +-
cpu/arm720t/interrupts.c | 46 ++++++++++--------
cpu/arm920t/at91rm9200/Makefile | 2 +-
cpu/arm920t/at91rm9200/{interrupts.c => timer.c} | 2 +-
cpu/arm920t/imx/Makefile | 4 +-
cpu/arm920t/imx/{interrupts.c => timer.c} | 2 +-
cpu/arm920t/ks8695/Makefile | 3 +-
cpu/arm920t/ks8695/{interrupts.c => timer.c} | 12 ++---
cpu/arm920t/s3c24x0/Makefile | 5 ++-
cpu/arm920t/s3c24x0/{interrupts.c => timer.c} | 2 +-
cpu/arm925t/Makefile | 5 ++-
cpu/arm925t/{interrupts.c => timer.c} | 2 +-
cpu/arm926ejs/Makefile | 2 +-
cpu/arm926ejs/interrupts.c | 57 ----------------------
cpu/arm_cortexa8/omap3/Makefile | 2 +-
cpu/arm_cortexa8/omap3/{interrupts.c => timer.c} | 2 +-
cpu/ixp/Makefile | 6 +--
cpu/ixp/interrupts.c | 55 ++++-----------------
cpu/ixp/timer.c | 54 ++++++++++++++++++++
cpu/lh7a40x/Makefile | 2 +-
cpu/lh7a40x/{interrupts.c => timer.c} | 2 +-
cpu/pxa/Makefile | 8 +++-
cpu/pxa/{interrupts.c => timer.c} | 7 ++-
cpu/s3c44b0/Makefile | 5 ++-
cpu/s3c44b0/{interrupts.c => timer.c} | 2 +-
cpu/sa1100/Makefile | 4 +-
cpu/sa1100/{interrupts.c => timer.c} | 5 +-
include/asm-arm/u-boot-arm.h | 3 +
include/configs/ixdpg425.h | 1 +
include/configs/pdnb3.h | 1 +
lib_arm/board.c | 3 +
43 files changed, 161 insertions(+), 173 deletions(-)
rename cpu/arm1136/mx31/{interrupts.c => timer.c} (97%)
rename cpu/arm1136/omap24xx/{interrupts.c => timer.c} (97%)
rename cpu/arm1176/s3c64xx/{interrupts.c => timer.c} (99%)
rename cpu/arm920t/at91rm9200/{interrupts.c => timer.c} (99%)
rename cpu/arm920t/imx/{interrupts.c => timer.c} (99%)
rename cpu/arm920t/ks8695/{interrupts.c => timer.c} (93%)
rename cpu/arm920t/s3c24x0/{interrupts.c => timer.c} (99%)
rename cpu/arm925t/{interrupts.c => timer.c} (99%)
delete mode 100644 cpu/arm926ejs/interrupts.c
rename cpu/arm_cortexa8/omap3/{interrupts.c => timer.c} (99%)
rename cpu/lh7a40x/{interrupts.c => timer.c} (99%)
rename cpu/pxa/{interrupts.c => timer.c} (96%)
rename cpu/s3c44b0/{interrupts.c => timer.c} (98%)
rename cpu/sa1100/{interrupts.c => timer.c} (95%)board/armltd/integratorap/integratorap.c +1 -1
@@ -540,7 +540,7 @@ static ulong div_timer = 1; /* Divisor to convert timer reading* - the Integrator/AP timer issues an interrupt * each time it reaches zero */ -int interrupt_init (void ) +int timer_init (void ) {/* Load timer with initial value */ *(volatile ulong *)(CONFIG_SYS_TIMERBASE +0 ) =TIMER_LOAD_VAL ;
board/armltd/integratorcp/integratorcp.c +1 -1
@@ -163,7 +163,7 @@ static ulong timestamp; /* U-Boot ticks since startup *//* starts up a counter * - the Integrator/CP timer can be set up to issue an interrupt */ -int interrupt_init (void ) +int timer_init (void ) {/* Load timer with initial value */ *(volatile ulong *)(CONFIG_SYS_TIMERBASE +0 ) =TIMER_LOAD_VAL ;
board/atmel/at91cap9adk/at91cap9adk.c +0 -1
@@ -61,7 +61,6 @@ static void at91cap9_slowclock_hw_init(void)if (at91_sys_read (AT91_PMC_VER ) ==ARCH_ID_AT91CAP9_REVC ) {unsigned i, tmp =at91_sys_read (AT91_SCKCR );if ((tmp &AT91CAP9_SCKCR_OSCSEL ) ==AT91CAP9_SCKCR_OSCSEL_RC ) { -extern void timer_init (void );timer_init (); tmp |=AT91CAP9_SCKCR_OSC32EN ;at91_sys_write (AT91_SCKCR , tmp);
board/davinci/common/misc.h +0 -1
@@ -22,7 +22,6 @@#ifndef __MISC_H#define __MISC_H -extern void timer_init (void );extern int eth_hw_init (void );void dv_display_clk_infos (void );
board/m501sk/m501sk.c +1 -1
@@ -127,7 +127,7 @@ int board_init(void)m501sk_gpio_init ();/* Do interrupt init here, because flash needs timers */ -interrupt_init (); +timer_init ();flash_init ();return 0 ;
board/netstar/netstar.c +1 -1
@@ -48,7 +48,7 @@ int dram_init(void)/* Take the Ethernet controller out of reset and wait * for the EEPROM load to complete. */ *((volatile unsigned short *)GPIO_DATA_OUTPUT_REG ) |=0x80 ; -udelay (10 );/* doesn't work before interrupt_init call */ +udelay (10 );/* doesn't work before timer_init call */ *((volatile unsigned short *)GPIO_DATA_OUTPUT_REG ) &= ~0x80 ;udelay (500 );
board/voiceblue/voiceblue.c +1 -1
@@ -43,7 +43,7 @@ int dram_init(void)/* Take the Ethernet controller out of reset and wait * for the EEPROM load to complete. */ *((volatile unsigned short *)GPIO_DATA_OUTPUT_REG ) |=0x80 ; -udelay (10 );/* doesn't work before interrupt_init call */ +udelay (10 );/* doesn't work before timer_init call */ *((volatile unsigned short *)GPIO_DATA_OUTPUT_REG ) &= ~0x80 ;udelay (500 );
cpu/arm1136/mx31/Makefile +2 -1
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = interrupts.o generic.o +COBJS += generic.o +COBJS += timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm1136/mx31/timer.c renamed from cpu/arm1136/mx31/interrupts.c +1 -2
@@ -89,9 +89,8 @@ static inline unsigned long long us_to_tick(unsigned long long us) }#endif -/* nothing really to do with interrupts, just starts up a counter. */ /* The 32768Hz 32-bit timer overruns in 131072 seconds */ -int interrupt_init (void ) +int timer_init (void ) {int i;
cpu/arm1136/omap24xx/Makefile +2 -1
@@ -25,9 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = interrupts.o SOBJS = start.o +COBJS = timer.o + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm1136/omap24xx/timer.c renamed from cpu/arm1136/omap24xx/interrupts.c +1 -2
@@ -42,8 +42,7 @@static ulong timestamp;static ulong lastinc; -/* nothing really to do with interrupts, just starts up a counter. */ -int interrupt_init (void ) +int timer_init (void ) {int32_t val;
cpu/arm1176/s3c64xx/Makefile +1 -1
@@ -28,8 +28,8 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS-y = interrupts.o COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o +COBJS-y += timer.o OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
cpu/arm1176/s3c64xx/timer.c renamed from cpu/arm1176/s3c64xx/interrupts.c +1 -1
@@ -66,7 +66,7 @@ static unsigned long lastdec;/* Monotonic incrementing timer */ static unsigned long long timestamp; -int interrupt_init (void ) +int timer_init (void ) {s3c64xx_timers *const timers =s3c64xx_get_base_timers ();
cpu/arm720t/interrupts.c +26 -20
67 lines not on this page · raw message
cpu/arm920t/at91rm9200/Makefile +1 -1
@@ -31,10 +31,10 @@ COBJS += bcm5221.o COBJS += dm9161.o COBJS += ether.o COBJS += i2c.o -COBJS += interrupts.o COBJS += lxt972.o COBJS += reset.o COBJS += spi.o +COBJS += timer.o COBJS += usb.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
cpu/arm920t/at91rm9200/timer.c renamed from cpu/arm920t/at91rm9200/interrupts.c +1 -1
@@ -45,7 +45,7 @@ AT91PS_TC tmr;static ulong timestamp;static ulong lastinc; -int interrupt_init (void ) +int timer_init (void ) { tmr =AT91C_BASE_TC0 ;
cpu/arm920t/imx/Makefile +3 -1
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = generic.o interrupts.o speed.o +COBJS += generic.o +COBJS += speed.o +COBJS += timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm920t/imx/timer.c renamed from cpu/arm920t/imx/interrupts.c +1 -1
@@ -35,7 +35,7 @@#include <arm920t.h> #include <asm/arch/imx-regs.h> -int interrupt_init (void ) +int timer_init (void ) {int i;/* setup GP Timer 1 */
cpu/arm920t/ks8695/Makefile +2 -1
@@ -25,9 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = interrupts.o SOBJS = lowlevel_init.o +COBJS = timer.o + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm920t/ks8695/timer.c renamed from cpu/arm920t/ks8695/interrupts.c +4 -8
@@ -29,13 +29,13 @@#define ks8695_read (a) *((volatile ulong *) (KS8695_IO_BASE + (a)))#define ks8695_write (a,v) *((volatile ulong *) (KS8695_IO_BASE + (a))) = (v) -int timer_inited;ulong timer_ticks; -int interrupt_init (void ) +int timer_init (void ) { -/* nothing happens here - we don't setup any IRQs */ -return (0 ); +reset_timer (); + +return 0 ; }/*
@@ -53,7 +53,6 @@ void reset_timer_masked(void)ks8695_write (KS8695_TIMER1_PCOUNT ,TIMER_PULSE );ks8695_write (KS8695_TIMER_CTRL ,0x2 ); timer_ticks =0 ; - timer_inited++; }void reset_timer (void )
@@ -87,9 +86,6 @@ void udelay(ulong usec)ulong start =get_timer_masked ();ulong end; -if (!timer_inited) -reset_timer (); -/* Only 1ms resolution :-( */ end = usec /1000 ;while (get_timer (start) < end)
cpu/arm920t/s3c24x0/Makefile +4 -1
@@ -25,7 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = interrupts.o speed.o usb.o usb_ohci.o +COBJS += speed.o +COBJS += timer.o +COBJS += usb.o +COBJS += usb_ohci.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm920t/s3c24x0/timer.c renamed from cpu/arm920t/s3c24x0/interrupts.c +1 -1
@@ -52,7 +52,7 @@ static inline ulong READ_TIMER(void)static ulong timestamp;static ulong lastdec; -int interrupt_init (void ) +int timer_init (void ) {S3C24X0_TIMERS *const timers =S3C24X0_GetBase_TIMERS ();
cpu/arm925t/Makefile +4 -1
@@ -26,7 +26,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = interrupts.o cpu.o omap925.o + +COBJS += cpu.o +COBJS += omap925.o +COBJS += timer.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/arm925t/timer.c renamed from cpu/arm925t/interrupts.c +1 -1
@@ -47,7 +47,7 @@ static uint32_t timestamp;static uint32_t lastdec;/* nothing really to do with interrupts, just starts up a counter. */ -int interrupt_init (void ) +int timer_init (void ) {/* Start the decrementer ticking down from 0xffffffff */ __raw_writel (TIMER_LOAD_VAL ,CONFIG_SYS_TIMERBASE +LOAD_TIM );
cpu/arm926ejs/Makefile +1 -1
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = interrupts.o cpu.o +COBJS = cpu.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
cpu/arm926ejs/interrupts.c deleted +0 -57
57 lines not on this page · raw message
cpu/arm_cortexa8/omap3/Makefile +1 -1
@@ -32,7 +32,7 @@ COBJS += clock.o COBJS += mem.o COBJS += syslib.o COBJS += sys_info.o -COBJS += interrupts.o +COBJS += timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
cpu/arm_cortexa8/omap3/timer.c renamed from cpu/arm_cortexa8/omap3/interrupts.c +1 -1
@@ -50,7 +50,7 @@ static gptimer_t *timer_base = (gptimer_t *)CONFIG_SYS_TIMERBASE;#define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV))#define TIMER_LOAD_VAL 0xffffffff -int interrupt_init (void ) +int timer_init (void ) {/* start the counter ticking up, reload value on overflow */ writel (TIMER_LOAD_VAL , &timer_base->tldr);
cpu/ixp/Makefile +2 -4
@@ -26,12 +26,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o + COBJS-y += cpu.o -ifndef CONFIG_USE_IRQ +COBJS-$(CONFIG_USE_IRQ) += interrupts.o COBJS-y += timer.o -else -COBJS-y += interrupts.o -endif SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
cpu/ixp/interrupts.c +10 -45
88 lines not on this page · raw message
cpu/ixp/timer.c +54 -0
63 lines not on this page · raw message
cpu/lh7a40x/Makefile +1 -1
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = cpu.o speed.o interrupts.o serial.o +COBJS = cpu.o speed.o serial.o timer.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/lh7a40x/timer.c renamed from cpu/lh7a40x/interrupts.c +1 -1
@@ -47,7 +47,7 @@ static inline ulong READ_TIMER(void)static ulong timestamp;static ulong lastdec; -int interrupt_init (void ) +int timer_init (void ) {lh7a40x_timers_t * timers =LH7A40X_TIMERS_PTR ;lh7a40x_timer_t * timer = &timers->timer1;
cpu/pxa/Makefile +7 -1
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = serial.o interrupts.o cpu.o i2c.o pxafb.o usb.o + +COBJS += cpu.o +COBJS += i2c.o +COBJS += pxafb.o +COBJS += serial.o +COBJS += timer.o +COBJS += usb.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/pxa/timer.c renamed from cpu/pxa/interrupts.c +4 -3
@@ -56,10 +56,11 @@ static inline unsigned long long us_to_tick(unsigned long long us)return us; } -int interrupt_init (void ) +int timer_init (void ) { -/* nothing happens here - we don't setup any IRQs */ -return (0 ); +reset_timer (); + +return 0 ; }void reset_timer (void )
cpu/s3c44b0/Makefile +4 -1
@@ -26,7 +26,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = cache.o cpu.o interrupts.o + +COBJS += cache.o +COBJS += cpu.o +COBJS += timer.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/s3c44b0/timer.c renamed from cpu/s3c44b0/interrupts.c +1 -1
@@ -40,7 +40,7 @@static ulong timestamp;static ulong lastdec; -int interrupt_init (void ) +int timer_init (void ) {TCFG0 =0x000000E9 ;TCFG1 =0x00000004 ;
cpu/sa1100/Makefile +3 -1
@@ -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),$(SOBJS) $(COBJS))
cpu/sa1100/timer.c renamed from cpu/sa1100/interrupts.c +2 -3
@@ -29,10 +29,9 @@#include <common.h> #include <SA-1100.h> -int interrupt_init (void ) +int timer_init (void ) { -/* nothing happens here - we don't setup any IRQs */ -return (0 ); +return 0 ; }void reset_timer (void )
include/asm-arm/u-boot-arm.h +3 -0
@@ -62,4 +62,7 @@ void reset_timer_masked (void);ulong get_timer_masked (void );void udelay_masked (unsigned long usec); +/* cpu/.../timer.c */ +int timer_init (void ); +#endif /* _U_BOOT_ARM_H_ */
include/configs/ixdpg425.h +1 -0
@@ -55,6 +55,7 @@*/ #undef CONFIG_USE_IRQ/* we don't need IRQ/FIQ stuff */ #define CONFIG_USE_IRQ 1/* we need IRQ stuff for timer */ +#define CONFIG_TIMER_IRQ #define CONFIG_BOOTCOUNT_LIMIT /* support for bootcount limit */ #define CONFIG_SYS_BOOTCOUNT_ADDR 0x60003000/* inside qmrg sram */
include/configs/pdnb3.h +1 -0
@@ -51,6 +51,7 @@* Misc configuration options */ #define CONFIG_USE_IRQ 1/* we need IRQ stuff for timer */ +#define CONFIG_TIMER_IRQ #define CONFIG_BOOTCOUNT_LIMIT /* support for bootcount limit */ #define CONFIG_SYS_BOOTCOUNT_ADDR 0x60003000/* inside qmrg sram */
lib_arm/board.c +3 -0
@@ -266,7 +266,10 @@ init_fnc_t *init_sequence[] = { arch_cpu_init, /* basic arch cpu dependent setup */ #endif board_init, /* basic board dependent setup */ +#if defined(CONFIG_USE_IRQ) interrupt_init, /* set up exceptions */ +#endif + timer_init, /* initialize timer */ env_init, /* initialize environment */ init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */
Signature · 1 line
1.6.2.4
PATCH v3 1/1 arm: timer and interrupt init rework
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
actually the timer init use the
interrupt_initas init callback which make the interrupt and timer implementation difficult to followso now rename it as int
timer_init(void)and useinterrupt_initfor interruptbtw 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.cSigned-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
ARM Cortex-A8 part
...
Quoted 5 lines
lib_arm/board.c +0
-0
lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 10 lines
lib_arm/board.c +3
-0@@ -266,7 +266,10 @@ init_fnc_t *init_sequence[] = { arch_cpu_init, /* basic arch cpu dependent setup */ #endif board_init, /* basic board dependent setup */ +#if defined(CONFIG_USE_IRQ) interrupt_init, /* set up exceptions */ +#endif + timer_init, /* initialize timer */ env_init, /* initialize environment */ init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */
Btw.: Jean-Christophe: I'm happy that you removed the re-ordering of boot sequence for the moment as discussed in [1] :)
Best regards
Dirk
[1] http://lists.denx.de/pipermail/u-boot/2009-May/051949.html