Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 2 | |
| 3 | #include <config.h> |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 4 | #include <linux/linkage.h> |
| 5 | |
| 6 | ENTRY(save_boot_params) |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 7 | stmfd sp!, {r0 - r12, lr} /* @ save registers on stack */ |
| 8 | ldr r12, =CONFIG_SPL_BOOTROM_SAVE |
| 9 | str sp, [r12] |
Stefan Roese | 00b154f | 2015-03-11 12:05:04 +0100 | [diff] [blame] | 10 | b save_boot_params_ret |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 11 | ENDPROC(save_boot_params) |
| 12 | |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 13 | ENTRY(return_to_bootrom) |
| 14 | ldr r12, =CONFIG_SPL_BOOTROM_SAVE |
| 15 | ldr sp, [r12] |
Pali Rohár | e4b1592 | 2021-07-23 11:14:23 +0200 | [diff] [blame] | 16 | ldmfd sp!, {r0 - r12, lr} /* @ restore registers from stack */ |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 17 | mov r0, #0x0 /* @ return value: 0x0 NO_ERR */ |
Pali Rohár | e4b1592 | 2021-07-23 11:14:23 +0200 | [diff] [blame] | 18 | bx lr /* @ return to bootrom */ |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 19 | ENDPROC(return_to_bootrom) |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 20 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 21 | /* |
| 22 | * cache_inv - invalidate Cache line |
| 23 | * r0 - dest |
| 24 | */ |
| 25 | .global cache_inv |
| 26 | .type cache_inv, %function |
| 27 | cache_inv: |
| 28 | |
| 29 | stmfd sp!, {r1-r12} |
| 30 | |
| 31 | mcr p15, 0, r0, c7, c6, 1 |
| 32 | |
| 33 | ldmfd sp!, {r1-r12} |
| 34 | bx lr |
| 35 | |
| 36 | |
| 37 | /* |
| 38 | * flush_l1_v6 - l1 cache clean invalidate |
| 39 | * r0 - dest |
| 40 | */ |
| 41 | .global flush_l1_v6 |
| 42 | .type flush_l1_v6, %function |
| 43 | flush_l1_v6: |
| 44 | |
| 45 | stmfd sp!, {r1-r12} |
| 46 | |
| 47 | mcr p15, 0, r0, c7, c10, 5 /* @ data memory barrier */ |
| 48 | mcr p15, 0, r0, c7, c14, 1 /* @ clean & invalidate D line */ |
| 49 | mcr p15, 0, r0, c7, c10, 4 /* @ data sync barrier */ |
| 50 | |
| 51 | ldmfd sp!, {r1-r12} |
| 52 | bx lr |
| 53 | |
| 54 | |
| 55 | /* |
| 56 | * flush_l1_v7 - l1 cache clean invalidate |
| 57 | * r0 - dest |
| 58 | */ |
| 59 | .global flush_l1_v7 |
| 60 | .type flush_l1_v7, %function |
| 61 | flush_l1_v7: |
| 62 | |
| 63 | stmfd sp!, {r1-r12} |
| 64 | |
| 65 | dmb /* @data memory barrier */ |
| 66 | mcr p15, 0, r0, c7, c14, 1 /* @ clean & invalidate D line */ |
| 67 | dsb /* @data sync barrier */ |
| 68 | |
| 69 | ldmfd sp!, {r1-r12} |
| 70 | bx lr |