]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/ppc/boot/simple/head.S
Merge ../powerpc-merge
[linux-2.6-omap-h63xx.git] / arch / ppc / boot / simple / head.S
1 /*
2  * arch/ppc/boot/simple/head.S
3  *
4  * Initial board bringup code for many different boards.
5  *
6  * Author: Tom Rini
7  *         trini@mvista.com
8  * Derived from arch/ppc/boot/prep/head.S (Cort Dougan, many others).
9  *
10  * 2001-2004 (c) MontaVista, Software, Inc.  This file is licensed under
11  * the terms of the GNU General Public License version 2.  This program
12  * is licensed "as is" without any warranty of any kind, whether express
13  * or implied.
14  */
15
16 #include <linux/config.h>
17 #include <asm/reg.h>
18 #include <asm/cache.h>
19 #include <asm/ppc_asm.h>
20
21         .text
22
23 /*
24  *      Begin at some arbitrary location in RAM or Flash
25  *        Initialize core registers
26  *        Configure memory controller (Not executing from RAM)
27  *      Move the boot code to the link address (8M)
28  *        Setup C stack
29  *        Initialize UART
30  *      Decompress the kernel to 0x0
31  *      Jump to the kernel entry
32  *
33  */
34
35         .globl  start
36 start:
37         bl      start_
38 #ifdef CONFIG_IBM_OPENBIOS
39         /* The IBM "Tree" bootrom knows that the address of the bootrom
40          * read only structure is 4 bytes after _start.
41          */
42         .long   0x62726f6d              # structure ID - "brom"
43         .long   0x5f726f00              #              - "_ro\0"
44         .long   1                       # structure version
45         .long   bootrom_cmdline         # address of *bootrom_cmdline
46 #endif
47
48 start_:
49 #ifdef CONFIG_FORCE
50         /* We have some really bad firmware.  We must disable the L1
51          * icache/dcache now or the board won't boot.
52          */
53         li      r4,0x0000
54         isync
55         mtspr   SPRN_HID0,r4
56         sync
57         isync
58 #endif
59
60 #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
61         mr      r29,r3  /* On the MBX860, r3 is the board info pointer.
62                          * On the RPXSUPER, r3 points to the NVRAM
63                          * configuration keys.
64                          * On PReP, r3 is the pointer to the residual data.
65                          */
66 #endif
67
68 #if defined(CONFIG_XILINX_VIRTEX_4_FX)
69         /* PPC errata 213: only for Virtex-4 FX */
70         mfccr0  0
71         oris    0,0,0x50000000@h
72         mtccr0  0
73 #endif
74
75         mflr    r3      /* Save our actual starting address. */
76
77         /* The following functions we call must not modify r3 or r4.....
78         */
79 #ifdef CONFIG_6xx
80         /* On PReP we must look at the OpenFirmware pointer and sanity
81          * test it.  On other platforms, we disable the MMU right now
82          * and other bits.
83          */
84 #ifdef CONFIG_PPC_PREP
85 /*
86  * Save the OF pointer to r25, but only if the entry point is in a sane
87  * location; if not we store 0.  If there is no entry point, or it is
88  * invalid, we establish the default MSR value immediately.  Otherwise,
89  * we defer doing that, to allow OF functions to be called, until we
90  * begin uncompressing the kernel.
91  */
92         lis     r8,0x0fff               /* r8 = 0x0fffffff */
93         ori     r8,r8,0xffff
94
95         subc    r8,r8,r5                /* r8 = (r5 <= r8) ? ~0 : 0 */
96         subfe   r8,r8,r8
97         nand    r8,r8,r8
98
99         and.    r5,r5,r8                /* r5 will be cleared if (r5 > r8) */
100         bne+    haveOF
101
102         li      r8,MSR_IP|MSR_FP        /* Not OF: set MSR immediately */
103         mtmsr   r8
104         isync
105 haveOF:
106         mr      r25,r5
107 #else
108         bl      disable_6xx_mmu
109 #endif
110         bl      disable_6xx_l1cache
111
112         CLEAR_CACHES
113 #endif
114
115 #ifdef CONFIG_8xx
116         mfmsr   r8              /* Turn off interrupts */
117         li      r9,0
118         ori     r9,r9,MSR_EE
119         andc    r8,r8,r9
120         mtmsr   r8
121
122         /* We do this because some boot roms don't initialize the
123          * processor correctly. Don't do this if you want to debug
124          * using a BDM device.
125          */
126         li      r4,0            /* Zero DER to prevent FRZ */
127         mtspr   SPRN_DER,r4
128 #endif
129
130 #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
131         mr      r4,r29  /* put the board info pointer where the relocate
132                          * routine will find it
133                          */
134 #endif
135
136         /* Get the load address.
137         */
138         subi    r3, r3, 4       /* Get the actual IP, not NIP */
139         b       relocate
140