Commit a8c7c708 authored by wdenk's avatar wdenk

* 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
parent fa1399ed
......@@ -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.
......
#!/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
......
TEXT_BASE = 0x21f00000
TEXT_BASE = 0x21f80000
......@@ -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
TEXT_BASE = 0xa0f08000
TEXT_BASE = 0xa0f80000
#TEXT_BASE = 0
......@@ -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
......@@ -25,4 +25,4 @@
# MA 02111-1307 USA
#
TEXT_BASE = 0xc0f00000
TEXT_BASE = 0xc0f80000
......@@ -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 */
......@@ -25,4 +25,4 @@
# MA 02111-1307 USA
#
TEXT_BASE = 0xc1700000
TEXT_BASE = 0xc1780000
......@@ -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
......@@ -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;
......
......@@ -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
......@@ -22,5 +22,5 @@
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
ifndef TEXT_BASE
TEXT_BASE = 0x0DF00000
TEXT_BASE = 0x0DF40000
endif
......@@ -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;
}
......
......@@ -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)
......
......@@ -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");
......
......@@ -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;
}
/****************************************************************************/
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -88,17 +88,15 @@ static void cp_delay (void)
int cpu_init (void)
{
/*
* setup up stack if necessary
* setup up stacks if necessary
*/