Blame view
arch/powerpc/cpu/ppc4xx/start.S
53.2 KB
0442ed869 Initial revision |
1 2 3 4 |
/* * Copyright (C) 1998 Dan Malek <dmalek@jlc.net> * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se> * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de> |
3cb86f3e4 [PATCH] Clean up ... |
5 |
* Copyright (C) 2007 Stefan Roese <sr@denx.de>, DENX Software Engineering |
c821b5f12 ppc4xx: Enable Pr... |
6 7 |
* Copyright (c) 2008 Nuovation System Designs, LLC * Grant Erickson <gerickson@nuovations.com> |
0442ed869 Initial revision |
8 |
* |
1b387ef55 SPDX: fix IBM-pib... |
9 |
* SPDX-License-Identifier: GPL-2.0 IBM-pibs |
83b4cfa3d Coding style clea... |
10 |
*/ |
0442ed869 Initial revision |
11 |
|
f7b548adb ppc4xx: Clarify c... |
12 13 |
/* * Startup code for IBM/AMCC PowerPC 4xx (PPC4xx) based boards |
0442ed869 Initial revision |
14 |
* |
f7b548adb ppc4xx: Clarify c... |
15 16 17 |
* The following description only applies to the NOR flash style booting. * NAND booting is different. For more details about NAND booting on 4xx * take a look at doc/README.nand-boot-ppc440. |
0442ed869 Initial revision |
18 |
* |
f7b548adb ppc4xx: Clarify c... |
19 20 21 22 23 24 25 26 |
* The CPU starts at address 0xfffffffc (last word in the address space). * The U-Boot image therefore has to be located in the "upper" area of the * flash (e.g. 512MiB - 0xfff80000 ... 0xffffffff). The default value for * the boot chip-select (CS0) is quite big and covers this area. On the * 405EX this is for example 0xffe00000 ... 0xffffffff. U-Boot will * reconfigure this CS0 (and other chip-selects as well when configured * this way) in the boot process to the "correct" values matching the * board layout. |
0442ed869 Initial revision |
27 |
*/ |
f7b548adb ppc4xx: Clarify c... |
28 |
|
25ddd1fb0 Replace CONFIG_SY... |
29 |
#include <asm-offsets.h> |
0442ed869 Initial revision |
30 |
#include <config.h> |
b36df5611 ppc4xx: Move ppc4... |
31 |
#include <asm/ppc4xx.h> |
0442ed869 Initial revision |
32 |
#include <version.h> |
0442ed869 Initial revision |
33 34 35 36 37 |
#include <ppc_asm.tmpl> #include <ppc_defs.h> #include <asm/cache.h> #include <asm/mmu.h> |
b14ca4b61 ppc4xx: Added ppc... |
38 |
#include <asm/ppc4xx-isram.h> |
0442ed869 Initial revision |
39 |
|
6d0f6bcf3 rename CFG_ macro... |
40 41 |
#ifdef CONFIG_SYS_INIT_DCACHE_CS # if (CONFIG_SYS_INIT_DCACHE_CS == 0) |
d1c3b2752 ppc4xx: Big clean... |
42 43 |
# define PBxAP PB1AP # define PBxCR PB0CR |
6d0f6bcf3 rename CFG_ macro... |
44 45 46 |
# if (defined(CONFIG_SYS_EBC_PB0AP) && defined(CONFIG_SYS_EBC_PB0CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB0AP # define PBxCR_VAL CONFIG_SYS_EBC_PB0CR |
c821b5f12 ppc4xx: Enable Pr... |
47 |
# endif |
0442ed869 Initial revision |
48 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
49 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 1) |
d1c3b2752 ppc4xx: Big clean... |
50 51 |
# define PBxAP PB1AP # define PBxCR PB1CR |
6d0f6bcf3 rename CFG_ macro... |
52 53 54 |
# if (defined(CONFIG_SYS_EBC_PB1AP) && defined(CONFIG_SYS_EBC_PB1CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB1AP # define PBxCR_VAL CONFIG_SYS_EBC_PB1CR |
c821b5f12 ppc4xx: Enable Pr... |
55 |
# endif |
0442ed869 Initial revision |
56 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
57 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 2) |
d1c3b2752 ppc4xx: Big clean... |
58 59 |
# define PBxAP PB2AP # define PBxCR PB2CR |
6d0f6bcf3 rename CFG_ macro... |
60 61 62 |
# if (defined(CONFIG_SYS_EBC_PB2AP) && defined(CONFIG_SYS_EBC_PB2CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB2AP # define PBxCR_VAL CONFIG_SYS_EBC_PB2CR |
c821b5f12 ppc4xx: Enable Pr... |
63 |
# endif |
0442ed869 Initial revision |
64 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
65 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 3) |
d1c3b2752 ppc4xx: Big clean... |
66 67 |
# define PBxAP PB3AP # define PBxCR PB3CR |
6d0f6bcf3 rename CFG_ macro... |
68 69 70 |
# if (defined(CONFIG_SYS_EBC_PB3AP) && defined(CONFIG_SYS_EBC_PB3CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB3AP # define PBxCR_VAL CONFIG_SYS_EBC_PB3CR |
c821b5f12 ppc4xx: Enable Pr... |
71 |
# endif |
0442ed869 Initial revision |
72 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
73 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 4) |
d1c3b2752 ppc4xx: Big clean... |
74 75 |
# define PBxAP PB4AP # define PBxCR PB4CR |
6d0f6bcf3 rename CFG_ macro... |
76 77 78 |
# if (defined(CONFIG_SYS_EBC_PB4AP) && defined(CONFIG_SYS_EBC_PB4CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB4AP # define PBxCR_VAL CONFIG_SYS_EBC_PB4CR |
c821b5f12 ppc4xx: Enable Pr... |
79 |
# endif |
0442ed869 Initial revision |
80 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
81 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 5) |
d1c3b2752 ppc4xx: Big clean... |
82 83 |
# define PBxAP PB5AP # define PBxCR PB5CR |
6d0f6bcf3 rename CFG_ macro... |
84 85 86 |
# if (defined(CONFIG_SYS_EBC_PB5AP) && defined(CONFIG_SYS_EBC_PB5CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB5AP # define PBxCR_VAL CONFIG_SYS_EBC_PB5CR |
c821b5f12 ppc4xx: Enable Pr... |
87 |
# endif |
0442ed869 Initial revision |
88 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
89 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 6) |
d1c3b2752 ppc4xx: Big clean... |
90 91 |
# define PBxAP PB6AP # define PBxCR PB6CR |
6d0f6bcf3 rename CFG_ macro... |
92 93 94 |
# if (defined(CONFIG_SYS_EBC_PB6AP) && defined(CONFIG_SYS_EBC_PB6CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB6AP # define PBxCR_VAL CONFIG_SYS_EBC_PB6CR |
c821b5f12 ppc4xx: Enable Pr... |
95 |
# endif |
0442ed869 Initial revision |
96 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
97 |
# if (CONFIG_SYS_INIT_DCACHE_CS == 7) |
d1c3b2752 ppc4xx: Big clean... |
98 99 |
# define PBxAP PB7AP # define PBxCR PB7CR |
6d0f6bcf3 rename CFG_ macro... |
100 101 102 |
# if (defined(CONFIG_SYS_EBC_PB7AP) && defined(CONFIG_SYS_EBC_PB7CR)) # define PBxAP_VAL CONFIG_SYS_EBC_PB7AP # define PBxCR_VAL CONFIG_SYS_EBC_PB7CR |
c821b5f12 ppc4xx: Enable Pr... |
103 104 105 106 107 108 109 110 111 |
# endif # endif # ifndef PBxAP_VAL # define PBxAP_VAL 0 # endif # ifndef PBxCR_VAL # define PBxCR_VAL 0 # endif /* |
6d0f6bcf3 rename CFG_ macro... |
112 |
* Memory Bank x (nothingness) initialization CONFIG_SYS_INIT_RAM_ADDR + 64 MiB |
c821b5f12 ppc4xx: Enable Pr... |
113 114 |
* used as temporary stack pointer for the primordial stack */ |
6d0f6bcf3 rename CFG_ macro... |
115 116 |
# ifndef CONFIG_SYS_INIT_DCACHE_PBxAR # define CONFIG_SYS_INIT_DCACHE_PBxAR (EBC_BXAP_BME_DISABLED | \ |
c821b5f12 ppc4xx: Enable Pr... |
117 118 119 120 121 122 123 124 125 126 127 128 |
EBC_BXAP_TWT_ENCODE(7) | \ EBC_BXAP_BCE_DISABLE | \ EBC_BXAP_BCT_2TRANS | \ EBC_BXAP_CSN_ENCODE(0) | \ EBC_BXAP_OEN_ENCODE(0) | \ EBC_BXAP_WBN_ENCODE(0) | \ EBC_BXAP_WBF_ENCODE(0) | \ EBC_BXAP_TH_ENCODE(2) | \ EBC_BXAP_RE_DISABLED | \ EBC_BXAP_SOR_NONDELAYED | \ EBC_BXAP_BEM_WRITEONLY | \ EBC_BXAP_PEN_DISABLED) |
6d0f6bcf3 rename CFG_ macro... |
129 130 131 |
# endif /* CONFIG_SYS_INIT_DCACHE_PBxAR */ # ifndef CONFIG_SYS_INIT_DCACHE_PBxCR # define CONFIG_SYS_INIT_DCACHE_PBxCR (EBC_BXCR_BAS_ENCODE(CONFIG_SYS_INIT_RAM_ADDR) | \ |
c821b5f12 ppc4xx: Enable Pr... |
132 133 134 |
EBC_BXCR_BS_64MB | \ EBC_BXCR_BU_RW | \ EBC_BXCR_BW_16BIT) |
6d0f6bcf3 rename CFG_ macro... |
135 136 137 |
# endif /* CONFIG_SYS_INIT_DCACHE_PBxCR */ # ifndef CONFIG_SYS_INIT_RAM_PATTERN # define CONFIG_SYS_INIT_RAM_PATTERN 0xDEADDEAD |
0442ed869 Initial revision |
138 |
# endif |
6d0f6bcf3 rename CFG_ macro... |
139 |
#endif /* CONFIG_SYS_INIT_DCACHE_CS */ |
0442ed869 Initial revision |
140 |
|
553f09823 Rename CONFIG_SYS... |
141 142 |
#if (defined(CONFIG_SYS_INIT_RAM_DCACHE) && (CONFIG_SYS_INIT_RAM_SIZE > (4 << 10))) #error Only 4k of init-ram is supported - please adjust CONFIG_SYS_INIT_RAM_SIZE! |
28d77d968 ppc4xx: Fix probl... |
143 |
#endif |
c821b5f12 ppc4xx: Enable Pr... |
144 145 |
/* * Unless otherwise overriden, enable two 128MB cachable instruction regions |
6d0f6bcf3 rename CFG_ macro... |
146 147 |
* at CONFIG_SYS_SDRAM_BASE and another 128MB cacheable instruction region covering * NOR flash at CONFIG_SYS_FLASH_BASE. Disable all cacheable data regions. |
c821b5f12 ppc4xx: Enable Pr... |
148 |
*/ |
6d0f6bcf3 rename CFG_ macro... |
149 |
#if !defined(CONFIG_SYS_FLASH_BASE) |
64852d09e ppc4xx/NAND_SPL: ... |
150 |
/* If not already defined, set it to the "last" 128MByte region */ |
6d0f6bcf3 rename CFG_ macro... |
151 |
# define CONFIG_SYS_FLASH_BASE 0xf8000000 |
64852d09e ppc4xx/NAND_SPL: ... |
152 |
#endif |
6d0f6bcf3 rename CFG_ macro... |
153 154 155 156 157 158 159 160 161 |
#if !defined(CONFIG_SYS_ICACHE_SACR_VALUE) # define CONFIG_SYS_ICACHE_SACR_VALUE \ (PPC_128MB_SACR_VALUE(CONFIG_SYS_SDRAM_BASE + ( 0 << 20)) | \ PPC_128MB_SACR_VALUE(CONFIG_SYS_SDRAM_BASE + (128 << 20)) | \ PPC_128MB_SACR_VALUE(CONFIG_SYS_FLASH_BASE)) #endif /* !defined(CONFIG_SYS_ICACHE_SACR_VALUE) */ #if !defined(CONFIG_SYS_DCACHE_SACR_VALUE) # define CONFIG_SYS_DCACHE_SACR_VALUE \ |
c821b5f12 ppc4xx: Enable Pr... |
162 |
(0x00000000) |
6d0f6bcf3 rename CFG_ macro... |
163 |
#endif /* !defined(CONFIG_SYS_DCACHE_SACR_VALUE) */ |
c821b5f12 ppc4xx: Enable Pr... |
164 |
|
4978e6058 ppc4xx: Cleanup B... |
165 166 167 |
#if !defined(CONFIG_SYS_TLB_FOR_BOOT_FLASH) #define CONFIG_SYS_TLB_FOR_BOOT_FLASH 0 /* use TLB 0 as default */ #endif |
83b4cfa3d Coding style clea... |
168 |
#define function_prolog(func_name) .text; \ |
cf959c7d6 ppc4xx: Add NAND ... |
169 170 171 |
.align 2; \ .globl func_name; \ func_name: |
83b4cfa3d Coding style clea... |
172 |
#define function_epilog(func_name) .type func_name,@function; \ |
cf959c7d6 ppc4xx: Add NAND ... |
173 |
.size func_name,.-func_name |
0442ed869 Initial revision |
174 175 176 177 178 179 180 |
/* We don't want the MMU yet. */ #undef MSR_KERNEL #define MSR_KERNEL ( MSR_ME ) /* Machine Check */ .extern ext_bus_cntlr_init |
0442ed869 Initial revision |
181 182 183 184 |
/* * Set up GOT: Global Offset Table * |
0f8aa1591 ppc: Use r12 inst... |
185 |
* Use r12 to access the GOT |
0442ed869 Initial revision |
186 |
*/ |
345b77bac ppc4xx: Remove 4x... |
187 |
#if !defined(CONFIG_SPL_BUILD) |
0442ed869 Initial revision |
188 189 190 191 192 193 194 195 |
START_GOT GOT_ENTRY(_GOT2_TABLE_) GOT_ENTRY(_FIXUP_TABLE_) GOT_ENTRY(_start) GOT_ENTRY(_start_of_vectors) GOT_ENTRY(_end_of_vectors) GOT_ENTRY(transfer_to_handler) |
3b57fe0a7 * Get (mostly) ri... |
196 |
GOT_ENTRY(__init_end) |
3929fb0a1 Replace __bss_end... |
197 |
GOT_ENTRY(__bss_end) |
5d232d0e7 * Patch by Dave E... |
198 |
GOT_ENTRY(__bss_start) |
0442ed869 Initial revision |
199 |
END_GOT |
345b77bac ppc4xx: Remove 4x... |
200 |
#endif /* CONFIG_SPL_BUILD */ |
0442ed869 Initial revision |
201 |
|
d20b99911 xilinx-ppc4xx-gen... |
202 |
#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_BOOT_FROM_XMD) |
d873133f2 ppc4xx: Add Sequo... |
203 204 205 206 207 208 |
/* * 4xx RAM-booting U-Boot image is started from offset 0 */ .text bl _start_440 #endif |
98f99e9f1 ppc4xx: Add SPL s... |
209 210 211 212 213 214 215 216 217 218 219 |
#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD) /* * This is the entry of the real U-Boot from a board port * that supports SPL booting on the PPC4xx. We only need * to call board_init_f() here. Everything else has already * been done in the SPL u-boot version. */ GET_GOT /* initialize GOT access */ bl board_init_f /* run 1st part of board init code (in Flash)*/ /* NOTREACHED - board_init_f() does not return */ #endif |
0442ed869 Initial revision |
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
/* * 440 Startup -- on reset only the top 4k of the effective * address space is mapped in by an entry in the instruction * and data shadow TLB. The .bootpg section is located in the * top 4k & does only what's necessary to map in the the rest * of the boot rom. Once the boot rom is mapped in we can * proceed with normal startup. * * NOTE: CS0 only covers the top 2MB of the effective address * space after reset. */ #if defined(CONFIG_440) .section .bootpg,"ax" .globl _start_440 /**************************************************************************/ _start_440: |
511d0c72b Coding style cleanup |
238 239 240 |
/*--------------------------------------------------------------------+ | 440EPX BUP Change - Hardware team request +--------------------------------------------------------------------*/ |
887e2ec9e Add support for A... |
241 242 243 244 245 |
#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) sync nop nop #endif |
6c5879f38 Add support for A... |
246 247 248 |
/*----------------------------------------------------------------+ | Core bug fix. Clear the esr +-----------------------------------------------------------------*/ |
edd6cf20e Fix timer problem... |
249 |
li r0,0 |
58ea142fb ppc4xx: Replace 4... |
250 |
mtspr SPRN_ESR,r0 |
0442ed869 Initial revision |
251 252 253 |
/*----------------------------------------------------------------*/ /* Clear and set up some registers. */ /*----------------------------------------------------------------*/ |
f901a83b7 Add support for e... |
254 255 |
iccci r0,r0 /* NOTE: operands not used for 440 */ dccci r0,r0 /* NOTE: operands not used for 440 */ |
0442ed869 Initial revision |
256 257 |
sync li r0,0 |
58ea142fb ppc4xx: Replace 4... |
258 259 260 261 |
mtspr SPRN_SRR0,r0 mtspr SPRN_SRR1,r0 mtspr SPRN_CSRR0,r0 mtspr SPRN_CSRR1,r0 |
887e2ec9e Add support for A... |
262 263 |
/* NOTE: 440GX adds machine check status regs */ #if defined(CONFIG_440) && !defined(CONFIG_440GP) |
58ea142fb ppc4xx: Replace 4... |
264 265 266 267 |
mtspr SPRN_MCSRR0,r0 mtspr SPRN_MCSRR1,r0 mfspr r1,SPRN_MCSR mtspr SPRN_MCSR,r1 |
ba56f6257 Patch by Travis S... |
268 |
#endif |
205328330 [PATCH] PPC4xx st... |
269 270 271 272 273 274 275 276 277 278 |
/*----------------------------------------------------------------*/ /* CCR0 init */ /*----------------------------------------------------------------*/ /* Disable store gathering & broadcast, guarantee inst/data * cache block touch, force load/store alignment * (see errata 1.12: 440_33) */ lis r1,0x0030 /* store gathering & broadcast disable */ ori r1,r1,0x6000 /* cache touch */ |
58ea142fb ppc4xx: Replace 4... |
279 |
mtspr SPRN_CCR0,r1 |
205328330 [PATCH] PPC4xx st... |
280 |
|
0442ed869 Initial revision |
281 282 283 |
/*----------------------------------------------------------------*/ /* Initialize debug */ /*----------------------------------------------------------------*/ |
58ea142fb ppc4xx: Replace 4... |
284 |
mfspr r1,SPRN_DBCR0 |
887e2ec9e Add support for A... |
285 286 |
andis. r1, r1, 0x8000 /* test DBCR0[EDM] bit */ bne skip_debug_init /* if set, don't clear debug register */ |
ad876fff3 ppc4xx: Disable t... |
287 288 289 |
mfspr r1,SPRN_CCR0 ori r1,r1,CCR0_DTB@l /* Disable Trace Broadcast */ mtspr SPRN_CCR0,r1 |
58ea142fb ppc4xx: Replace 4... |
290 291 292 293 294 295 296 297 298 299 300 301 302 |
mtspr SPRN_DBCR0,r0 mtspr SPRN_DBCR1,r0 mtspr SPRN_DBCR2,r0 mtspr SPRN_IAC1,r0 mtspr SPRN_IAC2,r0 mtspr SPRN_IAC3,r0 mtspr SPRN_DAC1,r0 mtspr SPRN_DAC2,r0 mtspr SPRN_DVC1,r0 mtspr SPRN_DVC2,r0 mfspr r1,SPRN_DBSR mtspr SPRN_DBSR,r1 /* Clear all valid bits */ |
887e2ec9e Add support for A... |
303 |
skip_debug_init: |
0442ed869 Initial revision |
304 |
|
6c5879f38 Add support for A... |
305 306 307 308 309 310 311 312 313 314 315 316 |
#if defined (CONFIG_440SPE) /*----------------------------------------------------------------+ | Initialize Core Configuration Reg1. | a. ICDPEI: Record even parity. Normal operation. | b. ICTPEI: Record even parity. Normal operation. | c. DCTPEI: Record even parity. Normal operation. | d. DCDPEI: Record even parity. Normal operation. | e. DCUPEI: Record even parity. Normal operation. | f. DCMPEI: Record even parity. Normal operation. | g. FCOM: Normal operation | h. MMUPEI: Record even parity. Normal operation. | i. FFF: Flush only as much data as necessary. |
edd6cf20e Fix timer problem... |
317 |
| j. TCS: Timebase increments from CPU clock. |
6c5879f38 Add support for A... |
318 |
+-----------------------------------------------------------------*/ |
edd6cf20e Fix timer problem... |
319 |
li r0,0 |
58ea142fb ppc4xx: Replace 4... |
320 |
mtspr SPRN_CCR1, r0 |
6c5879f38 Add support for A... |
321 322 323 324 325 |
/*----------------------------------------------------------------+ | Reset the timebase. | The previous write to CCR1 sets the timebase source. +-----------------------------------------------------------------*/ |
58ea142fb ppc4xx: Replace 4... |
326 327 |
mtspr SPRN_TBWL, r0 mtspr SPRN_TBWU, r0 |
6c5879f38 Add support for A... |
328 |
#endif |
0442ed869 Initial revision |
329 330 331 |
/*----------------------------------------------------------------*/ /* Setup interrupt vectors */ /*----------------------------------------------------------------*/ |
58ea142fb ppc4xx: Replace 4... |
332 |
mtspr SPRN_IVPR,r0 /* Vectors start at 0x0000_0000 */ |
f901a83b7 Add support for e... |
333 |
li r1,0x0100 |
58ea142fb ppc4xx: Replace 4... |
334 |
mtspr SPRN_IVOR0,r1 /* Critical input */ |
f901a83b7 Add support for e... |
335 |
li r1,0x0200 |
58ea142fb ppc4xx: Replace 4... |
336 |
mtspr SPRN_IVOR1,r1 /* Machine check */ |
f901a83b7 Add support for e... |
337 |
li r1,0x0300 |
58ea142fb ppc4xx: Replace 4... |
338 |
mtspr SPRN_IVOR2,r1 /* Data storage */ |
f901a83b7 Add support for e... |
339 |
li r1,0x0400 |
58ea142fb ppc4xx: Replace 4... |
340 |
mtspr SPRN_IVOR3,r1 /* Instruction storage */ |
0442ed869 Initial revision |
341 |
li r1,0x0500 |
58ea142fb ppc4xx: Replace 4... |
342 |
mtspr SPRN_IVOR4,r1 /* External interrupt */ |
0442ed869 Initial revision |
343 |
li r1,0x0600 |
58ea142fb ppc4xx: Replace 4... |
344 |
mtspr SPRN_IVOR5,r1 /* Alignment */ |
0442ed869 Initial revision |
345 |
li r1,0x0700 |
58ea142fb ppc4xx: Replace 4... |
346 |
mtspr SPRN_IVOR6,r1 /* Program check */ |
0442ed869 Initial revision |
347 |
li r1,0x0800 |
58ea142fb ppc4xx: Replace 4... |
348 |
mtspr SPRN_IVOR7,r1 /* Floating point unavailable */ |
0442ed869 Initial revision |
349 |
li r1,0x0c00 |
58ea142fb ppc4xx: Replace 4... |
350 |
mtspr SPRN_IVOR8,r1 /* System call */ |
efa35cf12 ppc4xx: Clean up ... |
351 |
li r1,0x0a00 |
58ea142fb ppc4xx: Replace 4... |
352 |
mtspr SPRN_IVOR9,r1 /* Auxiliary Processor unavailable */ |
efa35cf12 ppc4xx: Clean up ... |
353 |
li r1,0x0900 |
58ea142fb ppc4xx: Replace 4... |
354 |
mtspr SPRN_IVOR10,r1 /* Decrementer */ |
0442ed869 Initial revision |
355 |
li r1,0x1300 |
58ea142fb ppc4xx: Replace 4... |
356 |
mtspr SPRN_IVOR13,r1 /* Data TLB error */ |
efa35cf12 ppc4xx: Clean up ... |
357 |
li r1,0x1400 |
58ea142fb ppc4xx: Replace 4... |
358 |
mtspr SPRN_IVOR14,r1 /* Instr TLB error */ |
0442ed869 Initial revision |
359 |
li r1,0x2000 |
58ea142fb ppc4xx: Replace 4... |
360 |
mtspr SPRN_IVOR15,r1 /* Debug */ |
0442ed869 Initial revision |
361 362 363 364 |
/*----------------------------------------------------------------*/ /* Configure cache regions */ /*----------------------------------------------------------------*/ |
58ea142fb ppc4xx: Replace 4... |
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
mtspr SPRN_INV0,r0 mtspr SPRN_INV1,r0 mtspr SPRN_INV2,r0 mtspr SPRN_INV3,r0 mtspr SPRN_DNV0,r0 mtspr SPRN_DNV1,r0 mtspr SPRN_DNV2,r0 mtspr SPRN_DNV3,r0 mtspr SPRN_ITV0,r0 mtspr SPRN_ITV1,r0 mtspr SPRN_ITV2,r0 mtspr SPRN_ITV3,r0 mtspr SPRN_DTV0,r0 mtspr SPRN_DTV1,r0 mtspr SPRN_DTV2,r0 mtspr SPRN_DTV3,r0 |
0442ed869 Initial revision |
381 382 383 384 385 386 387 388 |
/*----------------------------------------------------------------*/ /* Cache victim limits */ /*----------------------------------------------------------------*/ /* floors 0, ceiling max to use the entire cache -- nothing locked */ lis r1,0x0001 ori r1,r1,0xf800 |
58ea142fb ppc4xx: Replace 4... |
389 390 |
mtspr SPRN_IVLIM,r1 mtspr SPRN_DVLIM,r1 |
0442ed869 Initial revision |
391 |
|
6c5879f38 Add support for A... |
392 393 394 |
/*----------------------------------------------------------------+ |Initialize MMUCR[STID] = 0. +-----------------------------------------------------------------*/ |
58ea142fb ppc4xx: Replace 4... |
395 |
mfspr r0,SPRN_MMUCR |
6c5879f38 Add support for A... |
396 397 398 |
addis r1,0,0xFFFF ori r1,r1,0xFF00 and r0,r0,r1 |
58ea142fb ppc4xx: Replace 4... |
399 |
mtspr SPRN_MMUCR,r0 |
6c5879f38 Add support for A... |
400 |
|
0442ed869 Initial revision |
401 402 403 |
/*----------------------------------------------------------------*/ /* Clear all TLB entries -- TID = 0, TS = 0 */ /*----------------------------------------------------------------*/ |
6c5879f38 Add support for A... |
404 |
addis r0,0,0x0000 |
0a371ca08 ppc4xx: Fix TLB r... |
405 |
#ifdef CONFIG_SYS_RAMBOOT |
d873133f2 ppc4xx: Add Sequo... |
406 |
li r4,0 /* Start with TLB #0 */ |
0a371ca08 ppc4xx: Fix TLB r... |
407 408 409 410 411 412 |
#else li r4,1 /* Start with TLB #1 */ #endif li r1,64 /* 64 TLB entries */ sub r1,r1,r4 /* calculate last TLB # */ mtctr r1 |
d873133f2 ppc4xx: Add Sequo... |
413 414 415 416 417 418 419 420 421 422 |
rsttlb: #ifdef CONFIG_SYS_RAMBOOT tlbre r3,r4,0 /* Read contents from TLB word #0 to get EPN */ rlwinm. r3,r3,0,0xfffffc00 /* Mask EPN */ beq tlbnxt /* Skip EPN=0 TLB, this is the SDRAM TLB */ #endif tlbwe r0,r4,0 /* Invalidate all entries (V=0)*/ tlbwe r0,r4,1 tlbwe r0,r4,2 tlbnxt: addi r4,r4,1 /* Next TLB */ |
6c5879f38 Add support for A... |
423 |
bdnz rsttlb |
0442ed869 Initial revision |
424 425 426 427 |
/*----------------------------------------------------------------*/ /* TLB entry setup -- step thru tlbtab */ /*----------------------------------------------------------------*/ |
2a72e9ed1 ppc4xx: Add optio... |
428 |
#if defined(CONFIG_440SPE_REVA) |
692519b1e Add support for P... |
429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
/*----------------------------------------------------------------*/ /* We have different TLB tables for revA and rev B of 440SPe */ /*----------------------------------------------------------------*/ mfspr r1, PVR lis r0,0x5342 ori r0,r0,0x1891 cmpw r7,r1,r0 bne r7,..revA bl tlbtabB b ..goon ..revA: bl tlbtabA ..goon: #else |
0442ed869 Initial revision |
443 |
bl tlbtab /* Get tlbtab pointer */ |
692519b1e Add support for P... |
444 |
#endif |
0442ed869 Initial revision |
445 446 447 448 449 450 |
mr r5,r0 li r1,0x003f /* 64 TLB entries max */ mtctr r1 li r4,0 /* TLB # */ addi r5,r5,-4 |
d873133f2 ppc4xx: Add Sequo... |
451 452 453 454 455 456 457 |
1: #ifdef CONFIG_SYS_RAMBOOT tlbre r3,r4,0 /* Read contents from TLB word #0 */ rlwinm. r3,r3,0,0x00000200 /* Mask V (valid) bit */ bne tlbnx2 /* Skip V=1 TLB, this is the SDRAM TLB */ #endif lwzu r0,4(r5) |
0442ed869 Initial revision |
458 459 460 461 462 463 464 |
cmpwi r0,0 beq 2f /* 0 marks end */ lwzu r1,4(r5) lwzu r2,4(r5) tlbwe r0,r4,0 /* TLB Word 0 */ tlbwe r1,r4,1 /* TLB Word 1 */ tlbwe r2,r4,2 /* TLB Word 2 */ |
d873133f2 ppc4xx: Add Sequo... |
465 |
tlbnx2: addi r4,r4,1 /* Next TLB */ |
0442ed869 Initial revision |
466 467 468 469 470 |
bdnz 1b /*----------------------------------------------------------------*/ /* Continue from 'normal' start */ /*----------------------------------------------------------------*/ |
887e2ec9e Add support for A... |
471 |
2: |
887e2ec9e Add support for A... |
472 |
bl 3f |
0442ed869 Initial revision |
473 474 475 |
b _start 3: li r0,0 |
58ea142fb ppc4xx: Replace 4... |
476 |
mtspr SPRN_SRR1,r0 /* Keep things disabled for now */ |
0442ed869 Initial revision |
477 |
mflr r1 |
58ea142fb ppc4xx: Replace 4... |
478 |
mtspr SPRN_SRR0,r1 |
0442ed869 Initial revision |
479 |
rfi |
b867d705b PPC405EP support ... |
480 |
#endif /* CONFIG_440 */ |
0442ed869 Initial revision |
481 482 483 484 485 |
/* * r3 - 1st arg to board_init(): IMMP pointer * r4 - 2nd arg to board_init(): boot flag */ |
345b77bac ppc4xx: Remove 4x... |
486 |
#if !defined(CONFIG_SPL_BUILD) |
0442ed869 Initial revision |
487 488 489 490 |
.text .long 0x27051956 /* U-Boot Magic Number */ .globl version_string version_string: |
09c2e90c1 unify version_string |
491 |
.ascii U_BOOT_VERSION_STRING, "\0" |
0442ed869 Initial revision |
492 |
|
0442ed869 Initial revision |
493 |
. = EXC_OFF_SYS_RESET |
efa35cf12 ppc4xx: Clean up ... |
494 495 496 497 498 499 500 501 |
.globl _start_of_vectors _start_of_vectors: /* Critical input. */ CRIT_EXCEPTION(0x100, CritcalInput, UnknownException) #ifdef CONFIG_440 /* Machine check */ |
83b4cfa3d Coding style clea... |
502 |
MCK_EXCEPTION(0x200, MachineCheck, MachineCheckException) |
efa35cf12 ppc4xx: Clean up ... |
503 |
#else |
83b4cfa3d Coding style clea... |
504 |
CRIT_EXCEPTION(0x200, MachineCheck, MachineCheckException) |
efa35cf12 ppc4xx: Clean up ... |
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
#endif /* CONFIG_440 */ /* Data Storage exception. */ STD_EXCEPTION(0x300, DataStorage, UnknownException) /* Instruction Storage exception. */ STD_EXCEPTION(0x400, InstStorage, UnknownException) /* External Interrupt exception. */ STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt) /* Alignment exception. */ . = 0x600 Alignment: EXCEPTION_PROLOG(SRR0, SRR1) mfspr r4,DAR stw r4,_DAR(r21) mfspr r5,DSISR stw r5,_DSISR(r21) addi r3,r1,STACK_FRAME_OVERHEAD |
fc4e18878 ppc: Loose GOT ac... |
525 |
EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE) |
efa35cf12 ppc4xx: Clean up ... |
526 527 528 529 530 531 |
/* Program check exception */ . = 0x700 ProgramCheck: EXCEPTION_PROLOG(SRR0, SRR1) addi r3,r1,STACK_FRAME_OVERHEAD |
fc4e18878 ppc: Loose GOT ac... |
532 533 |
EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException, MSR_KERNEL, COPY_EE) |
efa35cf12 ppc4xx: Clean up ... |
534 535 536 537 538 |
#ifdef CONFIG_440 STD_EXCEPTION(0x800, FPUnavailable, UnknownException) STD_EXCEPTION(0x900, Decrementer, DecrementerPITException) STD_EXCEPTION(0xa00, APU, UnknownException) |
df8a24cdd [ppc4xx] Fix prob... |
539 |
#endif |
efa35cf12 ppc4xx: Clean up ... |
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
STD_EXCEPTION(0xc00, SystemCall, UnknownException) #ifdef CONFIG_440 STD_EXCEPTION(0x1300, DataTLBError, UnknownException) STD_EXCEPTION(0x1400, InstructionTLBError, UnknownException) #else STD_EXCEPTION(0x1000, PIT, DecrementerPITException) STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException) STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException) #endif CRIT_EXCEPTION(0x2000, DebugBreakpoint, DebugException ) .globl _end_of_vectors _end_of_vectors: . = _START_OFFSET |
887e2ec9e Add support for A... |
555 |
#endif |
0442ed869 Initial revision |
556 557 |
.globl _start _start: |
98f99e9f1 ppc4xx: Add SPL s... |
558 559 560 561 562 563 564 565 566 567 568 |
#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD) /* * This is the entry of the real U-Boot from a board port * that supports SPL booting on the PPC4xx. We only need * to call board_init_f() here. Everything else has already * been done in the SPL u-boot version. */ GET_GOT /* initialize GOT access */ bl board_init_f /* run 1st part of board init code (in Flash)*/ /* NOTREACHED - board_init_f() does not return */ #endif |
0442ed869 Initial revision |
569 570 571 572 573 574 575 576 |
/*****************************************************************************/ #if defined(CONFIG_440) /*----------------------------------------------------------------*/ /* Clear and set up some registers. */ /*----------------------------------------------------------------*/ li r0,0x0000 lis r1,0xffff |
58ea142fb ppc4xx: Replace 4... |
577 578 579 580 581 582 |
mtspr SPRN_DEC,r0 /* prevent dec exceptions */ mtspr SPRN_TBWL,r0 /* prevent fit & wdt exceptions */ mtspr SPRN_TBWU,r0 mtspr SPRN_TSR,r1 /* clear all timer exception status */ mtspr SPRN_TCR,r0 /* disable all */ mtspr SPRN_ESR,r0 /* clear exception syndrome register */ |
0442ed869 Initial revision |
583 |
mtxer r0 /* clear integer exception register */ |
0442ed869 Initial revision |
584 585 586 |
/*----------------------------------------------------------------*/ /* Debug setup -- some (not very good) ice's need an event*/ |
6d0f6bcf3 rename CFG_ macro... |
587 |
/* to establish control :-( Define CONFIG_SYS_INIT_DBCR to the dbsr */ |
0442ed869 Initial revision |
588 589 |
/* value you need in this case 0x8cff 0000 should do the trick */ /*----------------------------------------------------------------*/ |
6d0f6bcf3 rename CFG_ macro... |
590 |
#if defined(CONFIG_SYS_INIT_DBCR) |
0442ed869 Initial revision |
591 592 |
lis r1,0xffff ori r1,r1,0xffff |
58ea142fb ppc4xx: Replace 4... |
593 |
mtspr SPRN_DBSR,r1 /* Clear all status bits */ |
6d0f6bcf3 rename CFG_ macro... |
594 595 |
lis r0,CONFIG_SYS_INIT_DBCR@h ori r0,r0,CONFIG_SYS_INIT_DBCR@l |
58ea142fb ppc4xx: Replace 4... |
596 |
mtspr SPRN_DBCR0,r0 |
0442ed869 Initial revision |
597 598 599 600 601 602 603 |
isync #endif /*----------------------------------------------------------------*/ /* Setup the internal SRAM */ /*----------------------------------------------------------------*/ li r0,0 |
887e2ec9e Add support for A... |
604 |
|
6d0f6bcf3 rename CFG_ macro... |
605 |
#ifdef CONFIG_SYS_INIT_RAM_DCACHE |
c157d8e21 Add support for A... |
606 |
/* Clear Dcache to use as RAM */ |
6d0f6bcf3 rename CFG_ macro... |
607 608 |
addis r3,r0,CONFIG_SYS_INIT_RAM_ADDR@h ori r3,r3,CONFIG_SYS_INIT_RAM_ADDR@l |
553f09823 Rename CONFIG_SYS... |
609 610 |
addis r4,r0,CONFIG_SYS_INIT_RAM_SIZE@h ori r4,r4,CONFIG_SYS_INIT_RAM_SIZE@l |
c157d8e21 Add support for A... |
611 |
rlwinm. r5,r4,0,27,31 |
f901a83b7 Add support for e... |
612 613 614 |
rlwinm r5,r4,27,5,31 beq ..d_ran addi r5,r5,0x0001 |
c157d8e21 Add support for A... |
615 |
..d_ran: |
f901a83b7 Add support for e... |
616 |
mtctr r5 |
c157d8e21 Add support for A... |
617 |
..d_ag: |
f901a83b7 Add support for e... |
618 619 620 |
dcbz r0,r3 addi r3,r3,32 bdnz ..d_ag |
e02c521d9 ppc4xx: Add 44x c... |
621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
/* * Lock the init-ram/stack in d-cache, so that other regions * may use d-cache as well * Note, that this current implementation locks exactly 4k * of d-cache, so please make sure that you don't define a * bigger init-ram area. Take a look at the lwmon5 440EPx * implementation as a reference. */ msync isync /* 8. set TFLOOR/NFLOOR to 8 (-> 8*16*32 bytes locked -> 4k) */ lis r1,0x0201 ori r1,r1,0xf808 |
58ea142fb ppc4xx: Replace 4... |
635 |
mtspr SPRN_DVLIM,r1 |
e02c521d9 ppc4xx: Add 44x c... |
636 637 |
lis r1,0x0808 ori r1,r1,0x0808 |
58ea142fb ppc4xx: Replace 4... |
638 639 640 641 642 643 644 645 |
mtspr SPRN_DNV0,r1 mtspr SPRN_DNV1,r1 mtspr SPRN_DNV2,r1 mtspr SPRN_DNV3,r1 mtspr SPRN_DTV0,r1 mtspr SPRN_DTV1,r1 mtspr SPRN_DTV2,r1 mtspr SPRN_DTV3,r1 |
e02c521d9 ppc4xx: Add 44x c... |
646 647 |
msync isync |
6d0f6bcf3 rename CFG_ macro... |
648 |
#endif /* CONFIG_SYS_INIT_RAM_DCACHE */ |
887e2ec9e Add support for A... |
649 650 651 652 |
/* 440EP & 440GR are only 440er PPC's without internal SRAM */ #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) /* not all PPC's have internal SRAM usable as L2-cache */ |
2801b2d2a ppc4xx: Add basic... |
653 654 |
#if defined(CONFIG_440GX) || \ defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \ |
7d3079368 ppc4xx: Add initi... |
655 |
defined(CONFIG_460SX) |
b14ca4b61 ppc4xx: Added ppc... |
656 |
mtdcr L2_CACHE_CFG,r0 /* Ensure L2 Cache is off */ |
9ed3246e1 powerpc: ppc4xx: ... |
657 |
#elif defined(CONFIG_460EX) || defined(CONFIG_460GT) |
ddf45cc75 ppc4xx: Changed 4... |
658 659 660 |
lis r1, 0x0000 ori r1,r1,0x0008 /* Set L2_CACHE_CFG[RDBW]=1 */ mtdcr L2_CACHE_CFG,r1 |
ba56f6257 Patch by Travis S... |
661 |
#endif |
0442ed869 Initial revision |
662 |
|
887e2ec9e Add support for A... |
663 |
lis r2,0x7fff |
0442ed869 Initial revision |
664 |
ori r2,r2,0xffff |
b14ca4b61 ppc4xx: Added ppc... |
665 |
mfdcr r1,ISRAM0_DPC |
0442ed869 Initial revision |
666 |
and r1,r1,r2 /* Disable parity check */ |
b14ca4b61 ppc4xx: Added ppc... |
667 668 |
mtdcr ISRAM0_DPC,r1 mfdcr r1,ISRAM0_PMEG |
887e2ec9e Add support for A... |
669 |
and r1,r1,r2 /* Disable pwr mgmt */ |
b14ca4b61 ppc4xx: Added ppc... |
670 |
mtdcr ISRAM0_PMEG,r1 |
0442ed869 Initial revision |
671 672 |
lis r1,0x8000 /* BAS = 8000_0000 */ |
6e7fb6eaa Add support for A... |
673 |
#if defined(CONFIG_440GX) || defined(CONFIG_440SP) |
ba56f6257 Patch by Travis S... |
674 |
ori r1,r1,0x0980 /* first 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
675 |
mtdcr ISRAM0_SB0CR,r1 |
ba56f6257 Patch by Travis S... |
676 677 |
lis r1,0x8001 ori r1,r1,0x0980 /* second 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
678 |
mtdcr ISRAM0_SB1CR,r1 |
ba56f6257 Patch by Travis S... |
679 680 |
lis r1, 0x8002 ori r1,r1, 0x0980 /* third 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
681 |
mtdcr ISRAM0_SB2CR,r1 |
ba56f6257 Patch by Travis S... |
682 683 |
lis r1, 0x8003 ori r1,r1, 0x0980 /* fourth 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
684 |
mtdcr ISRAM0_SB3CR,r1 |
1b8fec139 APM821xx: Add CPU... |
685 |
#elif defined(CONFIG_440SPE) || defined(CONFIG_460EX) || \ |
9ed3246e1 powerpc: ppc4xx: ... |
686 |
defined(CONFIG_460GT) |
ddf45cc75 ppc4xx: Changed 4... |
687 |
lis r1,0x0000 /* BAS = X_0000_0000 */ |
6c5879f38 Add support for A... |
688 |
ori r1,r1,0x0984 /* first 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
689 |
mtdcr ISRAM0_SB0CR,r1 |
6c5879f38 Add support for A... |
690 691 |
lis r1,0x0001 ori r1,r1,0x0984 /* second 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
692 |
mtdcr ISRAM0_SB1CR,r1 |
6c5879f38 Add support for A... |
693 694 |
lis r1, 0x0002 ori r1,r1, 0x0984 /* third 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
695 |
mtdcr ISRAM0_SB2CR,r1 |
6c5879f38 Add support for A... |
696 697 |
lis r1, 0x0003 ori r1,r1, 0x0984 /* fourth 64k */ |
b14ca4b61 ppc4xx: Added ppc... |
698 |
mtdcr ISRAM0_SB3CR,r1 |
9ed3246e1 powerpc: ppc4xx: ... |
699 |
#if defined(CONFIG_460EX) || defined(CONFIG_460GT) |
ddf45cc75 ppc4xx: Changed 4... |
700 701 702 703 |
lis r2,0x7fff ori r2,r2,0xffff mfdcr r1,ISRAM1_DPC and r1,r1,r2 /* Disable parity check */ |
455ae7e87 Coding style clea... |
704 |
mtdcr ISRAM1_DPC,r1 |
ddf45cc75 ppc4xx: Changed 4... |
705 706 707 708 709 |
mfdcr r1,ISRAM1_PMEG and r1,r1,r2 /* Disable pwr mgmt */ mtdcr ISRAM1_PMEG,r1 lis r1,0x0004 /* BAS = 4_0004_0000 */ |
1b8fec139 APM821xx: Add CPU... |
710 |
ori r1,r1,ISRAM1_SIZE /* ocm size */ |
ddf45cc75 ppc4xx: Changed 4... |
711 712 |
mtdcr ISRAM1_SB0CR,r1 #endif |
7d3079368 ppc4xx: Add initi... |
713 714 715 |
#elif defined(CONFIG_460SX) lis r1,0x0000 /* BAS = 0000_0000 */ ori r1,r1,0x0B84 /* first 128k */ |
b14ca4b61 ppc4xx: Added ppc... |
716 |
mtdcr ISRAM0_SB0CR,r1 |
7d3079368 ppc4xx: Add initi... |
717 718 |
lis r1,0x0001 ori r1,r1,0x0B84 /* second 128k */ |
b14ca4b61 ppc4xx: Added ppc... |
719 |
mtdcr ISRAM0_SB1CR,r1 |
7d3079368 ppc4xx: Add initi... |
720 721 |
lis r1, 0x0002 ori r1,r1, 0x0B84 /* third 128k */ |
b14ca4b61 ppc4xx: Added ppc... |
722 |
mtdcr ISRAM0_SB2CR,r1 |
7d3079368 ppc4xx: Add initi... |
723 724 |
lis r1, 0x0003 ori r1,r1, 0x0B84 /* fourth 128k */ |
b14ca4b61 ppc4xx: Added ppc... |
725 |
mtdcr ISRAM0_SB3CR,r1 |
887e2ec9e Add support for A... |
726 |
#elif defined(CONFIG_440GP) |
0442ed869 Initial revision |
727 |
ori r1,r1,0x0380 /* 8k rw */ |
b14ca4b61 ppc4xx: Added ppc... |
728 729 |
mtdcr ISRAM0_SB0CR,r1 mtdcr ISRAM0_SB1CR,r0 /* Disable bank 1 */ |
ba56f6257 Patch by Travis S... |
730 |
#endif |
887e2ec9e Add support for A... |
731 |
#endif /* #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) */ |
0442ed869 Initial revision |
732 733 734 735 |
/*----------------------------------------------------------------*/ /* Setup the stack in internal SRAM */ /*----------------------------------------------------------------*/ |
6d0f6bcf3 rename CFG_ macro... |
736 737 |
lis r1,CONFIG_SYS_INIT_RAM_ADDR@h ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET@l |
0442ed869 Initial revision |
738 739 740 741 742 743 744 745 746 |
li r0,0 stwu r0,-4(r1) stwu r0,-4(r1) /* Terminate call chain */ stwu r1,-8(r1) /* Save back chain and move SP */ lis r0,RESET_VECTOR@h /* Address of reset vector */ ori r0,r0, RESET_VECTOR@l stwu r1,-8(r1) /* Save back chain and move SP */ stw r0,+12(r1) /* Save return addr (underflow vect) */ |
8c4734e9a Revert "PowerPC: ... |
747 |
|
98f99e9f1 ppc4xx: Add SPL s... |
748 |
#ifndef CONFIG_SPL_BUILD |
0442ed869 Initial revision |
749 |
GET_GOT |
98f99e9f1 ppc4xx: Add SPL s... |
750 |
#endif |
5568e613e Add support for P... |
751 752 |
bl cpu_init_f /* run low-level CPU init code (from Flash) */ |
0442ed869 Initial revision |
753 |
bl board_init_f |
52ebd9c1e powerpc: Remove w... |
754 |
/* NOTREACHED - board_init_f() does not return */ |
0442ed869 Initial revision |
755 756 757 758 |
#endif /* CONFIG_440 */ /*****************************************************************************/ |
3fb858891 ppc4xx: Remove su... |
759 |
#if defined(CONFIG_405GP) || \ |
e01bd218b [PATCH] Add AMCC ... |
760 |
defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \ |
dbbd12572 ppc4xx: Add PPC40... |
761 |
defined(CONFIG_405EX) || defined(CONFIG_405) |
0442ed869 Initial revision |
762 763 764 765 |
/*----------------------------------------------------------------------- */ /* Clear and set up some registers. */ /*----------------------------------------------------------------------- */ addi r4,r0,0x0000 |
dbbd12572 ppc4xx: Add PPC40... |
766 |
#if !defined(CONFIG_405EX) |
58ea142fb ppc4xx: Replace 4... |
767 |
mtspr SPRN_SGR,r4 |
dbbd12572 ppc4xx: Add PPC40... |
768 769 770 771 772 773 774 775 |
#else /* * On 405EX, completely clearing the SGR leads to PPC hangup * upon PCIe configuration access. The PCIe memory regions * need to be guarded! */ lis r3,0x0000 ori r3,r3,0x7FFC |
58ea142fb ppc4xx: Replace 4... |
776 |
mtspr SPRN_SGR,r3 |
dbbd12572 ppc4xx: Add PPC40... |
777 |
#endif |
58ea142fb ppc4xx: Replace 4... |
778 |
mtspr SPRN_DCWR,r4 |
0442ed869 Initial revision |
779 780 781 782 |
mtesr r4 /* clear Exception Syndrome Reg */ mttcr r4 /* clear Timer Control Reg */ mtxer r4 /* clear Fixed-Point Exception Reg */ mtevpr r4 /* clear Exception Vector Prefix Reg */ |
0442ed869 Initial revision |
783 784 785 |
addi r4,r0,(0xFFFF-0x10000) /* set r4 to 0xFFFFFFFF (status in the */ /* dbsr is cleared by setting bits to 1) */ mtdbsr r4 /* clear/reset the dbsr */ |
c821b5f12 ppc4xx: Enable Pr... |
786 |
/* Invalidate the i- and d-caches. */ |
0442ed869 Initial revision |
787 788 |
bl invalidate_icache bl invalidate_dcache |
c821b5f12 ppc4xx: Enable Pr... |
789 |
/* Set-up icache cacheability. */ |
6d0f6bcf3 rename CFG_ macro... |
790 791 |
lis r4, CONFIG_SYS_ICACHE_SACR_VALUE@h ori r4, r4, CONFIG_SYS_ICACHE_SACR_VALUE@l |
c821b5f12 ppc4xx: Enable Pr... |
792 |
mticcr r4 |
0442ed869 Initial revision |
793 |
isync |
c821b5f12 ppc4xx: Enable Pr... |
794 |
/* Set-up dcache cacheability. */ |
6d0f6bcf3 rename CFG_ macro... |
795 796 |
lis r4, CONFIG_SYS_DCACHE_SACR_VALUE@h ori r4, r4, CONFIG_SYS_DCACHE_SACR_VALUE@l |
c821b5f12 ppc4xx: Enable Pr... |
797 |
mtdccr r4 |
0442ed869 Initial revision |
798 |
|
1f4d53260 ppc4xx: Generic a... |
799 800 |
#if !(defined(CONFIG_SYS_EBC_PB0AP) && defined(CONFIG_SYS_EBC_PB0CR))\ && !defined (CONFIG_XILINX_405) |
0442ed869 Initial revision |
801 802 803 804 805 |
/*----------------------------------------------------------------------- */ /* Tune the speed and size for flash CS0 */ /*----------------------------------------------------------------------- */ bl ext_bus_cntlr_init #endif |
64852d09e ppc4xx/NAND_SPL: ... |
806 |
|
6d0f6bcf3 rename CFG_ macro... |
807 |
#if !(defined(CONFIG_SYS_INIT_DCACHE_CS) || defined(CONFIG_SYS_TEMP_STACK_OCM)) |
dbbd12572 ppc4xx: Add PPC40... |
808 |
/* |
c821b5f12 ppc4xx: Enable Pr... |
809 810 811 |
* For boards that don't have OCM and can't use the data cache * for their primordial stack, setup stack here directly after the * SDRAM is initialized in ext_bus_cntlr_init. |
dbbd12572 ppc4xx: Add PPC40... |
812 |
*/ |
6d0f6bcf3 rename CFG_ macro... |
813 814 |
lis r1, CONFIG_SYS_INIT_RAM_ADDR@h ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in SDRAM */ |
dbbd12572 ppc4xx: Add PPC40... |
815 816 817 818 819 820 821 822 823 824 825 826 827 |
li r0, 0 /* Make room for stack frame header and */ stwu r0, -4(r1) /* clear final stack frame so that */ stwu r0, -4(r1) /* stack backtraces terminate cleanly */ /* * Set up a dummy frame to store reset vector as return address. * this causes stack underflow to reset board. */ stwu r1, -8(r1) /* Save back chain and move SP */ lis r0, RESET_VECTOR@h /* Address of reset vector */ ori r0, r0, RESET_VECTOR@l stwu r1, -8(r1) /* Save back chain and move SP */ stw r0, +12(r1) /* Save return addr (underflow vect) */ |
6d0f6bcf3 rename CFG_ macro... |
828 |
#endif /* !(CONFIG_SYS_INIT_DCACHE_CS || !CONFIG_SYS_TEM_STACK_OCM) */ |
0442ed869 Initial revision |
829 |
|
b867d705b PPC405EP support ... |
830 831 832 833 |
#if defined(CONFIG_405EP) /*----------------------------------------------------------------------- */ /* DMA Status, clear to come up clean */ /*----------------------------------------------------------------------- */ |
53677ef18 Big white-space c... |
834 |
addis r3,r0, 0xFFFF /* Clear all existing DMA status */ |
f901a83b7 Add support for e... |
835 |
ori r3,r3, 0xFFFF |
d1c3b2752 ppc4xx: Big clean... |
836 |
mtdcr DMASR, r3 |
b867d705b PPC405EP support ... |
837 |
|
53677ef18 Big white-space c... |
838 |
bl ppc405ep_init /* do ppc405ep specific init */ |
b867d705b PPC405EP support ... |
839 |
#endif /* CONFIG_405EP */ |
6d0f6bcf3 rename CFG_ macro... |
840 |
#if defined(CONFIG_SYS_OCM_DATA_ADDR) && defined(CONFIG_SYS_OCM_DATA_SIZE) |
e01bd218b [PATCH] Add AMCC ... |
841 842 843 844 845 846 |
#if defined(CONFIG_405EZ) /******************************************************************** * Setup OCM - On Chip Memory - PPC405EZ uses OCM Controller V2 *******************************************************************/ /* * We can map the OCM on the PLB3, so map it at |
6d0f6bcf3 rename CFG_ macro... |
847 |
* CONFIG_SYS_OCM_DATA_ADDR + 0x8000 |
e01bd218b [PATCH] Add AMCC ... |
848 |
*/ |
6d0f6bcf3 rename CFG_ macro... |
849 850 |
lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */ ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l |
df8a24cdd [ppc4xx] Fix prob... |
851 |
ori r3,r3,0x0270 /* 16K for Bank 1, R/W/Enable */ |
d1c3b2752 ppc4xx: Big clean... |
852 |
mtdcr OCM0_PLBCR1,r3 /* Set PLB Access */ |
e01bd218b [PATCH] Add AMCC ... |
853 |
ori r3,r3,0x4000 /* Add 0x4000 for bank 2 */ |
d1c3b2752 ppc4xx: Big clean... |
854 |
mtdcr OCM0_PLBCR2,r3 /* Set PLB Access */ |
e01bd218b [PATCH] Add AMCC ... |
855 |
isync |
6d0f6bcf3 rename CFG_ macro... |
856 857 |
lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */ ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l |
83b4cfa3d Coding style clea... |
858 |
ori r3,r3,0x0270 /* 16K for Bank 1, R/W/Enable */ |
d1c3b2752 ppc4xx: Big clean... |
859 860 |
mtdcr OCM0_DSRC1, r3 /* Set Data Side */ mtdcr OCM0_ISRC1, r3 /* Set Instruction Side */ |
e01bd218b [PATCH] Add AMCC ... |
861 |
ori r3,r3,0x4000 /* Add 0x4000 for bank 2 */ |
d1c3b2752 ppc4xx: Big clean... |
862 863 |
mtdcr OCM0_DSRC2, r3 /* Set Data Side */ mtdcr OCM0_ISRC2, r3 /* Set Instruction Side */ |
83b4cfa3d Coding style clea... |
864 |
addis r3,0,0x0800 /* OCM Data Parity Disable - 1 Wait State */ |
d1c3b2752 ppc4xx: Big clean... |
865 |
mtdcr OCM0_DISDPC,r3 |
e01bd218b [PATCH] Add AMCC ... |
866 867 |
isync |
3cb86f3e4 [PATCH] Clean up ... |
868 |
#else /* CONFIG_405EZ */ |
0442ed869 Initial revision |
869 870 871 872 |
/******************************************************************** * Setup OCM - On Chip Memory *******************************************************************/ /* Setup OCM */ |
8bde7f776 * Code cleanup: |
873 874 |
lis r0, 0x7FFF ori r0, r0, 0xFFFF |
d1c3b2752 ppc4xx: Big clean... |
875 876 |
mfdcr r3, OCM0_ISCNTL /* get instr-side IRAM config */ mfdcr r4, OCM0_DSCNTL /* get data-side IRAM config */ |
3cb86f3e4 [PATCH] Clean up ... |
877 878 |
and r3, r3, r0 /* disable data-side IRAM */ and r4, r4, r0 /* disable data-side IRAM */ |
d1c3b2752 ppc4xx: Big clean... |
879 880 |
mtdcr OCM0_ISCNTL, r3 /* set instr-side IRAM config */ mtdcr OCM0_DSCNTL, r4 /* set data-side IRAM config */ |
8bde7f776 * Code cleanup: |
881 |
isync |
0442ed869 Initial revision |
882 |
|
6d0f6bcf3 rename CFG_ macro... |
883 884 |
lis r3,CONFIG_SYS_OCM_DATA_ADDR@h /* OCM location */ ori r3,r3,CONFIG_SYS_OCM_DATA_ADDR@l |
d1c3b2752 ppc4xx: Big clean... |
885 |
mtdcr OCM0_DSARC, r3 |
0442ed869 Initial revision |
886 |
addis r4, 0, 0xC000 /* OCM data area enabled */ |
d1c3b2752 ppc4xx: Big clean... |
887 |
mtdcr OCM0_DSCNTL, r4 |
8bde7f776 * Code cleanup: |
888 |
isync |
e01bd218b [PATCH] Add AMCC ... |
889 |
#endif /* CONFIG_405EZ */ |
0442ed869 Initial revision |
890 891 892 893 894 |
#endif /*----------------------------------------------------------------------- */ /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */ /*----------------------------------------------------------------------- */ |
6d0f6bcf3 rename CFG_ macro... |
895 |
#ifdef CONFIG_SYS_INIT_DCACHE_CS |
c821b5f12 ppc4xx: Enable Pr... |
896 |
li r4, PBxAP |
d1c3b2752 ppc4xx: Big clean... |
897 |
mtdcr EBC0_CFGADDR, r4 |
6d0f6bcf3 rename CFG_ macro... |
898 899 |
lis r4, CONFIG_SYS_INIT_DCACHE_PBxAR@h ori r4, r4, CONFIG_SYS_INIT_DCACHE_PBxAR@l |
d1c3b2752 ppc4xx: Big clean... |
900 |
mtdcr EBC0_CFGDATA, r4 |
c821b5f12 ppc4xx: Enable Pr... |
901 902 |
addi r4, 0, PBxCR |
d1c3b2752 ppc4xx: Big clean... |
903 |
mtdcr EBC0_CFGADDR, r4 |
6d0f6bcf3 rename CFG_ macro... |
904 905 |
lis r4, CONFIG_SYS_INIT_DCACHE_PBxCR@h ori r4, r4, CONFIG_SYS_INIT_DCACHE_PBxCR@l |
d1c3b2752 ppc4xx: Big clean... |
906 |
mtdcr EBC0_CFGDATA, r4 |
c821b5f12 ppc4xx: Enable Pr... |
907 908 909 |
/* * Enable the data cache for the 128MB storage access control region |
6d0f6bcf3 rename CFG_ macro... |
910 |
* at CONFIG_SYS_INIT_RAM_ADDR. |
c821b5f12 ppc4xx: Enable Pr... |
911 912 |
*/ mfdccr r4 |
6d0f6bcf3 rename CFG_ macro... |
913 914 |
oris r4, r4, PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@h ori r4, r4, PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@l |
0442ed869 Initial revision |
915 |
mtdccr r4 |
c821b5f12 ppc4xx: Enable Pr... |
916 917 918 919 920 921 |
/* * Preallocate data cache lines to be used to avoid a subsequent * cache miss and an ensuing machine check exception when exceptions * are enabled. */ li r0, 0 |
0442ed869 Initial revision |
922 |
|
6d0f6bcf3 rename CFG_ macro... |
923 924 |
lis r3, CONFIG_SYS_INIT_RAM_ADDR@h ori r3, r3, CONFIG_SYS_INIT_RAM_ADDR@l |
0442ed869 Initial revision |
925 |
|
553f09823 Rename CONFIG_SYS... |
926 927 |
lis r4, CONFIG_SYS_INIT_RAM_SIZE@h ori r4, r4, CONFIG_SYS_INIT_RAM_SIZE@l |
c821b5f12 ppc4xx: Enable Pr... |
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
/* * Convert the size, in bytes, to the number of cache lines/blocks * to preallocate. */ clrlwi. r5, r4, (32 - L1_CACHE_SHIFT) srwi r5, r4, L1_CACHE_SHIFT beq ..load_counter addi r5, r5, 0x0001 ..load_counter: mtctr r5 /* Preallocate the computed number of cache blocks. */ ..alloc_dcache_block: dcba r0, r3 addi r3, r3, L1_CACHE_BYTES bdnz ..alloc_dcache_block sync /* * Load the initial stack pointer and data area and convert the size, * in bytes, to the number of words to initialize to a known value. */ |
6d0f6bcf3 rename CFG_ macro... |
951 952 |
lis r1, CONFIG_SYS_INIT_RAM_ADDR@h ori r1, r1, CONFIG_SYS_INIT_SP_OFFSET@l |
c821b5f12 ppc4xx: Enable Pr... |
953 |
|
553f09823 Rename CONFIG_SYS... |
954 955 |
lis r4, (CONFIG_SYS_INIT_RAM_SIZE >> 2)@h ori r4, r4, (CONFIG_SYS_INIT_RAM_SIZE >> 2)@l |
0442ed869 Initial revision |
956 |
mtctr r4 |
6d0f6bcf3 rename CFG_ macro... |
957 |
lis r2, CONFIG_SYS_INIT_RAM_ADDR@h |
553f09823 Rename CONFIG_SYS... |
958 |
ori r2, r2, CONFIG_SYS_INIT_RAM_SIZE@l |
0442ed869 Initial revision |
959 |
|
6d0f6bcf3 rename CFG_ macro... |
960 961 |
lis r4, CONFIG_SYS_INIT_RAM_PATTERN@h ori r4, r4, CONFIG_SYS_INIT_RAM_PATTERN@l |
0442ed869 Initial revision |
962 963 |
..stackloop: |
c821b5f12 ppc4xx: Enable Pr... |
964 |
stwu r4, -4(r2) |
0442ed869 Initial revision |
965 |
bdnz ..stackloop |
c821b5f12 ppc4xx: Enable Pr... |
966 967 968 969 970 971 |
/* * Make room for stack frame header and clear final stack frame so * that stack backtraces terminate cleanly. */ stwu r0, -4(r1) stwu r0, -4(r1) |
0442ed869 Initial revision |
972 973 974 975 976 977 978 979 980 |
/* * Set up a dummy frame to store reset vector as return address. * this causes stack underflow to reset board. */ stwu r1, -8(r1) /* Save back chain and move SP */ addis r0, 0, RESET_VECTOR@h /* Address of reset vector */ ori r0, r0, RESET_VECTOR@l stwu r1, -8(r1) /* Save back chain and move SP */ stw r0, +12(r1) /* Save return addr (underflow vect) */ |
6d0f6bcf3 rename CFG_ macro... |
981 982 |
#elif defined(CONFIG_SYS_TEMP_STACK_OCM) && \ (defined(CONFIG_SYS_OCM_DATA_ADDR) && defined(CONFIG_SYS_OCM_DATA_SIZE)) |
0442ed869 Initial revision |
983 984 985 986 987 |
/* * Stack in OCM. */ /* Set up Stack at top of OCM */ |
6d0f6bcf3 rename CFG_ macro... |
988 989 |
lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@h ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@l |
0442ed869 Initial revision |
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
/* Set up a zeroized stack frame so that backtrace works right */ li r0, 0 stwu r0, -4(r1) stwu r0, -4(r1) /* * Set up a dummy frame to store reset vector as return address. * this causes stack underflow to reset board. */ stwu r1, -8(r1) /* Save back chain and move SP */ lis r0, RESET_VECTOR@h /* Address of reset vector */ ori r0, r0, RESET_VECTOR@l stwu r1, -8(r1) /* Save back chain and move SP */ stw r0, +12(r1) /* Save return addr (underflow vect) */ |
6d0f6bcf3 rename CFG_ macro... |
1005 |
#endif /* CONFIG_SYS_INIT_DCACHE_CS */ |
0442ed869 Initial revision |
1006 |
|
0442ed869 Initial revision |
1007 |
GET_GOT /* initialize GOT access */ |
f901a83b7 Add support for e... |
1008 |
bl cpu_init_f /* run low-level CPU init code (from Flash) */ |
0442ed869 Initial revision |
1009 |
|
0442ed869 Initial revision |
1010 |
bl board_init_f /* run first part of init code (from Flash) */ |
52ebd9c1e powerpc: Remove w... |
1011 |
/* NOTREACHED - board_init_f() does not return */ |
3fb858891 ppc4xx: Remove su... |
1012 |
#endif /* CONFIG_405GP || CONFIG_405 || CONFIG_405EP */ |
12f34241c * Add support for... |
1013 |
/*----------------------------------------------------------------------- */ |
0442ed869 Initial revision |
1014 |
|
345b77bac ppc4xx: Remove 4x... |
1015 |
#if !defined(CONFIG_SPL_BUILD) |
0442ed869 Initial revision |
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 |
/* * This code finishes saving the registers to the exception frame * and jumps to the appropriate handler for the exception. * Register r21 is pointer into trap frame, r1 has new stack pointer. */ .globl transfer_to_handler transfer_to_handler: stw r22,_NIP(r21) lis r22,MSR_POW@h andc r23,r23,r22 stw r23,_MSR(r21) SAVE_GPR(7, r21) SAVE_4GPRS(8, r21) SAVE_8GPRS(12, r21) SAVE_8GPRS(24, r21) |
0442ed869 Initial revision |
1031 1032 1033 1034 1035 1036 |
mflr r23 andi. r24,r23,0x3f00 /* get vector offset */ stw r24,TRAP(r21) li r22,0 stw r22,RESULT(r21) mtspr SPRG2,r22 /* r1 is now kernel sp */ |
0442ed869 Initial revision |
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 |
lwz r24,0(r23) /* virtual address of handler */ lwz r23,4(r23) /* where to go when done */ mtspr SRR0,r24 mtspr SRR1,r20 mtlr r23 SYNC rfi /* jump to handler, enable MMU */ int_return: mfmsr r28 /* Disable interrupts */ li r4,0 ori r4,r4,MSR_EE andc r28,r28,r4 SYNC /* Some chip revs need this... */ mtmsr r28 SYNC lwz r2,_CTR(r1) lwz r0,_LINK(r1) mtctr r2 mtlr r0 lwz r2,_XER(r1) lwz r0,_CCR(r1) mtspr XER,r2 mtcrf 0xFF,r0 REST_10GPRS(3, r1) REST_10GPRS(13, r1) REST_8GPRS(23, r1) REST_GPR(31, r1) lwz r2,_NIP(r1) /* Restore environment */ lwz r0,_MSR(r1) mtspr SRR0,r2 mtspr SRR1,r0 lwz r0,GPR0(r1) lwz r2,GPR2(r1) lwz r1,GPR1(r1) SYNC rfi crit_return: mfmsr r28 /* Disable interrupts */ li r4,0 ori r4,r4,MSR_EE andc r28,r28,r4 SYNC /* Some chip revs need this... */ mtmsr r28 SYNC lwz r2,_CTR(r1) lwz r0,_LINK(r1) mtctr r2 mtlr r0 lwz r2,_XER(r1) lwz r0,_CCR(r1) mtspr XER,r2 mtcrf 0xFF,r0 REST_10GPRS(3, r1) REST_10GPRS(13, r1) REST_8GPRS(23, r1) REST_GPR(31, r1) lwz r2,_NIP(r1) /* Restore environment */ lwz r0,_MSR(r1) |
58ea142fb ppc4xx: Replace 4... |
1097 1098 |
mtspr SPRN_CSRR0,r2 mtspr SPRN_CSRR1,r0 |
0442ed869 Initial revision |
1099 1100 1101 1102 1103 |
lwz r0,GPR0(r1) lwz r2,GPR2(r1) lwz r1,GPR1(r1) SYNC rfci |
efa35cf12 ppc4xx: Clean up ... |
1104 1105 |
#ifdef CONFIG_440 mck_return: |
83b4cfa3d Coding style clea... |
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 |
mfmsr r28 /* Disable interrupts */ li r4,0 ori r4,r4,MSR_EE andc r28,r28,r4 SYNC /* Some chip revs need this... */ mtmsr r28 SYNC lwz r2,_CTR(r1) lwz r0,_LINK(r1) mtctr r2 mtlr r0 lwz r2,_XER(r1) lwz r0,_CCR(r1) mtspr XER,r2 mtcrf 0xFF,r0 REST_10GPRS(3, r1) REST_10GPRS(13, r1) REST_8GPRS(23, r1) REST_GPR(31, r1) lwz r2,_NIP(r1) /* Restore environment */ lwz r0,_MSR(r1) |
58ea142fb ppc4xx: Replace 4... |
1127 1128 |
mtspr SPRN_MCSRR0,r2 mtspr SPRN_MCSRR1,r0 |
83b4cfa3d Coding style clea... |
1129 1130 1131 1132 1133 |
lwz r0,GPR0(r1) lwz r2,GPR2(r1) lwz r1,GPR1(r1) SYNC rfmci |
efa35cf12 ppc4xx: Clean up ... |
1134 |
#endif /* CONFIG_440 */ |
0442ed869 Initial revision |
1135 1136 1137 1138 |
.globl get_pvr get_pvr: mfspr r3, PVR blr |
0442ed869 Initial revision |
1139 |
/*------------------------------------------------------------------------------- */ |
0442ed869 Initial revision |
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
/* Function: out16 */ /* Description: Output 16 bits */ /*------------------------------------------------------------------------------- */ .globl out16 out16: sth r4,0x0000(r3) blr /*------------------------------------------------------------------------------- */ /* Function: out16r */ /* Description: Byte reverse and output 16 bits */ /*------------------------------------------------------------------------------- */ .globl out16r out16r: sthbrx r4,r0,r3 blr /*------------------------------------------------------------------------------- */ |
0442ed869 Initial revision |
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 |
/* Function: out32r */ /* Description: Byte reverse and output 32 bits */ /*------------------------------------------------------------------------------- */ .globl out32r out32r: stwbrx r4,r0,r3 blr /*------------------------------------------------------------------------------- */ /* Function: in16 */ /* Description: Input 16 bits */ /*------------------------------------------------------------------------------- */ .globl in16 in16: lhz r3,0x0000(r3) blr /*------------------------------------------------------------------------------- */ /* Function: in16r */ /* Description: Input 16 bits and byte reverse */ /*------------------------------------------------------------------------------- */ .globl in16r in16r: lhbrx r3,r0,r3 blr /*------------------------------------------------------------------------------- */ |
0442ed869 Initial revision |
1185 1186 1187 1188 1189 1190 1191 |
/* Function: in32r */ /* Description: Input 32 bits and byte reverse */ /*------------------------------------------------------------------------------- */ .globl in32r in32r: lwbrx r3,r0,r3 blr |
98f99e9f1 ppc4xx: Add SPL s... |
1192 |
#if !defined(CONFIG_SPL_BUILD) |
0442ed869 Initial revision |
1193 1194 1195 1196 1197 1198 |
/* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * |
c821b5f12 ppc4xx: Enable Pr... |
1199 1200 1201 |
* r3 = Relocated stack pointer * r4 = Relocated global data pointer * r5 = Relocated text pointer |
0442ed869 Initial revision |
1202 1203 1204 |
*/ .globl relocate_code relocate_code: |
6d0f6bcf3 rename CFG_ macro... |
1205 |
#if defined(CONFIG_4xx_DCACHE) || defined(CONFIG_SYS_INIT_DCACHE_CS) |
9b94ac61d ppc4xx: Rework 4x... |
1206 |
/* |
7920954bd ppc4xx: Flush com... |
1207 1208 |
* We need to flush the initial global data (gd_t) and bd_info * before the dcache will be invalidated. |
9b94ac61d ppc4xx: Rework 4x... |
1209 |
*/ |
c821b5f12 ppc4xx: Enable Pr... |
1210 1211 1212 1213 |
/* Save registers */ mr r9, r3 mr r10, r4 mr r11, r5 |
9b94ac61d ppc4xx: Rework 4x... |
1214 |
|
7920954bd ppc4xx: Flush com... |
1215 1216 1217 1218 1219 |
/* * Flush complete dcache, this is faster than flushing the * ranges for global_data and bd_info instead. */ bl flush_dcache |
9b94ac61d ppc4xx: Rework 4x... |
1220 |
|
6d0f6bcf3 rename CFG_ macro... |
1221 |
#if defined(CONFIG_SYS_INIT_DCACHE_CS) |
c821b5f12 ppc4xx: Enable Pr... |
1222 1223 1224 1225 1226 1227 1228 1229 |
/* * Undo the earlier data cache set-up for the primordial stack and * data area. First, invalidate the data cache and then disable data * cacheability for that area. Finally, restore the EBC values, if * any. */ /* Invalidate the primordial stack and data area in cache */ |
6d0f6bcf3 rename CFG_ macro... |
1230 1231 |
lis r3, CONFIG_SYS_INIT_RAM_ADDR@h ori r3, r3, CONFIG_SYS_INIT_RAM_ADDR@l |
c821b5f12 ppc4xx: Enable Pr... |
1232 |
|
553f09823 Rename CONFIG_SYS... |
1233 1234 |
lis r4, CONFIG_SYS_INIT_RAM_SIZE@h ori r4, r4, CONFIG_SYS_INIT_RAM_SIZE@l |
c821b5f12 ppc4xx: Enable Pr... |
1235 1236 1237 1238 1239 1240 |
add r4, r4, r3 bl invalidate_dcache_range /* Disable cacheability for the region */ mfdccr r3 |
6d0f6bcf3 rename CFG_ macro... |
1241 1242 |
lis r4, ~PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@h ori r4, r4, ~PPC_128MB_SACR_VALUE(CONFIG_SYS_INIT_RAM_ADDR)@l |
c821b5f12 ppc4xx: Enable Pr... |
1243 1244 1245 1246 1247 |
and r3, r3, r4 mtdccr r3 /* Restore the EBC parameters */ li r3, PBxAP |
d1c3b2752 ppc4xx: Big clean... |
1248 |
mtdcr EBC0_CFGADDR, r3 |
c821b5f12 ppc4xx: Enable Pr... |
1249 1250 |
lis r3, PBxAP_VAL@h ori r3, r3, PBxAP_VAL@l |
d1c3b2752 ppc4xx: Big clean... |
1251 |
mtdcr EBC0_CFGDATA, r3 |
c821b5f12 ppc4xx: Enable Pr... |
1252 1253 |
li r3, PBxCR |
d1c3b2752 ppc4xx: Big clean... |
1254 |
mtdcr EBC0_CFGADDR, r3 |
c821b5f12 ppc4xx: Enable Pr... |
1255 1256 |
lis r3, PBxCR_VAL@h ori r3, r3, PBxCR_VAL@l |
d1c3b2752 ppc4xx: Big clean... |
1257 |
mtdcr EBC0_CFGDATA, r3 |
6d0f6bcf3 rename CFG_ macro... |
1258 |
#endif /* defined(CONFIG_SYS_INIT_DCACHE_CS) */ |
c821b5f12 ppc4xx: Enable Pr... |
1259 1260 1261 1262 1263 |
/* Restore registers */ mr r3, r9 mr r4, r10 mr r5, r11 |
6d0f6bcf3 rename CFG_ macro... |
1264 |
#endif /* defined(CONFIG_4xx_DCACHE) || defined(CONFIG_SYS_INIT_DCACHE_CS) */ |
e02c521d9 ppc4xx: Add 44x c... |
1265 |
|
6d0f6bcf3 rename CFG_ macro... |
1266 |
#ifdef CONFIG_SYS_INIT_RAM_DCACHE |
e02c521d9 ppc4xx: Add 44x c... |
1267 1268 1269 1270 1271 1272 1273 1274 |
/* * Unlock the previously locked d-cache */ msync isync /* set TFLOOR/NFLOOR to 0 again */ lis r6,0x0001 ori r6,r6,0xf800 |
58ea142fb ppc4xx: Replace 4... |
1275 |
mtspr SPRN_DVLIM,r6 |
e02c521d9 ppc4xx: Add 44x c... |
1276 1277 |
lis r6,0x0000 ori r6,r6,0x0000 |
58ea142fb ppc4xx: Replace 4... |
1278 1279 1280 1281 1282 1283 1284 1285 |
mtspr SPRN_DNV0,r6 mtspr SPRN_DNV1,r6 mtspr SPRN_DNV2,r6 mtspr SPRN_DNV3,r6 mtspr SPRN_DTV0,r6 mtspr SPRN_DTV1,r6 mtspr SPRN_DTV2,r6 mtspr SPRN_DTV3,r6 |
e02c521d9 ppc4xx: Add 44x c... |
1286 1287 |
msync isync |
f3cac5384 ppc4xx: Invalidat... |
1288 1289 1290 1291 1292 |
/* Invalidate data cache, now no longer our stack */ dccci 0,0 sync isync |
6d0f6bcf3 rename CFG_ macro... |
1293 |
#endif /* CONFIG_SYS_INIT_RAM_DCACHE */ |
e02c521d9 ppc4xx: Add 44x c... |
1294 |
|
a4c8d1389 Add support for P... |
1295 1296 1297 1298 |
/* * On some 440er platforms the cache is enabled in the first TLB (Boot-CS) * to speed up the boot process. Now this cache needs to be disabled. */ |
4978e6058 ppc4xx: Cleanup B... |
1299 |
#if defined(CONFIG_440) |
25fb4eaae ppc4xx: Clear all... |
1300 |
/* Clear all potential pending exceptions */ |
58ea142fb ppc4xx: Replace 4... |
1301 1302 |
mfspr r1,SPRN_MCSR mtspr SPRN_MCSR,r1 |
6d0f6bcf3 rename CFG_ macro... |
1303 |
addi r1,r0,CONFIG_SYS_TLB_FOR_BOOT_FLASH /* Use defined TLB */ |
c157d8e21 Add support for A... |
1304 |
tlbre r0,r1,0x0002 /* Read contents */ |
6e7fb6eaa Add support for A... |
1305 |
ori r0,r0,0x0c00 /* Or in the inhibit, write through bit */ |
f901a83b7 Add support for e... |
1306 |
tlbwe r0,r1,0x0002 /* Save it out */ |
a4c8d1389 Add support for P... |
1307 |
sync |
c157d8e21 Add support for A... |
1308 |
isync |
4978e6058 ppc4xx: Cleanup B... |
1309 |
#endif /* defined(CONFIG_440) */ |
0442ed869 Initial revision |
1310 1311 1312 |
mr r1, r3 /* Set new stack pointer */ mr r9, r4 /* Save copy of Init Data pointer */ mr r10, r5 /* Save copy of Destination Address */ |
0f8aa1591 ppc: Use r12 inst... |
1313 |
GET_GOT |
0442ed869 Initial revision |
1314 |
mr r3, r5 /* Destination Address */ |
6d0f6bcf3 rename CFG_ macro... |
1315 1316 |
lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l |
3b57fe0a7 * Get (mostly) ri... |
1317 1318 |
lwz r5, GOT(__init_end) sub r5, r5, r4 |
9b94ac61d ppc4xx: Rework 4x... |
1319 |
li r6, L1_CACHE_BYTES /* Cache Line Size */ |
0442ed869 Initial revision |
1320 1321 1322 1323 |
/* * Fix GOT pointer: * |
6d0f6bcf3 rename CFG_ macro... |
1324 |
* New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address |
0442ed869 Initial revision |
1325 1326 1327 1328 1329 1330 |
* * Offset: */ sub r15, r10, r4 /* First our own GOT */ |
0f8aa1591 ppc: Use r12 inst... |
1331 |
add r12, r12, r15 |
c821b5f12 ppc4xx: Enable Pr... |
1332 |
/* then the one used by the C code */ |
0442ed869 Initial revision |
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
add r30, r30, r15 /* * Now relocate code */ cmplw cr1,r3,r4 addi r0,r5,3 srwi. r0,r0,2 beq cr1,4f /* In place copy is not necessary */ beq 7f /* Protect against 0 count */ mtctr r0 bge cr1,2f la r8,-4(r4) la r7,-4(r3) 1: lwzu r0,4(r8) stwu r0,4(r7) bdnz 1b b 4f 2: slwi r0,r0,2 add r8,r4,r0 add r7,r3,r0 3: lwzu r0,-4(r8) stwu r0,-4(r7) bdnz 3b /* * Now flush the cache: note that we must start from a cache aligned * address. Otherwise we might miss one cache line. */ 4: cmpwi r6,0 add r5,r3,r5 beq 7f /* Always flush prefetch queue in any case */ subi r0,r6,1 andc r3,r3,r0 mr r4,r3 5: dcbst 0,r4 add r4,r4,r6 cmplw r4,r5 blt 5b sync /* Wait for all dcbst to complete on bus */ mr r4,r3 6: icbi 0,r4 add r4,r4,r6 cmplw r4,r5 blt 6b 7: sync /* Wait for all icbi to complete on bus */ isync /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ |
efa35cf12 ppc4xx: Clean up ... |
1388 |
addi r0, r10, in_ram - _start + _START_OFFSET |
0442ed869 Initial revision |
1389 1390 1391 1392 1393 1394 |
mtlr r0 blr /* NEVER RETURNS! */ in_ram: /* |
0f8aa1591 ppc: Use r12 inst... |
1395 |
* Relocation Function, r12 point to got2+0x8000 |
0442ed869 Initial revision |
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 |
* * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. */ li r0,__got2_entries@sectoff@l la r3,GOT(_GOT2_TABLE_) lwz r11,GOT(_GOT2_TABLE_) mtctr r0 sub r11,r3,r11 addi r3,r3,-4 1: lwzu r0,4(r3) |
afc3ba0fc relocation: Do no... |
1407 1408 |
cmpwi r0,0 beq- 2f |
0442ed869 Initial revision |
1409 1410 |
add r0,r0,r11 stw r0,0(r3) |
afc3ba0fc relocation: Do no... |
1411 |
2: bdnz 1b |
0442ed869 Initial revision |
1412 1413 1414 1415 1416 |
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ |
afc3ba0fc relocation: Do no... |
1417 |
li r0,__fixup_entries@sectoff@l |
0442ed869 Initial revision |
1418 1419 1420 1421 1422 1423 1424 |
lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 addi r3,r3,-4 beq 4f 3: lwzu r4,4(r3) lwzux r0,r4,r11 |
d1e0b10ac powerpc: do not f... |
1425 |
cmpwi r0,0 |
0442ed869 Initial revision |
1426 |
add r0,r0,r11 |
34bbf6186 PowerPC: Don't de... |
1427 |
stw r4,0(r3) |
d1e0b10ac powerpc: do not f... |
1428 |
beq- 5f |
0442ed869 Initial revision |
1429 |
stw r0,0(r4) |
d1e0b10ac powerpc: do not f... |
1430 |
5: bdnz 3b |
0442ed869 Initial revision |
1431 1432 1433 1434 1435 |
4: clear_bss: /* * Now clear BSS segment */ |
5d232d0e7 * Patch by Dave E... |
1436 |
lwz r3,GOT(__bss_start) |
3929fb0a1 Replace __bss_end... |
1437 |
lwz r4,GOT(__bss_end) |
0442ed869 Initial revision |
1438 1439 |
cmplw 0, r3, r4 |
42ed33ffe Fix ppc4xx clear_... |
1440 |
beq 7f |
0442ed869 Initial revision |
1441 1442 |
li r0, 0 |
42ed33ffe Fix ppc4xx clear_... |
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 |
andi. r5, r4, 3 beq 6f sub r4, r4, r5 mtctr r5 mr r5, r4 5: stb r0, 0(r5) addi r5, r5, 1 bdnz 5b 6: |
0442ed869 Initial revision |
1453 1454 1455 |
stw r0, 0(r3) addi r3, r3, 4 cmplw 0, r3, r4 |
42ed33ffe Fix ppc4xx clear_... |
1456 |
bne 6b |
0442ed869 Initial revision |
1457 |
|
42ed33ffe Fix ppc4xx clear_... |
1458 |
7: |
0442ed869 Initial revision |
1459 1460 1461 |
mr r3, r9 /* Init Data pointer */ mr r4, r10 /* Destination Address */ bl board_init_r |
0442ed869 Initial revision |
1462 1463 1464 1465 1466 1467 1468 1469 |
/* * Copy exception vector code to low memory * * r3: dest_addr * r7: source address, r8: end address, r9: target address */ .globl trap_init trap_init: |
0f8aa1591 ppc: Use r12 inst... |
1470 1471 |
mflr r4 /* save link register */ GET_GOT |
efa35cf12 ppc4xx: Clean up ... |
1472 |
lwz r7, GOT(_start_of_vectors) |
0442ed869 Initial revision |
1473 |
lwz r8, GOT(_end_of_vectors) |
682011ff6 * Patches by Udi ... |
1474 |
li r9, 0x100 /* reset vector always at 0x100 */ |
0442ed869 Initial revision |
1475 1476 1477 |
cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ |
0442ed869 Initial revision |
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 |
1: lwz r0, 0(r7) stw r0, 0(r9) addi r7, r7, 4 addi r9, r9, 4 cmplw 0, r7, r8 bne 1b /* * relocate `hdlr' and `int_return' entries */ |
efa35cf12 ppc4xx: Clean up ... |
1489 1490 |
li r7, .L_MachineCheck - _start + _START_OFFSET li r8, Alignment - _start + _START_OFFSET |
0442ed869 Initial revision |
1491 1492 |
2: bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1493 |
addi r7, r7, 0x100 /* next exception vector */ |
0442ed869 Initial revision |
1494 1495 |
cmplw 0, r7, r8 blt 2b |
efa35cf12 ppc4xx: Clean up ... |
1496 |
li r7, .L_Alignment - _start + _START_OFFSET |
0442ed869 Initial revision |
1497 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1498 |
li r7, .L_ProgramCheck - _start + _START_OFFSET |
0442ed869 Initial revision |
1499 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1500 1501 |
#ifdef CONFIG_440 li r7, .L_FPUnavailable - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1502 |
bl trap_reloc |
0442ed869 Initial revision |
1503 |
|
efa35cf12 ppc4xx: Clean up ... |
1504 |
li r7, .L_Decrementer - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1505 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1506 1507 |
li r7, .L_APU - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1508 |
bl trap_reloc |
df8a24cdd [ppc4xx] Fix prob... |
1509 |
|
83b4cfa3d Coding style clea... |
1510 1511 |
li r7, .L_InstructionTLBError - _start + _START_OFFSET bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1512 |
|
83b4cfa3d Coding style clea... |
1513 1514 |
li r7, .L_DataTLBError - _start + _START_OFFSET bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1515 1516 |
#else /* CONFIG_440 */ li r7, .L_PIT - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1517 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1518 1519 |
li r7, .L_InstructionTLBMiss - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1520 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1521 1522 |
li r7, .L_DataTLBMiss - _start + _START_OFFSET |
83b4cfa3d Coding style clea... |
1523 |
bl trap_reloc |
efa35cf12 ppc4xx: Clean up ... |
1524 |
#endif /* CONFIG_440 */ |
83b4cfa3d Coding style clea... |
1525 1526 |
li r7, .L_DebugBreakpoint - _start + _START_OFFSET bl trap_reloc |
0442ed869 Initial revision |
1527 |
|
887e2ec9e Add support for A... |
1528 |
#if !defined(CONFIG_440) |
9a7b408c1 cpu/ppc4xx/start.... |
1529 1530 1531 1532 |
addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */ oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */ mtmsr r7 /* change MSR */ #else |
887e2ec9e Add support for A... |
1533 1534 |
bl __440_msr_set b __440_msr_continue |
9a7b408c1 cpu/ppc4xx/start.... |
1535 |
|
887e2ec9e Add support for A... |
1536 |
__440_msr_set: |
9a7b408c1 cpu/ppc4xx/start.... |
1537 1538 |
addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */ oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */ |
58ea142fb ppc4xx: Replace 4... |
1539 |
mtspr SPRN_SRR1,r7 |
9a7b408c1 cpu/ppc4xx/start.... |
1540 |
mflr r7 |
58ea142fb ppc4xx: Replace 4... |
1541 |
mtspr SPRN_SRR0,r7 |
9a7b408c1 cpu/ppc4xx/start.... |
1542 |
rfi |
887e2ec9e Add support for A... |
1543 |
__440_msr_continue: |
9a7b408c1 cpu/ppc4xx/start.... |
1544 |
#endif |
0442ed869 Initial revision |
1545 1546 |
mtlr r4 /* restore link register */ blr |
98f99e9f1 ppc4xx: Add SPL s... |
1547 |
#endif /* CONFIG_SPL_BUILD */ |
0442ed869 Initial revision |
1548 |
|
cf959c7d6 ppc4xx: Add NAND ... |
1549 1550 1551 1552 1553 1554 |
#if defined(CONFIG_440) /*----------------------------------------------------------------------------+ | dcbz_area. +----------------------------------------------------------------------------*/ function_prolog(dcbz_area) rlwinm. r5,r4,0,27,31 |
83b4cfa3d Coding style clea... |
1555 1556 1557 1558 1559 1560 1561 |
rlwinm r5,r4,27,5,31 beq ..d_ra2 addi r5,r5,0x0001 ..d_ra2:mtctr r5 ..d_ag2:dcbz r0,r3 addi r3,r3,32 bdnz ..d_ag2 |
cf959c7d6 ppc4xx: Add NAND ... |
1562 1563 1564 |
sync blr function_epilog(dcbz_area) |
cf959c7d6 ppc4xx: Add NAND ... |
1565 |
#endif /* CONFIG_440 */ |
345b77bac ppc4xx: Remove 4x... |
1566 |
#endif /* CONFIG_SPL_BUILD */ |
b867d705b PPC405EP support ... |
1567 |
|
cf959c7d6 ppc4xx: Add NAND ... |
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 |
/*------------------------------------------------------------------------------- */ /* Function: in8 */ /* Description: Input 8 bits */ /*------------------------------------------------------------------------------- */ .globl in8 in8: lbz r3,0x0000(r3) blr /*------------------------------------------------------------------------------- */ /* Function: out8 */ /* Description: Output 8 bits */ /*------------------------------------------------------------------------------- */ .globl out8 out8: stb r4,0x0000(r3) blr /*------------------------------------------------------------------------------- */ /* Function: out32 */ /* Description: Output 32 bits */ /*------------------------------------------------------------------------------- */ .globl out32 out32: stw r4,0x0000(r3) blr /*------------------------------------------------------------------------------- */ /* Function: in32 */ /* Description: Input 32 bits */ /*------------------------------------------------------------------------------- */ .globl in32 in32: lwz 3,0x0000(3) blr |
b867d705b PPC405EP support ... |
1603 1604 |
/**************************************************************************/ |
f901a83b7 Add support for e... |
1605 |
/* PPC405EP specific stuff */ |
b867d705b PPC405EP support ... |
1606 1607 1608 |
/**************************************************************************/ #ifdef CONFIG_405EP ppc405ep_init: |
b828dda65 BUBINGA405EP port... |
1609 |
|
c157d8e21 Add support for A... |
1610 |
#ifdef CONFIG_BUBINGA |
b828dda65 BUBINGA405EP port... |
1611 1612 1613 1614 1615 1616 1617 |
/* * Initialize EBC chip selects 1 & 4 and GPIO pins (for alternate * function) to support FPGA and NVRAM accesses below. */ lis r3,GPIO0_OSRH@h /* config GPIO output select */ ori r3,r3,GPIO0_OSRH@l |
6d0f6bcf3 rename CFG_ macro... |
1618 1619 |
lis r4,CONFIG_SYS_GPIO0_OSRH@h ori r4,r4,CONFIG_SYS_GPIO0_OSRH@l |
b828dda65 BUBINGA405EP port... |
1620 1621 1622 |
stw r4,0(r3) lis r3,GPIO0_OSRL@h ori r3,r3,GPIO0_OSRL@l |
6d0f6bcf3 rename CFG_ macro... |
1623 1624 |
lis r4,CONFIG_SYS_GPIO0_OSRL@h ori r4,r4,CONFIG_SYS_GPIO0_OSRL@l |
b828dda65 BUBINGA405EP port... |
1625 1626 1627 1628 |
stw r4,0(r3) lis r3,GPIO0_ISR1H@h /* config GPIO input select */ ori r3,r3,GPIO0_ISR1H@l |
6d0f6bcf3 rename CFG_ macro... |
1629 1630 |
lis r4,CONFIG_SYS_GPIO0_ISR1H@h ori r4,r4,CONFIG_SYS_GPIO0_ISR1H@l |
b828dda65 BUBINGA405EP port... |
1631 1632 1633 |
stw r4,0(r3) lis r3,GPIO0_ISR1L@h ori r3,r3,GPIO0_ISR1L@l |
6d0f6bcf3 rename CFG_ macro... |
1634 1635 |
lis r4,CONFIG_SYS_GPIO0_ISR1L@h ori r4,r4,CONFIG_SYS_GPIO0_ISR1L@l |
b828dda65 BUBINGA405EP port... |
1636 1637 1638 1639 |
stw r4,0(r3) lis r3,GPIO0_TSRH@h /* config GPIO three-state select */ ori r3,r3,GPIO0_TSRH@l |
6d0f6bcf3 rename CFG_ macro... |
1640 1641 |
lis r4,CONFIG_SYS_GPIO0_TSRH@h ori r4,r4,CONFIG_SYS_GPIO0_TSRH@l |
b828dda65 BUBINGA405EP port... |
1642 1643 1644 |
stw r4,0(r3) lis r3,GPIO0_TSRL@h ori r3,r3,GPIO0_TSRL@l |
6d0f6bcf3 rename CFG_ macro... |
1645 1646 |
lis r4,CONFIG_SYS_GPIO0_TSRL@h ori r4,r4,CONFIG_SYS_GPIO0_TSRL@l |
b828dda65 BUBINGA405EP port... |
1647 1648 1649 1650 |
stw r4,0(r3) lis r3,GPIO0_TCR@h /* config GPIO driver output enables */ ori r3,r3,GPIO0_TCR@l |
6d0f6bcf3 rename CFG_ macro... |
1651 1652 |
lis r4,CONFIG_SYS_GPIO0_TCR@h ori r4,r4,CONFIG_SYS_GPIO0_TCR@l |
b828dda65 BUBINGA405EP port... |
1653 |
stw r4,0(r3) |
d1c3b2752 ppc4xx: Big clean... |
1654 1655 |
li r3,PB1AP /* program EBC bank 1 for RTC access */ mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1656 1657 |
lis r3,CONFIG_SYS_EBC_PB1AP@h ori r3,r3,CONFIG_SYS_EBC_PB1AP@l |
d1c3b2752 ppc4xx: Big clean... |
1658 1659 1660 |
mtdcr EBC0_CFGDATA,r3 li r3,PB1CR mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1661 1662 |
lis r3,CONFIG_SYS_EBC_PB1CR@h ori r3,r3,CONFIG_SYS_EBC_PB1CR@l |
d1c3b2752 ppc4xx: Big clean... |
1663 |
mtdcr EBC0_CFGDATA,r3 |
b828dda65 BUBINGA405EP port... |
1664 |
|
d1c3b2752 ppc4xx: Big clean... |
1665 1666 |
li r3,PB1AP /* program EBC bank 1 for RTC access */ mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1667 1668 |
lis r3,CONFIG_SYS_EBC_PB1AP@h ori r3,r3,CONFIG_SYS_EBC_PB1AP@l |
d1c3b2752 ppc4xx: Big clean... |
1669 1670 1671 |
mtdcr EBC0_CFGDATA,r3 li r3,PB1CR mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1672 1673 |
lis r3,CONFIG_SYS_EBC_PB1CR@h ori r3,r3,CONFIG_SYS_EBC_PB1CR@l |
d1c3b2752 ppc4xx: Big clean... |
1674 |
mtdcr EBC0_CFGDATA,r3 |
b828dda65 BUBINGA405EP port... |
1675 |
|
d1c3b2752 ppc4xx: Big clean... |
1676 1677 |
li r3,PB4AP /* program EBC bank 4 for FPGA access */ mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1678 1679 |
lis r3,CONFIG_SYS_EBC_PB4AP@h ori r3,r3,CONFIG_SYS_EBC_PB4AP@l |
d1c3b2752 ppc4xx: Big clean... |
1680 1681 1682 |
mtdcr EBC0_CFGDATA,r3 li r3,PB4CR mtdcr EBC0_CFGADDR,r3 |
6d0f6bcf3 rename CFG_ macro... |
1683 1684 |
lis r3,CONFIG_SYS_EBC_PB4CR@h ori r3,r3,CONFIG_SYS_EBC_PB4CR@l |
d1c3b2752 ppc4xx: Big clean... |
1685 |
mtdcr EBC0_CFGDATA,r3 |
b828dda65 BUBINGA405EP port... |
1686 |
#endif |
8bde7f776 * Code cleanup: |
1687 1688 1689 1690 1691 1692 |
/* !----------------------------------------------------------------------- ! Check to see if chip is in bypass mode. ! If so, write stored CPC0_PLLMR0 and CPC0_PLLMR1 values and perform a ! CPU reset Otherwise, skip this step and keep going. |
f901a83b7 Add support for e... |
1693 1694 |
! Note: Running BIOS in bypass mode is not supported since PLB speed ! will not be fast enough for the SDRAM (min 66MHz) |
8bde7f776 * Code cleanup: |
1695 |
!----------------------------------------------------------------------- |
b867d705b PPC405EP support ... |
1696 |
*/ |
f901a83b7 Add support for e... |
1697 |
mfdcr r5, CPC0_PLLMR1 |
53677ef18 Big white-space c... |
1698 |
rlwinm r4,r5,1,0x1 /* get system clock source (SSCS) */ |
f901a83b7 Add support for e... |
1699 |
cmpi cr0,0,r4,0x1 |
b867d705b PPC405EP support ... |
1700 |
|
53677ef18 Big white-space c... |
1701 1702 1703 1704 |
beq pll_done /* if SSCS =b'1' then PLL has */ /* already been set */ /* and CPU has been reset */ /* so skip to next section */ |
b867d705b PPC405EP support ... |
1705 |
|
c157d8e21 Add support for A... |
1706 |
#ifdef CONFIG_BUBINGA |
b867d705b PPC405EP support ... |
1707 |
/* |
8bde7f776 * Code cleanup: |
1708 1709 1710 1711 1712 1713 1714 |
!----------------------------------------------------------------------- ! Read NVRAM to get value to write in PLLMR. ! If value has not been correctly saved, write default value ! Default config values (assuming on-board 33MHz SYS_CLK) are above. ! See CPU_DEFAULT_200 and CPU_DEFAULT_266 above. ! ! WARNING: This code assumes the first three words in the nvram_t |
f901a83b7 Add support for e... |
1715 1716 |
! structure in openbios.h. Changing the beginning of ! the structure will break this code. |
8bde7f776 * Code cleanup: |
1717 1718 |
! !----------------------------------------------------------------------- |
b867d705b PPC405EP support ... |
1719 |
*/ |
f901a83b7 Add support for e... |
1720 1721 1722 1723 1724 1725 |
addis r3,0,NVRAM_BASE@h addi r3,r3,NVRAM_BASE@l lwz r4, 0(r3) addis r5,0,NVRVFY1@h addi r5,r5,NVRVFY1@l |
53677ef18 Big white-space c... |
1726 |
cmp cr0,0,r4,r5 /* Compare 1st NVRAM Magic number*/ |
f901a83b7 Add support for e... |
1727 1728 1729 1730 1731 |
bne ..no_pllset addi r3,r3,4 lwz r4, 0(r3) addis r5,0,NVRVFY2@h addi r5,r5,NVRVFY2@l |
53677ef18 Big white-space c... |
1732 |
cmp cr0,0,r4,r5 /* Compare 2 NVRAM Magic number */ |
f901a83b7 Add support for e... |
1733 1734 1735 1736 1737 1738 1739 |
bne ..no_pllset addi r3,r3,8 /* Skip over conf_size */ lwz r4, 4(r3) /* Load PLLMR1 value from NVRAM */ lwz r3, 0(r3) /* Load PLLMR0 value from NVRAM */ rlwinm r5,r4,1,0x1 /* get system clock source (SSCS) */ cmpi cr0,0,r5,1 /* See if PLL is locked */ beq pll_write |
b867d705b PPC405EP support ... |
1740 |
..no_pllset: |
c157d8e21 Add support for A... |
1741 |
#endif /* CONFIG_BUBINGA */ |
b867d705b PPC405EP support ... |
1742 |
|
d4024bb72 ppc4xx: Add suppo... |
1743 1744 1745 1746 1747 1748 1749 1750 1751 |
#ifdef CONFIG_TAIHU mfdcr r4, CPC0_BOOT andi. r5, r4, CPC0_BOOT_SEP@l bne strap_1 /* serial eeprom present */ addis r5,0,CPLD_REG0_ADDR@h ori r5,r5,CPLD_REG0_ADDR@l andi. r5, r5, 0x10 bne _pci_66mhz #endif /* CONFIG_TAIHU */ |
779e97511 ppc4xx: Add initi... |
1752 1753 1754 |
#if defined(CONFIG_ZEUS) mfdcr r4, CPC0_BOOT andi. r5, r4, CPC0_BOOT_SEP@l |
53677ef18 Big white-space c... |
1755 |
bne strap_1 /* serial eeprom present */ |
779e97511 ppc4xx: Add initi... |
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 |
lis r3,0x0000 addi r3,r3,0x3030 lis r4,0x8042 addi r4,r4,0x223e b 1f strap_1: mfdcr r3, CPC0_PLLMR0 mfdcr r4, CPC0_PLLMR1 b 1f #endif |
53677ef18 Big white-space c... |
1766 1767 1768 1769 |
addis r3,0,PLLMR0_DEFAULT@h /* PLLMR0 default value */ ori r3,r3,PLLMR0_DEFAULT@l /* */ addis r4,0,PLLMR1_DEFAULT@h /* PLLMR1 default value */ ori r4,r4,PLLMR1_DEFAULT@l /* */ |
b867d705b PPC405EP support ... |
1770 |
|
d4024bb72 ppc4xx: Add suppo... |
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 |
#ifdef CONFIG_TAIHU b 1f _pci_66mhz: addis r3,0,PLLMR0_DEFAULT_PCI66@h ori r3,r3,PLLMR0_DEFAULT_PCI66@l addis r4,0,PLLMR1_DEFAULT_PCI66@h ori r4,r4,PLLMR1_DEFAULT_PCI66@l b 1f strap_1: mfdcr r3, CPC0_PLLMR0 mfdcr r4, CPC0_PLLMR1 |
d4024bb72 ppc4xx: Add suppo... |
1782 |
#endif /* CONFIG_TAIHU */ |
779e97511 ppc4xx: Add initi... |
1783 |
1: |
53677ef18 Big white-space c... |
1784 |
b pll_write /* Write the CPC0_PLLMR with new value */ |
b867d705b PPC405EP support ... |
1785 1786 |
pll_done: |
8bde7f776 * Code cleanup: |
1787 1788 1789 1790 1791 |
/* !----------------------------------------------------------------------- ! Clear Soft Reset Register ! This is needed to enable PCI if not booting from serial EPROM !----------------------------------------------------------------------- |
b867d705b PPC405EP support ... |
1792 |
*/ |
f901a83b7 Add support for e... |
1793 1794 |
addi r3, 0, 0x0 mtdcr CPC0_SRR, r3 |
b867d705b PPC405EP support ... |
1795 |
|
f901a83b7 Add support for e... |
1796 1797 |
addis r3,0,0x0010 mtctr r3 |
b867d705b PPC405EP support ... |
1798 |
pci_wait: |
f901a83b7 Add support for e... |
1799 |
bdnz pci_wait |
b867d705b PPC405EP support ... |
1800 |
|
53677ef18 Big white-space c... |
1801 |
blr /* return to main code */ |
b867d705b PPC405EP support ... |
1802 1803 1804 |
/* !----------------------------------------------------------------------------- |
f901a83b7 Add support for e... |
1805 1806 1807 1808 1809 1810 1811 1812 1813 |
! Function: pll_write ! Description: Updates the value of the CPC0_PLLMR according to CMOS27E documentation ! That is: ! 1. Pll is first disabled (de-activated by putting in bypass mode) ! 2. PLL is reset ! 3. Clock dividers are set while PLL is held in reset and bypassed ! 4. PLL Reset is cleared ! 5. Wait 100us for PLL to lock ! 6. A core reset is performed |
b867d705b PPC405EP support ... |
1814 1815 1816 1817 1818 |
! Input: r3 = Value to write to CPC0_PLLMR0 ! Input: r4 = Value to write to CPC0_PLLMR1 ! Output r3 = none !----------------------------------------------------------------------------- */ |
0580e48f5 ppc4xx: Make pll_... |
1819 |
.globl pll_write |
b867d705b PPC405EP support ... |
1820 |
pll_write: |
8bde7f776 * Code cleanup: |
1821 1822 |
mfdcr r5, CPC0_UCR andis. r5,r5,0xFFFF |
53677ef18 Big white-space c... |
1823 1824 |
ori r5,r5,0x0101 /* Stop the UART clocks */ mtdcr CPC0_UCR,r5 /* Before changing PLL */ |
8bde7f776 * Code cleanup: |
1825 1826 |
mfdcr r5, CPC0_PLLMR1 |
53677ef18 Big white-space c... |
1827 |
rlwinm r5,r5,0,0x7FFFFFFF /* Disable PLL */ |
f901a83b7 Add support for e... |
1828 |
mtdcr CPC0_PLLMR1,r5 |
53677ef18 Big white-space c... |
1829 |
oris r5,r5,0x4000 /* Set PLL Reset */ |
f901a83b7 Add support for e... |
1830 |
mtdcr CPC0_PLLMR1,r5 |
53677ef18 Big white-space c... |
1831 1832 1833 1834 1835 |
mtdcr CPC0_PLLMR0,r3 /* Set clock dividers */ rlwinm r5,r4,0,0x3FFFFFFF /* Reset & Bypass new PLL dividers */ oris r5,r5,0x4000 /* Set PLL Reset */ mtdcr CPC0_PLLMR1,r5 /* Set clock dividers */ rlwinm r5,r5,0,0xBFFFFFFF /* Clear PLL Reset */ |
f901a83b7 Add support for e... |
1836 |
mtdcr CPC0_PLLMR1,r5 |
b867d705b PPC405EP support ... |
1837 1838 |
/* |
8bde7f776 * Code cleanup: |
1839 1840 1841 |
! Wait min of 100us for PLL to lock. ! See CMOS 27E databook for more info. ! At 200MHz, that means waiting 20,000 instructions |
b867d705b PPC405EP support ... |
1842 |
*/ |
f901a83b7 Add support for e... |
1843 1844 |
addi r3,0,20000 /* 2000 = 0x4e20 */ mtctr r3 |
b867d705b PPC405EP support ... |
1845 |
pll_wait: |
f901a83b7 Add support for e... |
1846 |
bdnz pll_wait |
8bde7f776 * Code cleanup: |
1847 |
|
f901a83b7 Add support for e... |
1848 1849 |
oris r5,r5,0x8000 /* Enable PLL */ mtdcr CPC0_PLLMR1,r5 /* Engage */ |
8bde7f776 * Code cleanup: |
1850 1851 1852 1853 1854 1855 |
/* * Reset CPU to guarantee timings are OK * Not sure if this is needed... */ addis r3,0,0x1000 |
58ea142fb ppc4xx: Replace 4... |
1856 |
mtspr SPRN_DBCR0,r3 /* This will cause a CPU core reset, and */ |
53677ef18 Big white-space c... |
1857 1858 |
/* execution will continue from the poweron */ /* vector of 0xfffffffc */ |
b867d705b PPC405EP support ... |
1859 |
#endif /* CONFIG_405EP */ |
4745acaa1 [PATCH] Add suppo... |
1860 1861 |
#if defined(CONFIG_440) |
4745acaa1 [PATCH] Add suppo... |
1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 |
/*----------------------------------------------------------------------------+ | mttlb3. +----------------------------------------------------------------------------*/ function_prolog(mttlb3) TLBWE(4,3,2) blr function_epilog(mttlb3) /*----------------------------------------------------------------------------+ | mftlb3. +----------------------------------------------------------------------------*/ function_prolog(mftlb3) |
743571145 Minor code cleanup. |
1874 |
TLBRE(3,3,2) |
4745acaa1 [PATCH] Add suppo... |
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 |
blr function_epilog(mftlb3) /*----------------------------------------------------------------------------+ | mttlb2. +----------------------------------------------------------------------------*/ function_prolog(mttlb2) TLBWE(4,3,1) blr function_epilog(mttlb2) /*----------------------------------------------------------------------------+ | mftlb2. +----------------------------------------------------------------------------*/ function_prolog(mftlb2) |
743571145 Minor code cleanup. |
1890 |
TLBRE(3,3,1) |
4745acaa1 [PATCH] Add suppo... |
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 |
blr function_epilog(mftlb2) /*----------------------------------------------------------------------------+ | mttlb1. +----------------------------------------------------------------------------*/ function_prolog(mttlb1) TLBWE(4,3,0) blr function_epilog(mttlb1) /*----------------------------------------------------------------------------+ | mftlb1. +----------------------------------------------------------------------------*/ function_prolog(mftlb1) |
743571145 Minor code cleanup. |
1906 |
TLBRE(3,3,0) |
4745acaa1 [PATCH] Add suppo... |
1907 1908 1909 |
blr function_epilog(mftlb1) #endif /* CONFIG_440 */ |