xref: /aosp_15_r20/external/arm-trusted-firmware/plat/amlogic/common/aml_console.c (revision 54fd6939e177f8ff529b10183254802c76df6d08)
1*54fd6939SJiyong Park /*
2*54fd6939SJiyong Park  * Copyright (c) 2019, Carlo Caione <[email protected]>
3*54fd6939SJiyong Park  *
4*54fd6939SJiyong Park  * SPDX-License-Identifier: BSD-3-Clause
5*54fd6939SJiyong Park  */
6*54fd6939SJiyong Park 
7*54fd6939SJiyong Park #include <common/debug.h>
8*54fd6939SJiyong Park #include <meson_console.h>
9*54fd6939SJiyong Park #include <platform_def.h>
10*54fd6939SJiyong Park 
11*54fd6939SJiyong Park /*******************************************************************************
12*54fd6939SJiyong Park  * Function that sets up the console
13*54fd6939SJiyong Park  ******************************************************************************/
14*54fd6939SJiyong Park static console_t aml_console;
15*54fd6939SJiyong Park 
aml_console_init(void)16*54fd6939SJiyong Park void aml_console_init(void)
17*54fd6939SJiyong Park {
18*54fd6939SJiyong Park 	int rc = console_meson_register(AML_UART0_AO_BASE,
19*54fd6939SJiyong Park 					AML_UART0_AO_CLK_IN_HZ,
20*54fd6939SJiyong Park 					AML_UART_BAUDRATE,
21*54fd6939SJiyong Park 					&aml_console);
22*54fd6939SJiyong Park 	if (rc == 0) {
23*54fd6939SJiyong Park 		/*
24*54fd6939SJiyong Park 		 * The crash console doesn't use the multi console API, it uses
25*54fd6939SJiyong Park 		 * the core console functions directly. It is safe to call panic
26*54fd6939SJiyong Park 		 * and let it print debug information.
27*54fd6939SJiyong Park 		 */
28*54fd6939SJiyong Park 		panic();
29*54fd6939SJiyong Park 	}
30*54fd6939SJiyong Park 
31*54fd6939SJiyong Park 	console_set_scope(&aml_console,
32*54fd6939SJiyong Park 			  CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME);
33*54fd6939SJiyong Park }
34