forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/arch/arm/mach-tegra/reset-handler.S
....@@ -1,17 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2012, NVIDIA Corporation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify it
5
- * under the terms and conditions of the GNU General Public License,
6
- * version 2, as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope it will be useful, but WITHOUT
9
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
- * more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
154 */
165
176 #include <linux/init.h>
....@@ -20,6 +9,7 @@
209 #include <soc/tegra/flowctrl.h>
2110 #include <soc/tegra/fuse.h>
2211
12
+#include <asm/assembler.h>
2313 #include <asm/asm-offsets.h>
2414 #include <asm/cache.h>
2515
....@@ -28,8 +18,6 @@
2818 #include "sleep.h"
2919
3020 #define PMC_SCRATCH41 0x140
31
-
32
-#define RESET_DATA(x) ((TEGRA_RESET_##x)*4)
3321
3422 #ifdef CONFIG_PM_SLEEP
3523 /*
....@@ -78,6 +66,7 @@
7866 orr r1, r1, #1
7967 str r1, [r0]
8068 #endif
69
+ bl tegra_resume_trusted_foundations
8170
8271 #ifdef CONFIG_CACHE_L2X0
8372 /* L2 cache resume & re-enable */
....@@ -90,6 +79,35 @@
9079
9180 b cpu_resume
9281 ENDPROC(tegra_resume)
82
+
83
+/*
84
+ * tegra_resume_trusted_foundations
85
+ *
86
+ * Trusted Foundations firmware initialization.
87
+ *
88
+ * Doesn't return if firmware presents.
89
+ * Corrupted registers: r1, r2
90
+ */
91
+ENTRY(tegra_resume_trusted_foundations)
92
+ /* Check whether Trusted Foundations firmware presents. */
93
+ mov32 r2, TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET
94
+ ldr r1, =__tegra_cpu_reset_handler_data_offset + \
95
+ RESET_DATA(TF_PRESENT)
96
+ ldr r1, [r2, r1]
97
+ cmp r1, #0
98
+ reteq lr
99
+
100
+ .arch_extension sec
101
+ /*
102
+ * First call after suspend wakes firmware. No arguments required
103
+ * for some firmware versions. Downstream kernel of ASUS TF300T uses
104
+ * r0=3 for the wake-up notification.
105
+ */
106
+ mov r0, #3
107
+ smc #0
108
+
109
+ b cpu_resume
110
+ENDPROC(tegra_resume_trusted_foundations)
93111 #endif
94112
95113 .align L1_CACHE_SHIFT
....@@ -115,12 +133,19 @@
115133 * must be position-independent.
116134 */
117135
136
+ .arm
118137 .align L1_CACHE_SHIFT
119138 ENTRY(__tegra_cpu_reset_handler)
120139
121140 cpsid aif, 0x13 @ SVC mode, interrupts disabled
122141
123142 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
143
+
144
+ adr r12, __tegra_cpu_reset_handler_data
145
+ ldr r5, [r12, #RESET_DATA(TF_PRESENT)]
146
+ cmp r5, #0
147
+ bne after_errata
148
+
124149 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
125150 t20_check:
126151 cmp r6, #TEGRA20
....@@ -155,25 +180,12 @@
155180 and r10, r10, #0x3 @ R10 = CPU number
156181 mov r11, #1
157182 mov r11, r11, lsl r10 @ R11 = CPU mask
158
- adr r12, __tegra_cpu_reset_handler_data
159183
160184 #ifdef CONFIG_SMP
161185 /* Does the OS know about this CPU? */
162186 ldr r7, [r12, #RESET_DATA(MASK_PRESENT)]
163187 tst r7, r11 @ if !present
164188 bleq __die @ CPU not present (to OS)
165
-#endif
166
-
167
-#ifdef CONFIG_ARCH_TEGRA_2x_SOC
168
- /* Are we on Tegra20? */
169
- cmp r6, #TEGRA20
170
- bne 1f
171
- /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
172
- mov32 r5, TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET
173
- mov r0, #CPU_NOT_RESETTABLE
174
- cmp r10, #0
175
- strneb r0, [r5, #__tegra20_cpu1_resettable_status_offset]
176
-1:
177189 #endif
178190
179191 /* Waking up from LP1? */
....@@ -277,14 +289,13 @@
277289 .align L1_CACHE_SHIFT
278290 .type __tegra_cpu_reset_handler_data, %object
279291 .globl __tegra_cpu_reset_handler_data
280
-__tegra_cpu_reset_handler_data:
281
- .rept TEGRA_RESET_DATA_SIZE
282
- .long 0
283
- .endr
284
- .globl __tegra20_cpu1_resettable_status_offset
285
- .equ __tegra20_cpu1_resettable_status_offset, \
292
+ .globl __tegra_cpu_reset_handler_data_offset
293
+ .equ __tegra_cpu_reset_handler_data_offset, \
286294 . - __tegra_cpu_reset_handler_start
287
- .byte 0
295
+__tegra_cpu_reset_handler_data:
296
+ .rept TEGRA_RESET_DATA_SIZE
297
+ .long 0
298
+ .endr
288299 .align L1_CACHE_SHIFT
289300
290301 ENTRY(__tegra_cpu_reset_handler_end)