* 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
This commit is contained in:
parent
fa1399ed12
commit
a8c7c708a9
@ -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.
|
||||
|
||||
|
4
MAKEALL
4
MAKEALL
@ -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
|
||||
}
|
||||
|
||||
|
40
Makefile
40
Makefile
@ -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
|
||||
|
||||
|
19
README
19
README
@ -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
|
||||
|
@ -1 +1 @@
|
||||
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
|
||||
|
@ -1,2 +1,2 @@
|
||||
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)
|
||||
timer_interrupt_cpu (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)
|
||||
{
|
||||
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
|
||||
*/
|
||||
#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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
@ -45,74 +38,20 @@ 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;
|
||||
}
|
||||
|
@ -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)
|
||||
int interrupt_init_cpu (ulong *decrementer_count)
|
||||
{
|
||||
unsigned long msr;
|
||||
*decrementer_count = get_tbclk() / CFG_HZ;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
timer_interrupt_cpu (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)
|
||||
{
|
||||
timestamp = t;
|
||||
/* nothing to do here */
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -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)
|
||||
int interrupt_init_cpu (unsigned *decrementer_count)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
timestamp = t;
|
||||
/* nothing to do here */
|
||||
return;
|
||||
}
|
||||
|
@ -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)
|
||||
void timer_interrupt_cpu (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)
|
||||
{
|
||||
timestamp = t;
|
||||
/* nothing to do here */
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
void timer_interrupt_cpu (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 */
|
||||
/* nothing to do here */
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void reset_timer (void)
|
||||
{
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
ulong get_timer (ulong base)
|
||||
{
|
||||
return (timestamp - base);
|
||||
}
|
||||
|
||||
void set_timer (ulong t)
|
||||
{
|
||||
timestamp = t;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -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)
|
||||
|
@ -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: ??? */
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
27
doc/README.ARM-memory-map
Normal file
27
doc/README.ARM-memory-map
Normal file
@ -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.
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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)
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -26,6 +26,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 */
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -26,6 +26,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 */
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
148
lib_ppc/interrupts.c
Normal file
148
lib_ppc/interrupts.c
Normal file
@ -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;
|
||||
}
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user