blob: da42557224da101ae06ec6f4cf7f5bd94f56a138 [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
33#include <config.h>
34#include <mpc5xx.h>
Peter Tyser62948502008-11-03 09:30:59 -060035#include <timestamp.h>
wdenk359733b2003-03-31 17:27:09 +000036#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>
wdenk57b2d802003-06-27 21:31:46 +000043
wdenk359733b2003-03-31 17:27:09 +000044#include <linux/config.h>
wdenk57b2d802003-06-27 21:31:46 +000045#include <asm/processor.h>
Peter Tyser3a1362d2010-10-14 23:33:24 -050046#include <asm/u-boot.h>
wdenk359733b2003-03-31 17:27:09 +000047
48#ifndef CONFIG_IDENT_STRING
49#define CONFIG_IDENT_STRING ""
50#endif
51
52/* We don't have a MMU.
53*/
54#undef MSR_KERNEL
55#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
56
57/*
58 * Set up GOT: Global Offset Table
59 *
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +010060 * Use r12 to access the GOT
wdenk359733b2003-03-31 17:27:09 +000061 */
62 START_GOT
63 GOT_ENTRY(_GOT2_TABLE_)
64 GOT_ENTRY(_FIXUP_TABLE_)
65
66 GOT_ENTRY(_start)
67 GOT_ENTRY(_start_of_vectors)
68 GOT_ENTRY(_end_of_vectors)
69 GOT_ENTRY(transfer_to_handler)
70
wdenkb9a83a92003-05-30 12:48:29 +000071 GOT_ENTRY(__init_end)
wdenk359733b2003-03-31 17:27:09 +000072 GOT_ENTRY(_end)
wdenkbf2f8c92003-05-22 22:52:13 +000073 GOT_ENTRY(__bss_start)
wdenk359733b2003-03-31 17:27:09 +000074 END_GOT
75
76/*
77 * r3 - 1st arg to board_init(): IMMP pointer
78 * r4 - 2nd arg to board_init(): boot flag
79 */
80 .text
81 .long 0x27051956 /* U-Boot Magic Number */
82 .globl version_string
83version_string:
84 .ascii U_BOOT_VERSION
Peter Tyser62948502008-11-03 09:30:59 -060085 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
wdenk359733b2003-03-31 17:27:09 +000086 .ascii CONFIG_IDENT_STRING, "\0"
87
88 . = EXC_OFF_SYS_RESET
89 .globl _start
90_start:
91 mfspr r3, 638
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020092 li r4, CONFIG_SYS_ISB /* Set ISB bit */
wdenk57b2d802003-06-27 21:31:46 +000093 or r3, r3, r4
wdenk359733b2003-03-31 17:27:09 +000094 mtspr 638, r3
wdenk359733b2003-03-31 17:27:09 +000095
96 /* Initialize machine status; enable machine check interrupt */
97 /*----------------------------------------------------------------------*/
98 li r3, MSR_KERNEL /* Set ME, RI flags */
99 mtmsr r3
100 mtspr SRR1, r3 /* Make SRR1 match MSR */
101
102 /* Initialize debug port registers */
103 /*----------------------------------------------------------------------*/
104 xor r0, r0, r0 /* Clear R0 */
105 mtspr LCTRL1, r0 /* Initialize debug port regs */
106 mtspr LCTRL2, r0
107 mtspr COUNTA, r0
108 mtspr COUNTB, r0
109
wdenkbc01dd52004-01-02 16:05:07 +0000110#if defined(CONFIG_PATI)
111 /* the external flash access on PATI fails if programming the PLL to 40MHz.
112 * Copy the PLL programming code to the internal RAM and execute it
113 *----------------------------------------------------------------------*/
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200114 lis r3, CONFIG_SYS_MONITOR_BASE@h
115 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenkbc01dd52004-01-02 16:05:07 +0000116 addi r3, r3, pll_prog_code_start - _start + EXC_OFF_SYS_RESET
117
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200118 lis r4, CONFIG_SYS_INIT_RAM_ADDR@h
119 ori r4, r4, CONFIG_SYS_INIT_RAM_ADDR@l
wdenkbc01dd52004-01-02 16:05:07 +0000120 mtlr r4
121 addis r5,0,0x0
122 ori r5,r5,((pll_prog_code_end - pll_prog_code_start) >>2)
123 mtctr r5
124 addi r3, r3, -4
125 addi r4, r4, -4
1260:
127 lwzu r0,4(r3)
128 stwu r0,4(r4)
129 bdnz 0b /* copy loop */
130 blrl
131#endif
132
wdenk359733b2003-03-31 17:27:09 +0000133 /*
134 * Calculate absolute address in FLASH and jump there
135 *----------------------------------------------------------------------*/
136
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200137 lis r3, CONFIG_SYS_MONITOR_BASE@h
138 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenk359733b2003-03-31 17:27:09 +0000139 addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
140 mtlr r3
141 blr
142
143in_flash:
144
145 /* Initialize some SPRs that are hard to access from C */
146 /*----------------------------------------------------------------------*/
wdenk57b2d802003-06-27 21:31:46 +0000147
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200148 lis r3, CONFIG_SYS_IMMR@h /* Pass IMMR as arg1 to C routine */
149 lis r2, CONFIG_SYS_INIT_SP_ADDR@h
150 ori r1, r2, CONFIG_SYS_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
wdenk359733b2003-03-31 17:27:09 +0000151 /* Note: R0 is still 0 here */
152 stwu r0, -4(r1) /* Clear final stack frame so that */
153 stwu r0, -4(r1) /* stack backtraces terminate cleanly */
154
155 /*
156 * Disable serialized ifetch and show cycles
157 * (i.e. set processor to normal mode) for maximum
158 * performance.
159 */
160
161 li r2, 0x0007
162 mtspr ICTRL, r2
163
164 /* Set up debug mode entry */
165
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200166 lis r2, CONFIG_SYS_DER@h
167 ori r2, r2, CONFIG_SYS_DER@l
wdenk359733b2003-03-31 17:27:09 +0000168 mtspr DER, r2
169
170 /* Let the C-code set up the rest */
171 /* */
172 /* Be careful to keep code relocatable ! */
173 /*----------------------------------------------------------------------*/
174
175 GET_GOT /* initialize GOT access */
176
177 /* r3: IMMR */
178 bl cpu_init_f /* run low-level CPU init code (from Flash) */
179
wdenk359733b2003-03-31 17:27:09 +0000180 bl board_init_f /* run 1st part of board init code (from Flash) */
181
Peter Tyser0c44caf2010-09-14 19:13:53 -0500182 /* NOTREACHED - board_init_f() does not return */
183
wdenk359733b2003-03-31 17:27:09 +0000184
wdenk359733b2003-03-31 17:27:09 +0000185 .globl _start_of_vectors
186_start_of_vectors:
187
188/* Machine check */
189 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
190
191/* Data Storage exception. "Never" generated on the 860. */
192 STD_EXCEPTION(0x300, DataStorage, UnknownException)
193
194/* Instruction Storage exception. "Never" generated on the 860. */
195 STD_EXCEPTION(0x400, InstStorage, UnknownException)
196
197/* External Interrupt exception. */
198 STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
199
200/* Alignment exception. */
201 . = 0x600
202Alignment:
Rafal Jaworowski06244e42007-06-22 14:58:04 +0200203 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk359733b2003-03-31 17:27:09 +0000204 mfspr r4,DAR
205 stw r4,_DAR(r21)
206 mfspr r5,DSISR
207 stw r5,_DSISR(r21)
208 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlund4ff6bc02010-01-19 14:41:55 +0100209 EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
wdenk359733b2003-03-31 17:27:09 +0000210
211/* Program check exception */
212 . = 0x700
213ProgramCheck:
Rafal Jaworowski06244e42007-06-22 14:58:04 +0200214 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk359733b2003-03-31 17:27:09 +0000215 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlund4ff6bc02010-01-19 14:41:55 +0100216 EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
217 MSR_KERNEL, COPY_EE)
wdenk359733b2003-03-31 17:27:09 +0000218
219 /* FPU on MPC5xx available. We will use it later.
220 */
221 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
222
223 /* I guess we could implement decrementer, and may have
224 * to someday for timekeeping.
225 */
226 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
227 STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
228 STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
wdenk874ac262003-07-24 23:38:38 +0000229 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
wdenk359733b2003-03-31 17:27:09 +0000230 STD_EXCEPTION(0xd00, SingleStep, UnknownException)
231
232 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
233 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
234
235 /* On the MPC8xx, this is a software emulation interrupt. It occurs
236 * for all unimplemented and illegal instructions.
237 */
238 STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
239 STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
240 STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
241 STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
242 STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
243
244 STD_EXCEPTION(0x1500, Reserved5, UnknownException)
245 STD_EXCEPTION(0x1600, Reserved6, UnknownException)
246 STD_EXCEPTION(0x1700, Reserved7, UnknownException)
247 STD_EXCEPTION(0x1800, Reserved8, UnknownException)
248 STD_EXCEPTION(0x1900, Reserved9, UnknownException)
249 STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
250 STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
251
252 STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
253 STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
254 STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
255 STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
256
257
258 .globl _end_of_vectors
259_end_of_vectors:
260
261
262 . = 0x2000
263
264/*
265 * This code finishes saving the registers to the exception frame
266 * and jumps to the appropriate handler for the exception.
267 * Register r21 is pointer into trap frame, r1 has new stack pointer.
268 */
269 .globl transfer_to_handler
270transfer_to_handler:
271 stw r22,_NIP(r21)
272 lis r22,MSR_POW@h
273 andc r23,r23,r22
274 stw r23,_MSR(r21)
275 SAVE_GPR(7, r21)
276 SAVE_4GPRS(8, r21)
277 SAVE_8GPRS(12, r21)
278 SAVE_8GPRS(24, r21)
279 mflr r23
280 andi. r24,r23,0x3f00 /* get vector offset */
281 stw r24,TRAP(r21)
282 li r22,0
283 stw r22,RESULT(r21)
284 mtspr SPRG2,r22 /* r1 is now kernel sp */
285 lwz r24,0(r23) /* virtual address of handler */
286 lwz r23,4(r23) /* where to go when done */
287 mtspr SRR0,r24
288 mtspr SRR1,r20
289 mtlr r23
290 SYNC
291 rfi /* jump to handler, enable MMU */
292
293int_return:
294 mfmsr r28 /* Disable interrupts */
295 li r4,0
296 ori r4,r4,MSR_EE
297 andc r28,r28,r4
298 SYNC /* Some chip revs need this... */
299 mtmsr r28
300 SYNC
301 lwz r2,_CTR(r1)
302 lwz r0,_LINK(r1)
303 mtctr r2
304 mtlr r0
305 lwz r2,_XER(r1)
306 lwz r0,_CCR(r1)
307 mtspr XER,r2
308 mtcrf 0xFF,r0
309 REST_10GPRS(3, r1)
310 REST_10GPRS(13, r1)
311 REST_8GPRS(23, r1)
312 REST_GPR(31, r1)
313 lwz r2,_NIP(r1) /* Restore environment */
314 lwz r0,_MSR(r1)
315 mtspr SRR0,r2
316 mtspr SRR1,r0
317 lwz r0,GPR0(r1)
318 lwz r2,GPR2(r1)
319 lwz r1,GPR1(r1)
320 SYNC
321 rfi
322
wdenk57b2d802003-06-27 21:31:46 +0000323
wdenk359733b2003-03-31 17:27:09 +0000324/*
325 * unsigned int get_immr (unsigned int mask)
326 *
327 * return (mask ? (IMMR & mask) : IMMR);
328 */
329 .globl get_immr
330get_immr:
331 mr r4,r3 /* save mask */
332 mfspr r3, IMMR /* IMMR */
333 cmpwi 0,r4,0 /* mask != 0 ? */
334 beq 4f
335 and r3,r3,r4 /* IMMR & mask */
3364:
337 blr
338
339 .globl get_pvr
340get_pvr:
341 mfspr r3, PVR
342 blr
343
344
345/*------------------------------------------------------------------------------*/
346
347/*
348 * void relocate_code (addr_sp, gd, addr_moni)
349 *
350 * This "function" does not return, instead it continues in RAM
351 * after relocating the monitor code.
352 *
353 * r3 = dest
354 * r4 = src
355 * r5 = length in bytes
356 * r6 = cachelinesize
357 */
358 .globl relocate_code
359relocate_code:
360 mr r1, r3 /* Set new stack pointer in SRAM */
361 mr r9, r4 /* Save copy of global data pointer in SRAM */
362 mr r10, r5 /* Save copy of monitor destination Address in SRAM */
363
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100364 GET_GOT
wdenk359733b2003-03-31 17:27:09 +0000365 mr r3, r5 /* Destination Address */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200366 lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
367 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
wdenkb9a83a92003-05-30 12:48:29 +0000368 lwz r5, GOT(__init_end)
369 sub r5, r5, r4
wdenk359733b2003-03-31 17:27:09 +0000370
371 /*
372 * Fix GOT pointer:
373 *
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200374 * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
wdenk359733b2003-03-31 17:27:09 +0000375 *
376 * Offset:
377 */
378 sub r15, r10, r4
379
380 /* First our own GOT */
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100381 add r12, r12, r15
wdenk359733b2003-03-31 17:27:09 +0000382 /* the the one used by the C code */
383 add r30, r30, r15
384
385 /*
386 * Now relocate code
387 */
388
389 cmplw cr1,r3,r4
390 addi r0,r5,3
391 srwi. r0,r0,2
392 beq cr1,4f /* In place copy is not necessary */
393 beq 4f /* Protect against 0 count */
394 mtctr r0
395 bge cr1,2f
396
397 la r8,-4(r4)
398 la r7,-4(r3)
3991: lwzu r0,4(r8)
400 stwu r0,4(r7)
401 bdnz 1b
402 b 4f
403
4042: slwi r0,r0,2
405 add r8,r4,r0
406 add r7,r3,r0
4073: lwzu r0,-4(r8)
408 stwu r0,-4(r7)
409 bdnz 3b
410
wdenk57b2d802003-06-27 21:31:46 +00004114: sync
wdenk359733b2003-03-31 17:27:09 +0000412 isync
413
414/*
415 * We are done. Do not return, instead branch to second part of board
416 * initialization, now running from RAM.
417 */
418
419 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
420 mtlr r0
421 blr
422
423in_ram:
424
425 /*
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100426 * Relocation Function, r12 point to got2+0x8000
wdenk359733b2003-03-31 17:27:09 +0000427 *
wdenk57b2d802003-06-27 21:31:46 +0000428 * Adjust got2 pointers, no need to check for 0, this code
429 * already puts a few entries in the table.
wdenk359733b2003-03-31 17:27:09 +0000430 */
431 li r0,__got2_entries@sectoff@l
432 la r3,GOT(_GOT2_TABLE_)
433 lwz r11,GOT(_GOT2_TABLE_)
434 mtctr r0
435 sub r11,r3,r11
436 addi r3,r3,-4
4371: lwzu r0,4(r3)
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +0200438 cmpwi r0,0
439 beq- 2f
wdenk359733b2003-03-31 17:27:09 +0000440 add r0,r0,r11
441 stw r0,0(r3)
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +02004422: bdnz 1b
wdenk359733b2003-03-31 17:27:09 +0000443
444 /*
wdenk57b2d802003-06-27 21:31:46 +0000445 * Now adjust the fixups and the pointers to the fixups
wdenk359733b2003-03-31 17:27:09 +0000446 * in case we need to move ourselves again.
447 */
Joakim Tjernlund4f2fdac2009-10-08 02:03:51 +0200448 li r0,__fixup_entries@sectoff@l
wdenk359733b2003-03-31 17:27:09 +0000449 lwz r3,GOT(_FIXUP_TABLE_)
450 cmpwi r0,0
451 mtctr r0
452 addi r3,r3,-4
453 beq 4f
4543: lwzu r4,4(r3)
455 lwzux r0,r4,r11
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +0200456 cmpwi r0,0
wdenk359733b2003-03-31 17:27:09 +0000457 add r0,r0,r11
458 stw r10,0(r3)
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +0200459 beq- 5f
wdenk359733b2003-03-31 17:27:09 +0000460 stw r0,0(r4)
Joakim Tjernlundc61b25a2010-10-14 11:51:44 +02004615: bdnz 3b
wdenk359733b2003-03-31 17:27:09 +00004624:
463clear_bss:
464 /*
465 * Now clear BSS segment
466 */
wdenkbf2f8c92003-05-22 22:52:13 +0000467 lwz r3,GOT(__bss_start)
wdenk359733b2003-03-31 17:27:09 +0000468 lwz r4,GOT(_end)
469 cmplw 0, r3, r4
470 beq 6f
471
472 li r0, 0
4735:
474 stw r0, 0(r3)
475 addi r3, r3, 4
476 cmplw 0, r3, r4
477 bne 5b
4786:
479
480 mr r3, r9 /* Global Data pointer */
481 mr r4, r10 /* Destination Address */
482 bl board_init_r
483
wdenk359733b2003-03-31 17:27:09 +0000484 /*
485 * Copy exception vector code to low memory
486 *
487 * r3: dest_addr
488 * r7: source address, r8: end address, r9: target address
489 */
490 .globl trap_init
491trap_init:
Joakim Tjernlund3fbaa4d2010-01-19 14:41:56 +0100492 mflr r4 /* save link register */
493 GET_GOT
wdenk359733b2003-03-31 17:27:09 +0000494 lwz r7, GOT(_start)
495 lwz r8, GOT(_end_of_vectors)
496
wdenk4e112c12003-06-03 23:54:09 +0000497 li r9, 0x100 /* reset vector always at 0x100 */
wdenk359733b2003-03-31 17:27:09 +0000498
499 cmplw 0, r7, r8
500 bgelr /* return if r7>=r8 - just in case */
wdenk359733b2003-03-31 17:27:09 +00005011:
502 lwz r0, 0(r7)
503 stw r0, 0(r9)
504 addi r7, r7, 4
505 addi r9, r9, 4
506 cmplw 0, r7, r8
507 bne 1b
508
509 /*
510 * relocate `hdlr' and `int_return' entries
511 */
512 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
513 li r8, Alignment - _start + EXC_OFF_SYS_RESET
5142:
515 bl trap_reloc
516 addi r7, r7, 0x100 /* next exception vector */
517 cmplw 0, r7, r8
518 blt 2b
519
520 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
521 bl trap_reloc
522
523 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
524 bl trap_reloc
525
526 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
527 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
5283:
529 bl trap_reloc
530 addi r7, r7, 0x100 /* next exception vector */
531 cmplw 0, r7, r8
532 blt 3b
533
534 li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
535 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
5364:
537 bl trap_reloc
538 addi r7, r7, 0x100 /* next exception vector */
539 cmplw 0, r7, r8
540 blt 4b
541
542 mtlr r4 /* restore link register */
543 blr
544
wdenkbc01dd52004-01-02 16:05:07 +0000545#if defined(CONFIG_PATI)
546/* Program the PLL */
547pll_prog_code_start:
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200548 lis r4, (CONFIG_SYS_IMMR + 0x002fc384)@h
549 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc384)@l
wdenkbc01dd52004-01-02 16:05:07 +0000550 lis r3, (0x55ccaa33)@h
551 ori r3, r3, (0x55ccaa33)@l
552 stw r3, 0(r4)
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200553 lis r4, (CONFIG_SYS_IMMR + 0x002fc284)@h
554 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc284)@l
555 lis r3, CONFIG_SYS_PLPRCR@h
556 ori r3, r3, CONFIG_SYS_PLPRCR@l
wdenkbc01dd52004-01-02 16:05:07 +0000557 stw r3, 0(r4)
558 addis r3,0,0x0
559 ori r3,r3,0xA000
560 mtctr r3
561..spinlp:
562 bdnz ..spinlp /* spin loop */
563 blr
564pll_prog_code_end:
565 nop
566 blr
567#endif