xref: /rk3399_ARM-atf/lib/cpus/aarch64/cortex_a520.S (revision b62673c645752a78f649282cfa293e8da09e3bef)
1/*
2 * Copyright (c) 2021-2025, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <common/bl_common.h>
10#include <cortex_a520.h>
11#include <cpu_macros.S>
12#include <plat_macros.S>
13
14/* .global erratum_cortex_a520_2938996_wa */
15.global check_erratum_cortex_a520_2938996
16
17/* Hardware handled coherency */
18#if HW_ASSISTED_COHERENCY == 0
19#error "Cortex A520 must be compiled with HW_ASSISTED_COHERENCY enabled"
20#endif
21
22/* 64-bit only core */
23#if CTX_INCLUDE_AARCH32_REGS == 1
24#error "Cortex A520 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
25#endif
26
27workaround_reset_start cortex_a520, ERRATUM(2630792), ERRATA_A520_2630792
28	sysreg_bit_set CORTEX_A520_CPUACTLR_EL1, BIT(38)
29workaround_reset_end cortex_a520, ERRATUM(2630792)
30
31check_erratum_ls cortex_a520, ERRATUM(2630792), CPU_REV(0, 1)
32
33workaround_reset_start cortex_a520, ERRATUM(2858100), ERRATA_A520_2858100
34	sysreg_bit_set CORTEX_A520_CPUACTLR_EL1, BIT(29)
35workaround_reset_end cortex_a520, ERRATUM(2858100)
36
37check_erratum_ls cortex_a520, ERRATUM(2858100), CPU_REV(0, 1)
38
39workaround_runtime_start cortex_a520, ERRATUM(2938996), ERRATA_A520_2938996, CORTEX_A520_MIDR
40workaround_runtime_end cortex_a520, ERRATUM(2938996)
41
42check_erratum_ls cortex_a520, ERRATUM(2938996), CPU_REV(0, 1)
43
44	/* ----------------------------------------------------
45	 * HW will do the cache maintenance while powering down
46	 * ----------------------------------------------------
47	 */
48func cortex_a520_core_pwr_dwn
49	/* ---------------------------------------------------
50	 * Enable CPU power down bit in power control register
51	 * ---------------------------------------------------
52	 */
53	sysreg_bit_set CORTEX_A520_CPUPWRCTLR_EL1, CORTEX_A520_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
54	isb
55	ret
56endfunc cortex_a520_core_pwr_dwn
57
58cpu_reset_func_start cortex_a520
59	/* Disable speculative loads */
60	msr	SSBS, xzr
61cpu_reset_func_end cortex_a520
62
63	/* ---------------------------------------------
64	 * This function provides Cortex A520 specific
65	 * register information for crash reporting.
66	 * It needs to return with x6 pointing to
67	 * a list of register names in ascii and
68	 * x8 - x15 having values of registers to be
69	 * reported.
70	 * ---------------------------------------------
71	 */
72.section .rodata.cortex_a520_regs, "aS"
73cortex_a520_regs:  /* The ascii list of register names to be reported */
74	.asciz	"cpuectlr_el1", ""
75
76func cortex_a520_cpu_reg_dump
77	adr	x6, cortex_a520_regs
78	mrs	x8, CORTEX_A520_CPUECTLR_EL1
79	ret
80endfunc cortex_a520_cpu_reg_dump
81
82declare_cpu_ops cortex_a520, CORTEX_A520_MIDR, \
83	cortex_a520_reset_func, \
84	cortex_a520_core_pwr_dwn
85