From a759d34519d4206dfe0a86389317c4b371850aa7 Mon Sep 17 00:00:00 2001 From: Carlo Caione Date: Thu, 5 Sep 2019 12:27:39 +0100 Subject: [PATCH] amlogic: console: Move console driver to common directory The code managing the console is the same for all the platforms currently supported. Since it is unlikely to change in the future move the code to an external file in the common directory. Signed-off-by: Carlo Caione Change-Id: I6df555ea82d483b4f08a4a1e2cb0a7488fbaa015 --- plat/amlogic/common/aml_console.c | 33 +++++++++++++++++++++++++++++++ plat/amlogic/gxbb/gxbb_common.c | 26 ------------------------ plat/amlogic/gxbb/platform.mk | 1 + plat/amlogic/gxl/gxl_common.c | 26 ------------------------ plat/amlogic/gxl/platform.mk | 1 + 5 files changed, 35 insertions(+), 52 deletions(-) create mode 100644 plat/amlogic/common/aml_console.c diff --git a/plat/amlogic/common/aml_console.c b/plat/amlogic/common/aml_console.c new file mode 100644 index 000000000..352279b6c --- /dev/null +++ b/plat/amlogic/common/aml_console.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019, Carlo Caione + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +/******************************************************************************* + * Function that sets up the console + ******************************************************************************/ +static console_meson_t aml_console; + +void aml_console_init(void) +{ + int rc = console_meson_register(AML_UART0_AO_BASE, + AML_UART0_AO_CLK_IN_HZ, + AML_UART_BAUDRATE, + &aml_console); + if (rc == 0) { + /* + * The crash console doesn't use the multi console API, it uses + * the core console functions directly. It is safe to call panic + * and let it print debug information. + */ + panic(); + } + + console_set_scope(&aml_console.console, + CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME); +} diff --git a/plat/amlogic/gxbb/gxbb_common.c b/plat/amlogic/gxbb/gxbb_common.c index e98748e77..260a347ab 100644 --- a/plat/amlogic/gxbb/gxbb_common.c +++ b/plat/amlogic/gxbb/gxbb_common.c @@ -7,9 +7,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -100,30 +98,6 @@ void aml_setup_page_tables(void) init_xlat_tables(); } -/******************************************************************************* - * Function that sets up the console - ******************************************************************************/ -static console_meson_t gxbb_console; - -void aml_console_init(void) -{ - int rc = console_meson_register(AML_UART0_AO_BASE, - AML_UART0_AO_CLK_IN_HZ, - AML_UART_BAUDRATE, - &gxbb_console); - if (rc == 0) { - /* - * The crash console doesn't use the multi console API, it uses - * the core console functions directly. It is safe to call panic - * and let it print debug information. - */ - panic(); - } - - console_set_scope(&gxbb_console.console, - CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME); -} - /******************************************************************************* * Function that returns the system counter frequency ******************************************************************************/ diff --git a/plat/amlogic/gxbb/platform.mk b/plat/amlogic/gxbb/platform.mk index 59c4f3d63..57167b077 100644 --- a/plat/amlogic/gxbb/platform.mk +++ b/plat/amlogic/gxbb/platform.mk @@ -32,6 +32,7 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${AML_PLAT_COMMON}/aml_sip_svc.c \ ${AML_PLAT_COMMON}/aml_thermal.c \ ${AML_PLAT_COMMON}/aml_topology.c \ + ${AML_PLAT_COMMON}/aml_console.c \ ${XLAT_TABLES_LIB_SRCS} \ ${GIC_SOURCES} diff --git a/plat/amlogic/gxl/gxl_common.c b/plat/amlogic/gxl/gxl_common.c index 468688538..e1d7bfb92 100644 --- a/plat/amlogic/gxl/gxl_common.c +++ b/plat/amlogic/gxl/gxl_common.c @@ -7,11 +7,9 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -100,30 +98,6 @@ void aml_setup_page_tables(void) init_xlat_tables(); } -/******************************************************************************* - * Function that sets up the console - ******************************************************************************/ -static console_meson_t gxl_console; - -void aml_console_init(void) -{ - int rc = console_meson_register(AML_UART0_AO_BASE, - AML_UART0_AO_CLK_IN_HZ, - AML_UART_BAUDRATE, - &gxl_console); - if (rc == 0) { - /* - * The crash console doesn't use the multi console API, it uses - * the core console functions directly. It is safe to call panic - * and let it print debug information. - */ - panic(); - } - - console_set_scope(&gxl_console.console, - CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME); -} - /******************************************************************************* * Function that returns the system counter frequency ******************************************************************************/ diff --git a/plat/amlogic/gxl/platform.mk b/plat/amlogic/gxl/platform.mk index 80c991ced..2e47670f0 100644 --- a/plat/amlogic/gxl/platform.mk +++ b/plat/amlogic/gxl/platform.mk @@ -35,6 +35,7 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ ${AML_PLAT_COMMON}/aml_sip_svc.c \ ${AML_PLAT_COMMON}/aml_thermal.c \ ${AML_PLAT_COMMON}/aml_topology.c \ + ${AML_PLAT_COMMON}/aml_console.c \ drivers/amlogic/crypto/sha_dma.c \ ${XLAT_TABLES_LIB_SRCS} \ ${GIC_SOURCES}