blob: cc11c8fc528537a1b4f39dd3d20e7e3f5aca92a3 [file] [log] [blame]
wdenk359733b2003-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.
wdenk57b2d802003-06-27 21:31:46 +00006 *
wdenk359733b2003-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
wdenk57b2d802003-06-27 21:31:46 +000028 *
wdenk359733b2003-03-31 17:27:09 +000029 * Discription: startup code
30 *
31 */
32
Wolfgang Denk0191e472010-10-26 14:34:52 +020033#include <asm-offsets.h>
wdenk359733b2003-03-31 17:27:09 +000034#include <config.h>
35#include <mpc5xx.h>
Peter Tyser62948502008-11-03 09:30:59 -060036#include <timestamp.h>
wdenk359733b2003-03-31 17:27:09 +000037#include <version.h>
38
39#define CONFIG_5xx 1 /* needed for Linux kernel header files */
40#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
41
42#include <ppc_asm.tmpl>
43#include <ppc_defs.h>
wdenk57b2d802003-06-27 21:31:46 +000044
wdenk359733b2003-03-31 17:27:09 +000045#include <linux/config.h>
wdenk57b2d802003-06-27 21:31:46 +000046#include <asm/processor.h>
Peter Tyser3a1362d2010-10-14 23:33:24 -050047#include <asm/u-boot.h>
wdenk359733b2003-03-31 17:27:09 +000048
49#ifndef CONFIG_IDENT_STRING
50#define CONFIG_IDENT_STRING ""
51#endif
52
53/* We don't have a MMU.
54*/
55#undef MSR_KERNEL
56#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
57
58/*
59 * Set up GOT: Global Offset Table
60 *
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +010061 * Use r12 to access the GOT
wdenk359733b2003-03-31 17:27:09 +000062 */
63 START_GOT
64 GOT_ENTRY(_GOT2_TABLE_)
65 GOT_ENTRY(_FIXUP_TABLE_)
66
67 GOT_ENTRY(_start)
68 GOT_ENTRY(_start_of_vectors)
69 GOT_ENTRY(_end_of_vectors)
70 GOT_ENTRY(transfer_to_handler)
71
wdenkb9a83a92003-05-30 12:48:29 +000072 GOT_ENTRY(__init_end)
Po-Yu Chuangcedbf4b2011-03-01 22:59:59 +000073 GOT_ENTRY(__bss_end__)
wdenkbf2f8c92003-05-22 22:52:13 +000074 GOT_ENTRY(__bss_start)
wdenk359733b2003-03-31 17:27:09 +000075 END_GOT
76
77/*
78 * r3 - 1st arg to board_init(): IMMP pointer
79 * r4 - 2nd arg to board_init(): boot flag
80 */
81 .text
82 .long 0x27051956 /* U-Boot Magic Number */
83 .globl version_string
84version_string:
85 .ascii U_BOOT_VERSION
Peter Tyser62948502008-11-03 09:30:59 -060086 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
wdenk359733b2003-03-31 17:27:09 +000087 .ascii CONFIG_IDENT_STRING, "\0"
88
89 . = EXC_OFF_SYS_RESET
90 .globl _start
91_start:
92 mfspr r3, 638
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020093 li r4, CONFIG_SYS_ISB /* Set ISB bit */
wdenk57b2d802003-06-27 21:31:46 +000094 or r3, r3, r4
wdenk359733b2003-03-31 17:27:09 +000095 mtspr 638, r3
wdenk359733b2003-03-31 17:27:09 +000096
97 /* Initialize machine status; enable machine check interrupt */
98 /*----------------------------------------------------------------------*/
99 li r3, MSR_KERNEL /* Set ME, RI flags */
100 mtmsr r3
101 mtspr SRR1, r3 /* Make SRR1 match MSR */
102
103 /* Initialize debug port registers */
104 /*----------------------------------------------------------------------*/
105 xor r0, r0, r0 /* Clear R0 */
106 mtspr LCTRL1, r0 /* Initialize debug port regs */
107 mtspr LCTRL2, r0
108 mtspr COUNTA, r0
109 mtspr COUNTB, r0
110
wdenkbc01dd52004-01-02 16:05:07 +0000111#if defined(CONFIG_PATI)
112 /* the external flash access on PATI fails if programming the PLL to 40MHz.
113 * Copy the PLL programming code to the internal RAM and execute it
114 *----------------------------------------------------------------------*/
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200115 lis r3, CONFIG_SYS_MONITOR_BASE@h
116 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenkbc01dd52004-01-02 16:05:07 +0000117 addi r3, r3, pll_prog_code_start - _start + EXC_OFF_SYS_RESET
118
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200119 lis r4, CONFIG_SYS_INIT_RAM_ADDR@h
120 ori r4, r4, CONFIG_SYS_INIT_RAM_ADDR@l
wdenkbc01dd52004-01-02 16:05:07 +0000121 mtlr r4
122 addis r5,0,0x0
123 ori r5,r5,((pll_prog_code_end - pll_prog_code_start) >>2)
124 mtctr r5
125 addi r3, r3, -4
126 addi r4, r4, -4
1270:
128 lwzu r0,4(r3)
129 stwu r0,4(r4)
130 bdnz 0b /* copy loop */
131 blrl
132#endif
133
wdenk359733b2003-03-31 17:27:09 +0000134 /*
135 * Calculate absolute address in FLASH and jump there
136 *----------------------------------------------------------------------*/
137
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200138 lis r3, CONFIG_SYS_MONITOR_BASE@h
139 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenk359733b2003-03-31 17:27:09 +0000140 addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
141 mtlr r3
142 blr
143
144in_flash:
145
146 /* Initialize some SPRs that are hard to access from C */
147 /*----------------------------------------------------------------------*/
wdenk57b2d802003-06-27 21:31:46 +0000148
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200149 lis r3, CONFIG_SYS_IMMR@h /* Pass IMMR as arg1 to C routine */
150 lis r2, CONFIG_SYS_INIT_SP_ADDR@h
151 ori r1, r2, CONFIG_SYS_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
wdenk359733b2003-03-31 17:27:09 +0000152 /* Note: R0 is still 0 here */
153 stwu r0, -4(r1) /* Clear final stack frame so that */
154 stwu r0, -4(r1) /* stack backtraces terminate cleanly */
155
156 /*
157 * Disable serialized ifetch and show cycles
158 * (i.e. set processor to normal mode) for maximum
159 * performance.
160 */
161
162 li r2, 0x0007
163 mtspr ICTRL, r2
164
165 /* Set up debug mode entry */
166
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200167 lis r2, CONFIG_SYS_DER@h
168 ori r2, r2, CONFIG_SYS_DER@l
wdenk359733b2003-03-31 17:27:09 +0000169 mtspr DER, r2
170
171 /* Let the C-code set up the rest */
172 /* */
173 /* Be careful to keep code relocatable ! */
174 /*----------------------------------------------------------------------*/
175
176 GET_GOT /* initialize GOT access */
Wolfgang Denkb2d36ea2011-04-20 22:11:21 +0200177
wdenk359733b2003-03-31 17:27:09 +0000178 /* r3: IMMR */
179 bl cpu_init_f /* run low-level CPU init code (from Flash) */
180
wdenk359733b2003-03-31 17:27:09 +0000181 bl board_init_f /* run 1st part of board init code (from Flash) */
182
Peter Tyser0c44caf2010-09-14 19:13:53 -0500183 /* NOTREACHED - board_init_f() does not return */
184
wdenk359733b2003-03-31 17:27:09 +0000185
wdenk359733b2003-03-31 17:27:09 +0000186 .globl _start_of_vectors
187_start_of_vectors:
188
189/* Machine check */
190 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
191
192/* Data Storage exception. "Never" generated on the 860. */
193 STD_EXCEPTION(0x300, DataStorage, UnknownException)
194
195/* Instruction Storage exception. "Never" generated on the 860. */
196 STD_EXCEPTION(0x400, InstStorage, UnknownException)
197
198/* External Interrupt exception. */
199 STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
200
201/* Alignment exception. */
202 . = 0x600
203Alignment:
Rafal Jaworowski06244e42007-06-22 14:58:04 +0200204 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk359733b2003-03-31 17:27:09 +0000205 mfspr r4,DAR
206 stw r4,_DAR(r21)
207 mfspr r5,DSISR
208 stw r5,_DSISR(r21)
209 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlund4ff6bc02010-01-19 14:41:55 +0100210 EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
wdenk359733b2003-03-31 17:27:09 +0000211
212/* Program check exception */
213 . = 0x700
214ProgramCheck:
Rafal Jaworowski06244e42007-06-22 14:58:04 +0200215 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk359733b2003-03-31 17:27:09 +0000216 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlund4ff6bc02010-01-19 14:41:55 +0100217 EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
218 MSR_KERNEL, COPY_EE)
wdenk359733b2003-03-31 17:27:09 +0000219
220 /* FPU on MPC5xx available. We will use it later.
221 */
222 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
223
224 /* I guess we could implement decrementer, and may have
225 * to someday for timekeeping.
226 */
227 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
228 STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
229 STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
wdenk874ac262003-07-24 23:38:38 +0000230 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
wdenk359733b2003-03-31 17:27:09 +0000231 STD_EXCEPTION(0xd00, SingleStep, UnknownException)
232
233 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
234 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
235
236 /* On the MPC8xx, this is a software emulation interrupt. It occurs
237 * for all unimplemented and illegal instructions.
238 */
239 STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
240 STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
241 STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
242 STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
243 STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
244
245 STD_EXCEPTION(0x1500, Reserved5, UnknownException)
246 STD_EXCEPTION(0x1600, Reserved6, UnknownException)
247 STD_EXCEPTION(0x1700, Reserved7, UnknownException)
248 STD_EXCEPTION(0x1800, Reserved8, UnknownException)
249 STD_EXCEPTION(0x1900, Reserved9, UnknownException)
250 STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
251 STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
252
253 STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
254 STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
255 STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
256 STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
257
258
259 .globl _end_of_vectors
260_end_of_vectors:
261
262
263 . = 0x2000
264
265/*
266 * This code finishes saving the registers to the exception frame
267 * and jumps to the appropriate handler for the exception.
268 * Register r21 is pointer into trap frame, r1 has new stack pointer.
269 */
270 .globl transfer_to_handler
271transfer_to_handler:
272 stw r22,_NIP(r21)
273 lis r22,MSR_POW@h
274 andc r23,r23,r22
275 stw r23,_MSR(r21)
276 SAVE_GPR(7, r21)
277 SAVE_4GPRS(8, r21)
278 SAVE_8GPRS(12, r21)
279 SAVE_8GPRS(24, r21)
280 mflr r23
281 andi. r24,r23,0x3f00 /* get vector offset */
282 stw r24,TRAP(r21)
283 li r22,0
284 stw r22,RESULT(r21)
285 mtspr SPRG2,r22 /* r1 is now kernel sp */
286 lwz r24,0(r23) /* virtual address of handler */
287 lwz r23,4(r23) /* where to go when done */
288 mtspr SRR0,r24
289 mtspr SRR1,r20
290 mtlr r23
291 SYNC
292 rfi /* jump to handler, enable MMU */
293
294int_return:
295 mfmsr r28 /* Disable interrupts */
296 li r4,0
297 ori r4,r4,MSR_EE
298 andc r28,r28,r4
299 SYNC /* Some chip revs need this... */
300 mtmsr r28
301 SYNC
302 lwz r2,_CTR(r1)
303 lwz r0,_LINK(r1)
304 mtctr r2
305 mtlr r0
306 lwz r2,_XER(r1)
307 lwz r0,_CCR(r1)
308 mtspr XER,r2
309 mtcrf 0xFF,r0
310 REST_10GPRS(3, r1)
311 REST_10GPRS(13, r1)
312 REST_8GPRS(23, r1)
313 REST_GPR(31, r1)
314 lwz r2,_NIP(r1) /* Restore environment */
315 lwz r0,_MSR(r1)
316 mtspr SRR0,r2
317 mtspr SRR1,r0
318 lwz r0,GPR0(r1)
319 lwz r2,GPR2(r1)
320 lwz r1,GPR1(r1)
321 SYNC
322 rfi
323
wdenk57b2d802003-06-27 21:31:46 +0000324
wdenk359733b2003-03-31 17:27:09 +0000325/*
326 * unsigned int get_immr (unsigned int mask)
327 *
328 * return (mask ? (IMMR & mask) : IMMR);
329 */
330 .globl get_immr
331get_immr:
332 mr r4,r3 /* save mask */
333 mfspr r3, IMMR /* IMMR */
334 cmpwi 0,r4,0 /* mask != 0 ? */
335 beq 4f
336 and r3,r3,r4 /* IMMR & mask */
3374:
338 blr
339
340 .globl get_pvr
341get_pvr:
342 mfspr r3, PVR
343 blr
344
345
346/*------------------------------------------------------------------------------*/
347
348/*
349 * void relocate_code (addr_sp, gd, addr_moni)
350 *
351 * This "function" does not return, instead it continues in RAM
352 * after relocating the monitor code.
353 *
354 * r3 = dest
355 * r4 = src
356 * r5 = length in bytes
357 * r6 = cachelinesize
358 */
359 .globl relocate_code
360relocate_code:
361 mr r1, r3 /* Set new stack pointer in SRAM */
362 mr r9, r4 /* Save copy of global data pointer in SRAM */
363 mr r10, r5 /* Save copy of monitor destination Address in SRAM */
364
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100365 GET_GOT
wdenk359733b2003-03-31 17:27:09 +0000366 mr r3, r5 /* Destination Address */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200367 lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
368 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
wdenkb9a83a92003-05-30 12:48:29 +0000369 lwz r5, GOT(__init_end)
370 sub r5, r5, r4
wdenk359733b2003-03-31 17:27:09 +0000371
372 /*
373 * Fix GOT pointer:
374 *
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200375 * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
wdenk359733b2003-03-31 17:27:09 +0000376 *
377 * Offset:
378 */
379 sub r15, r10, r4
380
381 /* First our own GOT */
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100382 add r12, r12, r15
wdenk359733b2003-03-31 17:27:09 +0000383 /* the the one used by the C code */
384 add r30, r30, r15
385
386 /*
387 * Now relocate code
388 */
389
390 cmplw cr1,r3,r4
391 addi r0,r5,3
392 srwi. r0,r0,2
393 beq cr1,4f /* In place copy is not necessary */
394 beq 4f /* Protect against 0 count */
395 mtctr r0
396 bge cr1,2f
397
398 la r8,-4(r4)
399 la r7,-4(r3)
4001: lwzu r0,4(r8)
401 stwu r0,4(r7)
402 bdnz 1b
403 b 4f
404
4052: slwi r0,r0,2
406 add r8,r4,r0
407 add r7,r3,r0
4083: lwzu r0,-4(r8)
409 stwu r0,-4(r7)
410 bdnz 3b
411
wdenk57b2d802003-06-27 21:31:46 +00004124: sync
wdenk359733b2003-03-31 17:27:09 +0000413 isync
414
415/*
416 * We are done. Do not return, instead branch to second part of board
417 * initialization, now running from RAM.
418 */
419
420 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
421 mtlr r0
422 blr
423
424in_ram:
425
426 /*
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100427 * Relocation Function, r12 point to got2+0x8000
wdenk359733b2003-03-31 17:27:09 +0000428 *
wdenk57b2d802003-06-27 21:31:46 +0000429 * Adjust got2 pointers, no need to check for 0, this code
430 * already puts a few entries in the table.
wdenk359733b2003-03-31 17:27:09 +0000431 */
432 li r0,__got2_entries@sectoff@l
433 la r3,GOT(_GOT2_TABLE_)
434 lwz r11,GOT(_GOT2_TABLE_)
435 mtctr r0
436 sub r11,r3,r11
437 addi r3,r3,-4
4381: lwzu r0,4(r3)
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +0200439 cmpwi r0,0
440 beq- 2f
wdenk359733b2003-03-31 17:27:09 +0000441 add r0,r0,r11
442 stw r0,0(r3)
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +02004432: bdnz 1b
wdenk359733b2003-03-31 17:27:09 +0000444
445 /*
wdenk57b2d802003-06-27 21:31:46 +0000446 * Now adjust the fixups and the pointers to the fixups
wdenk359733b2003-03-31 17:27:09 +0000447 * in case we need to move ourselves again.
448 */
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +0200449 li r0,__fixup_entries@sectoff@l
wdenk359733b2003-03-31 17:27:09 +0000450 lwz r3,GOT(_FIXUP_TABLE_)
451 cmpwi r0,0
452 mtctr r0
453 addi r3,r3,-4
454 beq 4f
4553: lwzu r4,4(r3)
456 lwzux r0,r4,r11
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +0200457 cmpwi r0,0
wdenk359733b2003-03-31 17:27:09 +0000458 add r0,r0,r11
Joakim Tjernlund401b5922010-11-04 19:02:00 +0100459 stw r4,0(r3)
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +0200460 beq- 5f
wdenk359733b2003-03-31 17:27:09 +0000461 stw r0,0(r4)
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +02004625: bdnz 3b
wdenk359733b2003-03-31 17:27:09 +00004634:
464clear_bss:
465 /*
466 * Now clear BSS segment
467 */
wdenkbf2f8c92003-05-22 22:52:13 +0000468 lwz r3,GOT(__bss_start)
Po-Yu Chuangcedbf4b2011-03-01 22:59:59 +0000469 lwz r4,GOT(__bss_end__)
wdenk359733b2003-03-31 17:27:09 +0000470 cmplw 0, r3, r4
471 beq 6f
472
473 li r0, 0
4745:
475 stw r0, 0(r3)
476 addi r3, r3, 4
477 cmplw 0, r3, r4
478 bne 5b
4796:
480
481 mr r3, r9 /* Global Data pointer */
482 mr r4, r10 /* Destination Address */
483 bl board_init_r
484
wdenk359733b2003-03-31 17:27:09 +0000485 /*
486 * Copy exception vector code to low memory
487 *
488 * r3: dest_addr
489 * r7: source address, r8: end address, r9: target address
490 */
491 .globl trap_init
492trap_init:
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100493 mflr r4 /* save link register */
494 GET_GOT
wdenk359733b2003-03-31 17:27:09 +0000495 lwz r7, GOT(_start)
496 lwz r8, GOT(_end_of_vectors)
497
wdenk4e112c12003-06-03 23:54:09 +0000498 li r9, 0x100 /* reset vector always at 0x100 */
wdenk359733b2003-03-31 17:27:09 +0000499
500 cmplw 0, r7, r8
501 bgelr /* return if r7>=r8 - just in case */
wdenk359733b2003-03-31 17:27:09 +00005021:
503 lwz r0, 0(r7)
504 stw r0, 0(r9)
505 addi r7, r7, 4
506 addi r9, r9, 4
507 cmplw 0, r7, r8
508 bne 1b
509
510 /*
511 * relocate `hdlr' and `int_return' entries
512 */
513 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
514 li r8, Alignment - _start + EXC_OFF_SYS_RESET
5152:
516 bl trap_reloc
517 addi r7, r7, 0x100 /* next exception vector */
518 cmplw 0, r7, r8
519 blt 2b
520
521 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
522 bl trap_reloc
523
524 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
525 bl trap_reloc
526
527 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
528 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
5293:
530 bl trap_reloc
531 addi r7, r7, 0x100 /* next exception vector */
532 cmplw 0, r7, r8
533 blt 3b
534
535 li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
536 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
5374:
538 bl trap_reloc
539 addi r7, r7, 0x100 /* next exception vector */
540 cmplw 0, r7, r8
541 blt 4b
542
543 mtlr r4 /* restore link register */
544 blr
545
wdenkbc01dd52004-01-02 16:05:07 +0000546#if defined(CONFIG_PATI)
547/* Program the PLL */
548pll_prog_code_start:
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200549 lis r4, (CONFIG_SYS_IMMR + 0x002fc384)@h
550 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc384)@l
wdenkbc01dd52004-01-02 16:05:07 +0000551 lis r3, (0x55ccaa33)@h
552 ori r3, r3, (0x55ccaa33)@l
553 stw r3, 0(r4)
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200554 lis r4, (CONFIG_SYS_IMMR + 0x002fc284)@h
555 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc284)@l
556 lis r3, CONFIG_SYS_PLPRCR@h
557 ori r3, r3, CONFIG_SYS_PLPRCR@l
wdenkbc01dd52004-01-02 16:05:07 +0000558 stw r3, 0(r4)
559 addis r3,0,0x0
560 ori r3,r3,0xA000
561 mtctr r3
562..spinlp:
563 bdnz ..spinlp /* spin loop */
564 blr
565pll_prog_code_end:
566 nop
567 blr
568#endif