blob: 0af879e39130577fa757ab065f0acd28f327f472 [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
33#include <config.h>
34#include <mpc5xx.h>
Peter Tyser561858e2008-11-03 09:30:59 -060035#include <timestamp.h>
wdenk0db5bca2003-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>
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>
wdenk0db5bca2003-03-31 17:27:09 +000046
47#ifndef CONFIG_IDENT_STRING
48#define CONFIG_IDENT_STRING ""
49#endif
50
51/* We don't have a MMU.
52*/
53#undef MSR_KERNEL
54#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
55
56/*
57 * Set up GOT: Global Offset Table
58 *
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +010059 * Use r12 to access the GOT
wdenk0db5bca2003-03-31 17:27:09 +000060 */
61 START_GOT
62 GOT_ENTRY(_GOT2_TABLE_)
63 GOT_ENTRY(_FIXUP_TABLE_)
64
65 GOT_ENTRY(_start)
66 GOT_ENTRY(_start_of_vectors)
67 GOT_ENTRY(_end_of_vectors)
68 GOT_ENTRY(transfer_to_handler)
69
wdenk3b57fe02003-05-30 12:48:29 +000070 GOT_ENTRY(__init_end)
wdenk0db5bca2003-03-31 17:27:09 +000071 GOT_ENTRY(_end)
wdenk5d232d02003-05-22 22:52:13 +000072 GOT_ENTRY(__bss_start)
wdenk0db5bca2003-03-31 17:27:09 +000073 END_GOT
74
75/*
76 * r3 - 1st arg to board_init(): IMMP pointer
77 * r4 - 2nd arg to board_init(): boot flag
78 */
79 .text
80 .long 0x27051956 /* U-Boot Magic Number */
81 .globl version_string
82version_string:
83 .ascii U_BOOT_VERSION
Peter Tyser561858e2008-11-03 09:30:59 -060084 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
wdenk0db5bca2003-03-31 17:27:09 +000085 .ascii CONFIG_IDENT_STRING, "\0"
86
87 . = EXC_OFF_SYS_RESET
88 .globl _start
89_start:
90 mfspr r3, 638
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020091 li r4, CONFIG_SYS_ISB /* Set ISB bit */
wdenk8bde7f72003-06-27 21:31:46 +000092 or r3, r3, r4
wdenk0db5bca2003-03-31 17:27:09 +000093 mtspr 638, r3
94 li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
95 b boot_cold
96
97 . = EXC_OFF_SYS_RESET + 0x20
98
99 .globl _start_warm
100_start_warm:
101 li r21, BOOTFLAG_WARM /* Software reboot */
102 b boot_warm
103
104boot_cold:
105boot_warm:
106
107 /* Initialize machine status; enable machine check interrupt */
108 /*----------------------------------------------------------------------*/
109 li r3, MSR_KERNEL /* Set ME, RI flags */
110 mtmsr r3
111 mtspr SRR1, r3 /* Make SRR1 match MSR */
112
113 /* Initialize debug port registers */
114 /*----------------------------------------------------------------------*/
115 xor r0, r0, r0 /* Clear R0 */
116 mtspr LCTRL1, r0 /* Initialize debug port regs */
117 mtspr LCTRL2, r0
118 mtspr COUNTA, r0
119 mtspr COUNTB, r0
120
wdenkb6e4c402004-01-02 16:05:07 +0000121#if defined(CONFIG_PATI)
122 /* the external flash access on PATI fails if programming the PLL to 40MHz.
123 * Copy the PLL programming code to the internal RAM and execute it
124 *----------------------------------------------------------------------*/
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200125 lis r3, CONFIG_SYS_MONITOR_BASE@h
126 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenkb6e4c402004-01-02 16:05:07 +0000127 addi r3, r3, pll_prog_code_start - _start + EXC_OFF_SYS_RESET
128
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200129 lis r4, CONFIG_SYS_INIT_RAM_ADDR@h
130 ori r4, r4, CONFIG_SYS_INIT_RAM_ADDR@l
wdenkb6e4c402004-01-02 16:05:07 +0000131 mtlr r4
132 addis r5,0,0x0
133 ori r5,r5,((pll_prog_code_end - pll_prog_code_start) >>2)
134 mtctr r5
135 addi r3, r3, -4
136 addi r4, r4, -4
1370:
138 lwzu r0,4(r3)
139 stwu r0,4(r4)
140 bdnz 0b /* copy loop */
141 blrl
142#endif
143
wdenk0db5bca2003-03-31 17:27:09 +0000144 /*
145 * Calculate absolute address in FLASH and jump there
146 *----------------------------------------------------------------------*/
147
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200148 lis r3, CONFIG_SYS_MONITOR_BASE@h
149 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
wdenk0db5bca2003-03-31 17:27:09 +0000150 addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
151 mtlr r3
152 blr
153
154in_flash:
155
156 /* Initialize some SPRs that are hard to access from C */
157 /*----------------------------------------------------------------------*/
wdenk8bde7f72003-06-27 21:31:46 +0000158
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200159 lis r3, CONFIG_SYS_IMMR@h /* Pass IMMR as arg1 to C routine */
160 lis r2, CONFIG_SYS_INIT_SP_ADDR@h
161 ori r1, r2, CONFIG_SYS_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
wdenk0db5bca2003-03-31 17:27:09 +0000162 /* Note: R0 is still 0 here */
163 stwu r0, -4(r1) /* Clear final stack frame so that */
164 stwu r0, -4(r1) /* stack backtraces terminate cleanly */
165
166 /*
167 * Disable serialized ifetch and show cycles
168 * (i.e. set processor to normal mode) for maximum
169 * performance.
170 */
171
172 li r2, 0x0007
173 mtspr ICTRL, r2
174
175 /* Set up debug mode entry */
176
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200177 lis r2, CONFIG_SYS_DER@h
178 ori r2, r2, CONFIG_SYS_DER@l
wdenk0db5bca2003-03-31 17:27:09 +0000179 mtspr DER, r2
180
181 /* Let the C-code set up the rest */
182 /* */
183 /* Be careful to keep code relocatable ! */
184 /*----------------------------------------------------------------------*/
185
186 GET_GOT /* initialize GOT access */
187
188 /* r3: IMMR */
189 bl cpu_init_f /* run low-level CPU init code (from Flash) */
190
191 mr r3, r21
192 /* r3: BOOTFLAG */
193 bl board_init_f /* run 1st part of board init code (from Flash) */
194
195
wdenk0db5bca2003-03-31 17:27:09 +0000196 .globl _start_of_vectors
197_start_of_vectors:
198
199/* Machine check */
200 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
201
202/* Data Storage exception. "Never" generated on the 860. */
203 STD_EXCEPTION(0x300, DataStorage, UnknownException)
204
205/* Instruction Storage exception. "Never" generated on the 860. */
206 STD_EXCEPTION(0x400, InstStorage, UnknownException)
207
208/* External Interrupt exception. */
209 STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
210
211/* Alignment exception. */
212 . = 0x600
213Alignment:
Rafal Jaworowski02032e82007-06-22 14:58:04 +0200214 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk0db5bca2003-03-31 17:27:09 +0000215 mfspr r4,DAR
216 stw r4,_DAR(r21)
217 mfspr r5,DSISR
218 stw r5,_DSISR(r21)
219 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlundfc4e1882010-01-19 14:41:55 +0100220 EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
wdenk0db5bca2003-03-31 17:27:09 +0000221
222/* Program check exception */
223 . = 0x700
224ProgramCheck:
Rafal Jaworowski02032e82007-06-22 14:58:04 +0200225 EXCEPTION_PROLOG(SRR0, SRR1)
wdenk0db5bca2003-03-31 17:27:09 +0000226 addi r3,r1,STACK_FRAME_OVERHEAD
Joakim Tjernlundfc4e1882010-01-19 14:41:55 +0100227 EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
228 MSR_KERNEL, COPY_EE)
wdenk0db5bca2003-03-31 17:27:09 +0000229
230 /* FPU on MPC5xx available. We will use it later.
231 */
232 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
233
234 /* I guess we could implement decrementer, and may have
235 * to someday for timekeeping.
236 */
237 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
238 STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
239 STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
wdenk27b207f2003-07-24 23:38:38 +0000240 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
wdenk0db5bca2003-03-31 17:27:09 +0000241 STD_EXCEPTION(0xd00, SingleStep, UnknownException)
242
243 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
244 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
245
246 /* On the MPC8xx, this is a software emulation interrupt. It occurs
247 * for all unimplemented and illegal instructions.
248 */
249 STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
250 STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
251 STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
252 STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
253 STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
254
255 STD_EXCEPTION(0x1500, Reserved5, UnknownException)
256 STD_EXCEPTION(0x1600, Reserved6, UnknownException)
257 STD_EXCEPTION(0x1700, Reserved7, UnknownException)
258 STD_EXCEPTION(0x1800, Reserved8, UnknownException)
259 STD_EXCEPTION(0x1900, Reserved9, UnknownException)
260 STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
261 STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
262
263 STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
264 STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
265 STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
266 STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
267
268
269 .globl _end_of_vectors
270_end_of_vectors:
271
272
273 . = 0x2000
274
275/*
276 * This code finishes saving the registers to the exception frame
277 * and jumps to the appropriate handler for the exception.
278 * Register r21 is pointer into trap frame, r1 has new stack pointer.
279 */
280 .globl transfer_to_handler
281transfer_to_handler:
282 stw r22,_NIP(r21)
283 lis r22,MSR_POW@h
284 andc r23,r23,r22
285 stw r23,_MSR(r21)
286 SAVE_GPR(7, r21)
287 SAVE_4GPRS(8, r21)
288 SAVE_8GPRS(12, r21)
289 SAVE_8GPRS(24, r21)
290 mflr r23
291 andi. r24,r23,0x3f00 /* get vector offset */
292 stw r24,TRAP(r21)
293 li r22,0
294 stw r22,RESULT(r21)
295 mtspr SPRG2,r22 /* r1 is now kernel sp */
296 lwz r24,0(r23) /* virtual address of handler */
297 lwz r23,4(r23) /* where to go when done */
298 mtspr SRR0,r24
299 mtspr SRR1,r20
300 mtlr r23
301 SYNC
302 rfi /* jump to handler, enable MMU */
303
304int_return:
305 mfmsr r28 /* Disable interrupts */
306 li r4,0
307 ori r4,r4,MSR_EE
308 andc r28,r28,r4
309 SYNC /* Some chip revs need this... */
310 mtmsr r28
311 SYNC
312 lwz r2,_CTR(r1)
313 lwz r0,_LINK(r1)
314 mtctr r2
315 mtlr r0
316 lwz r2,_XER(r1)
317 lwz r0,_CCR(r1)
318 mtspr XER,r2
319 mtcrf 0xFF,r0
320 REST_10GPRS(3, r1)
321 REST_10GPRS(13, r1)
322 REST_8GPRS(23, r1)
323 REST_GPR(31, r1)
324 lwz r2,_NIP(r1) /* Restore environment */
325 lwz r0,_MSR(r1)
326 mtspr SRR0,r2
327 mtspr SRR1,r0
328 lwz r0,GPR0(r1)
329 lwz r2,GPR2(r1)
330 lwz r1,GPR1(r1)
331 SYNC
332 rfi
333
wdenk8bde7f72003-06-27 21:31:46 +0000334
wdenk0db5bca2003-03-31 17:27:09 +0000335/*
336 * unsigned int get_immr (unsigned int mask)
337 *
338 * return (mask ? (IMMR & mask) : IMMR);
339 */
340 .globl get_immr
341get_immr:
342 mr r4,r3 /* save mask */
343 mfspr r3, IMMR /* IMMR */
344 cmpwi 0,r4,0 /* mask != 0 ? */
345 beq 4f
346 and r3,r3,r4 /* IMMR & mask */
3474:
348 blr
349
350 .globl get_pvr
351get_pvr:
352 mfspr r3, PVR
353 blr
354
355
356/*------------------------------------------------------------------------------*/
357
358/*
359 * void relocate_code (addr_sp, gd, addr_moni)
360 *
361 * This "function" does not return, instead it continues in RAM
362 * after relocating the monitor code.
363 *
364 * r3 = dest
365 * r4 = src
366 * r5 = length in bytes
367 * r6 = cachelinesize
368 */
369 .globl relocate_code
370relocate_code:
371 mr r1, r3 /* Set new stack pointer in SRAM */
372 mr r9, r4 /* Save copy of global data pointer in SRAM */
373 mr r10, r5 /* Save copy of monitor destination Address in SRAM */
374
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100375 GET_GOT
wdenk0db5bca2003-03-31 17:27:09 +0000376 mr r3, r5 /* Destination Address */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200377 lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
378 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
wdenk3b57fe02003-05-30 12:48:29 +0000379 lwz r5, GOT(__init_end)
380 sub r5, r5, r4
wdenk0db5bca2003-03-31 17:27:09 +0000381
382 /*
383 * Fix GOT pointer:
384 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200385 * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
wdenk0db5bca2003-03-31 17:27:09 +0000386 *
387 * Offset:
388 */
389 sub r15, r10, r4
390
391 /* First our own GOT */
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100392 add r12, r12, r15
wdenk0db5bca2003-03-31 17:27:09 +0000393 /* the the one used by the C code */
394 add r30, r30, r15
395
396 /*
397 * Now relocate code
398 */
399
400 cmplw cr1,r3,r4
401 addi r0,r5,3
402 srwi. r0,r0,2
403 beq cr1,4f /* In place copy is not necessary */
404 beq 4f /* Protect against 0 count */
405 mtctr r0
406 bge cr1,2f
407
408 la r8,-4(r4)
409 la r7,-4(r3)
4101: lwzu r0,4(r8)
411 stwu r0,4(r7)
412 bdnz 1b
413 b 4f
414
4152: slwi r0,r0,2
416 add r8,r4,r0
417 add r7,r3,r0
4183: lwzu r0,-4(r8)
419 stwu r0,-4(r7)
420 bdnz 3b
421
wdenk8bde7f72003-06-27 21:31:46 +00004224: sync
wdenk0db5bca2003-03-31 17:27:09 +0000423 isync
424
425/*
426 * We are done. Do not return, instead branch to second part of board
427 * initialization, now running from RAM.
428 */
429
430 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
431 mtlr r0
432 blr
433
434in_ram:
435
436 /*
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100437 * Relocation Function, r12 point to got2+0x8000
wdenk0db5bca2003-03-31 17:27:09 +0000438 *
wdenk8bde7f72003-06-27 21:31:46 +0000439 * Adjust got2 pointers, no need to check for 0, this code
440 * already puts a few entries in the table.
wdenk0db5bca2003-03-31 17:27:09 +0000441 */
442 li r0,__got2_entries@sectoff@l
443 la r3,GOT(_GOT2_TABLE_)
444 lwz r11,GOT(_GOT2_TABLE_)
445 mtctr r0
446 sub r11,r3,r11
447 addi r3,r3,-4
4481: lwzu r0,4(r3)
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +0200449 cmpwi r0,0
450 beq- 2f
wdenk0db5bca2003-03-31 17:27:09 +0000451 add r0,r0,r11
452 stw r0,0(r3)
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +02004532: bdnz 1b
wdenk0db5bca2003-03-31 17:27:09 +0000454
455 /*
wdenk8bde7f72003-06-27 21:31:46 +0000456 * Now adjust the fixups and the pointers to the fixups
wdenk0db5bca2003-03-31 17:27:09 +0000457 * in case we need to move ourselves again.
458 */
Joakim Tjernlundafc3ba02009-10-08 02:03:51 +0200459 li r0,__fixup_entries@sectoff@l
wdenk0db5bca2003-03-31 17:27:09 +0000460 lwz r3,GOT(_FIXUP_TABLE_)
461 cmpwi r0,0
462 mtctr r0
463 addi r3,r3,-4
464 beq 4f
4653: lwzu r4,4(r3)
466 lwzux r0,r4,r11
467 add r0,r0,r11
468 stw r10,0(r3)
469 stw r0,0(r4)
470 bdnz 3b
4714:
472clear_bss:
473 /*
474 * Now clear BSS segment
475 */
wdenk5d232d02003-05-22 22:52:13 +0000476 lwz r3,GOT(__bss_start)
wdenk0db5bca2003-03-31 17:27:09 +0000477 lwz r4,GOT(_end)
478 cmplw 0, r3, r4
479 beq 6f
480
481 li r0, 0
4825:
483 stw r0, 0(r3)
484 addi r3, r3, 4
485 cmplw 0, r3, r4
486 bne 5b
4876:
488
489 mr r3, r9 /* Global Data pointer */
490 mr r4, r10 /* Destination Address */
491 bl board_init_r
492
wdenk0db5bca2003-03-31 17:27:09 +0000493 /*
494 * Copy exception vector code to low memory
495 *
496 * r3: dest_addr
497 * r7: source address, r8: end address, r9: target address
498 */
499 .globl trap_init
500trap_init:
Joakim Tjernlund0f8aa152010-01-19 14:41:56 +0100501 mflr r4 /* save link register */
502 GET_GOT
wdenk0db5bca2003-03-31 17:27:09 +0000503 lwz r7, GOT(_start)
504 lwz r8, GOT(_end_of_vectors)
505
wdenk682011f2003-06-03 23:54:09 +0000506 li r9, 0x100 /* reset vector always at 0x100 */
wdenk0db5bca2003-03-31 17:27:09 +0000507
508 cmplw 0, r7, r8
509 bgelr /* return if r7>=r8 - just in case */
wdenk0db5bca2003-03-31 17:27:09 +00005101:
511 lwz r0, 0(r7)
512 stw r0, 0(r9)
513 addi r7, r7, 4
514 addi r9, r9, 4
515 cmplw 0, r7, r8
516 bne 1b
517
518 /*
519 * relocate `hdlr' and `int_return' entries
520 */
521 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
522 li r8, Alignment - _start + EXC_OFF_SYS_RESET
5232:
524 bl trap_reloc
525 addi r7, r7, 0x100 /* next exception vector */
526 cmplw 0, r7, r8
527 blt 2b
528
529 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
530 bl trap_reloc
531
532 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
533 bl trap_reloc
534
535 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
536 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
5373:
538 bl trap_reloc
539 addi r7, r7, 0x100 /* next exception vector */
540 cmplw 0, r7, r8
541 blt 3b
542
543 li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
544 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
5454:
546 bl trap_reloc
547 addi r7, r7, 0x100 /* next exception vector */
548 cmplw 0, r7, r8
549 blt 4b
550
551 mtlr r4 /* restore link register */
552 blr
553
wdenkb6e4c402004-01-02 16:05:07 +0000554#if defined(CONFIG_PATI)
555/* Program the PLL */
556pll_prog_code_start:
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200557 lis r4, (CONFIG_SYS_IMMR + 0x002fc384)@h
558 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc384)@l
wdenkb6e4c402004-01-02 16:05:07 +0000559 lis r3, (0x55ccaa33)@h
560 ori r3, r3, (0x55ccaa33)@l
561 stw r3, 0(r4)
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200562 lis r4, (CONFIG_SYS_IMMR + 0x002fc284)@h
563 ori r4, r4, (CONFIG_SYS_IMMR + 0x002fc284)@l
564 lis r3, CONFIG_SYS_PLPRCR@h
565 ori r3, r3, CONFIG_SYS_PLPRCR@l
wdenkb6e4c402004-01-02 16:05:07 +0000566 stw r3, 0(r4)
567 addis r3,0,0x0
568 ori r3,r3,0xA000
569 mtctr r3
570..spinlp:
571 bdnz ..spinlp /* spin loop */
572 blr
573pll_prog_code_end:
574 nop
575 blr
576#endif