blob: ed3300b8c6d5327facaccbf229d391176051c623 [file] [log] [blame]
Soren Brinkmann76fcae32016-03-06 20:16:27 -08001/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2014-2019, Arm Limited and Contributors. All rights reserved.
Soren Brinkmann76fcae32016-03-06 20:16:27 -08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmann76fcae32016-03-06 20:16:27 -08005 */
6
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <common/bl_common.h>
8#include <common/debug.h>
9#include <drivers/console.h>
Antonio Nino Diazbd7b7402019-01-25 14:30:04 +000010#include <plat/arm/common/plat_arm.h>
Isla Mitchelle3631462017-07-14 10:46:32 +010011#include <platform_tsp.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000012
Prasad Kummari536e1102023-06-22 10:50:02 +053013#include <plat_private.h>
14
Soren Brinkmann76fcae32016-03-06 20:16:27 -080015/*******************************************************************************
16 * Initialize the UART
17 ******************************************************************************/
18void tsp_early_platform_setup(void)
19{
20 /*
Ambroise Vincent53f193f2019-05-29 11:46:08 +010021 * Register a different console than already in use to display
Soren Brinkmann76fcae32016-03-06 20:16:27 -080022 * messages from TSP
23 */
Andre Przywara8ccc4a42020-01-25 00:58:35 +000024 static console_t tsp_boot_console;
Ambroise Vincent53f193f2019-05-29 11:46:08 +010025 (void)console_cdns_register(ZYNQMP_UART_BASE,
26 zynqmp_get_uart_clk(),
27 ZYNQMP_UART_BAUDRATE,
28 &tsp_boot_console);
Andre Przywara8ccc4a42020-01-25 00:58:35 +000029 console_set_scope(&tsp_boot_console,
Ambroise Vincent53f193f2019-05-29 11:46:08 +010030 CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
Soren Brinkmann76fcae32016-03-06 20:16:27 -080031
32 /* Initialize the platform config for future decision making */
33 zynqmp_config_setup();
34}
35
36/*******************************************************************************
37 * Perform platform specific setup placeholder
38 ******************************************************************************/
39void tsp_platform_setup(void)
40{
41 plat_arm_gic_driver_init();
42 plat_arm_gic_init();
43}
44
45/*******************************************************************************
46 * Perform the very early platform specific architectural setup here. At the
Elyes Haouas2be03c02023-02-13 09:14:48 +010047 * moment this is only initializes the MMU
Soren Brinkmann76fcae32016-03-06 20:16:27 -080048 ******************************************************************************/
49void tsp_plat_arch_setup(void)
50{
Daniel Boulby45a2c9e2018-07-06 16:54:44 +010051 const mmap_region_t bl_regions[] = {
52 MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE,
53 MT_MEMORY | MT_RW | MT_SECURE),
54 MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
55 MT_CODE | MT_SECURE),
56 MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
57 MT_RO_DATA | MT_SECURE),
58 MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
59 BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
60 MT_DEVICE | MT_RW | MT_SECURE),
61 {0}
62 };
63
Roberto Vargas344ff022018-10-19 16:44:18 +010064 setup_page_tables(bl_regions, plat_arm_get_mmap());
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +010065 enable_mmu_el1(0);
Soren Brinkmann76fcae32016-03-06 20:16:27 -080066}