ti: k3: common: Add console initialization base

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
This commit is contained in:
Nishanth Menon 2016-10-14 01:13:44 +00:00 committed by Andrew F. Davis
parent e67bfcf344
commit fff6ffca5b
6 changed files with 94 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include <assert.h>
#include <bl_common.h>
#include <debug.h>
#include <k3_console.h>
#include <plat_arm.h>
#include <platform_def.h>
#include <string.h>
@ -16,6 +17,7 @@
/* Table of regions to map using the MMU */
const mmap_region_t plat_arm_mmap[] = {
MAP_REGION_FLAT(SHARED_RAM_BASE, SHARED_RAM_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
MAP_REGION_FLAT(K3_USART_BASE_ADDRESS, K3_USART_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
{ /* sentinel */ }
};
@ -55,6 +57,8 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
assert(from_bl2 == NULL);
assert(plat_params_from_bl2 == NULL);
bl31_console_setup();
#ifdef BL32_BASE
/* Populate entry point information for BL32 */
SET_PARAM_HEAD(&bl32_image_ep_info, PARAM_EP, VERSION_1, 0);

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <console.h>
#include <k3_console.h>
#include <platform_def.h>
#include <uart_16550.h>
void bl31_console_setup(void)
{
static console_16550_t console;
/* Initialize the console to provide early debug support */
console_16550_register(K3_USART_BASE_ADDRESS, K3_USART_CLK_SPEED,
K3_USART_BAUD, &console);
}

View File

@ -92,3 +92,31 @@ func plat_my_core_pos
out:
ret
endfunc plat_my_core_pos
/* ---------------------------------------------
* int plat_crash_console_init(void)
* Function to initialize the crash console
* without a C Runtime to print crash report.
* Clobber list : x0 - x4
* ---------------------------------------------
*/
func plat_crash_console_init
mov_imm x0, CRASH_CONSOLE_BASE
mov_imm x1, CRASH_CONSOLE_CLK
mov_imm x2, CRASH_CONSOLE_BAUD_RATE
mov w3, #0x0
b console_core_init
endfunc plat_crash_console_init
/* ---------------------------------------------
* int plat_crash_console_putc(void)
* Function to print a character on the crash
* console without a C Runtime.
* Clobber list : x1, x2
* ---------------------------------------------
*/
func plat_crash_console_putc
mov_imm x1, CRASH_CONSOLE_BASE
b console_core_putc
endfunc plat_crash_console_putc

View File

@ -25,6 +25,10 @@ ERRATA_A53_836870 := 1
ERRATA_A53_843419 := 1
ERRATA_A53_855873 := 1
MULTI_CONSOLE_API := 1
TI_16550_MDR_QUIRK := 1
$(eval $(call add_define,TI_16550_MDR_QUIRK))
# Libraries
include lib/xlat_tables_v2/xlat_tables.mk
@ -33,10 +37,16 @@ PLAT_INCLUDES += \
-Iinclude/plat/arm/common/ \
-Iinclude/plat/arm/common/aarch64/ \
K3_CONSOLE_SOURCES += \
drivers/console/aarch64/console.S \
drivers/ti/uart/aarch64/16550_console.S \
${PLAT_PATH}/common/k3_console.c \
PLAT_BL_COMMON_SOURCES += \
plat/arm/common/arm_common.c \
lib/cpus/aarch64/cortex_a53.S \
${XLAT_TABLES_LIB_SRCS} \
${K3_CONSOLE_SOURCES} \
BL31_SOURCES += \
${PLAT_PATH}/common/k3_bl31_setup.c \

View File

@ -0,0 +1,12 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __K3_CONSOLE_H__
#define __K3_CONSOLE_H__
void bl31_console_setup(void);
#endif /* __K3_CONSOLE_H__ */

View File

@ -122,4 +122,25 @@
#define CACHE_WRITEBACK_SHIFT 6
#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
/* Platform default console definitions */
#ifndef K3_USART_BASE_ADDRESS
#define K3_USART_BASE_ADDRESS 0x02800000
#endif
/* USART has a default size for address space */
#define K3_USART_SIZE 0x1000
#ifndef K3_USART_CLK_SPEED
#define K3_USART_CLK_SPEED 48000000
#endif
#ifndef K3_USART_BAUD
#define K3_USART_BAUD 115200
#endif
/* Crash console defaults */
#define CRASH_CONSOLE_BASE K3_USART_BASE_ADDRESS
#define CRASH_CONSOLE_CLK K3_USART_CLK_SPEED
#define CRASH_CONSOLE_BAUD_RATE K3_USART_BAUD
#endif /* __PLATFORM_DEF_H__ */