blob: 983ebe3da9f7e09bd8c86d3a5acb3cafd830c3f8 [file] [log] [blame]
developer65014b82015-04-13 14:47:57 +08001/*
Ambroise Vincent962109f2019-03-27 13:48:15 +00002 * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
developer65014b82015-04-13 14:47:57 +08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
developer65014b82015-04-13 14:47:57 +08005 */
6#include <arch.h>
7#include <asm_macros.S>
8#include <mt8173_def.h>
9
10 .globl plat_secondary_cold_boot_setup
11 .globl plat_report_exception
12 .globl platform_is_primary_cpu
Koan-Sin Tanbc998072017-01-19 16:43:49 +080013 .globl plat_my_core_pos
developer65014b82015-04-13 14:47:57 +080014 .globl plat_crash_console_init
15 .globl plat_crash_console_putc
Ambroise Vincent962109f2019-03-27 13:48:15 +000016 .globl plat_crash_console_flush
developer65014b82015-04-13 14:47:57 +080017
18 /* -----------------------------------------------------
19 * void plat_secondary_cold_boot_setup (void);
20 *
21 * This function performs any platform specific actions
22 * needed for a secondary cpu after a cold reset e.g
23 * mark the cpu's presence, mechanism to place it in a
24 * holding pen etc.
25 * -----------------------------------------------------
26 */
27func plat_secondary_cold_boot_setup
28 /* MT8173 Oak does not do cold boot for secondary CPU */
29cb_panic:
30 b cb_panic
31endfunc plat_secondary_cold_boot_setup
32
33func platform_is_primary_cpu
34 and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
35 cmp x0, #MT8173_PRIMARY_CPU
36 cset x0, eq
37 ret
38endfunc platform_is_primary_cpu
39
Koan-Sin Tanbc998072017-01-19 16:43:49 +080040 /* -----------------------------------------------------
41 * unsigned int plat_my_core_pos(void);
42 *
43 * result: CorePos = CoreId + (ClusterId << 2)
44 * -----------------------------------------------------
45 */
46func plat_my_core_pos
47 mrs x0, mpidr_el1
48 and x1, x0, #MPIDR_CPU_MASK
49 and x0, x0, #MPIDR_CLUSTER_MASK
50 add x0, x1, x0, LSR #6
51 ret
52endfunc plat_my_core_pos
Koan-Sin Tanbc998072017-01-19 16:43:49 +080053
developer65014b82015-04-13 14:47:57 +080054 /* ---------------------------------------------
55 * int plat_crash_console_init(void)
56 * Function to initialize the crash console
57 * without a C Runtime to print crash report.
Juan Castilloe7ae6db2015-11-26 14:52:15 +000058 * Clobber list : x0 - x4
developer65014b82015-04-13 14:47:57 +080059 * ---------------------------------------------
60 */
61func plat_crash_console_init
62 mov_imm x0, MT8173_UART0_BASE
63 mov_imm x1, MT8173_UART_CLOCK
64 mov_imm x2, MT8173_BAUDRATE
65 b console_core_init
66endfunc plat_crash_console_init
67
68 /* ---------------------------------------------
69 * int plat_crash_console_putc(void)
70 * Function to print a character on the crash
71 * console without a C Runtime.
72 * Clobber list : x1, x2
73 * ---------------------------------------------
74 */
75func plat_crash_console_putc
76 mov_imm x1, MT8173_UART0_BASE
77 b console_core_putc
78endfunc plat_crash_console_putc
Ambroise Vincent962109f2019-03-27 13:48:15 +000079
80 /* ---------------------------------------------
81 * int plat_crash_console_flush(int c)
82 * Function to force a write of all buffered
83 * data that hasn't been output.
84 * Out : return -1 on error else return 0.
85 * Clobber list : x0, x1
86 * ---------------------------------------------
87 */
88func plat_crash_console_flush
89 mov_imm x0, MT8173_UART0_BASE
90 b console_core_flush
91endfunc plat_crash_console_flush