Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Altera Corporation <www.altera.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include <config.h> |
| 19 | #include <version.h> |
| 20 | |
| 21 | /* Save the parameter pass in by previous boot loader */ |
| 22 | .global save_boot_params |
| 23 | save_boot_params: |
| 24 | /* save the parameter here */ |
| 25 | |
| 26 | /* |
| 27 | * Setup stack for exception, which is located |
| 28 | * at the end of on-chip RAM. We don't expect exception prior to |
| 29 | * relocation and if that happens, we won't worry -- it will overide |
| 30 | * global data region as the code will goto reset. After relocation, |
| 31 | * this region won't be used by other part of program. |
| 32 | * Hence it is safe. |
| 33 | */ |
| 34 | ldr r0, =(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE) |
| 35 | ldr r1, =IRQ_STACK_START_IN |
| 36 | str r0, [r1] |
| 37 | |
| 38 | bx lr |
| 39 | |
| 40 | |
| 41 | /* Set up the platform, once the cpu has been initialized */ |
| 42 | .globl lowlevel_init |
| 43 | lowlevel_init: |
| 44 | |
| 45 | /* Remap */ |
| 46 | #ifdef CONFIG_SPL_BUILD |
| 47 | /* |
| 48 | * SPL : configure the remap (L3 NIC-301 GPV) |
| 49 | * so the on-chip RAM at lower memory instead ROM. |
| 50 | */ |
| 51 | ldr r0, =SOCFPGA_L3REGS_ADDRESS |
| 52 | mov r1, #0x19 |
| 53 | str r1, [r0] |
| 54 | #else |
| 55 | /* |
| 56 | * U-Boot : configure the remap (L3 NIC-301 GPV) |
| 57 | * so the SDRAM at lower memory instead on-chip RAM. |
| 58 | */ |
| 59 | ldr r0, =SOCFPGA_L3REGS_ADDRESS |
| 60 | mov r1, #0x2 |
| 61 | str r1, [r0] |
| 62 | |
| 63 | /* Private components security */ |
| 64 | |
| 65 | /* |
| 66 | * U-Boot : configure private timer, global timer and cpu |
| 67 | * component access as non secure for kernel stage (as required |
| 68 | * by kernel) |
| 69 | */ |
| 70 | mrc p15,4,r0,c15,c0,0 |
| 71 | add r1, r0, #0x54 |
| 72 | ldr r2, [r1] |
| 73 | orr r2, r2, #0xff |
| 74 | orr r2, r2, #0xf00 |
| 75 | str r2, [r1] |
| 76 | #endif /* #ifdef CONFIG_SPL_BUILD */ |
| 77 | mov pc, lr |