1 /* 2 * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <assert.h> 8 9 #include <common/debug.h> 10 #include <drivers/console.h> 11 #include <drivers/ti/uart/uart_16550.h> 12 13 #include <platform_def.h> 14 15 /******************************************************************************* 16 * Functions that set up the console 17 ******************************************************************************/ 18 static console_t bcm_boot_console; 19 static console_t bcm_runtime_console; 20 21 /* Initialize the console to provide early debug support */ 22 void bcm_console_boot_init(void) 23 { 24 int rc = console_16550_register(PLAT_BRCM_BOOT_UART_BASE, 25 PLAT_BRCM_BOOT_UART_CLK_IN_HZ, 26 BRCM_CONSOLE_BAUDRATE, 27 &bcm_boot_console); 28 if (rc == 0) { 29 /* 30 * The crash console doesn't use the multi console API, it uses 31 * the core console functions directly. It is safe to call panic 32 * and let it print debug information. 33 */ 34 panic(); 35 } 36 37 console_set_scope(&bcm_boot_console, CONSOLE_FLAG_BOOT); 38 } 39 40 void bcm_console_boot_end(void) 41 { 42 console_flush(); 43 44 (void)console_unregister(&bcm_boot_console); 45 } 46 47 /* Initialize the runtime console */ 48 void bcm_console_runtime_init(void) 49 { 50 int rc = console_16550_register(PLAT_BRCM_BL31_RUN_UART_BASE, 51 PLAT_BRCM_BL31_RUN_UART_CLK_IN_HZ, 52 BRCM_CONSOLE_BAUDRATE, 53 &bcm_runtime_console); 54 if (rc == 0) 55 panic(); 56 57 console_set_scope(&bcm_runtime_console, CONSOLE_FLAG_RUNTIME); 58 } 59 60 void bcm_console_runtime_end(void) 61 { 62 console_flush(); 63 64 (void)console_unregister(&bcm_runtime_console); 65 } 66