1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2019, HiSilicon Technologies Co., Ltd.
4  */
5 
6 #include <console.h>
7 #include <drivers/gic.h>
8 #include <drivers/pl011.h>
9 #include <kernel/panic.h>
10 #include <mm/tee_pager.h>
11 #include <mm/core_memprot.h>
12 #include <platform_config.h>
13 #include <stdint.h>
14 
15 static struct pl011_data console_data;
16 register_phys_mem(MEM_AREA_IO_NSEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
17 #ifdef BOOTSRAM_BASE
18 register_phys_mem(MEM_AREA_IO_SEC, BOOTSRAM_BASE, BOOTSRAM_SIZE);
19 #endif
20 #ifdef CPU_CRG_BASE
21 register_phys_mem(MEM_AREA_IO_SEC, CPU_CRG_BASE, CPU_CRG_SIZE);
22 #endif
23 #ifdef SYS_CTRL_BASE
24 register_phys_mem(MEM_AREA_IO_SEC, SYS_CTRL_BASE, SYS_CTRL_SIZE);
25 #endif
26 
console_init(void)27 void console_init(void)
28 {
29 	pl011_init(&console_data, CONSOLE_UART_BASE,
30 		CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
31 	register_serial_console(&console_data.chip);
32 }
33