blob: 6ffb9440786a476b4052f6dab24a2311fd16f61f [file] [log] [blame]
Sandrine Bailleux432aa772016-01-07 16:52:49 +00001/*
Sona Mathew92c0aa82023-06-19 14:43:43 -05002 * Copyright (c) 2016-2023, 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
Sona Mathewcfc66a52023-06-19 14:49:02 -050019 sysreg_bit_clear sctlr_el3, SCTLR_C_BIT
Sandrine Bailleux432aa772016-01-07 16:52:49 +000020 isb
21 ret
22endfunc cortex_a35_disable_dcache
23
24 /* ---------------------------------------------
25 * Disable intra-cluster coherency
26 * ---------------------------------------------
27 */
28func cortex_a35_disable_smp
Sona Mathewcfc66a52023-06-19 14:49:02 -050029 sysreg_bit_clear CORTEX_A35_CPUECTLR_EL1, CORTEX_A35_CPUECTLR_SMPEN_BIT
Sandrine Bailleux432aa772016-01-07 16:52:49 +000030 isb
31 dsb sy
32 ret
33endfunc cortex_a35_disable_smp
34
Sona Mathew92c0aa82023-06-19 14:43:43 -050035workaround_reset_start cortex_a35, ERRATUM(855472), ERRATA_A35_855472
Sona Mathewcfc66a52023-06-19 14:49:02 -050036 sysreg_bit_set CORTEX_A35_CPUACTLR_EL1, CORTEX_A35_CPUACTLR_EL1_ENDCCASCI
Sona Mathew92c0aa82023-06-19 14:43:43 -050037workaround_reset_end cortex_a35, ERRATUM(855472)
Louis Mayencourt8a061272019-04-05 16:25:25 +010038
Sona Mathew92c0aa82023-06-19 14:43:43 -050039check_erratum_ls cortex_a35, ERRATUM(855472), CPU_REV(0, 0)
Louis Mayencourt8a061272019-04-05 16:25:25 +010040
Sandrine Bailleux432aa772016-01-07 16:52:49 +000041 /* -------------------------------------------------
42 * The CPU Ops reset function for Cortex-A35.
Sandrine Bailleux432aa772016-01-07 16:52:49 +000043 * -------------------------------------------------
44 */
Sona Mathew92c0aa82023-06-19 14:43:43 -050045cpu_reset_func_start cortex_a35
Sandrine Bailleux432aa772016-01-07 16:52:49 +000046 /* ---------------------------------------------
Sandrine Bailleuxf12a31d2016-01-29 14:37:58 +000047 * Enable the SMP bit.
Sandrine Bailleux432aa772016-01-07 16:52:49 +000048 * ---------------------------------------------
49 */
Sona Mathewcfc66a52023-06-19 14:49:02 -050050 sysreg_bit_set CORTEX_A35_CPUECTLR_EL1, CORTEX_A35_CPUECTLR_SMPEN_BIT
Sona Mathew92c0aa82023-06-19 14:43:43 -050051cpu_reset_func_end cortex_a35
Sandrine Bailleux432aa772016-01-07 16:52:49 +000052
53func cortex_a35_core_pwr_dwn
54 mov x18, x30
55
56 /* ---------------------------------------------
57 * Turn off caches.
58 * ---------------------------------------------
59 */
60 bl cortex_a35_disable_dcache
61
62 /* ---------------------------------------------
63 * Flush L1 caches.
64 * ---------------------------------------------
65 */
66 mov x0, #DCCISW
67 bl dcsw_op_level1
68
69 /* ---------------------------------------------
70 * Come out of intra cluster coherency
71 * ---------------------------------------------
72 */
73 mov x30, x18
74 b cortex_a35_disable_smp
75endfunc cortex_a35_core_pwr_dwn
76
77func cortex_a35_cluster_pwr_dwn
78 mov x18, x30
79
80 /* ---------------------------------------------
81 * Turn off caches.
82 * ---------------------------------------------
83 */
84 bl cortex_a35_disable_dcache
85
86 /* ---------------------------------------------
87 * Flush L1 caches.
88 * ---------------------------------------------
89 */
90 mov x0, #DCCISW
91 bl dcsw_op_level1
92
93 /* ---------------------------------------------
94 * Disable the optional ACP.
95 * ---------------------------------------------
96 */
97 bl plat_disable_acp
98
99 /* ---------------------------------------------
100 * Flush L2 caches.
101 * ---------------------------------------------
102 */
103 mov x0, #DCCISW
104 bl dcsw_op_level2
105
106 /* ---------------------------------------------
107 * Come out of intra cluster coherency
108 * ---------------------------------------------
109 */
110 mov x30, x18
111 b cortex_a35_disable_smp
112endfunc cortex_a35_cluster_pwr_dwn
113
Sona Mathew92c0aa82023-06-19 14:43:43 -0500114errata_report_shim cortex_a35
Soby Mathew0980dce2018-09-17 04:34:35 +0100115
Sandrine Bailleux432aa772016-01-07 16:52:49 +0000116 /* ---------------------------------------------
117 * This function provides cortex_a35 specific
118 * register information for crash reporting.
119 * It needs to return with x6 pointing to
120 * a list of register names in ascii and
121 * x8 - x15 having values of registers to be
122 * reported.
123 * ---------------------------------------------
124 */
125.section .rodata.cortex_a35_regs, "aS"
126cortex_a35_regs: /* The ascii list of register names to be reported */
127 .asciz "cpuectlr_el1", ""
128
129func cortex_a35_cpu_reg_dump
130 adr x6, cortex_a35_regs
131 mrs x8, CORTEX_A35_CPUECTLR_EL1
132 ret
133endfunc cortex_a35_cpu_reg_dump
134
Jeenu Viswambharanee5eb802016-11-18 12:58:28 +0000135declare_cpu_ops cortex_a35, CORTEX_A35_MIDR, \
136 cortex_a35_reset_func, \
137 cortex_a35_core_pwr_dwn, \
138 cortex_a35_cluster_pwr_dwn