Simon Glass | 5debe1f | 2015-02-07 10:47:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Utility functions for FEL mode. |
| 3 | * |
| 4 | * Copyright (c) 2015 Google, Inc |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <asm-offsets.h> |
| 10 | #include <config.h> |
| 11 | #include <asm/system.h> |
| 12 | #include <linux/linkage.h> |
| 13 | |
| 14 | ENTRY(save_boot_params) |
| 15 | ldr r0, =fel_stash |
| 16 | str sp, [r0, #0] |
| 17 | str lr, [r0, #4] |
Siarhei Siamashka | 7ef91f0 | 2015-02-16 10:23:59 +0200 | [diff] [blame] | 18 | mrs lr, cpsr @ Read CPSR |
| 19 | str lr, [r0, #8] |
| 20 | mrc p15, 0, lr, c1, c0, 0 @ Read CP15 SCTLR Register |
| 21 | str lr, [r0, #12] |
| 22 | mrc p15, 0, lr, c12, c0, 0 @ Read VBAR |
| 23 | str lr, [r0, #16] |
| 24 | mrc p15, 0, lr, c1, c0, 0 @ Read CP15 Control Register |
| 25 | str lr, [r0, #20] |
Simon Glass | 5debe1f | 2015-02-07 10:47:30 -0700 | [diff] [blame] | 26 | b save_boot_params_ret |
| 27 | ENDPROC(save_boot_params) |
| 28 | |
| 29 | ENTRY(return_to_fel) |
| 30 | mov sp, r0 |
| 31 | mov lr, r1 |
Siarhei Siamashka | 7ef91f0 | 2015-02-16 10:23:59 +0200 | [diff] [blame] | 32 | ldr r0, =fel_stash |
| 33 | ldr r1, [r0, #20] |
| 34 | mcr p15, 0, r1, c1, c0, 0 @ Write CP15 Control Register |
| 35 | ldr r1, [r0, #16] |
| 36 | mcr p15, 0, r1, c12, c0, 0 @ Write VBAR |
| 37 | ldr r1, [r0, #12] |
| 38 | mcr p15, 0, r1, c1, c0, 0 @ Write CP15 SCTLR Register |
| 39 | ldr r1, [r0, #8] |
| 40 | msr cpsr, r1 @ Write CPSR |
Simon Glass | 5debe1f | 2015-02-07 10:47:30 -0700 | [diff] [blame] | 41 | bx lr |
| 42 | ENDPROC(return_to_fel) |