tsp_plat_setup.c 2.07 KB
Newer Older
1
/*
2
 * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
8
9
#include <common/bl_common.h>
#include <common/debug.h>
#include <drivers/console.h>
10
#include <plat/arm/common/plat_arm.h>
11

12
#include <plat_private.h>
13
#include <platform_tsp.h>
14

15
16
17
18
19
20
/*******************************************************************************
 * Initialize the UART
 ******************************************************************************/
void tsp_early_platform_setup(void)
{
	/*
21
	 * Register a different console than already in use to display
22
23
	 * messages from TSP
	 */
24
25
26
27
28
29
30
	static console_cdns_t tsp_boot_console;
	(void)console_cdns_register(ZYNQMP_UART_BASE,
				       zynqmp_get_uart_clk(),
				       ZYNQMP_UART_BAUDRATE,
				       &tsp_boot_console);
	console_set_scope(&tsp_boot_console.console,
			  CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

	/* Initialize the platform config for future decision making */
	zynqmp_config_setup();
}

/*******************************************************************************
 * Perform platform specific setup placeholder
 ******************************************************************************/
void tsp_platform_setup(void)
{
	plat_arm_gic_driver_init();
	plat_arm_gic_init();
}

/*******************************************************************************
 * Perform the very early platform specific architectural setup here. At the
 * moment this is only intializes the MMU
 ******************************************************************************/
void tsp_plat_arch_setup(void)
{
51
52
53
54
55
56
57
58
59
60
61
62
63
	const mmap_region_t bl_regions[] = {
		MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE,
			MT_MEMORY | MT_RW | MT_SECURE),
		MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
			MT_CODE | MT_SECURE),
		MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
			MT_RO_DATA | MT_SECURE),
		MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
			BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
			MT_DEVICE | MT_RW | MT_SECURE),
		{0}
	};

64
	setup_page_tables(bl_regions, plat_arm_get_mmap());
65
	enable_mmu_el1(0);
66
}