blob: 1b275c66a1d894f4d031b37092876d2813b29b26 [file] [log] [blame]
wdenk0db5bca2003-03-31 17:27:09 +00001/*
2 * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
3 * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
4 * Copyright (C) 2000, 2001, 2002 Wolfgang Denk <wd@denx.de>
5 * Copyright (C) 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
wdenk8bde7f72003-06-27 21:31:46 +00006 *
wdenk0db5bca2003-03-31 17:27:09 +00007 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26/*
27 * File: start.S
wdenk8bde7f72003-06-27 21:31:46 +000028 *
wdenk0db5bca2003-03-31 17:27:09 +000029 * Discription: startup code
30 *
31 */
32
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +020033#include <asm-offsets.h>
wdenk0db5bca2003-03-31 17:27:09 +000034#include <config.h>
35#include <mpc5xx.h>
36#include <version.h>
37
38#define CONFIG_5xx 1 /* needed for Linux kernel header files */
39#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
40
41#include <ppc_asm.tmpl>
42#include <ppc_defs.h>
wdenk8bde7f72003-06-27 21:31:46 +000043
wdenk0db5bca2003-03-31 17:27:09 +000044#include <linux/config.h>
wdenk8bde7f72003-06-27 21:31:46 +000045#include <asm/processor.h>
Peter Tyserd98b0522010-10-14 23:33:24 -050046#include <asm/u-boot.h>
wdenk0db5bca2003-03-31 17:27:09 +000047
wdenk0db5bca2003-03-31 17:27:09 +000048/* We don't have a MMU.
49*/
50#undef MSR_KERNEL
51#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
52
53/*
54 * Set up GOT: Global Offset Table
55 *
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +010056 * Use r12 to access the GOT
wdenk0db5bca2003-03-31 17:27:09 +000057 */
58 START_GOT
59 GOT_ENTRY(_GOT2_TABLE_)
60 GOT_ENTRY(_FIXUP_TABLE_)
61
62 GOT_ENTRY(_start)
63 GOT_ENTRY(_start_of_vectors)
64 GOT_ENTRY(_end_of_vectors)
65 GOT_ENTRY(transfer_to_handler)
66
wdenk3b57fe02003-05-30 12:48:29 +000067 GOT_ENTRY(__init_end)
Simon Glass3929fb02013-03-14 06:54:53 +000068 GOT_ENTRY(__bss_end)
wdenk5d232d02003-05-22 22:52:13 +000069 GOT_ENTRY(__bss_start)
wdenk0db5bca2003-03-31 17:27:09 +000070 END_GOT
71
72/*
73 * r3 - 1st arg to board_init(): IMMP pointer
74 * r4 - 2nd arg to board_init(): boot flag
75 */
76 .text
77 .long 0x27051956 /* U-Boot Magic Number */
78 .globl version_string
79version_string:
Andreas Bießmann09c2e902011-07-18 20:24:04 +020080 .ascii U_BOOT_VERSION_STRING, "\0"
wdenk0db5bca2003-03-31 17:27:09 +000081
82 . = EXC_OFF_SYS_RESET
83 .globl _start
84_start:
85 mfspr r3, 638
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020086 li r4, CONFIG_SYS_ISB /* Set ISB bit */
wdenk8bde7f72003-06-27 21:31:46 +000087 or r3, r3, r4
wdenk0db5bca2003-03-31 17:27:09 +000088 mtspr 638, r3
wdenk0db5bca2003-03-31 17:27:09 +000089
90 /* Initialize machine status; enable machine check interrupt */
91 /*----------------------------------------------------------------------*/
92 li r3, MSR_KERNEL /* Set ME, RI flags */
93 mtmsr r3
94 mtspr SRR1, r3 /* Make SRR1 match MSR */
95
96 /* Initialize debug port registers */
97 /*----------------------------------------------------------------------*/
98 xor r0, r0, r0 /* Clear R0 */
99 mtspr LCTRL1, r0 /* Initialize debug port regs */
100 mtspr LCTRL2, r0
101 mtspr COUNTA, r0
102 mtspr COUNTB, r0
103
wdenkb6e4c402004-01-02 16:05:07 +0000104#if defined(CONFIG_PATI)
105 /* the external flash access on PATI fails if programming the PLL to 40MHz.
106 * Copy the PLL programming code to the internal RAM and execute it
107 *----------------------------------------------------------------------*/
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200108 lis r3, CONFIG_SYS_MONITOR_BASE@h
109 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenkb6e4c402004-01-02 16:05:07 +0000110 addi r3, r3, pll_prog_code_start - _start + EXC_OFF_SYS_RESET
111
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200112 lis r4, CONFIG_SYS_INIT_RAM_ADDR@h
113 ori r4, r4, CONFIG_SYS_INIT_RAM_ADDR@l
wdenkb6e4c402004-01-02 16:05:07 +0000114 mtlr r4
115 addis r5,0,0x0
116 ori r5,r5,((pll_prog_code_end - pll_prog_code_start) >>2)
117 mtctr r5
118 addi r3, r3, -4
119 addi r4, r4, -4
1200:
121 lwzu r0,4(r3)
122 stwu r0,4(r4)
123 bdnz 0b /* copy loop */
124 blrl
125#endif
126
wdenk0db5bca2003-03-31 17:27:09 +0000127 /*
128 * Calculate absolute address in FLASH and jump there
129 *----------------------------------------------------------------------*/
130
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200131 lis r3, CONFIG_SYS_MONITOR_BASE@h
132 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenk0db5bca2003-03-31 17:27:09 +0000133 addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
134 mtlr r3
135 blr
136
137in_flash:
138
139 /* Initialize some SPRs that are hard to access from C */
140 /*----------------------------------------------------------------------*/
wdenk8bde7f72003-06-27 21:31:46 +0000141
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200142 lis r3, CONFIG_SYS_IMMR@h /* Pass IMMR as arg1 to C routine */
143 lis r2, CONFIG_SYS_INIT_SP_ADDR@h
144 ori r1, r2, CONFIG_SYS_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
wdenk0db5bca2003-03-31 17:27:09 +0000145 /* Note: R0 is still 0 here */
146 stwu r0, -4(r1) /* Clear final stack frame so that */
147 stwu r0, -4(r1) /* stack backtraces terminate cleanly */
148
149 /*
150 * Disable serialized ifetch and show cycles
151 * (i.e. set processor to normal mode) for maximum
152 * performance.
153 */
154
155 li r2, 0x0007
156 mtspr ICTRL, r2
157
158 /* Set up debug mode entry */
159
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200160 lis r2, CONFIG_SYS_DER@h
161 ori r2, r2, CONFIG_SYS_DER@l
wdenk0db5bca2003-03-31 17:27:09 +0000162 mtspr DER, r2
163
164 /* Let the C-code set up the rest */
165 /* */
166 /* Be careful to keep code relocatable ! */
167 /*----------------------------------------------------------------------*/
168
169 GET_GOT /* initialize GOT access */
Wolfgang Denk8c4734e2011-04-20 22:11:21 +0200170
wdenk0db5bca2003-03-31 17:27:09 +0000171 /* r3: IMMR */
172 bl cpu_init_f /* run low-level CPU init code (from Flash) */
173
wdenk0db5bca2003-03-31 17:27:09 +0000174 bl board_init_f /* run 1st part of board init code (from Flash) */
175
Peter Tyser52ebd9c2010-09-14 19:13:53 -0500176 /* NOTREACHED - board_init_f() does not return */
177
wdenk0db5bca2003-03-31 17:27:09 +0000178
wdenk0db5bca2003-03-31 17:27:09 +0000179 .globl _start_of_vectors
180_start_of_vectors:
181
182/* Machine check */
183 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
184
185/* Data Storage exception. "Never" generated on the 860. */
186 STD_EXCEPTION(0x300, DataStorage, UnknownException)
187
188/* Instruction Storage exception. "Never" generated on the 860. */
189 STD_EXCEPTION(0x400, InstStorage, UnknownException)
190
191/* External Interrupt exception. */
192 STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
193
194/* Alignment exception. */
195 . = 0x600
196Alignment:
Rafal Jaworowski02032e82007-06-22 14:58:04 +0200197 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk0db5bca2003-03-31 17:27:09 +0000198 mfspr r4,DAR
199 stw r4,_DAR(r21)
200 mfspr r5,DSISR
201 stw r5,_DSISR(r21)
202 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlundfc4e1882010-01-19 14:41:55 +0100203 EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
wdenk0db5bca2003-03-31 17:27:09 +0000204
205/* Program check exception */
206 . = 0x700
207ProgramCheck:
Rafal Jaworowski02032e82007-06-22 14:58:04 +0200208 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk0db5bca2003-03-31 17:27:09 +0000209 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlundfc4e1882010-01-19 14:41:55 +0100210 EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
211 MSR_KERNEL, COPY_EE)
wdenk0db5bca2003-03-31 17:27:09 +0000212
213 /* FPU on MPC5xx available. We will use it later.
214 */
215 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
216
217 /* I guess we could implement decrementer, and may have
218 * to someday for timekeeping.
219 */
220 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
221 STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
222 STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
wdenk27b207f2003-07-24 23:38:38 +0000223 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
wdenk0db5bca2003-03-31 17:27:09 +0000224 STD_EXCEPTION(0xd00, SingleStep, UnknownException)
225
226 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
227 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
228
229 /* On the MPC8xx, this is a software emulation interrupt. It occurs
230 * for all unimplemented and illegal instructions.
231 */
232 STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
233 STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
234 STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
235 STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
236 STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
237
238 STD_EXCEPTION(0x1500, Reserved5, UnknownException)
239 STD_EXCEPTION(0x1600, Reserved6, UnknownException)
240 STD_EXCEPTION(0x1700, Reserved7, UnknownException)
241 STD_EXCEPTION(0x1800, Reserved8, UnknownException)
242 STD_EXCEPTION(0x1900, Reserved9, UnknownException)
243 STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
244 STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
245
246 STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
247 STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
248 STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
249 STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
250
251
252 .globl _end_of_vectors
253_end_of_vectors:
254
255
256 . = 0x2000
257
258/*
259 * This code finishes saving the registers to the exception frame
260 * and jumps to the appropriate handler for the exception.
261 * Register r21 is pointer into trap frame, r1 has new stack pointer.
262 */
263 .globl transfer_to_handler
264transfer_to_handler:
265 stw r22,_NIP(r21)
266 lis r22,MSR_POW@h
267 andc r23,r23,r22
268 stw r23,_MSR(r21)
269 SAVE_GPR(7, r21)
270 SAVE_4GPRS(8, r21)
271 SAVE_8GPRS(12, r21)
272 SAVE_8GPRS(24, r21)
273 mflr r23
274 andi. r24,r23,0x3f00 /* get vector offset */
275 stw r24,TRAP(r21)
276 li r22,0
277 stw r22,RESULT(r21)
278 mtspr SPRG2,r22 /* r1 is now kernel sp */
279 lwz r24,0(r23) /* virtual address of handler */
280 lwz r23,4(r23) /* where to go when done */
281 mtspr SRR0,r24
282 mtspr SRR1,r20
283 mtlr r23
284 SYNC
285 rfi /* jump to handler, enable MMU */
286
287int_return:
288 mfmsr r28 /* Disable interrupts */
289 li r4,0
290 ori r4,r4,MSR_EE
291 andc r28,r28,r4
292 SYNC /* Some chip revs need this... */
293 mtmsr r28
294 SYNC
295 lwz r2,_CTR(r1)
296 lwz r0,_LINK(r1)
297 mtctr r2
298 mtlr r0
299 lwz r2,_XER(r1)
300 lwz r0,_CCR(r1)
301 mtspr XER,r2
302 mtcrf 0xFF,r0
303 REST_10GPRS(3, r1)
304 REST_10GPRS(13, r1)
305 REST_8GPRS(23, r1)
306 REST_GPR(31, r1)
307 lwz r2,_NIP(r1) /* Restore environment */
308 lwz r0,_MSR(r1)
309 mtspr SRR0,r2
310 mtspr SRR1,r0
311 lwz r0,GPR0(r1)
312 lwz r2,GPR2(r1)
313 lwz r1,GPR1(r1)
314 SYNC
315 rfi
316
wdenk8bde7f72003-06-27 21:31:46 +0000317
wdenk0db5bca2003-03-31 17:27:09 +0000318/*
319 * unsigned int get_immr (unsigned int mask)
320 *
321 * return (mask ? (IMMR & mask) : IMMR);
322 */
323 .globl get_immr
324get_immr:
325 mr r4,r3 /* save mask */
326 mfspr r3, IMMR /* IMMR */
327 cmpwi 0,r4,0 /* mask != 0 ? */
328 beq 4f
329 and r3,r3,r4 /* IMMR & mask */
3304:
331 blr
332
333 .globl get_pvr
334get_pvr:
335 mfspr r3, PVR
336 blr
337
338
339/*------------------------------------------------------------------------------*/
340
341/*
342 * void relocate_code (addr_sp, gd, addr_moni)
343 *
344 * This "function" does not return, instead it continues in RAM
345 * after relocating the monitor code.
346 *
347 * r3 = dest
348 * r4 = src
349 * r5 = length in bytes
350 * r6 = cachelinesize
351 */
352 .globl relocate_code
353relocate_code:
354 mr r1, r3 /* Set new stack pointer in SRAM */
355 mr r9, r4 /* Save copy of global data pointer in SRAM */
356 mr r10, r5 /* Save copy of monitor destination Address in SRAM */
357
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100358 GET_GOT
wdenk0db5bca2003-03-31 17:27:09 +0000359 mr r3, r5 /* Destination Address */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200360 lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
361 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
wdenk3b57fe02003-05-30 12:48:29 +0000362 lwz r5, GOT(__init_end)
363 sub r5, r5, r4
wdenk0db5bca2003-03-31 17:27:09 +0000364
365 /*
366 * Fix GOT pointer:
367 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200368 * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
wdenk0db5bca2003-03-31 17:27:09 +0000369 *
370 * Offset:
371 */
372 sub r15, r10, r4
373
374 /* First our own GOT */
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100375 add r12, r12, r15
wdenk0db5bca2003-03-31 17:27:09 +0000376 /* the the one used by the C code */
377 add r30, r30, r15
378
379 /*
380 * Now relocate code
381 */
382
383 cmplw cr1,r3,r4
384 addi r0,r5,3
385 srwi. r0,r0,2
386 beq cr1,4f /* In place copy is not necessary */
387 beq 4f /* Protect against 0 count */
388 mtctr r0
389 bge cr1,2f
390
391 la r8,-4(r4)
392 la r7,-4(r3)
3931: lwzu r0,4(r8)
394 stwu r0,4(r7)
395 bdnz 1b
396 b 4f
397
3982: slwi r0,r0,2
399 add r8,r4,r0
400 add r7,r3,r0
4013: lwzu r0,-4(r8)
402 stwu r0,-4(r7)
403 bdnz 3b
404
wdenk8bde7f72003-06-27 21:31:46 +00004054: sync
wdenk0db5bca2003-03-31 17:27:09 +0000406 isync
407
408/*
409 * We are done. Do not return, instead branch to second part of board
410 * initialization, now running from RAM.
411 */
412
413 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
414 mtlr r0
415 blr
416
417in_ram:
418
419 /*
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100420 * Relocation Function, r12 point to got2+0x8000
wdenk0db5bca2003-03-31 17:27:09 +0000421 *
wdenk8bde7f72003-06-27 21:31:46 +0000422 * Adjust got2 pointers, no need to check for 0, this code
423 * already puts a few entries in the table.
wdenk0db5bca2003-03-31 17:27:09 +0000424 */
425 li r0,__got2_entries@sectoff@l
426 la r3,GOT(_GOT2_TABLE_)
427 lwz r11,GOT(_GOT2_TABLE_)
428 mtctr r0
429 sub r11,r3,r11
430 addi r3,r3,-4
4311: lwzu r0,4(r3)
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +0200432 cmpwi r0,0
433 beq- 2f
wdenk0db5bca2003-03-31 17:27:09 +0000434 add r0,r0,r11
435 stw r0,0(r3)
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +02004362: bdnz 1b
wdenk0db5bca2003-03-31 17:27:09 +0000437
438 /*
wdenk8bde7f72003-06-27 21:31:46 +0000439 * Now adjust the fixups and the pointers to the fixups
wdenk0db5bca2003-03-31 17:27:09 +0000440 * in case we need to move ourselves again.
441 */
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +0200442 li r0,__fixup_entries@sectoff@l
wdenk0db5bca2003-03-31 17:27:09 +0000443 lwz r3,GOT(_FIXUP_TABLE_)
444 cmpwi r0,0
445 mtctr r0
446 addi r3,r3,-4
447 beq 4f
4483: lwzu r4,4(r3)
449 lwzux r0,r4,r11
Joakim Tjernlundd1e0b102010-10-14 11:51:44 +0200450 cmpwi r0,0
wdenk0db5bca2003-03-31 17:27:09 +0000451 add r0,r0,r11
Joakim Tjernlund34bbf612010-11-04 19:02:00 +0100452 stw r4,0(r3)
Joakim Tjernlundd1e0b102010-10-14 11:51:44 +0200453 beq- 5f
wdenk0db5bca2003-03-31 17:27:09 +0000454 stw r0,0(r4)
Joakim Tjernlundd1e0b102010-10-14 11:51:44 +02004555: bdnz 3b
wdenk0db5bca2003-03-31 17:27:09 +00004564:
457clear_bss:
458 /*
459 * Now clear BSS segment
460 */
wdenk5d232d02003-05-22 22:52:13 +0000461 lwz r3,GOT(__bss_start)
Simon Glass3929fb02013-03-14 06:54:53 +0000462 lwz r4,GOT(__bss_end)
wdenk0db5bca2003-03-31 17:27:09 +0000463 cmplw 0, r3, r4
464 beq 6f
465
466 li r0, 0
4675:
468 stw r0, 0(r3)
469 addi r3, r3, 4
470 cmplw 0, r3, r4
471 bne 5b
4726:
473
474 mr r3, r9 /* Global Data pointer */
475 mr r4, r10 /* Destination Address */
476 bl board_init_r
477
wdenk0db5bca2003-03-31 17:27:09 +0000478 /*
479 * Copy exception vector code to low memory
480 *
481 * r3: dest_addr
482 * r7: source address, r8: end address, r9: target address
483 */
484 .globl trap_init
485trap_init:
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100486 mflr r4 /* save link register */
487 GET_GOT
wdenk0db5bca2003-03-31 17:27:09 +0000488 lwz r7, GOT(_start)
489 lwz r8, GOT(_end_of_vectors)
490
wdenk682011f2003-06-03 23:54:09 +0000491 li r9, 0x100 /* reset vector always at 0x100 */
wdenk0db5bca2003-03-31 17:27:09 +0000492
493 cmplw 0, r7, r8
494 bgelr /* return if r7>=r8 - just in case */
wdenk0db5bca2003-03-31 17:27:09 +00004951:
496 lwz r0, 0(r7)
497 stw r0, 0(r9)
498 addi r7, r7, 4
499 addi r9, r9, 4
500 cmplw 0, r7, r8
501 bne 1b
502
503 /*
504 * relocate `hdlr' and `int_return' entries
505 */
506 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
507 li r8, Alignment - _start + EXC_OFF_SYS_RESET
5082:
509 bl trap_reloc
510 addi r7, r7, 0x100 /* next exception vector */
511 cmplw 0, r7, r8
512 blt 2b
513
514 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
515 bl trap_reloc
516
517 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
518 bl trap_reloc
519
520 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
521 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
5223:
523 bl trap_reloc
524 addi r7, r7, 0x100 /* next exception vector */
525 cmplw 0, r7, r8
526 blt 3b
527
528 li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
529 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
5304:
531 bl trap_reloc
532 addi r7, r7, 0x100 /* next exception vector */
533 cmplw 0, r7, r8
534 blt 4b
535
536 mtlr r4 /* restore link register */
537 blr
538
wdenkb6e4c402004-01-02 16:05:07 +0000539#if defined(CONFIG_PATI)
540/* Program the PLL */
541pll_prog_code_start:
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200542 lis r4, (CONFIG_SYS_IMMR + 0x002fc384)@h
543 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc384)@l
wdenkb6e4c402004-01-02 16:05:07 +0000544 lis r3, (0x55ccaa33)@h
545 ori r3, r3, (0x55ccaa33)@l
546 stw r3, 0(r4)
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200547 lis r4, (CONFIG_SYS_IMMR + 0x002fc284)@h
548 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc284)@l
549 lis r3, CONFIG_SYS_PLPRCR@h
550 ori r3, r3, CONFIG_SYS_PLPRCR@l
wdenkb6e4c402004-01-02 16:05:07 +0000551 stw r3, 0(r4)
552 addis r3,0,0x0
553 ori r3,r3,0xA000
554 mtctr r3
555..spinlp:
556 bdnz ..spinlp /* spin loop */
557 blr
558pll_prog_code_end:
559 nop
560 blr
561#endif