blob: eba106dc1a59fcd02fd0bea95da62bbfe5b56138 [file] [log] [blame]
Konstantin Porotchkind8e39572018-11-14 17:15:08 +02001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#include <assert.h>
7#include <console.h>
8#include <debug.h>
9#include <plat_marvell.h>
10#include <platform_def.h>
11
12#ifdef PLAT_a3700
13#include <a3700_console.h>
14
15static console_a3700_t marvell_boot_console;
16static console_a3700_t marvell_runtime_console;
17#else
18#include <uart_16550.h>
19
20static console_16550_t marvell_boot_console;
21static console_16550_t marvell_runtime_console;
22#endif
23
24/*******************************************************************************
25 * Functions that set up the console
26 ******************************************************************************/
27
28/* Initialize the console to provide early debug support */
29void marvell_console_boot_init(void)
30{
31 int rc =
32#ifdef PLAT_a3700
33 console_a3700_register(
34#else
35 console_16550_register(
36#endif
37 PLAT_MARVELL_BOOT_UART_BASE,
38 PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
39 MARVELL_CONSOLE_BAUDRATE,
40 &marvell_boot_console);
41 if (rc == 0) {
42 /*
43 * The crash console doesn't use the multi console API, it uses
44 * the core console functions directly. It is safe to call panic
45 * and let it print debug information.
46 */
47 panic();
48 }
49
50 console_set_scope(&marvell_boot_console.console,
51 CONSOLE_FLAG_BOOT);
52}
53
54void marvell_console_boot_end(void)
55{
56 (void)console_flush();
57
58 (void)console_unregister(&marvell_boot_console.console);
59}
60
61/* Initialize the runtime console */
62void marvell_console_runtime_init(void)
63{
64 int rc =
65#ifdef PLAT_a3700
66 console_a3700_register(
67#else
68 console_16550_register(
69#endif
70 PLAT_MARVELL_BOOT_UART_BASE,
71 PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
72 MARVELL_CONSOLE_BAUDRATE,
73 &marvell_runtime_console);
74 if (rc == 0)
75 panic();
76
77 console_set_scope(&marvell_runtime_console.console,
78 CONSOLE_FLAG_RUNTIME);
79}
80
81void marvell_console_runtime_end(void)
82{
83 (void)console_flush();
84
85 (void)console_unregister(&marvell_runtime_console.console);
86}