summaryrefslogtreecommitdiffstats
path: root/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'cpu')
-rw-r--r--cpu/74xx_7xx/interrupts.c109
-rw-r--r--cpu/arm720t/cpu.c15
-rw-r--r--cpu/arm720t/start.S48
-rw-r--r--cpu/arm920t/cpu.c16
-rw-r--r--cpu/arm920t/start.S50
-rw-r--r--cpu/arm925t/cpu.c16
-rw-r--r--cpu/arm925t/start.S53
-rw-r--r--cpu/arm926ejs/cpu.c16
-rw-r--r--cpu/arm926ejs/start.S53
-rw-r--r--cpu/at91rm9200/cpu.c18
-rw-r--r--cpu/at91rm9200/start.S22
-rw-r--r--cpu/mpc5xx/interrupts.c116
-rw-r--r--cpu/mpc5xxx/interrupts.c106
-rw-r--r--cpu/mpc824x/interrupts.c99
-rw-r--r--cpu/mpc8260/interrupts.c131
-rw-r--r--cpu/mpc8xx/interrupts.c117
-rw-r--r--cpu/ppc4xx/405gp_enet.c2
-rw-r--r--cpu/ppc4xx/interrupts.c95
-rw-r--r--cpu/pxa/cpu.c19
-rw-r--r--cpu/pxa/start.S42
-rw-r--r--cpu/sa1100/cpu.c14
-rw-r--r--cpu/sa1100/start.S48
22 files changed, 225 insertions, 980 deletions
diff --git a/cpu/74xx_7xx/interrupts.c b/cpu/74xx_7xx/interrupts.c
index 2e2e45615d..f0ea485265 100644
--- a/cpu/74xx_7xx/interrupts.c
+++ b/cpu/74xx_7xx/interrupts.c
@@ -32,62 +32,7 @@
#include <commproc.h>
#include <command.h>
-/****************************************************************************/
-
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-/****************************************************************************/
-
-static __inline__ unsigned long
-get_msr(void)
-{
- unsigned long msr;
-
- asm volatile("mfmsr %0" : "=r" (msr) :);
- return msr;
-}
-
-static __inline__ void
-set_msr(unsigned long msr)
-{
- asm volatile("mtmsr %0" : : "r" (msr));
-}
-
-static __inline__ unsigned long
-get_dec(void)
-{
- unsigned long val;
-
- asm volatile("mfdec %0" : "=r" (val) :);
- return val;
-}
-
-
-static __inline__ void
-set_dec(unsigned long val)
-{
- asm volatile("mtdec %0" : : "r" (val));
-}
-
-
-void
-enable_interrupts(void)
-{
- set_msr (get_msr() | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int
-disable_interrupts(void)
-{
- ulong msr = get_msr();
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/****************************************************************************/
-
-int interrupt_init(void)
+int interrupt_init_cpu (unsigned *decrementer_count)
{
#if defined(DEBUG) && !defined(CONFIG_AMIGAONEG3SE)
printf("interrupt_init: GT main cause reg: %08x:%08x\n",
@@ -103,22 +48,8 @@ int interrupt_init(void)
GTREGREAD(ETHERNET2_INTERRUPT_MASK_REGISTER));
puts("interrupt_init: setting decrementer_count\n");
#endif
- decrementer_count = get_tbclk() / CFG_HZ;
+ *decrementer_count = get_tbclk() / CFG_HZ;
-#ifdef DEBUG
- puts("interrupt_init: setting actual decremter\n");
-#endif
- set_dec (get_tbclk() / CFG_HZ);
-
-#ifdef DEBUG
- printf("interrupt_init: enabling interrupts (msr = %08lx)\n",
- get_msr());
-#endif
- set_msr (get_msr() | MSR_EE);
-
-#ifdef DEBUG
- printf("interrupt_init: done. (msr = %08lx)\n", get_msr());
-#endif
return (0);
}
@@ -141,40 +72,10 @@ volatile ulong timestamp = 0;
* Trivial implementation - no need to be really accurate.
*/
void
-timer_interrupt(struct pt_regs *regs)
-{
- set_dec(decrementer_count);
- timestamp++;
-
-#if defined(CONFIG_WATCHDOG)
- if ((timestamp % (CFG_HZ / 2)) == 0) {
-#if defined(CONFIG_PCIPPC2)
- extern void pcippc2_wdt_reset (void);
-
- pcippc2_wdt_reset();
-#endif
- }
-#endif /* CONFIG_WATCHDOG */
-}
-
-/****************************************************************************/
-
-void
-reset_timer(void)
-{
- timestamp = 0;
-}
-
-ulong
-get_timer(ulong base)
-{
- return (timestamp - base);
-}
-
-void
-set_timer(ulong t)
+timer_interrupt_cpu (struct pt_regs *regs)
{
- timestamp = t;
+ /* nothing to do here */
+ return;
}
/****************************************************************************/
diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c
index 7521fbaf5f..b6fcef9b43 100644
--- a/cpu/arm720t/cpu.c
+++ b/cpu/arm720t/cpu.c
@@ -82,18 +82,15 @@ static void cp_delay (void)
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end + \
- CONFIG_STACKSIZE + \
- CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif
- return (0);
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S
index fdedc915fb..8ddb0c9264 100644
--- a/cpu/arm720t/start.S
+++ b/cpu/arm720t/start.S
@@ -90,14 +90,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -132,32 +124,32 @@ reset:
bl cpu_init_crit
#endif
-relocate:
- /*
- * relocate armboot to RAM
- */
- adr r0, _start /* r0 <- current position of code */
+relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq stack_setup
+
ldr r2, _armboot_start
ldr r3, _armboot_end
- sub r2, r3, r2 /* r2 <- size of armboot */
- ldr r1, _TEXT_BASE /* r1 <- destination address */
- add r2, r0, r2 /* r2 <- source end address */
+ sub r2, r3, r2 /* r2 <- size of armboot */
+ add r2, r0, r2 /* r2 <- source end address */
- /*
- * r0 = source address
- * r1 = target address
- * r2 = source end address
- */
copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
+ ldmia r0!, {r3-r10} /* copy from source address [r0] */
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
ldr pc, _start_armboot
diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c
index 41cebdfd94..e638c1f8dd 100644
--- a/cpu/arm920t/cpu.c
+++ b/cpu/arm920t/cpu.c
@@ -87,17 +87,15 @@ static void cp_delay (void)
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
-#endif /* CONFIG_USE_IRQ */
- return (0);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
+#endif
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S
index 17c5f86bc3..d640942d8a 100644
--- a/cpu/arm920t/start.S
+++ b/cpu/arm920t/start.S
@@ -91,14 +91,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -171,28 +163,33 @@ reset:
bl cpu_init_crit
#endif
-relocate:
- /*
- * relocate armboot to RAM
- */
- adr r0, _start /* r0 <- current position of code */
+relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq stack_setup
+
ldr r2, _armboot_start
ldr r3, _armboot_end
- sub r2, r3, r2 /* r2 <- size of armboot */
- ldr r1, _TEXT_BASE /* r1 <- destination address */
- add r2, r0, r2 /* r2 <- source end address */
+ sub r2, r3, r2 /* r2 <- size of armboot */
+ add r2, r0, r2 /* r2 <- source end address */
- /*
- * r0 = source address
- * r1 = target address
- * r2 = source end address
- */
copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
+ ldmia r0!, {r3-r10} /* copy from source address [r0] */
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
+
#if 0
/* try doing this stuff after the relocation */
ldr r0, =pWTCON
@@ -214,11 +211,6 @@ copy_loop:
/* END stuff after relocation */
#endif
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
ldr pc, _start_armboot
_start_armboot: .word start_armboot
diff --git a/cpu/arm925t/cpu.c b/cpu/arm925t/cpu.c
index c55fbc7959..6bac53da82 100644
--- a/cpu/arm925t/cpu.c
+++ b/cpu/arm925t/cpu.c
@@ -88,17 +88,15 @@ static void cp_delay (void)
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
-#endif /* CONFIG_USE_IRQ */
- return (0);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
+#endif
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/arm925t/start.S b/cpu/arm925t/start.S
index 6dd3012055..0a3042d9a6 100644
--- a/cpu/arm925t/start.S
+++ b/cpu/arm925t/start.S
@@ -100,14 +100,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -168,34 +160,41 @@ poll1:
ldrh r1, [r0]
ands r1, r1, #0x01
beq poll1
- bl cpu_init_crit
-relocate:
/*
- * relocate armboot to RAM
+ * we do sys-critical inits only at reboot,
+ * not when booting from ram!
*/
- adr r0, _start /* r0 <- current position of code */
+#ifdef CONFIG_INIT_CRITICAL
+ bl cpu_init_crit
+#endif
+
+relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq stack_setup
+
ldr r2, _armboot_start
ldr r3, _armboot_end
- sub r2, r3, r2 /* r2 <- size of armboot */
- ldr r1, _TEXT_BASE /* r1 <- destination address */
- add r2, r0, r2 /* r2 <- source end address */
+ sub r2, r3, r2 /* r2 <- size of armboot */
+ add r2, r0, r2 /* r2 <- source end address */
- /*
- * r0 = source address
- * r1 = target address
- * r2 = source end address
- */
copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
+ ldmia r0!, {r3-r10} /* copy from source address [r0] */
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
ldr pc, _start_armboot
diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c
index a91aa37828..748a21a416 100644
--- a/cpu/arm926ejs/cpu.c
+++ b/cpu/arm926ejs/cpu.c
@@ -88,17 +88,15 @@ static void cp_delay (void)
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
-#endif /* CONFIG_USE_IRQ */
- return (0);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
+#endif
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/arm926ejs/start.S b/cpu/arm926ejs/start.S
index b860fd408e..39d7409b03 100644
--- a/cpu/arm926ejs/start.S
+++ b/cpu/arm926ejs/start.S
@@ -108,14 +108,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -162,34 +154,41 @@ reset:
str r1, [r0]
ldr r0, =REG_IHL2_MIR
str r1, [r0]
- bl cpu_init_crit
-relocate:
/*
- * relocate armboot to RAM
+ * we do sys-critical inits only at reboot,
+ * not when booting from ram!
*/
- adr r0, _start /* r0 <- current position of code */
+#ifdef CONFIG_INIT_CRITICAL
+ bl cpu_init_crit
+#endif
+
+relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq stack_setup
+
ldr r2, _armboot_start
ldr r3, _armboot_end
- sub r2, r3, r2 /* r2 <- size of armboot */
- ldr r1, _TEXT_BASE /* r1 <- destination address */
- add r2, r0, r2 /* r2 <- source end address */
+ sub r2, r3, r2 /* r2 <- size of armboot */
+ add r2, r0, r2 /* r2 <- source end address */
- /*
- * r0 = source address
- * r1 = target address
- * r2 = source end address
- */
copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
+ ldmia r0!, {r3-r10} /* copy from source address [r0] */
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
ldr pc, _start_armboot
diff --git a/cpu/at91rm9200/cpu.c b/cpu/at91rm9200/cpu.c
index 262ca340e1..b0cfcefeca 100644
--- a/cpu/at91rm9200/cpu.c
+++ b/cpu/at91rm9200/cpu.c
@@ -81,18 +81,16 @@ static void cp_delay(void)
int cpu_init(void)
{
- /*
- * setup up stack if necessary
- */
+ /*
+ * setup up stacks if necessary
+ */
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif
- return 0;
+ return 0;
}
int cleanup_before_linux(void)
diff --git a/cpu/at91rm9200/start.S b/cpu/at91rm9200/start.S
index 9fa1461d2d..a93d0454d6 100644
--- a/cpu/at91rm9200/start.S
+++ b/cpu/at91rm9200/start.S
@@ -93,14 +93,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -147,10 +139,16 @@ copyex:
bl cpu_init_crit
#endif
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
+
ldr pc,_start_armboot
_start_armboot: .word start_armboot
diff --git a/cpu/mpc5xx/interrupts.c b/cpu/mpc5xx/interrupts.c
index 4618680000..3678b5bfc8 100644
--- a/cpu/mpc5xx/interrupts.c
+++ b/cpu/mpc5xx/interrupts.c
@@ -28,16 +28,9 @@
*/
#include <common.h>
-#include <watchdog.h>
#include <mpc5xx.h>
#include <asm/processor.h>
-/************************************************************************/
-
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-/************************************************************************/
-
struct interrupt_action {
interrupt_handler_t *handler;
void *arg;
@@ -46,73 +39,19 @@ struct interrupt_action {
static struct interrupt_action irq_vecs[NR_IRQS];
/*
- * Local function prototypes
- */
-static __inline__ unsigned long get_msr (void)
-{
- unsigned long msr;
-
- asm volatile ("mfmsr %0":"=r" (msr):);
-
- return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
- asm volatile ("mtmsr %0"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec (void)
-{
- unsigned long val;
-
- asm volatile ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-
-static __inline__ void set_dec (unsigned long val)
-{
- asm volatile ("mtdec %0"::"r" (val));
-}
-
-/*
- * Enable interrupts
- */
-void enable_interrupts (void)
-{
- set_msr (get_msr () | MSR_EE);
-}
-
-/*
- * Returns flag if MSR_EE was set before
- */
-int disable_interrupts (void)
-{
- ulong msr = get_msr ();
-
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/*
* Initialise interrupts
*/
-int interrupt_init (void)
+int interrupt_init_cpu (ulong *decrementer_count)
{
volatile immap_t *immr = (immap_t *) CFG_IMMR;
/* Decrementer used here for status led */
- decrementer_count = get_tbclk () / CFG_HZ;
+ *decrementer_count = get_tbclk () / CFG_HZ;
/* Disable all interrupts */
immr->im_siu_conf.sc_simask = 0;
- set_dec (decrementer_count);
-
- set_msr (get_msr () | MSR_EE);
return (0);
}
@@ -206,19 +145,14 @@ void irq_free_handler (int vec)
irq_vecs[vec].arg = NULL;
}
-volatile ulong timestamp = 0;
-
/*
* Timer interrupt - gets called when bit 0 of DEC changes from
* 0. Decrementer is enabled with bit TBE in TBSCR.
*/
-void timer_interrupt (struct pt_regs *regs)
+void timer_interrupt_cpu (struct pt_regs *regs)
{
volatile immap_t *immr = (immap_t *) CFG_IMMR;
-#ifdef CONFIG_STATUS_LED
- extern void status_led_tick (ulong);
-#endif
#if 0
printf ("*** Timer Interrupt *** ");
#endif
@@ -227,47 +161,5 @@ void timer_interrupt (struct pt_regs *regs)
__asm__ ("nop");
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
- /* Restore Decrementer Count */
- set_dec (decrementer_count);
-
- timestamp++;
-
-#ifdef CONFIG_STATUS_LED
- status_led_tick (timestamp);
-#endif /* CONFIG_STATUS_LED */
-
-#if defined(CONFIG_WATCHDOG)
- /*
- * The shortest watchdog period of all boards
- * is approx. 1 sec, thus re-trigger watchdog at least
- * every 500 ms = CFG_HZ / 2
- */
- if ((timestamp % (CFG_HZ / 2)) == 0) {
- reset_5xx_watchdog (immr);
- }
-#endif /* CONFIG_WATCHDOG */
-}
-
-/*
- * Reset timer
- */
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-/*
- * Get Timer
- */
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-/*
- * Set timer
- */
-void set_timer (ulong t)
-{
- timestamp = t;
+ return;
}
diff --git a/cpu/mpc5xxx/interrupts.c b/cpu/mpc5xxx/interrupts.c
index 5aa43880bb..7bacecd595 100644
--- a/cpu/mpc5xxx/interrupts.c
+++ b/cpu/mpc5xxx/interrupts.c
@@ -32,79 +32,10 @@
#include <asm/processor.h>
#include <command.h>
-/****************************************************************************/
-
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-/****************************************************************************/
-
-static __inline__ unsigned long
-get_msr(void)
-{
- unsigned long msr;
-
- asm volatile("mfmsr %0" : "=r" (msr) :);
- return msr;
-}
-
-static __inline__ void
-set_msr(unsigned long msr)
-{
- asm volatile("mtmsr %0" : : "r" (msr));
-}
-
-static __inline__ unsigned long
-get_dec(void)
-{
- unsigned long val;
-
- asm volatile("mfdec %0" : "=r" (val) :);
- return val;
-}
-
-
-static __inline__ void
-set_dec(unsigned long val)
-{
- asm volatile("mtdec %0" : : "r" (val));
-}
-
-
-void
-enable_interrupts(void)
-{
- set_msr (get_msr() | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int
-disable_interrupts(void)
-{
- ulong msr = get_msr();
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/****************************************************************************/
-
-int interrupt_init(void)
+int interrupt_init_cpu (ulong *decrementer_count)
{
- decrementer_count = get_tbclk() / CFG_HZ;
+ *decrementer_count = get_tbclk() / CFG_HZ;
-#ifdef DEBUG
- puts("interrupt_init: setting actual decremter\n");
-#endif
- set_dec (get_tbclk() / CFG_HZ);
-
-#ifdef DEBUG
- printf("interrupt_init: enabling interrupts (msr = %08lx)\n",
- get_msr());
-#endif
- set_msr (get_msr() | MSR_EE);
-
-#ifdef DEBUG
- printf("interrupt_init: done. (msr = %08lx)\n", get_msr());
-#endif
return (0);
}
@@ -119,38 +50,11 @@ external_interrupt(struct pt_regs *regs)
puts("external_interrupt (oops!)\n");
}
-volatile ulong timestamp = 0;
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void
-timer_interrupt(struct pt_regs *regs)
-{
- set_dec(decrementer_count);
- timestamp++;
-}
-
-/****************************************************************************/
-
-void
-reset_timer(void)
-{
- timestamp = 0;
-}
-
-ulong
-get_timer(ulong base)
-{
- return (timestamp - base);
-}
-
void
-set_timer(ulong t)
+timer_interrupt_cpu (struct pt_regs *regs)
{
- timestamp = t;
+ /* nothing to do here */
+ return;
}
/****************************************************************************/
diff --git a/cpu/mpc824x/interrupts.c b/cpu/mpc824x/interrupts.c
index 825857b054..acb8947e0d 100644
--- a/cpu/mpc824x/interrupts.c
+++ b/cpu/mpc824x/interrupts.c
@@ -27,62 +27,11 @@
#include <asm/processor.h>
#include <asm/pci_io.h>
#include <commproc.h>
-#include <watchdog.h>
#include "drivers/epic.h"
-/****************************************************************************/
-
-unsigned decrementer_count; /* count val for 1e6/HZ microseconds */
-
-static __inline__ unsigned long get_msr (void)
-{
- unsigned long msr;
-
- asm volatile ("mfmsr %0":"=r" (msr):);
-
- return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
- asm volatile ("mtmsr %0"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec (void)
-{
- unsigned long val;
-
- asm volatile ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-
-static __inline__ void set_dec (unsigned long val)
-{
- asm volatile ("mtdec %0"::"r" (val));
-}
-
-
-void enable_interrupts (void)
+int interrupt_init_cpu (unsigned *decrementer_count)
{
- set_msr (get_msr () | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
- ulong msr = get_msr ();
-
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/****************************************************************************/
-
-int interrupt_init (void)
-{
- decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ;
+ *decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ;
/*
* It's all broken at the moment and I currently don't need
@@ -96,10 +45,6 @@ int interrupt_init (void)
/* EPIC won't generate INT unless Current Task Pri < 15 */
epicCurTaskPrioSet(0);
- set_dec (decrementer_count);
-
- set_msr (get_msr () | MSR_EE);
-
return (0);
}
@@ -141,42 +86,8 @@ void irq_free_handler (int vec)
vga?
*/
-volatile ulong timestamp = 0;
-
-void timer_interrupt (struct pt_regs *regs)
-{
- /* Restore Decrementer Count */
- set_dec (decrementer_count);
-
- timestamp++;
-
-#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
- if ((timestamp % (CFG_HZ / 2)) == 0) {
- WATCHDOG_RESET ();
- }
-#endif /* CONFIG_WATCHDOG */
-#if defined(CONFIG_SHOW_ACTIVITY) && defined(CONFIG_OXC)
- if ((timestamp % (CFG_HZ / 10)) == 0) {
- {
- extern void oxc_toggle_activeled (void);
-
- oxc_toggle_activeled ();
- }
- }
-#endif
-}
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
+void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp)
{
- timestamp = t;
+ /* nothing to do here */
+ return;
}
diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c
index 3c5ef7460e..e2a6c97782 100644
--- a/cpu/mpc8260/interrupts.c
+++ b/cpu/mpc8260/interrupts.c
@@ -24,19 +24,13 @@
*/
#include <common.h>
-#include <watchdog.h>
#include <command.h>
#include <mpc8260.h>
#include <mpc8260_irq.h>
#include <asm/processor.h>
-#ifdef CONFIG_STATUS_LED
-#include <status_led.h>
-#endif
/****************************************************************************/
-unsigned decrementer_count; /* count val for 1e6/HZ microseconds */
-
struct irq_action {
interrupt_handler_t *handler;
void *arg;
@@ -144,57 +138,13 @@ static int m8260_get_irq (struct pt_regs *regs)
/* end of code ripped out of arch/ppc/kernel/ppc8260_pic.c */
/****************************************************************************/
-static __inline__ unsigned long get_msr (void)
-{
- unsigned long msr;
-
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
- __asm__ __volatile__ ("mtmsr %0;sync;isync"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec (void)
-{
- unsigned long val;
-
- __asm__ __volatile__ ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-static __inline__ void set_dec (unsigned long val)
-{
- __asm__ __volatile__ ("mtdec %0"::"r" (val));
-}
-
-void enable_interrupts (void)
-{
- set_msr (get_msr () | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
- ulong msr = get_msr ();
-
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/****************************************************************************/
-
-int interrupt_init (void)
+int interrupt_init_cpu (unsigned *decrementer_count)
{
DECLARE_GLOBAL_DATA_PTR;
volatile immap_t *immr = (immap_t *) CFG_IMMR;
- decrementer_count = (gd->bus_clk / 4) / CFG_HZ;
+ *decrementer_count = (gd->bus_clk / 4) / CFG_HZ;
/* Initialize the default interrupt mapping priorities */
immr->im_intctl.ic_sicr = 0;
@@ -216,10 +166,6 @@ int interrupt_init (void)
immr->im_intctl.ic_siexr = -1;
#endif
- set_dec (decrementer_count);
-
- set_msr (get_msr () | MSR_EE);
-
return (0);
}
@@ -236,7 +182,7 @@ void external_interrupt (struct pt_regs *regs)
m8260_mask_and_ack (irq);
- set_msr (get_msr () | MSR_EE);
+ enable_interrupts ();
if (irq_handlers[irq].handler != NULL)
(*irq_handlers[irq].handler) (irq_handlers[irq].arg);
@@ -292,75 +238,10 @@ void irq_free_handler (int irq)
/****************************************************************************/
-volatile ulong timestamp = 0;
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void timer_interrupt (struct pt_regs *regs)
-{
-#if defined(CONFIG_WATCHDOG) || defined(CFG_HYMOD_DBLEDS)
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-#endif /* CONFIG_WATCHDOG */
-
- /* Restore Decrementer Count */
- set_dec (decrementer_count);
-
- timestamp++;
-
-#if defined(CONFIG_WATCHDOG) || \
- defined(CFG_CMA_LCD_HEARTBEAT) || \
- defined(CFG_HYMOD_DBLEDS)
-
- if ((timestamp % CFG_HZ) == 0) {
-#if defined(CFG_CMA_LCD_HEARTBEAT)
- extern void lcd_heartbeat (void);
-#endif /* CFG_CMA_LCD_HEARTBEAT */
-#if defined(CFG_HYMOD_DBLEDS)
- volatile iop8260_t *iop = &immr->im_ioport;
- static int shift = 0;
-#endif /* CFG_HYMOD_DBLEDS */
-
-#if defined(CFG_CMA_LCD_HEARTBEAT)
- lcd_heartbeat ();
-#endif /* CFG_CMA_LCD_HEARTBEAT */
-
-#if defined(CONFIG_WATCHDOG)
- reset_8260_watchdog (immr);
-#endif /* CONFIG_WATCHDOG */
-
-#if defined(CFG_HYMOD_DBLEDS)
- /* hymod daughter board LEDs */
- if (++shift > 3)
- shift = 0;
- iop->iop_pdatd =
- (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift));
-#endif /* CFG_HYMOD_DBLEDS */
- }
-#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */
-
-#ifdef CONFIG_STATUS_LED
- status_led_tick (timestamp);
-#endif /* CONFIG_STATUS_LED */
-}
-
-/****************************************************************************/
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
+void timer_interrupt_cpu (struct pt_regs *regs)
{
- timestamp = t;
+ /* nothing to do here */
+ return;
}
/****************************************************************************/
diff --git a/cpu/mpc8xx/interrupts.c b/cpu/mpc8xx/interrupts.c
index 8bc0a1afde..558dc09c07 100644
--- a/cpu/mpc8xx/interrupts.c
+++ b/cpu/mpc8xx/interrupts.c
@@ -22,7 +22,6 @@
*/
#include <common.h>
-#include <watchdog.h>
#include <mpc8xx.h>
#include <mpc8xx_irq.h>
#include <asm/processor.h>
@@ -30,10 +29,6 @@
/************************************************************************/
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-/************************************************************************/
-
/*
* CPM interrupt vector functions.
*/
@@ -50,57 +45,11 @@ static void cpm_interrupt (void *regs);
/************************************************************************/
-static __inline__ unsigned long get_msr (void)
-{
- unsigned long msr;
-
- asm volatile ("mfmsr %0":"=r" (msr):);
-
- return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
- asm volatile ("mtmsr %0"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec (void)
-{
- unsigned long val;
-
- asm volatile ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-
-static __inline__ void set_dec (unsigned long val)
-{
- asm volatile ("mtdec %0"::"r" (val));
-}
-
-
-void enable_interrupts (void)
-{
- set_msr (get_msr () | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
- ulong msr = get_msr ();
-
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-/************************************************************************/
-
-int interrupt_init (void)
+int interrupt_init_cpu (unsigned *decrementer_count)
{
volatile immap_t *immr = (immap_t *) CFG_IMMR;
- decrementer_count = get_tbclk () / CFG_HZ;
+ *decrementer_count = get_tbclk () / CFG_HZ;
/* disable all interrupts */
immr->im_siu_conf.sc_simask = 0;
@@ -108,10 +57,6 @@ int interrupt_init (void)
/* Configure CPM interrupts */
cpm_interrupt_init ();
- set_dec (decrementer_count);
-
- set_msr (get_msr () | MSR_EE);
-
return (0);
}
@@ -314,20 +259,15 @@ static void cpm_interrupt_init (void)
/************************************************************************/
-volatile ulong timestamp = 0;
-
/*
* timer_interrupt - gets called when the decrementer overflows,
* with interrupts disabled.
* Trivial implementation - no need to be really accurate.
*/
-void timer_interrupt (struct pt_regs *regs)
+void timer_interrupt_cpu (struct pt_regs *regs)
{
volatile immap_t *immr = (immap_t *) CFG_IMMR;
-#ifdef CONFIG_STATUS_LED
- extern void status_led_tick (ulong);
-#endif
#if 0
printf ("*** Timer Interrupt *** ");
#endif
@@ -339,57 +279,6 @@ void timer_interrupt (struct pt_regs *regs)
#else
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
#endif
- /* Restore Decrementer Count */
- set_dec (decrementer_count);
-
- timestamp++;
-
-#ifdef CONFIG_STATUS_LED
- status_led_tick (timestamp);
-#endif /* CONFIG_STATUS_LED */
-
-#if defined(CONFIG_WATCHDOG) || defined(CFG_CMA_LCD_HEARTBEAT)
-
- /*
- * The shortest watchdog period of all boards (except LWMON)
- * is approx. 1 sec, thus re-trigger watchdog at least
- * every 500 ms = CFG_HZ / 2
- */
-#ifndef CONFIG_LWMON
- if ((timestamp % (CFG_HZ / 2)) == 0) {
-#else
- if ((timestamp % (CFG_HZ / 20)) == 0) {
-#endif
-
-#if defined(CFG_CMA_LCD_HEARTBEAT)
- extern void lcd_heartbeat (void);
-
- lcd_heartbeat ();
-#endif /* CFG_CMA_LCD_HEARTBEAT */
-
-#if defined(CONFIG_WATCHDOG)
- reset_8xx_watchdog (immr);
-#endif /* CONFIG_WATCHDOG */
-
- }
-#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */
-}
-
-/************************************************************************/
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
}
/************************************************************************/
diff --git a/cpu/ppc4xx/405gp_enet.c b/cpu/ppc4xx/405gp_enet.c
index c222c719e8..a9c7cfe050 100644
--- a/cpu/ppc4xx/405gp_enet.c
+++ b/cpu/ppc4xx/405gp_enet.c
@@ -159,7 +159,7 @@ static int tx_i_index = 0; /* Transmit Interrupt Queue Index */
static int tx_u_index = 0; /* Transmit User Queue Index */
static int tx_run[NUM_TX_BUFF]; /* Transmit Running Queue */
-#undef INFO_405_ENET 1
+#undef INFO_405_ENET
#ifdef INFO_405_ENET
static int packetSent = 0;
static int packetReceived = 0;
diff --git a/cpu/ppc4xx/interrupts.c b/cpu/ppc4xx/interrupts.c
index b6a956c152..1a9ae9d7d1 100644
--- a/cpu/ppc4xx/interrupts.c
+++ b/cpu/ppc4xx/interrupts.c
@@ -35,10 +35,6 @@
/****************************************************************************/
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-/****************************************************************************/
-
/*
* CPM interrupt vector functions.
*/
@@ -57,20 +53,6 @@ void uic1_interrupt( void * parms); /* UIC1 handler */
#endif
/****************************************************************************/
-
-static __inline__ unsigned long get_msr(void)
-{
- unsigned long msr;
-
- asm volatile("mfmsr %0" : "=r" (msr) :);
- return msr;
-}
-
-static __inline__ void set_msr(unsigned long msr)
-{
- asm volatile("mtmsr %0" : : "r" (msr));
-}
-
#if defined(CONFIG_440)
/* SPRN changed in 440 */
@@ -81,21 +63,6 @@ static __inline__ void set_evpr(unsigned long val)
#else /* !defined(CONFIG_440) */
-static __inline__ unsigned long get_dec(void)
-{
- unsigned long val;
-
- asm volatile("mfdec %0" : "=r" (val) :);
- return val;
-}
-
-
-static __inline__ void set_dec(unsigned long val)
-{
- asm volatile("mtdec %0" : : "r" (val));
-}
-
-
static __inline__ void set_pit(unsigned long val)
{
asm volatile("mtpit %0" : : "r" (val));
@@ -114,29 +81,18 @@ static __inline__ void set_evpr(unsigned long val)
}
#endif /* defined(CONFIG_440 */
-
-void enable_interrupts (void)
-{
- set_msr (get_msr() | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
- ulong msr = get_msr();
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
/****************************************************************************/
-int interrupt_init(void)
+int interrupt_init_cpu (unsigned *decrementer_count)
{
DECLARE_GLOBAL_DATA_PTR;
int vec;
unsigned long val;
+ /* decrementer is automatically reloaded */
+ *decrementer_count = 0;
+
/*
* Mark all irqs as free
*/
@@ -194,10 +150,6 @@ int interrupt_init(void)
irq_install_handler(VECNUM_UIC1NC, uic1_interrupt, 0);
irq_install_handler(VECNUM_UIC1C, uic1_interrupt, 0);
#endif
- /*
- * Enable external interrupts (including PIT)
- */
- set_msr (get_msr() | MSR_EE);
return (0);
}
@@ -362,47 +314,14 @@ irq_free_handler(int vec)
/****************************************************************************/
-
-volatile ulong timestamp = 0;
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void timer_interrupt(struct pt_regs *regs)
-{
-#if 0
- printf ("*** Timer Interrupt *** ");
-#endif
- timestamp++;
-
-#if defined(CONFIG_WATCHDOG)
- if ((timestamp % 1000) == 0)
- reset_4xx_watchdog();
-#endif /* CONFIG_WATCHDOG */
-}
-
-/****************************************************************************/
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
+void timer_interrupt_cpu (struct pt_regs *regs)
{
- timestamp = t;
+ /* nothing to do here */
+ return;
}
/****************************************************************************/
-
#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
/*******************************************************************************
diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c
index 6b82f04f7d..32ec4f692a 100644
--- a/cpu/pxa/cpu.c
+++ b/cpu/pxa/cpu.c
@@ -37,22 +37,15 @@
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
-/*
-
- FIXME: the stack is _below_ the uboot code!!
-
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif
-*/
- return (0);
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/pxa/start.S b/cpu/pxa/start.S
index a425449265..d41b414774 100644
--- a/cpu/pxa/start.S
+++ b/cpu/pxa/start.S
@@ -4,10 +4,10 @@
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
* Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
- * Copyright (C) 2001 Alex Züpke <azu@sysgo.de>
+ * Copyright (C) 2001 Alex Zuepke <azu@sysgo.de>
* Copyright (C) 2002 Kyle Harris <kharris@nexus-tech.net>
* Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
- * Copyright (C) 2003 Kai-Uwe Bloehm <kai-uwe.bloem@auerswald.de>
+ * Copyright (C) 2003 Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -55,7 +55,7 @@ _fiq: .word fiq
/*
* Startup Code (reset vector)
*
- * do important init only if we don't start from memory!
+ * do important init only if we don't start from RAM!
* - relocate armboot to ram
* - setup stack
* - jump to second stage
@@ -91,21 +91,6 @@ _bss_start:
_bss_end:
.word bss_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
-/*
- * We relocate uboot to this address (end of RAM - 128 KiB)
- */
-.globl _uboot_reloc
-_uboot_reloc:
- .word TEXT_BASE
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -131,7 +116,13 @@ reset:
orr r0,r0,#0x13
msr cpsr,r0
+ /*
+ * we do sys-critical inits only at reboot,
+ * not when booting from ram!
+ */
+#ifdef CONFIG_INIT_CRITICAL
bl cpu_init_crit /* we do sys-critical inits */
+#endif
relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
@@ -151,12 +142,13 @@ copy_loop:
ble copy_loop
/* Set up the stack */
-
stack_setup:
-
- ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- /* FIXME: bdinfo should be here */
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
sub sp, r0, #12 /* leave 3 words for abort-stack */
clear_bss:
@@ -202,9 +194,13 @@ OSTIMER_BASE: .word 0x40a00000
#define OIER 0x1C
/* Clock Manager Registers */
+#ifdef CFG_CPUSPEED
CC_BASE: .word 0x41300000
#define CCCR 0x00
cpuspeed: .word CFG_CPUSPEED
+#else
+#error "You have to define CFG_CPUSPEED!!"
+#endif
/* RS: ??? */
diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c
index 370ea6cb96..b613fe7ebf 100644
--- a/cpu/sa1100/cpu.c
+++ b/cpu/sa1100/cpu.c
@@ -36,17 +36,15 @@
int cpu_init (void)
{
/*
- * setup up stack if necessary
+ * setup up stacks if necessary
*/
#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_end +
- CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
- FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
- _armboot_real_end = FIQ_STACK_START + 4;
-#else
- _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+ FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif
- return (0);
+ return 0;
}
int cleanup_before_linux (void)
diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S
index 6b4c948913..0c8946e008 100644
--- a/cpu/sa1100/start.S
+++ b/cpu/sa1100/start.S
@@ -92,14 +92,6 @@ _armboot_end_data:
_armboot_end:
.word armboot_end
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
- .word 0x0badc0de
-
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
@@ -134,32 +126,32 @@ reset:
bl cpu_init_crit
#endif
-relocate:
- /*
- * relocate armboot to RAM
- */
- adr r0, _start /* r0 <- current position of code */
+relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq stack_setup
+
ldr r2, _armboot_start
ldr r3, _armboot_end
- sub r2, r3, r2 /* r2 <- size of armboot */
- ldr r1, _TEXT_BASE /* r1 <- destination address */
- add r2, r0, r2 /* r2 <- source end address */
+ sub r2, r3, r2 /* r2 <- size of armboot */
+ add r2, r0, r2 /* r2 <- source end address */
- /*
- * r0 = source address
- * r1 = target address
- * r2 = source end address
- */
copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
+ ldmia r0!, {r3-r10} /* copy from source address [r0] */
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
- /* set up the stack */
- ldr r0, _armboot_end
- add r0, r0, #CONFIG_STACKSIZE
- sub sp, r0, #12 /* leave 3 words for abort-stack */
+ /* Set up the stack */
+stack_setup:
+ ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
+ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
+ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
+#ifdef CONFIG_USE_IRQ
+ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
+ sub sp, r0, #12 /* leave 3 words for abort-stack */
ldr pc, _start_armboot
OpenPOWER on IntegriCloud