1 // SPDX-License-Identifier: BSD-2-Clause 2 /* 3 * Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. 4 * Copyright (C) 2019, Theobroma Systems Design und Consulting GmbH 5 */ 6 7 #include <console.h> 8 #include <drivers/gic.h> 9 #include <drivers/serial8250_uart.h> 10 #include <io.h> 11 #include <kernel/boot.h> 12 #include <kernel/panic.h> 13 #include <mm/core_memprot.h> 14 #include <platform_config.h> 15 #include <stdint.h> 16 17 #if defined(CFG_EARLY_CONSOLE) 18 static struct serial8250_uart_data early_console_data; 19 register_phys_mem_pgdir(MEM_AREA_IO_NSEC, 20 CFG_EARLY_CONSOLE_BASE, CFG_EARLY_CONSOLE_SIZE); 21 #endif 22 23 register_phys_mem_pgdir(MEM_AREA_IO_SEC, GIC_BASE, GIC_SIZE); 24 25 void boot_primary_init_intc(void) 26 { 27 gic_init(GICC_BASE, GICD_BASE); 28 } 29 30 void boot_secondary_init_intc(void) 31 { 32 gic_init_per_cpu(); 33 } 34 35 void plat_console_init(void) 36 { 37 #if defined(CFG_EARLY_CONSOLE) 38 /* 39 * Console devices can vary a lot between devices and 40 * OP-TEE will switch to the DT-based real console later, 41 * based on DT-devices and the systems chosen node. 42 * So early console is only needed for early debugging. 43 */ 44 serial8250_uart_init(&early_console_data, 45 CFG_EARLY_CONSOLE_BASE, 46 CFG_EARLY_CONSOLE_CLK_IN_HZ, 47 CFG_EARLY_CONSOLE_BAUDRATE); 48 register_serial_console(&early_console_data.chip); 49 #endif 50 } 51