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