blob: 52d4bf8cc335fd625b7f333fc6559d45c1e18011 [file] [log] [blame]
Soren Brinkmannc8284402016-03-06 20:16:27 -08001/*
Sandrine Bailleuxb5fa6562016-05-18 16:11:47 +01002 * Copyright (c) 2014-2016, 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
7#include <bl_common.h>
8#include <console.h>
9#include <debug.h>
Soren Brinkmannc8284402016-03-06 20:16:27 -080010#include <plat_arm.h>
Isla Mitchellee1ebbd2017-07-14 10:46:32 +010011#include <platform_tsp.h>
Soren Brinkmannc8284402016-03-06 20:16:27 -080012#include "../zynqmp_private.h"
13
Soren Brinkmannc8284402016-03-06 20:16:27 -080014#define BL32_END (unsigned long)(&__BL32_END__)
15
Soren Brinkmannc8284402016-03-06 20:16:27 -080016/*******************************************************************************
17 * Initialize the UART
18 ******************************************************************************/
19void tsp_early_platform_setup(void)
20{
21 /*
22 * Initialize a different console than already in use to display
23 * messages from TSP
24 */
Soren Brinkmann7de544a2016-06-10 09:57:14 -070025 console_init(ZYNQMP_UART_BASE, zynqmp_get_uart_clk(),
Soren Brinkmannc8284402016-03-06 20:16:27 -080026 ZYNQMP_UART_BAUDRATE);
27
28 /* Initialize the platform config for future decision making */
29 zynqmp_config_setup();
30}
31
32/*******************************************************************************
33 * Perform platform specific setup placeholder
34 ******************************************************************************/
35void tsp_platform_setup(void)
36{
37 plat_arm_gic_driver_init();
38 plat_arm_gic_init();
39}
40
41/*******************************************************************************
42 * Perform the very early platform specific architectural setup here. At the
43 * moment this is only intializes the MMU
44 ******************************************************************************/
45void tsp_plat_arch_setup(void)
46{
Daniel Boulbyd323af92018-07-06 16:54:44 +010047 const mmap_region_t bl_regions[] = {
48 MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE,
49 MT_MEMORY | MT_RW | MT_SECURE),
50 MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
51 MT_CODE | MT_SECURE),
52 MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
53 MT_RO_DATA | MT_SECURE),
54 MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
55 BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
56 MT_DEVICE | MT_RW | MT_SECURE),
57 {0}
58 };
59
60 arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
Sandrine Bailleuxb5fa6562016-05-18 16:11:47 +010061 enable_mmu_el1(0);
Soren Brinkmannc8284402016-03-06 20:16:27 -080062}