blob: a9f2dbd733b0c5971456bc159f3f31d11cdb08f8 [file] [log] [blame]
Soren Brinkmannc8284402016-03-06 20:16:27 -08001/*
Michal Simek619bc132023-04-14 08:43:51 +02002 * Copyright (c) 2014-2019, Arm Limited and Contributors. All rights reserved.
Soren Brinkmannc8284402016-03-06 20:16:27 -08003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmannc8284402016-03-06 20:16:27 -08005 */
6
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +00007#include <common/bl_common.h>
8#include <common/debug.h>
9#include <drivers/console.h>
Antonio Nino Diazbd9344f2019-01-25 14:30:04 +000010#include <plat/arm/common/plat_arm.h>
Isla Mitchellee1ebbd2017-07-14 10:46:32 +010011#include <platform_tsp.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000012
Prasad Kummari01a326a2023-06-22 10:50:02 +053013#include <plat_private.h>
14
Soren Brinkmannc8284402016-03-06 20:16:27 -080015/*******************************************************************************
16 * Initialize the UART
17 ******************************************************************************/
18void tsp_early_platform_setup(void)
19{
20 /*
Ambroise Vincent55a08b32019-05-29 11:46:08 +010021 * Register a different console than already in use to display
Soren Brinkmannc8284402016-03-06 20:16:27 -080022 * messages from TSP
23 */
Andre Przywara78b40dc2020-01-25 00:58:35 +000024 static console_t tsp_boot_console;
Michal Simek04a48332023-09-27 13:58:06 +020025 (void)console_cdns_register(UART_BASE,
26 get_uart_clk(),
27 UART_BAUDRATE,
Ambroise Vincent55a08b32019-05-29 11:46:08 +010028 &tsp_boot_console);
Andre Przywara78b40dc2020-01-25 00:58:35 +000029 console_set_scope(&tsp_boot_console,
Ambroise Vincent55a08b32019-05-29 11:46:08 +010030 CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
Soren Brinkmannc8284402016-03-06 20:16:27 -080031}
32
33/*******************************************************************************
34 * Perform platform specific setup placeholder
35 ******************************************************************************/
36void tsp_platform_setup(void)
37{
38 plat_arm_gic_driver_init();
39 plat_arm_gic_init();
40}
41
42/*******************************************************************************
43 * Perform the very early platform specific architectural setup here. At the
Elyes Haouas1b491ee2023-02-13 09:14:48 +010044 * moment this is only initializes the MMU
Soren Brinkmannc8284402016-03-06 20:16:27 -080045 ******************************************************************************/
46void tsp_plat_arch_setup(void)
47{
Daniel Boulbyd323af92018-07-06 16:54:44 +010048 const mmap_region_t bl_regions[] = {
49 MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE,
50 MT_MEMORY | MT_RW | MT_SECURE),
51 MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
52 MT_CODE | MT_SECURE),
53 MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
54 MT_RO_DATA | MT_SECURE),
55 MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
56 BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
57 MT_DEVICE | MT_RW | MT_SECURE),
58 {0}
59 };
60
Roberto Vargas0916c382018-10-19 16:44:18 +010061 setup_page_tables(bl_regions, plat_arm_get_mmap());
Sandrine Bailleuxb5fa6562016-05-18 16:11:47 +010062 enable_mmu_el1(0);
Soren Brinkmannc8284402016-03-06 20:16:27 -080063}