xref: /rk3399_ARM-atf/plat/nxp/s32/s32g274ardb2/plat_console.c (revision 10ecd58093a34e95e2dfad65b1180610f29397cc)
1 /*
2  * Copyright 2024 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <common/debug.h>
8 #include <lib/xlat_tables/xlat_tables_v2.h>
9 #include <linflex.h>
10 #include <plat_console.h>
11 #include <platform_def.h>
12 
13 void console_s32g2_register(void)
14 {
15 	static console_t s32g2_console = {
16 		.next = NULL,
17 		.flags = 0u,
18 	};
19 	int ret;
20 
21 	ret = mmap_add_dynamic_region(UART_BASE, UART_BASE, PAGE_SIZE,
22 				      MT_DEVICE | MT_RW | MT_SECURE);
23 	if (ret != 0) {
24 		panic();
25 	}
26 
27 	ret = console_linflex_register(UART_BASE, UART_CLOCK_HZ,
28 				       UART_BAUDRATE, &s32g2_console);
29 	if (ret == 0) {
30 		panic();
31 	}
32 
33 	console_set_scope(&s32g2_console,
34 			  CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH |
35 			  CONSOLE_FLAG_TRANSLATE_CRLF);
36 }
37