fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / m68knommu / platform / 5307 / head.S
index c30c462..b9aa0ca 100644 (file)
@@ -3,12 +3,11 @@
 /*
  *     head.S -- common startup code for ColdFire CPUs.
  *
- *     (C) Copyright 1999-2004, Greg Ungerer (gerg@snapgear.com).
+ *     (C) Copyright 1999-2006, Greg Ungerer <gerg@snapgear.com>.
  */
 
 /*****************************************************************************/
 
-#include <linux/config.h>
 #include <linux/sys.h>
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 /*****************************************************************************/
 
 /*
- *     Define fixed memory sizes. Configuration of a fixed memory size
- *     overrides everything else. If the user defined a size we just
- *     blindly use it (they know what they are doing right :-)
- */
-#if defined(CONFIG_RAM32MB)
-#define MEM_SIZE       0x02000000      /* memory size 32Mb */
-#elif defined(CONFIG_RAM16MB)
-#define MEM_SIZE       0x01000000      /* memory size 16Mb */
-#elif defined(CONFIG_RAM8MB)
-#define MEM_SIZE       0x00800000      /* memory size 8Mb */
-#elif defined(CONFIG_RAM4MB)
-#define MEM_SIZE       0x00400000      /* memory size 4Mb */
-#elif defined(CONFIG_RAM1MB)
-#define MEM_SIZE       0x00100000      /* memory size 1Mb */
-#endif
-
-/*
- *     Memory size exceptions for special cases. Some boards may be set
- *     for auto memory sizing, but we can't do it that way for some reason.
- *     For example the 5206eLITE board has static RAM, and auto-detecting
- *     the SDRAM will do you no good at all. Same goes for the MOD5272.
- */
-#ifdef CONFIG_RAMAUTO
-#if defined(CONFIG_M5206eLITE)
-#define        MEM_SIZE        0x00100000      /* 1MiB default memory */
-#endif
-#if defined(CONFIG_MOD5272)
-#define MEM_SIZE       0x00800000      /* 8MiB default memory */
-#endif
-#endif /* CONFIG_RAMAUTO */
-
-
-/*
- *     If we don't have a fixed memory size now, then lets build in code
+ *     If we don't have a fixed memory size, then lets build in code
  *     to auto detect the DRAM size. Obviously this is the prefered
- *     method, and should work for most boards (it won't work for those
- *     that do not have their RAM starting at address 0).
+ *     method, and should work for most boards. It won't work for those
+ *     that do not have their RAM starting at address 0, and it only
+ *     works on SDRAM (not boards fitted with SRAM).
  */
-#if defined(MEM_SIZE)
+#if CONFIG_RAMSIZE != 0
 .macro GET_MEM_SIZE
-       movel   #MEM_SIZE,%d0           /* hard coded memory size */
+       movel   #CONFIG_RAMSIZE,%d0     /* hard coded memory size */
 .endm
 
 #elif defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
        negl    %d0                     /* negate bits */
 .endm
 
-#else
-#error "ERROR: I don't know how to determine your boards memory size?"
-#endif
-
-
-/*
- *     Most ColdFire boards have their DRAM starting at address 0.
- *     Notable exception is the 5206eLITE board, another is the MOD5272.
- */
-#if defined(CONFIG_M5206eLITE)
-#define        MEM_BASE        0x30000000
-#endif
-#if defined(CONFIG_MOD5272)
-#define MEM_BASE       0x02000000
-#define VBR_BASE       0x20000000      /* vectors in SRAM */
-#endif
-#if defined(CONFIG_M5208EVB)
-#define MEM_BASE       0x40000000
-#endif
-
-#ifndef MEM_BASE
-#define        MEM_BASE        0x00000000      /* memory base at address 0 */
-#endif
+#elif defined(CONFIG_M520x)
+.macro GET_MEM_SIZE
+       clrl    %d0
+       movel   MCF_MBAR+MCFSIM_SDCS0, %d2 /* Get SDRAM chip select 0 config */
+       andl    #0x1f, %d2              /* Get only the chip select size */
+       beq     3f                      /* Check if it is enabled */
+       addql   #1, %d2                 /* Form exponent */
+       moveql  #1, %d0
+       lsll    %d2, %d0                /* 2 ^ exponent */
+3:
+       movel   MCF_MBAR+MCFSIM_SDCS1, %d2 /* Get SDRAM chip select 1 config */
+       andl    #0x1f, %d2              /* Get only the chip select size */
+       beq     4f                      /* Check if it is enabled */
+       addql   #1, %d2                 /* Form exponent */
+       moveql  #1, %d1
+       lsll    %d2, %d1                /* 2 ^ exponent */
+       addl    %d1, %d0                /* Total size of SDRAM in d0 */
+4:
+.endm
 
-/*
- *     The default location for the vectors is at the base of RAM.
- *     Some boards might like to use internal SRAM or something like
- *     that. If no board specific header defines an alternative then
- *     use the base of RAM.
- */
-#ifndef        VBR_BASE
-#define        VBR_BASE        MEM_BASE        /* vector address */
+#else
+#error "ERROR: I don't know how to probe your boards memory size?"
 #endif
 
 /*****************************************************************************/
@@ -191,11 +148,11 @@ _start:
         *      Create basic memory configuration. Set VBR accordingly,
         *      and size memory.
         */
-       movel   #VBR_BASE,%a7
+       movel   #CONFIG_VECTORBASE,%a7
        movec   %a7,%VBR                        /* set vectors addr */
        movel   %a7,_ramvec
 
-       movel   #MEM_BASE,%a7                   /* mark the base of RAM */
+       movel   #CONFIG_RAMBASE,%a7             /* mark the base of RAM */
        movel   %a7,_rambase
 
        GET_MEM_SIZE                            /* macro code determines size */