Skip to contentSkip to conversation

arm: rename timer init callback timer_init

PATCH New Jean-Christophe PLAGNIOL-VILLARD 4 participants 12 messages Apr 18, 2009 – May 6, 2009

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

PATCH 1/1 arm: rename timer init callback timer_init

---
 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                  |    8 +++-
 cpu/arm_cortexa8/omap3/{interrupts.c => timer.c} |    3 +-
 cpu/ixp/Makefile                                 |    6 +--
 cpu/ixp/interrupts.c                             |   55 ++++-----------------
 cpu/ixp/timer.c                                  |   54 ++++++++++++++++++++
 cpu/lh7a40x/interrupts.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                                  |    5 ++-
 42 files changed, 166 insertions(+), 175 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} (97%)
 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
index 9631967..5ececd6 100644
@@ -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
index 72629ce..0d3afd8 100644
@@ -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
index e8025e7..8f7fd28 100644
@@ -60,7 +60,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
index 4a57dbb..5d29784 100644
@@ -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 +0 -2
index dc5b786..d6881e9 100644
@@ -126,8 +126,6 @@ int board_init(void)
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 	m501sk_gpio_init();
 
-	/* Do interrupt init here, because flash needs timers */
-	interrupt_init();
 	flash_init();
 
 	return 0;
board/netstar/netstar.c +1 -1
index ee4f2cd..ffd60bf 100644
@@ -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
index c8dde36..59b3310 100644
@@ -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
index 0e06f0a..1e49e8d 100644
@@ -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
similarity index 97%
rename from cpu/arm1136/mx31/interrupts.c
rename to cpu/arm1136/mx31/timer.c
index ab7202f..29b484e 100644
@@ -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
index f9afed7..2a79d9b 100644
@@ -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
similarity index 97%
rename from cpu/arm1136/omap24xx/interrupts.c
rename to cpu/arm1136/omap24xx/timer.c
index 6be1262..aef0b13 100644
@@ -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
index fa4ee3f..4656d9a 100644
@@ -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
similarity index 99%
rename from cpu/arm1176/s3c64xx/interrupts.c
rename to cpu/arm1176/s3c64xx/timer.c
index 83f3806..e3de1dc 100644
@@ -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
index 161ca94..73aeeac 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/at91rm9200/interrupts.c
rename to cpu/arm920t/at91rm9200/timer.c
index 4c38a9a..235d107 100644
@@ -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
index d3352de..28945e2 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/imx/interrupts.c
rename to cpu/arm920t/imx/timer.c
index ddcfb34..09b4eaf 100644
@@ -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
index f6b0063..f53fdc2 100644
@@ -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
similarity index 93%
rename from cpu/arm920t/ks8695/interrupts.c
rename to cpu/arm920t/ks8695/timer.c
index 883d689..22987bc 100644
@@ -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
index 3afe19c..5d2be2c 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/s3c24x0/interrupts.c
rename to cpu/arm920t/s3c24x0/timer.c
index 11e6804..328c652 100644
@@ -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
index 0d4912c..8d0e88f 100644
@@ -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
similarity index 99%
rename from cpu/arm925t/interrupts.c
rename to cpu/arm925t/timer.c
index e5c77f7..9e45031 100644
@@ -43,7 +43,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
index d5ac7d3..7701b03 100644
@@ -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 +7 -1
index b96b3dd..edf5cb2 100644
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a
 
 SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.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 -2
similarity index 97%
rename from cpu/arm_cortexa8/omap3/interrupts.c
rename to cpu/arm_cortexa8/omap3/timer.c
index e0b3fbc..5d480b9 100644
@@ -41,8 +41,7 @@ static ulong timestamp;
 static ulong lastinc;
 static gptimer_t *timer_base = (gptimer_t *)CONFIG_SYS_TIMERBASE;
 
-/* nothing really to do with interrupts, just starts up a counter. */
-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
index a673cb1..1403c4f 100644
@@ -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/interrupts.c +1 -1
index 5acfe1a..91ca6a9 100644
@@ -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
index 42903b2..5dc3a52 100644
@@ -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
similarity index 96%
rename from cpu/pxa/interrupts.c
rename to cpu/pxa/timer.c
index 2bc5c50..e2df3a5 100644
@@ -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
index ae909a6..6da2016 100644
@@ -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
similarity index 98%
rename from cpu/s3c44b0/interrupts.c
rename to cpu/s3c44b0/timer.c
index eb23e6a..34184ab 100644
@@ -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
index fd696f7..28b6682 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),$(SOBJS) $(COBJS))
cpu/sa1100/timer.c renamed from cpu/sa1100/interrupts.c +2 -3
similarity index 95%
rename from cpu/sa1100/interrupts.c
rename to cpu/sa1100/timer.c
index 2eff045..3f77e81 100644
@@ -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
index 4ee5a32..32af927 100644
@@ -59,4 +59,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
index 75707e5..0c09234 100644
@@ -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
index edaa81b..1255f21 100644
@@ -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 +4 -1
index 3dfaec0..54a46ae 100644
@@ -262,8 +262,11 @@ int print_cpuinfo (void); /* test-only */
 
 init_fnc_t *init_sequence[] = {
 	cpu_init,		/* basic cpu dependent setup */
-	board_init,		/* basic board dependent setup */
+#if defined(CONFIG_USE_IRQ)
 	interrupt_init,		/* set up exceptions */
+#endif
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */
Signature · 1 line
1.6.2.1
#1 lore raw

PATCH 1/1 arm: rename timer init callback timer_init

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 1 line · In message <[email protected]> you wrote:

The Subject: indicates a mere formal change (a rename of a function name), but the patch actually does other things as well:

...

Quoted 86 lines
cpu/ixp/interrupts.c +9 -42
index ee0129e..a05e439 100644
@@ -33,14 +33,6 @@
 #include <asm/arch/ixp425.h>
 #include <asm/proc-armv/ptrace.h>
 
-/*
- * When interrupts are enabled, use timer 2 for time/delay generation...
- */
-
-#define FREQ		66666666
-#define CLOCK_TICK_RATE	(((FREQ / CONFIG_SYS_HZ & ~IXP425_OST_RELOAD_MASK) + 1) * CONFIG_SYS_HZ)
-#define LATCH		((CLOCK_TICK_RATE + CONFIG_SYS_HZ/2) / CONFIG_SYS_HZ)	/* For divider */
-
 struct _irq_handler {
 	void                *m_data;
 	void (*m_func)( void *data);
@@ -48,8 +40,6 @@ struct _irq_handler {
 
 static struct _irq_handler IRQ_HANDLER[N_IRQS];
 
-static volatile ulong timestamp;
-
 static void default_isr(void *data)
 {
 	printf("default_isr():  called for IRQ %d, Interrupt Status=%x PR=%x\n",
@@ -61,33 +51,20 @@ static int next_irq(void)
 	return (((*IXP425_ICIH & 0x000000fc) >> 2) - 1);
 }
 
-static void timer_isr(void *data)
-{
-	unsigned int *pTime = (unsigned int *)data;
-
-	(*pTime)++;
-
-	/*
-	 * Reset IRQ source
-	 */
-	*IXP425_OSST = IXP425_OSST_TIMER_2_PEND;
-}
-
-ulong get_timer (ulong base)
+void do_irq (struct pt_regs *pt_regs)
 {
-	return timestamp - base;
-}
+	int irq = next_irq();
 
-void reset_timer (void)
-{
-	timestamp = 0;
+	IRQ_HANDLER[irq].m_func(IRQ_HANDLER[irq].m_data);
 }
 
-void do_irq (struct pt_regs *pt_regs)
+void irq_install_handler (int irq, interrupt_handler_t handle_irq, void *data)
 {
-	int irq = next_irq();
+	if (irq >= N_IRQS || !handle_irq)
+		return;
 
-	IRQ_HANDLER[irq].m_func(IRQ_HANDLER[irq].m_data);
+	IRQ_HANDLER[irq].m_data = data;
+	IRQ_HANDLER[irq].m_func = handle_irq;
 }
 
 int interrupt_init (void)
@@ -95,23 +72,11 @@ 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;
-	}
-
-	/* install interrupt handler for timer */
-	IRQ_HANDLER[IXP425_TIMER_2_IRQ].m_data = (void *)&timestamp;
-	IRQ_HANDLER[IXP425_TIMER_2_IRQ].m_func = timer_isr;
-
-	/* setup the Timer counter value */
-	*IXP425_OSRT2 = (LATCH & ~IXP425_OST_RELOAD_MASK) | IXP425_OST_ENABLE;
+	for (i = 0; i < N_IRQS; i++)

cpu/ixp/interrupts.c int interrupt_init (void) · line 82

Quoted 10 lines
cpu/ixp/interrupts.c +1 -3
+		irq_install_handler(i, default_isr, (void *)i);
 
 	/* configure interrupts for IRQ mode */
 	*IXP425_ICLR = 0x00000000;
 
-	/* enable timer irq */
-	*IXP425_ICMR = (1 << IXP425_TIMER_2_IRQ);
-
 	return (0);
 }

This is far beyond a mere rename. from the patch it is not even easy to judge if the resulting code is equivalent or not.

I think the commit message should explain in more detail what exactly is being changed here, and why.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The one who says it cannot be done should never interrupt the one who
is doing it.
#2 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

In reply to Jean-Christophe PLAGNIOL-VILLARD

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

as some timer need interrupt and we need delay in the board init

the new init sequence is now
interrupt_init (if used)
timer_init
board_init

---
 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                  |    8 +++-
 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                                  |    5 ++-
 43 files changed, 167 insertions(+), 175 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
index 9631967..5ececd6 100644
@@ -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
index 72629ce..0d3afd8 100644
@@ -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
index f52edaa..9f73df6 100644
@@ -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
index 4a57dbb..5d29784 100644
@@ -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 +0 -2
index dc5b786..d6881e9 100644
@@ -126,8 +126,6 @@ int board_init(void)
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 	m501sk_gpio_init();
 
-	/* Do interrupt init here, because flash needs timers */
-	interrupt_init();
 	flash_init();
 
 	return 0;
board/netstar/netstar.c +1 -1
index ee4f2cd..ffd60bf 100644
@@ -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
index c8dde36..59b3310 100644
@@ -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
index 0e06f0a..1e49e8d 100644
@@ -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
similarity index 97%
rename from cpu/arm1136/mx31/interrupts.c
rename to cpu/arm1136/mx31/timer.c
index ab7202f..29b484e 100644
@@ -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
index f9afed7..2a79d9b 100644
@@ -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
similarity index 97%
rename from cpu/arm1136/omap24xx/interrupts.c
rename to cpu/arm1136/omap24xx/timer.c
index 6be1262..aef0b13 100644
@@ -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
index fa4ee3f..4656d9a 100644
@@ -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
similarity index 99%
rename from cpu/arm1176/s3c64xx/interrupts.c
rename to cpu/arm1176/s3c64xx/timer.c
index 83f3806..e3de1dc 100644
@@ -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
index 161ca94..73aeeac 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/at91rm9200/interrupts.c
rename to cpu/arm920t/at91rm9200/timer.c
index 4c38a9a..235d107 100644
@@ -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
index d3352de..28945e2 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/imx/interrupts.c
rename to cpu/arm920t/imx/timer.c
index ddcfb34..09b4eaf 100644
@@ -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
index f6b0063..f53fdc2 100644
@@ -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
similarity index 93%
rename from cpu/arm920t/ks8695/interrupts.c
rename to cpu/arm920t/ks8695/timer.c
index 883d689..22987bc 100644
@@ -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
index 3afe19c..5d2be2c 100644
@@ -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
similarity index 99%
rename from cpu/arm920t/s3c24x0/interrupts.c
rename to cpu/arm920t/s3c24x0/timer.c
index 11e6804..328c652 100644
@@ -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
index 0d4912c..8d0e88f 100644
@@ -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
similarity index 99%
rename from cpu/arm925t/interrupts.c
rename to cpu/arm925t/timer.c
index ec2a978..069f509 100644
@@ -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
index d5ac7d3..7701b03 100644
@@ -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 +7 -1
index b96b3dd..edf5cb2 100644
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a
 
 SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.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
similarity index 99%
rename from cpu/arm_cortexa8/omap3/interrupts.c
rename to cpu/arm_cortexa8/omap3/timer.c
index 9f1189f..e99b149 100644
@@ -178,7 +178,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
index a673cb1..1403c4f 100644
@@ -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
index bac2a64..b9ae76e 100644
@@ -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
similarity index 99%
rename from cpu/lh7a40x/interrupts.c
rename to cpu/lh7a40x/timer.c
index 5acfe1a..91ca6a9 100644
@@ -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
index 42903b2..5dc3a52 100644
@@ -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
similarity index 96%
rename from cpu/pxa/interrupts.c
rename to cpu/pxa/timer.c
index 2bc5c50..e2df3a5 100644
@@ -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
index ae909a6..6da2016 100644
@@ -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
similarity index 98%
rename from cpu/s3c44b0/interrupts.c
rename to cpu/s3c44b0/timer.c
index eb23e6a..34184ab 100644
@@ -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
index fd696f7..28b6682 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),$(SOBJS) $(COBJS))
cpu/sa1100/timer.c renamed from cpu/sa1100/interrupts.c +2 -3
similarity index 95%
rename from cpu/sa1100/interrupts.c
rename to cpu/sa1100/timer.c
index 2eff045..3f77e81 100644
@@ -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
index e7d58fe..238d408 100644
@@ -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
index 75707e5..0c09234 100644
@@ -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
index edaa81b..1255f21 100644
@@ -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 +4 -1
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	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 */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */
Signature · 1 line
1.6.2.1
#3 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Dear Jean-Christophe,

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD

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

as some timer need interrupt and we need delay in the board init

the new init sequence is now
interrupt_init (if used)
timer_init
board_init

...

Quoted 6 lines
cpu/arm_cortexa8/omap3/Makefile +0 -0
index b96b3dd..edf5cb2 100644
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 35

Quoted 10 lines
cpu/arm_cortexa8/omap3/Makefile +7 -1
 
 SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

Why is this related to a patch named "timer and interrupt init rework"?

Maybe I'm wrong, but it's my feeling that you would reject something like this with e.g. "NACK, don't mix different clean up in one patch. Please split into several patches"? ;)

cpu/arm_cortexa8/omap3/timer.c

Quoted 4 lines
cpu/arm_cortexa8/omap3/timer.c renamed from cpu/arm_cortexa8/omap3/interrupts.c +0 -0
similarity index 99%
rename from cpu/arm_cortexa8/omap3/interrupts.c
rename to cpu/arm_cortexa8/omap3/timer.c

I have to look into the details, but if I remember correctly, this file contains interrupt _and_ timer code? So that each name isn't totally correct, why touching it?

cpu/arm_cortexa8/omap3/timer.c static gptimer_t *timer_base = (gptimer_t *)CONFIG_SYS_TIMERBASE; · line 184

Quoted 12 lines

index 9f1189f..e99b149 100644

cpu/arm_cortexa8/omap3/timer.c renamed from cpu/arm_cortexa8/omap3/interrupts.c +1 -1
@@ -178,7 +178,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);

This is ok...

Quoted 7 lines
lib_arm/board.c +0 -0
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	arch_cpu_init,		/* basic arch cpu dependent setup */

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 10 lines
lib_arm/board.c +4 -1
 #endif
-	board_init,		/* basic board dependent setup */
+#if defined(CONFIG_USE_IRQ)
 	interrupt_init,		/* set up exceptions */
+#endif
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

Old order: board_init -> interrupt_init (including timer_init)

New order: timer_init -> board_init

Is this correct? If yes, we have to check that there are no issues with dependencies?

On which OMAP3 board have you tested this?

Best regards

Dirk

#4 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Dear Dirk,

Quoted 18 lines · In message <[email protected]> you wrote:
Quoted 5 lines
cpu/arm_cortexa8/omap3/Makefile +0 -0
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 35

Quoted 10 lines
cpu/arm_cortexa8/omap3/Makefile +7 -1
 
 SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

Quoted 5 lines

Why is this related to a patch named "timer and interrupt init rework"?

Maybe I'm wrong, but it's my feeling that you would reject something like this with e.g. "NACK, don't mix different clean up in one patch. Please split into several patches"? ;)

Indeed. The patch needs to be split.

Quoted 21 lines
Quoted 7 lines
lib_arm/board.c +0 -0
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	arch_cpu_init,		/* basic arch cpu dependent setup */

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 10 lines
lib_arm/board.c +4 -1
 #endif
-	board_init,		/* basic board dependent setup */
+#if defined(CONFIG_USE_IRQ)
 	interrupt_init,		/* set up exceptions */
+#endif
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

Quoted 3 lines

Old order: board_init -> interrupt_init (including timer_init)

New order: timer_init -> board_init

Well spotted.

Jean-Christophe - what is your rationale for this change?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How many NASA managers does it take to screw in a lightbulb?  "That's
a known problem... don't worry about it."
#5 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

In reply to Dirk Behme
Quoted 31 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD

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

as some timer need interrupt and we need delay in the board init

the new init sequence is now
interrupt_init (if used)
timer_init
board_init

...

Quoted 9 lines
cpu/arm_cortexa8/omap3/Makefile +1 -1
index b96b3dd..edf5cb2 100644
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a
  SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
Quoted 8 lines

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 35

Quoted 6 lines
cpu/arm_cortexa8/omap3/Makefile +6 -0
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

simple to allow vertical patch to be applied instead of have merge problem

so yes it's needed

Quoted 12 lines
Quoted 12 lines
lib_arm/board.c +2 -1
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	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
Quoted 8 lines

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 5 lines
lib_arm/board.c +2 -0
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

maybe read the commit message will answer your question

Best Regards,
J.

#6 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Dear Jean-Christophe,

Quoted 39 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 22 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD

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

as some timer need interrupt and we need delay in the board init

the new init sequence is now
interrupt_init (if used)
timer_init
board_init

...

Quoted 16 lines
Quoted 5 lines
cpu/arm_cortexa8/omap3/Makefile +0 -0
index b96b3dd..edf5cb2 100644

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 34

Quoted 10 lines
cpu/arm_cortexa8/omap3/Makefile +7 -1
@@ -26,7 +26,13 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).a
  SOBJS	:= lowlevel_init.o
-COBJS	:= sys_info.o board.o clock.o interrupts.o mem.o syslib.o
+
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

Quoted 3 lines

simple to allow vertical patch to be applied instead of have merge problem

so yes it's needed

Please elaborate more:

What is "vertical patch"?

Why to "to be applied"? I can't find any note in this patch that mentions a dependency to any other patch.

Which "merge problem" do you expect?

So for what "it's needed"?

Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
lib_arm/board.c +1 -1
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	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 */
Quoted 8 lines

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 6 lines
lib_arm/board.c +3 -0
+#endif
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

Quoted 1 line

maybe read the commit message will answer your question

I understand this as confirmation that the initialization order changes by this patch.

Please answer the additional questions in

http://lists.denx.de/pipermail/u-boot/2009-May/051925.html

http://lists.denx.de/pipermail/u-boot/2009-May/051928.html

then.

Dirk

#7 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 9 lines

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 35

Quoted 7 lines
cpu/arm_cortexa8/omap3/Makefile +6 -0
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

Quoted 3 lines

simple to allow vertical patch to be applied instead of have merge problem

so yes it's needed

But it must go in a separate patch.

Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
lib_arm/board.c +2 -1
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	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
Quoted 8 lines

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 5 lines
lib_arm/board.c +2 -0
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

Quoted 1 line

maybe read the commit message will answer your question

Argh. Instead of snippy remarks you should read Dirks message yourself and answer his (very valid) questions:

| Is this correct? If yes, we have to check that there are no issues 
| with dependencies?
| 
| On which OMAP3 board have you tested this?

Can you please explain on which boards this has actually been tested, and especially on which OMAP3 boards?

Also, I do not see why we need to implement such a critical change.

If I understand you corrctly, your argument goes that board_init() needs delays (like udelay()), delays need timers, and timers need interrupts, so we must initialize first interrupts, then timers, and only then we can run board_init()? Is this your argument?

But the I ask why udelay() would need timers and interrupts? This does not fit into the design philosophy of U-Boot, which attempts to bring up a board at least to a state where we have serial console output with as little as possible requirements. Your change breaks this, because now we have to initialize timers and interrupts (which are not exactly a trivial thing to set up or debug if they aren't working correctly) BEFORE we have a console output. [I ignore the case of CONFIG_USE_IRQ here, because only 4 boards actually use this feature, and they could probably be changed to do without, too.]

So while I really appreciate your attempts to clean up the timer code on ARM, the resulting consequences are expensive, and I am not yet convincet the advantages of the new code are bigger than this disadvantage, and especially I am not convinced thatthis is really necessary and unavoidable.

Can we not do delays without interrupts? And do we need full-blown timer services for delays? [Keep in mind that a delay is usually used to implement a timeout in the error branch; that means, it does not matter if it has not 10e-6 precision or better.]

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Thought for the day: What if there were no hypothetical situations?
#8 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Quoted 6 lines

Also, I do not see why we need to implement such a critical change.

If I understand you corrctly, your argument goes that board_init() needs delays (like udelay()), delays need timers, and timers need interrupts, so we must initialize first interrupts, then timers, and only then we can run board_init()? Is this your argument?

First it you wish to do delay before the timer is ready you will have to do loop delay which is cpu speed dependent so the code is not maintainable at the end

Quoted 8 lines

But the I ask why udelay() would need timers and interrupts? This does not fit into the design philosophy of U-Boot, which attempts to bring up a board at least to a state where we have serial console output with as little as possible requirements. Your change breaks this, because now we have to initialize timers and interrupts (which are not exactly a trivial thing to set up or debug if they aren't working correctly) BEFORE we have a console output.

On ARM we have two kind of "serial" port the physical one which need init to be used before and the DCC which can be used at the start of the CPU. So to debug the timer and earlier init you can use this one.

My changes does not break it as precedently the timer was init by interrupts_init
the only change is that the board_init will be done after the timer

Quoted 3 lines

[I ignore the
case of CONFIG_USE_IRQ here, because only 4 boards actually use this feature, and they could probably be changed to do without, too.]

IIRC as least the S3C must use interrupt for the timer

Quoted 6 lines

So while I really appreciate your attempts to clean up the timer code on ARM, the resulting consequences are expensive, and I am not yet convincet the advantages of the new code are bigger than this disadvantage, and especially I am not convinced thatthis is really necessary and unavoidable.

boards actually init the timer themself in thee board_init to have a correct delay

Quoted 2 lines

Can we not do delays without interrupts?

no not on all soc

Quoted 1 line

And do we need full-blown timer services for delays?

Yes as we need to init the timer which is in nearly all case soc dependent

Quoted 3 lines

[Keep in mind that a delay is usually used
to implement a timeout in the error branch; that means, it does not matter if it has not 10e-6 precision or better.]

not only
it's use for slow clock, for chip reset timing etc...
but the precision is just that if you need to wait 10us you will not wait less and if you want to wait 100ms you will not have to wait 1s
an other example for spi transfer you will have to use some delay more you timer is precise more you transfert will be work at higher rate it's the same for nand etc...

Best Regards,
J.

#9 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

If I understand you corrctly, your argument goes that board_init() needs delays (like udelay()), delays need timers, and timers need interrupts, so we must initialize first interrupts, then timers, and only then we can run board_init()? Is this your argument?

First it you wish to do delay before the timer is ready you will have to do loop delay which is cpu speed dependent so the code is not maintainable at the end

I disagree. See for example the PowerPC code, where we can use the always-present Time Base Register to provide reliable delays without using counted loops. I think similar features are available on other processors as well. And even if we have to initialize some general purpose hardware timer, that does not mean that we have to initialize full time services or even interrupts.

Quoted 10 lines
Quoted 7 lines

But the I ask why udelay() would need timers and interrupts? This does not fit into the design philosophy of U-Boot, which attempts to bring up a board at least to a state where we have serial console output with as little as possible requirements. Your change breaks this, because now we have to initialize timers and interrupts (which are not exactly a trivial thing to set up or debug if they aren't working correctly) BEFORE we have a console output.

On ARM we have two kind of "serial" port the physical one which need init to be used before and the DCC which can be used at the start of the CPU. So to debug the timer and earlier init you can use this one.

I'm referring to the standard serial port only.

But your argument was that board_init() would need delays (like udelay()) which would not work without timers and interrupts.

Quoted 3 lines

My changes does not break it as precedently the timer was init by interrupts_init
the only change is that the board_init will be done after the timer

Yes, and I don't want to change this without real need. And I do not see any such need yet - the existing code is working, isn't it?

Quoted 4 lines
Quoted 3 lines

[I ignore the
case of CONFIG_USE_IRQ here, because only 4 boards actually use this feature, and they could probably be changed to do without, too.]

IIRC as least the S3C must use interrupt for the timer

Maybe. But as mentioned before - full-fledged timer services and simple delays are two different things.

Quoted 7 lines
Quoted 5 lines

So while I really appreciate your attempts to clean up the timer code on ARM, the resulting consequences are expensive, and I am not yet convincet the advantages of the new code are bigger than this disadvantage, and especially I am not convinced thatthis is really necessary and unavoidable.

boards actually init the timer themself in thee board_init to have a correct delay

Hm... you said "as least the S3C must use interrupt for the timer" - but as fas as I can see there is no timer init code anywhere in the board specific code for smdk2400, smdk2410, or smdk6400.

Even for AT91 it is only done for a single board:

-> g timer board/atmel/*/*
board/atmel/at91cap9adk/at91cap9adk.c: extern void timer_init(void);
board/atmel/at91cap9adk/at91cap9adk.c: timer_init();

board/atmel/at91rm9200dk/flash.c:               /* arm simple, non interrupt dependent timer */
board/atmel/at91rm9200dk/flash.c:               reset_timer_masked ();
board/atmel/at91rm9200dk/flash.c:                               if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
board/atmel/at91rm9200dk/flash.c:       /* arm simple, non interrupt dependent timer */
board/atmel/at91rm9200dk/flash.c:       reset_timer_masked ();
board/atmel/at91rm9200dk/flash.c:               if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
board/atmel/atstk1000/flash.c:          start_time = get_timer(0);

-> ls board/atmel/*/Makefile | wc -l
9

One out of 9...

Quoted 2 lines
Quoted 1 line

Can we not do delays without interrupts?

no not on all soc

I don't buy that. Do you have an example?

Quoted 2 lines
Quoted 1 line

And do we need full-blown timer services for delays?

Yes as we need to init the timer which is in nearly all case soc dependent

Please re-read my question. I accept that we may need a simple, free-running timer which we can poll for a delay loop. But we do not need full-blown timer services just to implement delays.

Quoted 5 lines
Quoted 3 lines

[Keep in mind that a delay is usually used
to implement a timeout in the error branch; that means, it does not matter if it has not 10e-6 precision or better.]

not only
it's use for slow clock, for chip reset timing etc...

What is "slow clock"?

And if you reset a chip, you don't really care if the delay loop is 10 or 12 milliseconds, or do you?

Quoted 1 line

but the precision is just that if you need to wait 10us you will not wait less

If you have to wait 10us or more, then you will probably set a timeout ouf 20us anyway.

Quoted 1 line

and if you want to wait 100ms you will not have to wait 1s

Indeed. But usually you don't care whether it's 100, 101 or 110 ms.

Quoted 3 lines

an other example for spi transfer you will have to use some delay more you timer is precise more you transfert will be work at higher rate it's the same for nand etc...

Come on - SPI transfers or NAND flash controllers use their own clocks; they do NOT depend on the accuracy of udelay() [and if there should be a port that does depend on udelay(), then it is seriously broken and urgently needs to be fixed by the board maintainer].

But I'm repeating myself.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Politics:  A  strife  of  interests  masquerading  as  a  contest  of
principles. The conduct of public affairs for private advantage.
- Ambrose Bierce
#10 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

Quoted 1 line · Wolfgang Denk

What is "slow clock"?

On (some) ARM SoC there are two oscillators: A "slow" free running oscillator typically with a dedicated 32 kHz crystal and the "main" oscillator with a dedicated crystal in the MHz range.

The processor starts with the slow slock enabled and init code needs to set up PLLs and muxes etc. to enable the main oscillator and switch to derived clocks like master clock, cpu clock, IO clock and so on.

#11 lore raw

PATCH v2 1/1 arm: timer and interrupt init rework

In reply to Wolfgang Denk
Quoted 72 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 7 lines

cpu/arm_cortexa8/omap3/Makefile include $(TOPDIR)/config.mk · line 35

Quoted 6 lines
cpu/arm_cortexa8/omap3/Makefile +6 -0
+COBJS	+= board.o
+COBJS	+= clock.o
+COBJS	+= mem.o
+COBJS	+= syslib.o
+COBJS	+= sys_info.o
+COBJS	+= timer.o

What do we win with this?

simple to allow vertical patch to be applied instead of have merge problem

so yes it's needed

But it must go in a separate patch.

Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
lib_arm/board.c +1 -1
index 5d05d9b..b678a63 100644
@@ -265,8 +265,11 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_ARCH_CPU_INIT)
 	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 */
Quoted 8 lines

lib_arm/board.c init_fnc_t *init_sequence[] = { · line 275

Quoted 6 lines
lib_arm/board.c +3 -0
+#endif
+	timer_init,		/* initialize timer */
+	board_init,		/* basic board dependent setup */
 	env_init,		/* initialize environment */
 	init_baudrate,		/* initialze baudrate settings */
 	serial_init,		/* serial communications setup */

... if you tested this on an OMAP3 board: I'm not sure, but it seems to me that the initialization order might change by this?

Quoted 1 line

maybe read the commit message will answer your question

Argh. Instead of snippy remarks you should read Dirks message yourself and answer his (very valid) questions:

| Is this correct? If yes, we have to check that there are no issues 
| with dependencies?
| 
| On which OMAP3 board have you tested this?

Can you please explain on which boards this has actually been tested, and especially on which OMAP3 boards?

Also, I do not see why we need to implement such a critical change.

If I understand you corrctly, your argument goes that board_init() needs delays (like udelay()), delays need timers, and timers need interrupts, so we must initialize first interrupts, then timers, and only then we can run board_init()? Is this your argument?

But the I ask why udelay() would need timers and interrupts? This does not fit into the design philosophy of U-Boot, which attempts to bring up a board at least to a state where we have serial console output with as little as possible requirements. Your change breaks this, because now we have to initialize timers and interrupts (which are not exactly a trivial thing to set up or debug if they aren't working correctly) BEFORE we have a console output. [I ignore the case of CONFIG_USE_IRQ here, because only 4 boards actually use this feature, and they could probably be changed to do without, too.]

So while I really appreciate your attempts to clean up the timer code on ARM, the resulting consequences are expensive, and I am not yet convincet the advantages of the new code are bigger than this disadvantage, and especially I am not convinced thatthis is really necessary and unavoidable.

Quoted 4 lines

Can we not do delays without interrupts? And do we need full-blown timer services for delays? [Keep in mind that a delay is usually used to implement a timeout in the error branch; that means, it does not matter if it has not 10e-6 precision or better.]

Btw, it seems that this patch is already in u-boot-arm next

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=commit;h=482d69eafb6a78c82251f7a346cc67f12a9bd731

Did I miss an ACK somewhere? It's my understanding that this patch is still under discussion? Sorry if I missed something ;)

Best regards

Dirk