blob: 5f2009403a4c8ea1c5ba014d9ac79af30430e1b4 [file] [log] [blame]
Sheetal Tigadoli13680c92019-12-13 10:39:06 +05301/*
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 ******************************************************************************/
18static console_t bcm_boot_console;
19static console_t bcm_runtime_console;
20
21/* Initialize the console to provide early debug support */
22void 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
40void bcm_console_boot_end(void)
41{
Jimmy Brisson39f9eee2020-08-05 13:44:05 -050042 console_flush();
Sheetal Tigadoli13680c92019-12-13 10:39:06 +053043
44 (void)console_unregister(&bcm_boot_console);
45}
46
47/* Initialize the runtime console */
48void 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
60void bcm_console_runtime_end(void)
61{
Jimmy Brisson39f9eee2020-08-05 13:44:05 -050062 console_flush();
Sheetal Tigadoli13680c92019-12-13 10:39:06 +053063
64 (void)console_unregister(&bcm_runtime_console);
65}