xref: /rk3399_ARM-atf/plat/mediatek/mt8173/aarch64/plat_helpers.S (revision 7d116dccab2249a692181ba9521a52277e86591c)
1*7d116dccSCC Ma/*
2*7d116dccSCC Ma * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
3*7d116dccSCC Ma *
4*7d116dccSCC Ma * Redistribution and use in source and binary forms, with or without
5*7d116dccSCC Ma * modification, are permitted provided that the following conditions are met:
6*7d116dccSCC Ma *
7*7d116dccSCC Ma * Redistributions of source code must retain the above copyright notice, this
8*7d116dccSCC Ma * list of conditions and the following disclaimer.
9*7d116dccSCC Ma *
10*7d116dccSCC Ma * Redistributions in binary form must reproduce the above copyright notice,
11*7d116dccSCC Ma * this list of conditions and the following disclaimer in the documentation
12*7d116dccSCC Ma * and/or other materials provided with the distribution.
13*7d116dccSCC Ma *
14*7d116dccSCC Ma * Neither the name of ARM nor the names of its contributors may be used
15*7d116dccSCC Ma * to endorse or promote products derived from this software without specific
16*7d116dccSCC Ma * prior written permission.
17*7d116dccSCC Ma *
18*7d116dccSCC Ma * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19*7d116dccSCC Ma * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*7d116dccSCC Ma * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*7d116dccSCC Ma * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22*7d116dccSCC Ma * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*7d116dccSCC Ma * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*7d116dccSCC Ma * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*7d116dccSCC Ma * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*7d116dccSCC Ma * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*7d116dccSCC Ma * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*7d116dccSCC Ma * POSSIBILITY OF SUCH DAMAGE.
29*7d116dccSCC Ma */
30*7d116dccSCC Ma#include <arch.h>
31*7d116dccSCC Ma#include <asm_macros.S>
32*7d116dccSCC Ma#include <mt8173_def.h>
33*7d116dccSCC Ma
34*7d116dccSCC Ma	.globl	plat_secondary_cold_boot_setup
35*7d116dccSCC Ma	.globl	plat_report_exception
36*7d116dccSCC Ma	.globl	platform_is_primary_cpu
37*7d116dccSCC Ma	.globl	plat_crash_console_init
38*7d116dccSCC Ma	.globl	plat_crash_console_putc
39*7d116dccSCC Ma
40*7d116dccSCC Ma	/* -----------------------------------------------------
41*7d116dccSCC Ma	 * void plat_secondary_cold_boot_setup (void);
42*7d116dccSCC Ma	 *
43*7d116dccSCC Ma	 * This function performs any platform specific actions
44*7d116dccSCC Ma	 * needed for a secondary cpu after a cold reset e.g
45*7d116dccSCC Ma	 * mark the cpu's presence, mechanism to place it in a
46*7d116dccSCC Ma	 * holding pen etc.
47*7d116dccSCC Ma	 * -----------------------------------------------------
48*7d116dccSCC Ma	 */
49*7d116dccSCC Mafunc plat_secondary_cold_boot_setup
50*7d116dccSCC Ma	/* MT8173 Oak does not do cold boot for secondary CPU */
51*7d116dccSCC Macb_panic:
52*7d116dccSCC Ma	b	cb_panic
53*7d116dccSCC Maendfunc plat_secondary_cold_boot_setup
54*7d116dccSCC Ma
55*7d116dccSCC Mafunc platform_is_primary_cpu
56*7d116dccSCC Ma	and	x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
57*7d116dccSCC Ma	cmp	x0, #MT8173_PRIMARY_CPU
58*7d116dccSCC Ma	cset	x0, eq
59*7d116dccSCC Ma	ret
60*7d116dccSCC Maendfunc platform_is_primary_cpu
61*7d116dccSCC Ma
62*7d116dccSCC Ma	/* ---------------------------------------------
63*7d116dccSCC Ma	 * int plat_crash_console_init(void)
64*7d116dccSCC Ma	 * Function to initialize the crash console
65*7d116dccSCC Ma	 * without a C Runtime to print crash report.
66*7d116dccSCC Ma	 * Clobber list : x0, x1, x2
67*7d116dccSCC Ma	 * ---------------------------------------------
68*7d116dccSCC Ma	 */
69*7d116dccSCC Mafunc plat_crash_console_init
70*7d116dccSCC Ma	mov_imm	x0, MT8173_UART0_BASE
71*7d116dccSCC Ma	mov_imm	x1, MT8173_UART_CLOCK
72*7d116dccSCC Ma	mov_imm	x2, MT8173_BAUDRATE
73*7d116dccSCC Ma	b	console_core_init
74*7d116dccSCC Maendfunc plat_crash_console_init
75*7d116dccSCC Ma
76*7d116dccSCC Ma	/* ---------------------------------------------
77*7d116dccSCC Ma	 * int plat_crash_console_putc(void)
78*7d116dccSCC Ma	 * Function to print a character on the crash
79*7d116dccSCC Ma	 * console without a C Runtime.
80*7d116dccSCC Ma	 * Clobber list : x1, x2
81*7d116dccSCC Ma	 * ---------------------------------------------
82*7d116dccSCC Ma	 */
83*7d116dccSCC Mafunc plat_crash_console_putc
84*7d116dccSCC Ma	mov_imm x1, MT8173_UART0_BASE
85*7d116dccSCC Ma	b	console_core_putc
86*7d116dccSCC Maendfunc plat_crash_console_putc
87