]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/at91rm9200/cpu.c
Patch by Gary Jennejohn, 09 Sep 2004:
[karo-tx-uboot.git] / cpu / at91rm9200 / cpu.c
index f41210b54572fda678369b5a389ef577a1f4be59..c006d9c7e6d0ec8ae51fa7f4e083b63ad25a6823 100644 (file)
 
 #include <common.h>
 #include <command.h>
-#include <AT91RM9200.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+
+#if !defined(CONFIG_DBGU) && !defined(CONFIG_USART1)
+#error must define one of CONFIG_DBGU or CONFIG_USART1
+#endif
 
 /* read co-processor 15, register #1 (control register) */
 static unsigned long read_p15_c1(void)
@@ -53,7 +58,7 @@ static void write_p15_c1(unsigned long value)
 {
     /*printf("write %08lx to p15/c1\n", value); */
     __asm__ __volatile__(
-        "mcr     p15, 0, %0, c1, c0, 0   @ write it back\n"
+       "mcr     p15, 0, %0, c1, c0, 0   @ write it back\n"
        : "=r" (value)
        :
        : "memory");
@@ -80,18 +85,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_SIZE - 4;
+       FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
-    return 0;
+       return 0;
 }
 
 int cleanup_before_linux(void)
@@ -117,7 +120,12 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
     disable_interrupts();
     reset_cpu(0);
 #else
+#ifdef CONFIG_DBGU
+   AT91PS_USART us = AT91C_BASE_DBGU;
+#endif
+#ifdef CONFIG_USART1
    AT91PS_USART us = AT91C_BASE_US1;
+#endif
    AT91PS_PIO pio = AT91C_BASE_PIOA;
 
    /*shutdown the console to avoid strange chars during reset */