diff options
author | wdenk <wdenk> | 2003-12-06 19:49:23 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-12-06 19:49:23 +0000 |
commit | a8c7c708a9e0051c6358718c53572a4681eaa22b (patch) | |
tree | b560561c91725eb2f86289da61ee676787419e37 | |
parent | fa1399ed127c8be507bf182dc7d8d61a54938d79 (diff) |
* Patch by Gleb Natapov, 19 Sep 2003:
Move most of the timer interrupt related PPC code to ppc_lib/interrupts.c
* Patch by Anders Larsen, 17 Sep 2003:
Bring ARM memory layout in sync with the documentation:
stack and malloc-heap are now located _below_ the U-Boot code
66 files changed, 569 insertions, 1055 deletions
diff --git a/CHANGELOG b/CHANGELOG index d64acbbd680..974ce57731c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,13 @@ Changes since U-Boot 1.0.0: ====================================================================== +* Patch by Gleb Natapov, 19 Sep 2003: + Move most of the timer interrupt related PPC code to ppc_lib/interrupts.c + +* Patch by Anders Larsen, 17 Sep 2003: + Bring ARM memory layout in sync with the documentation: + stack and malloc-heap are now located _below_ the U-Boot code + * Accelerate booting on TRAB board: read and check autoupdate image headers first instead of always reading the whole images. @@ -1,5 +1,7 @@ #!/bin/sh +: ${JOBS:=} + if [ "${CROSS_COMPILE}" ] ; then MAKE="make CROSS_COMPILE=${CROSS_COMPILE}" else @@ -179,7 +181,7 @@ build_target() { ${MAKE} distclean >/dev/null ${MAKE} ${target}_config - ${MAKE} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR + ${MAKE} ${JOBS} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR ${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG } @@ -77,24 +77,6 @@ endif export CROSS_COMPILE -# The "tools" are needed early, so put this first -SUBDIRS = tools \ - examples \ - lib_generic \ - lib_$(ARCH) \ - cpu/$(CPU) \ - board/$(BOARDDIR) \ - common \ - disk \ - fs \ - net \ - rtc \ - dtt \ - drivers \ - drivers/sk98lin \ - post \ - post/cpu - ######################################################################### # U-Boot objects....order is important (i.e. start must be first) @@ -123,9 +105,17 @@ LIBS += drivers/sk98lin/libsk98lin.a LIBS += post/libpost.a post/cpu/libcpu.a LIBS += common/libcommon.a LIBS += lib_generic/libgeneric.a + # Add GCC lib PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc +# The "tools" are needed early, so put this first +# Don't include stuff already done in $(LIBS) +SUBDIRS = tools \ + examples \ + post \ + post/cpu + ######################################################################### ######################################################################### @@ -149,14 +139,18 @@ u-boot.img: u-boot.bin u-boot.dis: u-boot $(OBJDUMP) -d $< > $@ -u-boot: depend subdirs $(OBJS) $(LIBS) $(LDSCRIPT) +u-boot: depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT) UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \ --start-group $(LIBS) $(PLATFORM_LIBS) --end-group \ -Map u-boot.map -o u-boot -subdirs: - @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit 1 ; done +$(LIBS): + $(MAKE) -C `dirname $@` + +$(SUBDIRS): + @echo "#### MAKE $@ ####" + $(MAKE) -C $@ gdbtools: $(MAKE) -C tools/gdb || exit 1 @@ -884,12 +878,12 @@ trab_old_config: unconfig @[ -z "$(findstring _bigflash,$@)" ] || \ { echo "#define CONFIG_RAM_16MB" >>include/config.h ; \ echo "... with 16 MB Flash, 16 MB RAM" ; \ - echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \ + echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \ } @[ -z "$(findstring _old,$@)" ] || \ { echo "#define CONFIG_OLD_VERSION" >>include/config.h ; \ echo "... with small memory configuration" ; \ - echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \ + echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \ } @./mkconfig -a $(call xtract_trab,$@) arm arm920t trab @@ -1353,7 +1353,7 @@ The following options need to be configured: of the backslashes before semicolons and special symbols. -- Default Environment +- Default Environment: CONFIG_EXTRA_ENV_SETTINGS Define this to contain any number of null terminated @@ -1379,14 +1379,14 @@ The following options need to be configured: the environment like the autoscript function or the boot command first. -- DataFlash Support +- DataFlash Support: CONFIG_HAS_DATAFLASH Defining this option enables DataFlash features and allows to read/write in Dataflash via the standard commands cp, md... -- Show boot progress +- Show boot progress: CONFIG_SHOW_BOOT_PROGRESS Defining this option allows to add some board- @@ -1466,6 +1466,19 @@ Modem Support: Enables debugging stuff (char screen[1024], dbg()) for modem support. Useful only with BDI2000. +- Interrupt support (PPC): + + There are common interrupt_init() and timer_interrupt() + for all PPC archs. interrupt_init() calls interrupt_init_cpu() + for cpu specific initialization. interrupt_init_cpu() + should set decrementer_count to appropriate value. If + cpu resets decrementer automatically after interrupt + (ppc4xx) it should set decrementer_count to zero. + timer_interrupt() calls timer_interrupt_cpu() for cpu + specific handling. If board has watchdog / status_led + / other_activity_monitor it works automatically from + general timer_interrupt(). + - General: In the target system modem support is enabled when a diff --git a/board/at91rm9200dk/config.mk b/board/at91rm9200dk/config.mk index 9ce161e55f0..27cb3b123d7 100644 --- a/board/at91rm9200dk/config.mk +++ b/board/at91rm9200dk/config.mk @@ -1 +1 @@ -TEXT_BASE = 0x21f00000 +TEXT_BASE = 0x21f80000 diff --git a/board/cogent/lcd.c b/board/cogent/lcd.c index c1b4d116ea8..814b4c80a04 100644 --- a/board/cogent/lcd.c +++ b/board/cogent/lcd.c @@ -229,3 +229,17 @@ lcd_heartbeat(void) if (++rotator_index >= (sizeof rotchars / sizeof rotchars[0])) rotator_index = 0; } + +#ifdef CONFIG_SHOW_ACTIVITY +void board_show_activity (ulong timestamp) +{ +#ifdef CONFIG_STATUS_LED + if ((timestamp % (CFG_HZ / 2) == 0) + lcd_heartbeat (); +#endif +} + +void show_activity(int arg) +{ +} +#endif diff --git a/board/cradle/config.mk b/board/cradle/config.mk index 3ffcfe84448..aa40388811a 100644 --- a/board/cradle/config.mk +++ b/board/cradle/config.mk @@ -1,2 +1,2 @@ -TEXT_BASE = 0xa0f08000 +TEXT_BASE = 0xa0f80000 #TEXT_BASE = 0 diff --git a/board/dnp1110/config.mk b/board/dnp1110/config.mk index 72ba595f1ac..4f6af46f8cc 100644 --- a/board/dnp1110/config.mk +++ b/board/dnp1110/config.mk @@ -11,7 +11,7 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to c1f0'0000, the upper 1 MB of the first (only) bank +# we load ourself to c1f8'0000, the upper 1 MB of the first (only) bank # -TEXT_BASE = 0xc1f00000 +TEXT_BASE = 0xc1f80000 diff --git a/board/ep7312/config.mk b/board/ep7312/config.mk index e1ba0e17985..0ae16a2efec 100644 --- a/board/ep7312/config.mk +++ b/board/ep7312/config.mk @@ -25,4 +25,4 @@ # MA 02111-1307 USA # -TEXT_BASE = 0xc0f00000 +TEXT_BASE = 0xc0f80000 diff --git a/board/hymod/hymod.c b/board/hymod/hymod.c index 3611a129771..dea0a70a23a 100644 --- a/board/hymod/hymod.c +++ b/board/hymod/hymod.c @@ -513,3 +513,25 @@ last_stage_init (void) return (0); } + +#ifdef CONFIG_SHOW_ACTIVITY +void board_show_activity (ulong timebase) +{ +#ifdef CFG_HYMOD_DBLEDS + volatile immap_t *immr = (immap_t *) CFG_IMMR; + volatile iop8260_t *iop = &immr->im_ioport; + static int shift = 0; + + if ((timestamp % CFG_HZ) == 0) { + if (++shift > 3) + shift = 0; + iop->iop_pdatd = + (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift)); + } +#endif /* CFG_HYMOD_DBLEDS */ +} + +void show_activity(int arg) +{ +} +#endif /* CONFIG_SHOW_ACTIVITY */ diff --git a/board/impa7/config.mk b/board/impa7/config.mk index 69b376c094d..417d6a8e2cb 100644 --- a/board/impa7/config.mk +++ b/board/impa7/config.mk @@ -25,4 +25,4 @@ # MA 02111-1307 USA # -TEXT_BASE = 0xc1700000 +TEXT_BASE = 0xc1780000 diff --git a/board/lart/config.mk b/board/lart/config.mk index 8f1a62bbaa1..3033c4fba69 100644 --- a/board/lart/config.mk +++ b/board/lart/config.mk @@ -14,10 +14,10 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to c170'0000, the upper 1 MB of second bank +# we load ourself to c178'0000, the upper 1 MB of second bank # # download areas is c800'0000 # -TEXT_BASE = 0xc1700000 +TEXT_BASE = 0xc1780000 diff --git a/board/oxc/oxc.c b/board/oxc/oxc.c index 5f5e59a3ad2..0d6fc8536c0 100644 --- a/board/oxc/oxc.c +++ b/board/oxc/oxc.c @@ -156,6 +156,12 @@ void oxc_toggle_activeled(void) ledtoggle++; } +void board_show_activity (ulong timestamp) +{ + if ((timestamp % (CFG_HZ / 10)) == 0) + oxc_toggle_activeled (); +} + void show_activity(int arg) { static unsigned char led = 0; diff --git a/board/shannon/config.mk b/board/shannon/config.mk index 736d3af623e..ca45733af00 100644 --- a/board/shannon/config.mk +++ b/board/shannon/config.mk @@ -14,10 +14,10 @@ # # Linux-Kernel is expected to be at c000'8000, entry c000'8000 # -# we load ourself to d830'0000, the upper 1 MB of the last (4th) bank +# we load ourself to d838'0000, the upper 1 MB of the last (4th) bank # # download areas is c800'0000 # -TEXT_BASE = 0xd8300000 +TEXT_BASE = 0xd8380000 diff --git a/board/trab/config.mk b/board/trab/config.mk index 2cb8edabf22..f2411d009c6 100644 --- a/board/trab/config.mk +++ b/board/trab/config.mk @@ -22,5 +22,5 @@ sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp ifndef TEXT_BASE -TEXT_BASE = 0x0DF00000 +TEXT_BASE = 0x0DF40000 endif diff --git a/board/wepep250/wepep250.c b/board/wepep250/wepep250.c index 08b1bfde72a..581818316e7 100644 --- a/board/wepep250/wepep250.c +++ b/board/wepep250/wepep250.c @@ -40,15 +40,6 @@ int board_init( void ){ #endif PSSR = 0x20; -/* - * Following code is just bug workaround, remove it if not neccessary - */ - - /* cpu/xscale/cpu.c do not set armboot_real_end that is used for - malloc pool.*/ - if( _armboot_real_end == 0xbadc0de ){ - _armboot_real_end = _armboot_end; - } return 0; } diff --git a/common/Makefile b/common/Makefile index ae8222a6ae3..dae5942db5e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -63,6 +63,9 @@ environment.o: environment.c ../tools/envcrc -DENV_CRC=$(shell ../tools/envcrc) \ -c -o $@ environment.c +../tools/envcrc: + $(MAKE) -C ../tools + ######################################################################### .depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/common/xilinx.c b/common/xilinx.c index cb153e14eff..b2e61692cb0 100644 --- a/common/xilinx.c +++ b/common/xilinx.c @@ -194,6 +194,7 @@ int xilinx_info (Xilinx_desc * desc) /* Add new family types here */ default: /* we don't need a message here - we give one up above */ + ; } } else printf ("No Device Function Table.\n"); diff --git a/cpu/74xx_7xx/interrupts.c b/cpu/74xx_7xx/interrupts.c index 2e2e45615db..f0ea4852654 100644 --- a/cpu/74xx_7xx/interrupts.c +++ b/cpu/74xx_7xx/interrupts.c @@ -32,62 +32,7 @@ #include <commproc.h> #include <command.h> -/****************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - -static __inline__ unsigned long -get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void -set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - -static __inline__ unsigned long -get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void -set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - -void -enable_interrupts(void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int -disable_interrupts(void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init(void) +int interrupt_init_cpu (unsigned *decrementer_count) { #if defined(DEBUG) && !defined(CONFIG_AMIGAONEG3SE) printf("interrupt_init: GT main cause reg: %08x:%08x\n", @@ -103,22 +48,8 @@ int interrupt_init(void) GTREGREAD(ETHERNET2_INTERRUPT_MASK_REGISTER)); puts("interrupt_init: setting decrementer_count\n"); #endif - decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CFG_HZ; -#ifdef DEBUG - puts("interrupt_init: setting actual decremter\n"); -#endif - set_dec (get_tbclk() / CFG_HZ); - -#ifdef DEBUG - printf("interrupt_init: enabling interrupts (msr = %08lx)\n", - get_msr()); -#endif - set_msr (get_msr() | MSR_EE); - -#ifdef DEBUG - printf("interrupt_init: done. (msr = %08lx)\n", get_msr()); -#endif return (0); } @@ -141,40 +72,10 @@ volatile ulong timestamp = 0; * Trivial implementation - no need to be really accurate. */ void -timer_interrupt(struct pt_regs *regs) -{ - set_dec(decrementer_count); - timestamp++; - -#if defined(CONFIG_WATCHDOG) - if ((timestamp % (CFG_HZ / 2)) == 0) { -#if defined(CONFIG_PCIPPC2) - extern void pcippc2_wdt_reset (void); - - pcippc2_wdt_reset(); -#endif - } -#endif /* CONFIG_WATCHDOG */ -} - -/****************************************************************************/ - -void -reset_timer(void) -{ - timestamp = 0; -} - -ulong -get_timer(ulong base) -{ - return (timestamp - base); -} - -void -set_timer(ulong t) +timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c index 7521fbaf5fc..b6fcef9b435 100644 --- a/cpu/arm720t/cpu.c +++ b/cpu/arm720t/cpu.c @@ -82,18 +82,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + \ - CONFIG_STACKSIZE + \ - CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S index fdedc915fb5..8ddb0c9264d 100644 --- a/cpu/arm720t/start.S +++ b/cpu/arm720t/start.S @@ -90,14 +90,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -132,32 +124,32 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c index 41cebdfd94b..e638c1f8dde 100644 --- a/cpu/arm920t/cpu.c +++ b/cpu/arm920t/cpu.c @@ -87,17 +87,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index 17c5f86bc36..d640942d8aa 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -91,14 +91,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -171,28 +163,33 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ + #if 0 /* try doing this stuff after the relocation */ ldr r0, =pWTCON @@ -214,11 +211,6 @@ copy_loop: /* END stuff after relocation */ #endif - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ - ldr pc, _start_armboot _start_armboot: .word start_armboot diff --git a/cpu/arm925t/cpu.c b/cpu/arm925t/cpu.c index c55fbc7959f..6bac53da824 100644 --- a/cpu/arm925t/cpu.c +++ b/cpu/arm925t/cpu.c @@ -88,17 +88,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm925t/start.S b/cpu/arm925t/start.S index 6dd30120559..0a3042d9a65 100644 --- a/cpu/arm925t/start.S +++ b/cpu/arm925t/start.S @@ -100,14 +100,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -168,34 +160,41 @@ poll1: ldrh r1, [r0] ands r1, r1, #0x01 beq poll1 - bl cpu_init_crit -relocate: /* - * relocate armboot to RAM + * we do sys-critical inits only at reboot, + * not when booting from ram! */ - adr r0, _start /* r0 <- current position of code */ +#ifdef CONFIG_INIT_CRITICAL + bl cpu_init_crit +#endif + +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c index a91aa378285..748a21a416e 100644 --- a/cpu/arm926ejs/cpu.c +++ b/cpu/arm926ejs/cpu.c @@ -88,17 +88,15 @@ static void cp_delay (void) int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; -#endif /* CONFIG_USE_IRQ */ - return (0); + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; +#endif + return 0; } int cleanup_before_linux (void) diff --git a/cpu/arm926ejs/start.S b/cpu/arm926ejs/start.S index b860fd408ee..39d7409b030 100644 --- a/cpu/arm926ejs/start.S +++ b/cpu/arm926ejs/start.S @@ -108,14 +108,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -162,34 +154,41 @@ reset: str r1, [r0] ldr r0, =REG_IHL2_MIR str r1, [r0] - bl cpu_init_crit -relocate: /* - * relocate armboot to RAM + * we do sys-critical inits only at reboot, + * not when booting from ram! */ - adr r0, _start /* r0 <- current position of code */ +#ifdef CONFIG_INIT_CRITICAL + bl cpu_init_crit +#endif + +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/cpu/at91rm9200/cpu.c b/cpu/at91rm9200/cpu.c index 262ca340e12..b0cfcefeca5 100644 --- a/cpu/at91rm9200/cpu.c +++ b/cpu/at91rm9200/cpu.c @@ -81,18 +81,16 @@ static void cp_delay(void) int cpu_init(void) { - /* - * setup up stack if necessary - */ + /* + * setup up stacks if necessary + */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return 0; + return 0; } int cleanup_before_linux(void) diff --git a/cpu/at91rm9200/start.S b/cpu/at91rm9200/start.S index 9fa1461d2d8..a93d0454d6d 100644 --- a/cpu/at91rm9200/start.S +++ b/cpu/at91rm9200/start.S @@ -93,14 +93,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -147,10 +139,16 @@ copyex: bl cpu_init_crit #endif - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ + ldr pc,_start_armboot _start_armboot: .word start_armboot diff --git a/cpu/mpc5xx/interrupts.c b/cpu/mpc5xx/interrupts.c index 46186800007..3678b5bfc8d 100644 --- a/cpu/mpc5xx/interrupts.c +++ b/cpu/mpc5xx/interrupts.c @@ -28,16 +28,9 @@ */ #include <common.h> -#include <watchdog.h> #include <mpc5xx.h> #include <asm/processor.h> -/************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/************************************************************************/ - struct interrupt_action { interrupt_handler_t *handler; void *arg; @@ -46,73 +39,19 @@ struct interrupt_action { static struct interrupt_action irq_vecs[NR_IRQS]; /* - * Local function prototypes - */ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - -/* - * Enable interrupts - */ -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* - * Returns flag if MSR_EE was set before - */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/* * Initialise interrupts */ -int interrupt_init (void) +int interrupt_init_cpu (ulong *decrementer_count) { volatile immap_t *immr = (immap_t *) CFG_IMMR; /* Decrementer used here for status led */ - decrementer_count = get_tbclk () / CFG_HZ; + *decrementer_count = get_tbclk () / CFG_HZ; /* Disable all interrupts */ immr->im_siu_conf.sc_simask = 0; - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); return (0); } @@ -206,19 +145,14 @@ void irq_free_handler (int vec) irq_vecs[vec].arg = NULL; } -volatile ulong timestamp = 0; - /* * Timer interrupt - gets called when bit 0 of DEC changes from * 0. Decrementer is enabled with bit TBE in TBSCR. */ -void timer_interrupt (struct pt_regs *regs) +void timer_interrupt_cpu (struct pt_regs *regs) { volatile immap_t *immr = (immap_t *) CFG_IMMR; -#ifdef CONFIG_STATUS_LED - extern void status_led_tick (ulong); -#endif #if 0 printf ("*** Timer Interrupt *** "); #endif @@ -227,47 +161,5 @@ void timer_interrupt (struct pt_regs *regs) __asm__ ("nop"); immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST; - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ - -#if defined(CONFIG_WATCHDOG) - /* - * The shortest watchdog period of all boards - * is approx. 1 sec, thus re-trigger watchdog at least - * every 500 ms = CFG_HZ / 2 - */ - if ((timestamp % (CFG_HZ / 2)) == 0) { - reset_5xx_watchdog (immr); - } -#endif /* CONFIG_WATCHDOG */ -} - -/* - * Reset timer - */ -void reset_timer (void) -{ - timestamp = 0; -} - -/* - * Get Timer - */ -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -/* - * Set timer - */ -void set_timer (ulong t) -{ - timestamp = t; + return; } diff --git a/cpu/mpc5xxx/interrupts.c b/cpu/mpc5xxx/interrupts.c index 5aa43880bb7..7bacecd595b 100644 --- a/cpu/mpc5xxx/interrupts.c +++ b/cpu/mpc5xxx/interrupts.c @@ -32,79 +32,10 @@ #include <asm/processor.h> #include <command.h> -/****************************************************************************/ - -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - -static __inline__ unsigned long -get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void -set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - -static __inline__ unsigned long -get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void -set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - -void -enable_interrupts(void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int -disable_interrupts(void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init(void) +int interrupt_init_cpu (ulong *decrementer_count) { - decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CFG_HZ; -#ifdef DEBUG - puts("interrupt_init: setting actual decremter\n"); -#endif - set_dec (get_tbclk() / CFG_HZ); - -#ifdef DEBUG - printf("interrupt_init: enabling interrupts (msr = %08lx)\n", - get_msr()); -#endif - set_msr (get_msr() | MSR_EE); - -#ifdef DEBUG - printf("interrupt_init: done. (msr = %08lx)\n", get_msr()); -#endif return (0); } @@ -119,38 +50,11 @@ external_interrupt(struct pt_regs *regs) puts("external_interrupt (oops!)\n"); } -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void -timer_interrupt(struct pt_regs *regs) -{ - set_dec(decrementer_count); - timestamp++; -} - -/****************************************************************************/ - -void -reset_timer(void) -{ - timestamp = 0; -} - -ulong -get_timer(ulong base) -{ - return (timestamp - base); -} - void -set_timer(ulong t) +timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/mpc824x/interrupts.c b/cpu/mpc824x/interrupts.c index 825857b0548..acb8947e0d8 100644 --- a/cpu/mpc824x/interrupts.c +++ b/cpu/mpc824x/interrupts.c @@ -27,62 +27,11 @@ #include <asm/processor.h> #include <asm/pci_io.h> #include <commproc.h> -#include <watchdog.h> #include "drivers/epic.h" -/****************************************************************************/ - -unsigned decrementer_count; /* count val for 1e6/HZ microseconds */ - -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - - -void enable_interrupts (void) +int interrupt_init_cpu (unsigned *decrementer_count) { - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init (void) -{ - decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ; + *decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ; /* * It's all broken at the moment and I currently don't need @@ -96,10 +45,6 @@ int interrupt_init (void) /* EPIC won't generate INT unless Current Task Pri < 15 */ epicCurTaskPrioSet(0); - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -141,42 +86,8 @@ void irq_free_handler (int vec) vga? */ -volatile ulong timestamp = 0; - -void timer_interrupt (struct pt_regs *regs) -{ - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) - if ((timestamp % (CFG_HZ / 2)) == 0) { - WATCHDOG_RESET (); - } -#endif /* CONFIG_WATCHDOG */ -#if defined(CONFIG_SHOW_ACTIVITY) && defined(CONFIG_OXC) - if ((timestamp % (CFG_HZ / 10)) == 0) { - { - extern void oxc_toggle_activeled (void); - - oxc_toggle_activeled (); - } - } -#endif -} - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp) { - timestamp = t; + /* nothing to do here */ + return; } diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c index 3c5ef7460eb..e2a6c977821 100644 --- a/cpu/mpc8260/interrupts.c +++ b/cpu/mpc8260/interrupts.c @@ -24,19 +24,13 @@ */ #include <common.h> -#include <watchdog.h> #include <command.h> #include <mpc8260.h> #include <mpc8260_irq.h> #include <asm/processor.h> -#ifdef CONFIG_STATUS_LED -#include <status_led.h> -#endif /****************************************************************************/ -unsigned decrementer_count; /* count val for 1e6/HZ microseconds */ - struct irq_action { interrupt_handler_t *handler; void *arg; @@ -144,57 +138,13 @@ static int m8260_get_irq (struct pt_regs *regs) /* end of code ripped out of arch/ppc/kernel/ppc8260_pic.c */ /****************************************************************************/ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - __asm__ __volatile__ ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - __asm__ __volatile__ ("mtmsr %0;sync;isync"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - __asm__ __volatile__ ("mfdec %0":"=r" (val):); - - return val; -} - -static __inline__ void set_dec (unsigned long val) -{ - __asm__ __volatile__ ("mtdec %0"::"r" (val)); -} - -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/****************************************************************************/ - -int interrupt_init (void) +int interrupt_init_cpu (unsigned *decrementer_count) { DECLARE_GLOBAL_DATA_PTR; volatile immap_t *immr = (immap_t *) CFG_IMMR; - decrementer_count = (gd->bus_clk / 4) / CFG_HZ; + *decrementer_count = (gd->bus_clk / 4) / CFG_HZ; /* Initialize the default interrupt mapping priorities */ immr->im_intctl.ic_sicr = 0; @@ -216,10 +166,6 @@ int interrupt_init (void) immr->im_intctl.ic_siexr = -1; #endif - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -236,7 +182,7 @@ void external_interrupt (struct pt_regs *regs) m8260_mask_and_ack (irq); - set_msr (get_msr () | MSR_EE); + enable_interrupts (); if (irq_handlers[irq].handler != NULL) (*irq_handlers[irq].handler) (irq_handlers[irq].arg); @@ -292,75 +238,10 @@ void irq_free_handler (int irq) /****************************************************************************/ -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void timer_interrupt (struct pt_regs *regs) -{ -#if defined(CONFIG_WATCHDOG) || defined(CFG_HYMOD_DBLEDS) - volatile immap_t *immr = (immap_t *) CFG_IMMR; -#endif /* CONFIG_WATCHDOG */ - - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#if defined(CONFIG_WATCHDOG) || \ - defined(CFG_CMA_LCD_HEARTBEAT) || \ - defined(CFG_HYMOD_DBLEDS) - - if ((timestamp % CFG_HZ) == 0) { -#if defined(CFG_CMA_LCD_HEARTBEAT) - extern void lcd_heartbeat (void); -#endif /* CFG_CMA_LCD_HEARTBEAT */ -#if defined(CFG_HYMOD_DBLEDS) - volatile iop8260_t *iop = &immr->im_ioport; - static int shift = 0; -#endif /* CFG_HYMOD_DBLEDS */ - -#if defined(CFG_CMA_LCD_HEARTBEAT) - lcd_heartbeat (); -#endif /* CFG_CMA_LCD_HEARTBEAT */ - -#if defined(CONFIG_WATCHDOG) - reset_8260_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ - -#if defined(CFG_HYMOD_DBLEDS) - /* hymod daughter board LEDs */ - if (++shift > 3) - shift = 0; - iop->iop_pdatd = - (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift)); -#endif /* CFG_HYMOD_DBLEDS */ - } -#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */ - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ -} - -/****************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ diff --git a/cpu/mpc8xx/interrupts.c b/cpu/mpc8xx/interrupts.c index 8bc0a1afdea..558dc09c078 100644 --- a/cpu/mpc8xx/interrupts.c +++ b/cpu/mpc8xx/interrupts.c @@ -22,7 +22,6 @@ */ #include <common.h> -#include <watchdog.h> #include <mpc8xx.h> #include <mpc8xx_irq.h> #include <asm/processor.h> @@ -30,10 +29,6 @@ /************************************************************************/ -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/************************************************************************/ - /* * CPM interrupt vector functions. */ @@ -50,57 +45,11 @@ static void cpm_interrupt (void *regs); /************************************************************************/ -static __inline__ unsigned long get_msr (void) -{ - unsigned long msr; - - asm volatile ("mfmsr %0":"=r" (msr):); - - return msr; -} - -static __inline__ void set_msr (unsigned long msr) -{ - asm volatile ("mtmsr %0"::"r" (msr)); -} - -static __inline__ unsigned long get_dec (void) -{ - unsigned long val; - - asm volatile ("mfdec %0":"=r" (val):); - - return val; -} - - -static __inline__ void set_dec (unsigned long val) -{ - asm volatile ("mtdec %0"::"r" (val)); -} - - -void enable_interrupts (void) -{ - set_msr (get_msr () | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr (); - - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - -/************************************************************************/ - -int interrupt_init (void) +int interrupt_init_cpu (unsigned *decrementer_count) { volatile immap_t *immr = (immap_t *) CFG_IMMR; - decrementer_count = get_tbclk () / CFG_HZ; + *decrementer_count = get_tbclk () / CFG_HZ; /* disable all interrupts */ immr->im_siu_conf.sc_simask = 0; @@ -108,10 +57,6 @@ int interrupt_init (void) /* Configure CPM interrupts */ cpm_interrupt_init (); - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -314,20 +259,15 @@ static void cpm_interrupt_init (void) /************************************************************************/ -volatile ulong timestamp = 0; - /* * timer_interrupt - gets called when the decrementer overflows, * with interrupts disabled. * Trivial implementation - no need to be really accurate. */ -void timer_interrupt (struct pt_regs *regs) +void timer_interrupt_cpu (struct pt_regs *regs) { volatile immap_t *immr = (immap_t *) CFG_IMMR; -#ifdef CONFIG_STATUS_LED - extern void status_led_tick (ulong); -#endif #if 0 printf ("*** Timer Interrupt *** "); #endif @@ -339,57 +279,6 @@ void timer_interrupt (struct pt_regs *regs) #else immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST; #endif - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ - -#if defined(CONFIG_WATCHDOG) || defined(CFG_CMA_LCD_HEARTBEAT) - - /* - * The shortest watchdog period of all boards (except LWMON) - * is approx. 1 sec, thus re-trigger watchdog at least - * every 500 ms = CFG_HZ / 2 - */ -#ifndef CONFIG_LWMON - if ((timestamp % (CFG_HZ / 2)) == 0) { -#else - if ((timestamp % (CFG_HZ / 20)) == 0) { -#endif - -#if defined(CFG_CMA_LCD_HEARTBEAT) - extern void lcd_heartbeat (void); - - lcd_heartbeat (); -#endif /* CFG_CMA_LCD_HEARTBEAT */ - -#if defined(CONFIG_WATCHDOG) - reset_8xx_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ - - } -#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */ -} - -/************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) -{ - timestamp = t; } /************************************************************************/ diff --git a/cpu/ppc4xx/405gp_enet.c b/cpu/ppc4xx/405gp_enet.c index c222c719e8d..a9c7cfe0506 100644 --- a/cpu/ppc4xx/405gp_enet.c +++ b/cpu/ppc4xx/405gp_enet.c @@ -159,7 +159,7 @@ static int tx_i_index = 0; /* Transmit Interrupt Queue Index */ static int tx_u_index = 0; /* Transmit User Queue Index */ static int tx_run[NUM_TX_BUFF]; /* Transmit Running Queue */ -#undef INFO_405_ENET 1 +#undef INFO_405_ENET #ifdef INFO_405_ENET static int packetSent = 0; static int packetReceived = 0; diff --git a/cpu/ppc4xx/interrupts.c b/cpu/ppc4xx/interrupts.c index b6a956c152c..1a9ae9d7d1f 100644 --- a/cpu/ppc4xx/interrupts.c +++ b/cpu/ppc4xx/interrupts.c @@ -35,10 +35,6 @@ /****************************************************************************/ -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ - -/****************************************************************************/ - /* * CPM interrupt vector functions. */ @@ -57,20 +53,6 @@ void uic1_interrupt( void * parms); /* UIC1 handler */ #endif /****************************************************************************/ - -static __inline__ unsigned long get_msr(void) -{ - unsigned long msr; - - asm volatile("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void set_msr(unsigned long msr) -{ - asm volatile("mtmsr %0" : : "r" (msr)); -} - #if defined(CONFIG_440) /* SPRN changed in 440 */ @@ -81,21 +63,6 @@ static __inline__ void set_evpr(unsigned long val) #else /* !defined(CONFIG_440) */ -static __inline__ unsigned long get_dec(void) -{ - unsigned long val; - - asm volatile("mfdec %0" : "=r" (val) :); - return val; -} - - -static __inline__ void set_dec(unsigned long val) -{ - asm volatile("mtdec %0" : : "r" (val)); -} - - static __inline__ void set_pit(unsigned long val) { asm volatile("mtpit %0" : : "r" (val)); @@ -114,29 +81,18 @@ static __inline__ void set_evpr(unsigned long val) } #endif /* defined(CONFIG_440 */ - -void enable_interrupts (void) -{ - set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int disable_interrupts (void) -{ - ulong msr = get_msr(); - set_msr (msr & ~MSR_EE); - return ((msr & MSR_EE) != 0); -} - /****************************************************************************/ -int interrupt_init(void) +int interrupt_init_cpu (unsigned *decrementer_count) { DECLARE_GLOBAL_DATA_PTR; int vec; unsigned long val; + /* decrementer is automatically reloaded */ + *decrementer_count = 0; + /* * Mark all irqs as free */ @@ -194,10 +150,6 @@ int interrupt_init(void) irq_install_handler(VECNUM_UIC1NC, uic1_interrupt, 0); irq_install_handler(VECNUM_UIC1C, uic1_interrupt, 0); #endif - /* - * Enable external interrupts (including PIT) - */ - set_msr (get_msr() | MSR_EE); return (0); } @@ -362,47 +314,14 @@ irq_free_handler(int vec) /****************************************************************************/ - -volatile ulong timestamp = 0; - -/* - * timer_interrupt - gets called when the decrementer overflows, - * with interrupts disabled. - * Trivial implementation - no need to be really accurate. - */ -void timer_interrupt(struct pt_regs *regs) -{ -#if 0 - printf ("*** Timer Interrupt *** "); -#endif - timestamp++; - -#if defined(CONFIG_WATCHDOG) - if ((timestamp % 1000) == 0) - reset_4xx_watchdog(); -#endif /* CONFIG_WATCHDOG */ -} - -/****************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ - #if (CONFIG_COMMANDS & CFG_CMD_IRQ) /******************************************************************************* diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c index 6b82f04f7d7..32ec4f692ac 100644 --- a/cpu/pxa/cpu.c +++ b/cpu/pxa/cpu.c @@ -37,22 +37,15 @@ int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ -/* - - FIXME: the stack is _below_ the uboot code!! - #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif -*/ - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/pxa/start.S b/cpu/pxa/start.S index a4254492659..d41b414774d 100644 --- a/cpu/pxa/start.S +++ b/cpu/pxa/start.S @@ -4,10 +4,10 @@ * Copyright (C) 1998 Dan Malek <dmalek@jlc.net> * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se> * Copyright (C) 2000 Wolfgang Denk <wd@denx.de> - * Copyright (C) 2001 Alex Züpke <azu@sysgo.de> + * Copyright (C) 2001 Alex Zuepke <azu@sysgo.de> * Copyright (C) 2002 Kyle Harris <kharris@nexus-tech.net> * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de> - * Copyright (C) 2003 Kai-Uwe Bloehm <kai-uwe.bloem@auerswald.de> + * Copyright (C) 2003 Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de> * * See file CREDITS for list of people who contributed to this * project. @@ -55,7 +55,7 @@ _fiq: .word fiq /* * Startup Code (reset vector) * - * do important init only if we don't start from memory! + * do important init only if we don't start from RAM! * - relocate armboot to ram * - setup stack * - jump to second stage @@ -91,21 +91,6 @@ _bss_start: _bss_end: .word bss_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - -/* - * We relocate uboot to this address (end of RAM - 128 KiB) - */ -.globl _uboot_reloc -_uboot_reloc: - .word TEXT_BASE - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -131,7 +116,13 @@ reset: orr r0,r0,#0x13 msr cpsr,r0 + /* + * we do sys-critical inits only at reboot, + * not when booting from ram! + */ +#ifdef CONFIG_INIT_CRITICAL bl cpu_init_crit /* we do sys-critical inits */ +#endif relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ @@ -151,12 +142,13 @@ copy_loop: ble copy_loop /* Set up the stack */ - stack_setup: - - ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */ - sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ - /* FIXME: bdinfo should be here */ + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif sub sp, r0, #12 /* leave 3 words for abort-stack */ clear_bss: @@ -202,9 +194,13 @@ OSTIMER_BASE: .word 0x40a00000 #define OIER 0x1C /* Clock Manager Registers */ +#ifdef CFG_CPUSPEED CC_BASE: .word 0x41300000 #define CCCR 0x00 cpuspeed: .word CFG_CPUSPEED +#else +#error "You have to define CFG_CPUSPEED!!" +#endif /* RS: ??? */ diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c index 370ea6cb96a..b613fe7ebf1 100644 --- a/cpu/sa1100/cpu.c +++ b/cpu/sa1100/cpu.c @@ -36,17 +36,15 @@ int cpu_init (void) { /* - * setup up stack if necessary + * setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ - IRQ_STACK_START = _armboot_end + - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4; - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; - _armboot_real_end = FIQ_STACK_START + 4; -#else - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE; + DECLARE_GLOBAL_DATA_PTR; + + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4; + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ; #endif - return (0); + return 0; } int cleanup_before_linux (void) diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S index 6b4c9489137..0c8946e008c 100644 --- a/cpu/sa1100/start.S +++ b/cpu/sa1100/start.S @@ -92,14 +92,6 @@ _armboot_end_data: _armboot_end: .word armboot_end -/* - * _armboot_real_end is the first usable RAM address behind armboot - * and the various stacks - */ -.globl _armboot_real_end -_armboot_real_end: - .word 0x0badc0de - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START @@ -134,32 +126,32 @@ reset: bl cpu_init_crit #endif -relocate: - /* - * relocate armboot to RAM - */ - adr r0, _start /* r0 <- current position of code */ +relocate: /* relocate U-Boot to RAM */ + adr r0, _start /* r0 <- current position of code */ + ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup + ldr r2, _armboot_start ldr r3, _armboot_end - sub r2, r3, r2 /* r2 <- size of armboot */ - ldr r1, _TEXT_BASE /* r1 <- destination address */ - add r2, r0, r2 /* r2 <- source end address */ + sub r2, r3, r2 /* r2 <- size of armboot */ + add r2, r0, r2 /* r2 <- source end address */ - /* - * r0 = source address - * r1 = target address - * r2 = source end address - */ copy_loop: - ldmia r0!, {r3-r10} - stmia r1!, {r3-r10} - cmp r0, r2 + ldmia r0!, {r3-r10} /* copy from source address [r0] */ + stmia r1!, {r3-r10} /* copy to target address [r1] */ + cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop - /* set up the stack */ - ldr r0, _armboot_end - add r0, r0, #CONFIG_STACKSIZE - sub sp, r0, #12 /* leave 3 words for abort-stack */ + /* Set up the stack */ +stack_setup: + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_USE_IRQ + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) +#endif + sub sp, r0, #12 /* leave 3 words for abort-stack */ ldr pc, _start_armboot diff --git a/doc/README.ARM-memory-map b/doc/README.ARM-memory-map new file mode 100644 index 00000000000..8905a50b888 --- /dev/null +++ b/doc/README.ARM-memory-map @@ -0,0 +1,27 @@ +Subject: Re: [PATCH][CFT] bring ARM memory layout in line with the documented behaviour +From: "Anders Larsen" <alarsen@rea.de> +Date: Thu, 18 Sep 2003 14:15:21 +0200 +To: Wolfgang Denk <wd@denx.de> + +... +>I still see references to _armboot_start, _armboot_end_data, and +>_armboot_end - which role do these play now? Can we get rid of them? +> +>How are they (should they be) set in your memory map above? + +_armboot_start contains the value of TEXT_BASE (0xA07E0000); it seems +TEXT_BASE and _armboot_start are both used for the same purpose in +different parts of the (ARM) code. +Furthermore, the startup code (cpu/<arm>/start.S) internally uses +another variable (_TEXT_BASE) with the same content as _armboot_start. +I agree that this mess should be cleaned up. + +_armboot_end_data is the end address of the initialized data section, +and is only used in one place (board/logodl/flash.c - the reference in +lib_arm/board.c is purely informational). + +_armboot_end is the end address of the BSS and is used to determine +the address of the VFD buffer. + +Eliminating those should be doable, and at least the patch already +eliminates _armboot_real_end. diff --git a/include/asm-arm/u-boot-arm.h b/include/asm-arm/u-boot-arm.h index 355b1e4e680..4c92b1f361c 100644 --- a/include/asm-arm/u-boot-arm.h +++ b/include/asm-arm/u-boot-arm.h @@ -35,7 +35,6 @@ extern ulong _armboot_end_data; /* code + data end */ extern ulong _armboot_end; /* BSS end */ extern ulong IRQ_STACK_START; /* top of IRQ stack */ extern ulong FIQ_STACK_START; /* top of FIQ stack */ -extern ulong _armboot_real_end; /* first usable RAM address */ /* cpu/.../cpu.c */ int cpu_init(void); diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h index 9f868f8c879..8a09da68802 100644 --- a/include/configs/VCMA9.h +++ b/include/configs/VCMA9.h @@ -97,6 +97,7 @@ * Size of malloc() pool */ #define CONFIG_MALLOC_SIZE (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_MONITOR_LEN (256 * 1024) #define CFG_MALLOC_LEN (128 * 1024) diff --git a/include/configs/at91rm9200dk.h b/include/configs/at91rm9200dk.h index 415b7fb6ea6..b092ec7a156 100644 --- a/include/configs/at91rm9200dk.h +++ b/include/configs/at91rm9200dk.h @@ -25,6 +25,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + /* ARM asynchronous clock */ #define AT91C_MAIN_CLOCK 179712000 /* from 18.432 MHz crystal (18432000 / 4 * 39) */ #define AT91C_MASTER_CLOCK 59904000 /* peripheral clock (AT91C_MASTER_CLOCK / 3) */ @@ -40,7 +46,10 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ + #define CONFIG_BAUDRATE 115200 + /* * Hardware drivers */ diff --git a/include/configs/cogent_mpc8260.h b/include/configs/cogent_mpc8260.h index 22d154e6d23..d7305272d26 100644 --- a/include/configs/cogent_mpc8260.h +++ b/include/configs/cogent_mpc8260.h @@ -160,6 +160,7 @@ #define CFG_CMA_CONS_SERIAL /* use Cogent motherboard serial for console */ #endif #define CFG_CMA_LCD_HEARTBEAT /* define for sec rotator in lcd corner */ +#define CONFIG_SHOW_ACTIVITY #if (CMA_MB_CAPS & CMA_MB_CAP_FLASH) /* diff --git a/include/configs/cogent_mpc8xx.h b/include/configs/cogent_mpc8xx.h index 2fd4037fdea..51d4a7a7f0b 100644 --- a/include/configs/cogent_mpc8xx.h +++ b/include/configs/cogent_mpc8xx.h @@ -126,6 +126,7 @@ #define CFG_CMA_CONS_SERIAL /* use Cogent motherboard serial for console */ #define CONFIG_CONS_INDEX 1 #define CFG_CMA_LCD_HEARTBEAT /* define for sec rotator in lcd corner */ +#define CONFIG_SHOW_ACTIVITY #if (CMA_MB_CAPS & CMA_MB_CAP_FLASH) /* * flash exists on the motherboard diff --git a/include/configs/cradle.h b/include/configs/cradle.h index 13996d4ab64..2cec4c7c513 100644 --- a/include/configs/cradle.h +++ b/include/configs/cradle.h @@ -47,6 +47,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/csb226.h b/include/configs/csb226.h index 879607cb56d..1b39d23c884 100644 --- a/include/configs/csb226.h +++ b/include/configs/csb226.h @@ -94,6 +94,7 @@ * */ #define CFG_MALLOC_LEN (128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_LONGHELP /* undef to save memory */ #define CFG_PROMPT "uboot> " /* Monitor Command Prompt */ diff --git a/include/configs/dnp1110.h b/include/configs/dnp1110.h index 8594e65822b..f3a871bda3f 100644 --- a/include/configs/dnp1110.h +++ b/include/configs/dnp1110.h @@ -47,6 +47,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h index 9a4c7e6ac41..d9dd620c1ca 100644 --- a/include/configs/ep7312.h +++ b/include/configs/ep7312.h @@ -48,6 +48,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/impa7.h b/include/configs/impa7.h index fb35bd4e7ca..b4c1edfa3dc 100644 --- a/include/configs/impa7.h +++ b/include/configs/impa7.h @@ -48,6 +48,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/innokom.h b/include/configs/innokom.h index cfe9032893d..709c0d7a993 100644 --- a/include/configs/innokom.h +++ b/include/configs/innokom.h @@ -87,6 +87,7 @@ * */ #define CFG_MALLOC_LEN (256*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_LONGHELP /* undef to save memory */ #define CFG_PROMPT "uboot> " /* Monitor Command Prompt */ diff --git a/include/configs/lart.h b/include/configs/lart.h index 32153fc5216..c98f3777ca2 100644 --- a/include/configs/lart.h +++ b/include/configs/lart.h @@ -46,6 +46,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h index 609ce339ae1..bfced4420ba 100644 --- a/include/configs/lubbock.h +++ b/include/configs/lubbock.h @@ -52,6 +52,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h index 74511922de5..04215a60ece 100644 --- a/include/configs/lwmon.h +++ b/include/configs/lwmon.h @@ -113,6 +113,7 @@ #undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */ #define CONFIG_WATCHDOG 1 /* watchdog enabled */ +#define CFG_WATCHDOG_FREQ (CFG_HZ / 20) #undef CONFIG_STATUS_LED /* Status LED disabled */ diff --git a/include/configs/omap1510inn.h b/include/configs/omap1510inn.h index 66a8b6bbd4c..845e4d2473c 100644 --- a/include/configs/omap1510inn.h +++ b/include/configs/omap1510inn.h @@ -27,6 +27,12 @@ #define __CONFIG_H /* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + +/* * High Level Configuration Options * (easy to change) */ @@ -49,6 +55,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/omap1610inn.h b/include/configs/omap1610inn.h index d65e2a01d6f..9bdd795b887 100644 --- a/include/configs/omap1610inn.h +++ b/include/configs/omap1610inn.h @@ -27,6 +27,12 @@ #define __CONFIG_H /* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + +/* * High Level Configuration Options * (easy to change) */ @@ -50,6 +56,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers @@ -66,14 +73,13 @@ #define CFG_NS16550 #define CFG_NS16550_SERIAL #define CFG_NS16550_REG_SIZE (-4) -#define CFG_NS16550_CLK (48000000) /* can be 12M/32Khz or 48Mhz */ -#define CFG_NS16550_COM1 0xfffb0000 /* uart1, bluetooth uart - on helen */ +#define CFG_NS16550_CLK (48000000) /* can be 12M/32Khz or 48Mhz */ +#define CFG_NS16550_COM1 0xfffb0000 /* uart1, bluetooth uart on helen */ /* * select serial console configuration */ -#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on OMAP1610 Innovator */ +#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on OMAP1610 Innovator */ /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/shannon.h b/include/configs/shannon.h index 77af2f3bc1c..7afe62d7cc1 100644 --- a/include/configs/shannon.h +++ b/include/configs/shannon.h @@ -52,6 +52,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h index a557bc6cf93..a7621a2d11a 100644 --- a/include/configs/smdk2400.h +++ b/include/configs/smdk2400.h @@ -55,6 +55,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index 0dcbbb063d3..7e3a02d29ba 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -54,6 +54,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/trab.h b/include/configs/trab.h index 4d37807e7d6..95ee37e2a74 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -89,6 +89,7 @@ * Size of malloc() pool */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ /* * Hardware drivers diff --git a/include/configs/wepep250.h b/include/configs/wepep250.h index ecb7215e2e6..a8a8ee535cd 100644 --- a/include/configs/wepep250.h +++ b/include/configs/wepep250.h @@ -23,6 +23,12 @@ #ifndef __CONFIG_H #define __CONFIG_H +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#define CONFIG_INIT_CRITICAL /* undef for developing */ + #define CONFIG_PXA250 1 /* this is an PXA250 CPU */ #define CONFIG_WEPEP250 1 /* config for wepep250 board */ #undef CONFIG_USE_IRQ /* don't need use IRQ/FIQ */ @@ -93,6 +99,7 @@ * Malloc pool need to host env + 128 Kb reserve for other allocations. */ #define CFG_MALLOC_LEN (CFG_ENV_SIZE + (128<<10) ) +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CONFIG_STACKSIZE (120<<10) /* stack size */ diff --git a/lib_arm/board.c b/lib_arm/board.c index a6029b0f200..16e1575ed51 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -149,7 +149,7 @@ static int display_dram_config (void) return (0); #endif - puts ("DRAM Configuration:\n"); + puts ("RAM Configuration:\n"); for(i=0; i<CONFIG_NR_DRAM_BANKS; i++) { printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start); @@ -173,7 +173,7 @@ static void display_flash_config (ulong size) /* - * Breath some life into the board... + * Breathe some life into the board... * * Initialize a serial port as console, and carry out some hardware * tests. @@ -219,8 +219,6 @@ void start_armboot (void) DECLARE_GLOBAL_DATA_PTR; ulong size; - gd_t gd_data; - bd_t bd_data; init_fnc_t **init_fnc_ptr; char *s; #if defined(CONFIG_VFD) @@ -228,9 +226,9 @@ void start_armboot (void) #endif /* Pointer is writable since we allocated a register for it */ - gd = &gd_data; - memset ((void *)gd, 0, sizeof (gd_t)); - gd->bd = &bd_data; + gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t)); + memset ((void*)gd, 0, sizeof (gd_t)); + gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); memset (gd->bd, 0, sizeof (bd_t)); monitor_flash_len = _armboot_end_data - _armboot_start; @@ -246,25 +244,21 @@ void start_armboot (void) display_flash_config (size); #ifdef CONFIG_VFD -# ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -# endif +# ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +# endif /* * reserve memory for VFD display (always full pages) */ - /* armboot_real_end is defined in the board-specific linker script */ - addr = (_armboot_real_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + /* armboot_end is defined in the board-specific linker script */ + addr = (_armboot_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); size = vfd_setmem (addr); gd->fb_base = addr; - /* round to the next page boundary */ - addr += size; - addr = (addr + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); - mem_malloc_init (addr); -#else - /* armboot_real_end is defined in the board-specific linker script */ - mem_malloc_init (_armboot_real_end); #endif /* CONFIG_VFD */ + /* armboot_start is defined in the board-specific linker script */ + mem_malloc_init (_armboot_start - CFG_MALLOC_LEN); + #if (CONFIG_COMMANDS & CFG_CMD_NAND) puts ("NAND:"); nand_init(); /* go init the NAND */ @@ -281,10 +275,10 @@ void start_armboot (void) #ifdef CONFIG_VFD /* must do this after the framebuffer is allocated */ drv_vfd_init(); -#endif +#endif /* CONFIG_VFD */ /* IP Address */ - bd_data.bi_ip_addr = getenv_IPaddr ("ipaddr"); + gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); /* MAC Address */ { @@ -297,7 +291,7 @@ void start_armboot (void) s = (i > 0) ? tmp : NULL; for (reg = 0; reg < 6; ++reg) { - bd_data.bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; + gd->bd->bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; if (s) s = (*e) ? e + 1 : e; } @@ -317,6 +311,7 @@ void start_armboot (void) /* enable exceptions */ enable_interrupts (); + /* Perform network card initialisation if necessary */ #ifdef CONFIG_DRIVER_CS8900 cs8900_get_enetaddr (gd->bd->bi_enetaddr); #endif diff --git a/lib_ppc/Makefile b/lib_ppc/Makefile index 36ddf3cacf4..652a4199ec5 100644 --- a/lib_ppc/Makefile +++ b/lib_ppc/Makefile @@ -28,7 +28,7 @@ LIB = lib$(ARCH).a AOBJS = ppcstring.o ticks.o COBJS = board.o \ - bat_rw.o cache.o extable.o kgdb.o time.o + bat_rw.o cache.o extable.o kgdb.o time.o interrupts.o OBJS = $(AOBJS) $(COBJS) diff --git a/lib_ppc/interrupts.c b/lib_ppc/interrupts.c new file mode 100644 index 00000000000..1e540a5c3f7 --- /dev/null +++ b/lib_ppc/interrupts.c @@ -0,0 +1,148 @@ +/* + * (C) Copyright 2000-2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2003 + * Gleb Natapov <gnatapov@mrv.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/processor.h> +#include <watchdog.h> +#ifdef CONFIG_STATUS_LED +#include <status_led.h> +#endif + +#ifdef CONFIG_SHOW_ACTIVITY + extern void board_show_activity (ulong); +#endif /* CONFIG_SHOW_ACTIVITY */ + +#ifndef CFG_WATCHDOG_FREQ +#define CFG_WATCHDOG_FREQ (CFG_HZ / 2) +#endif + +extern int interrupt_init_cpu (unsigned *); +extern void timer_interrupt_cpu (struct pt_regs *); + +static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ + +static __inline__ unsigned long get_msr (void) +{ + unsigned long msr; + + asm volatile ("mfmsr %0":"=r" (msr):); + + return msr; +} + +static __inline__ void set_msr (unsigned long msr) +{ + asm volatile ("mtmsr %0"::"r" (msr)); +} + +static __inline__ unsigned long get_dec (void) +{ + unsigned long val; + + asm volatile ("mfdec %0":"=r" (val):); + + return val; +} + + +static __inline__ void set_dec (unsigned long val) +{ + if (val) + asm volatile ("mtdec %0"::"r" (val)); +} + + +void enable_interrupts (void) +{ + set_msr (get_msr () | MSR_EE); +} + +/* returns flag if MSR_EE was set before */ +int disable_interrupts (void) +{ + ulong msr = get_msr (); + + set_msr (msr & ~MSR_EE); + return ((msr & MSR_EE) != 0); +} + +int interrupt_init (void) +{ + int ret; + + /* call cpu specific function from $(CPU)/interrupts.c */ + ret = interrupt_init_cpu (&decrementer_count); + + if (ret) + return ret; + + set_dec (decrementer_count); + + set_msr (get_msr () | MSR_EE); + + return (0); +} + +static volatile ulong timestamp = 0; + +void timer_interrupt (struct pt_regs *regs) +{ + /* call cpu specific function from $(CPU)/interrupts.c */ + timer_interrupt_cpu (regs); + + /* Restore Decrementer Count */ + set_dec (decrementer_count); + + timestamp++; + +#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) + if ((timestamp % (CFG_WATCHDOG_FREQ)) == 0) + WATCHDOG_RESET (); +#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ + +#ifdef CONFIG_STATUS_LED + status_led_tick (timestamp); +#endif /* CONFIG_STATUS_LED */ + +#ifdef CONFIG_SHOW_ACTIVITY + board_show_activity (timestamp); +#endif /* CONFIG_SHOW_ACTIVITY */ +} + +void reset_timer (void) +{ + timestamp = 0; +} + +ulong get_timer (ulong base) +{ + return (timestamp - base); +} + +void set_timer (ulong t) +{ + timestamp = t; +} diff --git a/tools/Makefile b/tools/Makefile index c191203e453..0576a3f43e7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -180,12 +180,14 @@ else endif environment.c: + @rm -f environment.c ln -s ../common/environment.c environment.c environment.o: environment.c $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c $< crc32.c: + @rm -f crc32.c ln -s ../lib_generic/crc32.c crc32.c $(LOGO_H): bmp_logo $(LOGO_BMP) |