blob: be3c652cca4329b2b5ff8aadc17824a6a692eb0d [file] [log] [blame]
Sandrine Bailleux432aa772016-01-07 16:52:49 +00001/*
Louis Mayencourt8a061272019-04-05 16:25:25 +01002 * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
Sandrine Bailleux432aa772016-01-07 16:52:49 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Sandrine Bailleux432aa772016-01-07 16:52:49 +00005 */
6
7#include <arch.h>
8#include <asm_macros.S>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <common/bl_common.h>
Sandrine Bailleux432aa772016-01-07 16:52:49 +000010#include <cortex_a35.h>
11#include <cpu_macros.S>
12#include <plat_macros.S>
13
14 /* ---------------------------------------------
15 * Disable L1 data cache and unified L2 cache
16 * ---------------------------------------------
17 */
18func cortex_a35_disable_dcache
19 mrs x1, sctlr_el3
20 bic x1, x1, #SCTLR_C_BIT
21 msr sctlr_el3, x1
22 isb
23 ret
24endfunc cortex_a35_disable_dcache
25
26 /* ---------------------------------------------
27 * Disable intra-cluster coherency
28 * ---------------------------------------------
29 */
30func cortex_a35_disable_smp
31 mrs x0, CORTEX_A35_CPUECTLR_EL1
32 bic x0, x0, #CORTEX_A35_CPUECTLR_SMPEN_BIT
33 msr CORTEX_A35_CPUECTLR_EL1, x0
34 isb
35 dsb sy
36 ret
37endfunc cortex_a35_disable_smp
38
Louis Mayencourt8a061272019-04-05 16:25:25 +010039 /* ---------------------------------------------------
40 * Errata Workaround for Cortex A35 Errata #855472.
41 * This applies to revisions r0p0 of Cortex A35.
42 * Inputs:
43 * x0: variant[4:7] and revision[0:3] of current cpu.
44 * Shall clobber: x0-x17
45 * ---------------------------------------------------
46 */
47func errata_a35_855472_wa
48 /*
49 * Compare x0 against revision r0p0
50 */
51 mov x17, x30
52 bl check_errata_855472
53 cbz x0, 1f
54 mrs x1, CORTEX_A35_CPUACTLR_EL1
55 orr x1, x1, #CORTEX_A35_CPUACTLR_EL1_ENDCCASCI
56 msr CORTEX_A35_CPUACTLR_EL1, x1
57 isb
581:
59 ret x17
60endfunc errata_a35_855472_wa
61
62func check_errata_855472
63 mov x1, #0x00
64 b cpu_rev_var_ls
65endfunc check_errata_855472
66
Sandrine Bailleux432aa772016-01-07 16:52:49 +000067 /* -------------------------------------------------
68 * The CPU Ops reset function for Cortex-A35.
69 * Clobbers: x0
70 * -------------------------------------------------
71 */
72func cortex_a35_reset_func
Louis Mayencourt8a061272019-04-05 16:25:25 +010073 mov x19, x30
74 bl cpu_get_rev_var
75
76#if ERRATA_A35_855472
77 bl errata_a35_855472_wa
78#endif
79
Sandrine Bailleux432aa772016-01-07 16:52:49 +000080 /* ---------------------------------------------
Sandrine Bailleuxf12a31d2016-01-29 14:37:58 +000081 * Enable the SMP bit.
Sandrine Bailleux432aa772016-01-07 16:52:49 +000082 * ---------------------------------------------
83 */
84 mrs x0, CORTEX_A35_CPUECTLR_EL1
Sandrine Bailleux432aa772016-01-07 16:52:49 +000085 orr x0, x0, #CORTEX_A35_CPUECTLR_SMPEN_BIT
86 msr CORTEX_A35_CPUECTLR_EL1, x0
Sandrine Bailleux432aa772016-01-07 16:52:49 +000087 isb
Louis Mayencourt8a061272019-04-05 16:25:25 +010088 ret x19
Sandrine Bailleux432aa772016-01-07 16:52:49 +000089endfunc cortex_a35_reset_func
90
91func cortex_a35_core_pwr_dwn
92 mov x18, x30
93
94 /* ---------------------------------------------
95 * Turn off caches.
96 * ---------------------------------------------
97 */
98 bl cortex_a35_disable_dcache
99
100 /* ---------------------------------------------
101 * Flush L1 caches.
102 * ---------------------------------------------
103 */
104 mov x0, #DCCISW
105 bl dcsw_op_level1
106
107 /* ---------------------------------------------
108 * Come out of intra cluster coherency
109 * ---------------------------------------------
110 */
111 mov x30, x18
112 b cortex_a35_disable_smp
113endfunc cortex_a35_core_pwr_dwn
114
115func cortex_a35_cluster_pwr_dwn
116 mov x18, x30
117
118 /* ---------------------------------------------
119 * Turn off caches.
120 * ---------------------------------------------
121 */
122 bl cortex_a35_disable_dcache
123
124 /* ---------------------------------------------
125 * Flush L1 caches.
126 * ---------------------------------------------
127 */
128 mov x0, #DCCISW
129 bl dcsw_op_level1
130
131 /* ---------------------------------------------
132 * Disable the optional ACP.
133 * ---------------------------------------------
134 */
135 bl plat_disable_acp
136
137 /* ---------------------------------------------
138 * Flush L2 caches.
139 * ---------------------------------------------
140 */
141 mov x0, #DCCISW
142 bl dcsw_op_level2
143
144 /* ---------------------------------------------
145 * Come out of intra cluster coherency
146 * ---------------------------------------------
147 */
148 mov x30, x18
149 b cortex_a35_disable_smp
150endfunc cortex_a35_cluster_pwr_dwn
151
Soby Mathew0980dce2018-09-17 04:34:35 +0100152#if REPORT_ERRATA
153/*
154 * Errata printing function for Cortex A35. Must follow AAPCS.
155 */
156func cortex_a35_errata_report
Louis Mayencourt8a061272019-04-05 16:25:25 +0100157 stp x8, x30, [sp, #-16]!
158
159 bl cpu_get_rev_var
160 mov x8, x0
161
162 /*
163 * Report all errata. The revision-variant information is passed to
164 * checking functions of each errata.
165 */
166 report_errata ERRATA_A35_855472, cortex_a35, 855472
167
168 ldp x8, x30, [sp], #16
Soby Mathew0980dce2018-09-17 04:34:35 +0100169 ret
170endfunc cortex_a35_errata_report
171#endif
172
173
Sandrine Bailleux432aa772016-01-07 16:52:49 +0000174 /* ---------------------------------------------
175 * This function provides cortex_a35 specific
176 * register information for crash reporting.
177 * It needs to return with x6 pointing to
178 * a list of register names in ascii and
179 * x8 - x15 having values of registers to be
180 * reported.
181 * ---------------------------------------------
182 */
183.section .rodata.cortex_a35_regs, "aS"
184cortex_a35_regs: /* The ascii list of register names to be reported */
185 .asciz "cpuectlr_el1", ""
186
187func cortex_a35_cpu_reg_dump
188 adr x6, cortex_a35_regs
189 mrs x8, CORTEX_A35_CPUECTLR_EL1
190 ret
191endfunc cortex_a35_cpu_reg_dump
192
Jeenu Viswambharanee5eb802016-11-18 12:58:28 +0000193declare_cpu_ops cortex_a35, CORTEX_A35_MIDR, \
194 cortex_a35_reset_func, \
195 cortex_a35_core_pwr_dwn, \
196 cortex_a35_cluster_pwr_dwn