blob: abeaea0bcd0c98f9c453026f526750fa6ae0b8a6 [file] [log] [blame]
Dan Handley9df48042015-03-19 18:58:55 +00001/*
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +01002 * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
Dan Handley9df48042015-03-19 18:58:55 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Dan Handley9df48042015-03-19 18:58:55 +00005 */
6
7#include <arm_def.h>
8#include <bl_common.h>
9#include <console.h>
Isla Mitchelld2548792017-07-14 10:48:25 +010010#include <plat_arm.h>
Dan Handley9df48042015-03-19 18:58:55 +000011#include <platform_def.h>
12#include <platform_tsp.h>
Dan Handley9df48042015-03-19 18:58:55 +000013
Dan Handley9df48042015-03-19 18:58:55 +000014#define BL32_END (unsigned long)(&__BL32_END__)
15
Dan Handley9df48042015-03-19 18:58:55 +000016/* Weak definitions may be overridden in specific ARM standard platform */
17#pragma weak tsp_early_platform_setup
18#pragma weak tsp_platform_setup
19#pragma weak tsp_plat_arch_setup
20
21
22/*******************************************************************************
23 * Initialize the UART
24 ******************************************************************************/
25void arm_tsp_early_platform_setup(void)
26{
27 /*
28 * Initialize a different console than already in use to display
29 * messages from TSP
30 */
31 console_init(PLAT_ARM_TSP_UART_BASE, PLAT_ARM_TSP_UART_CLK_IN_HZ,
32 ARM_CONSOLE_BAUDRATE);
33}
34
35void tsp_early_platform_setup(void)
36{
37 arm_tsp_early_platform_setup();
38}
39
40/*******************************************************************************
41 * Perform platform specific setup placeholder
42 ******************************************************************************/
43void tsp_platform_setup(void)
44{
Achin Gupta1fa7eb62015-11-03 14:18:34 +000045 plat_arm_gic_driver_init();
Dan Handley9df48042015-03-19 18:58:55 +000046}
47
48/*******************************************************************************
49 * Perform the very early platform specific architectural setup here. At the
50 * moment this is only intializes the MMU
51 ******************************************************************************/
52void tsp_plat_arch_setup(void)
53{
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010054 arm_setup_page_tables(BL32_BASE,
55 (BL32_END - BL32_BASE),
56 BL_CODE_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090057 BL_CODE_END,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010058 BL_RO_DATA_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090059 BL_RO_DATA_END
Dan Handley9df48042015-03-19 18:58:55 +000060#if USE_COHERENT_MEM
Masahiro Yamada0fac5af2016-12-28 16:11:41 +090061 , BL_COHERENT_RAM_BASE,
62 BL_COHERENT_RAM_END
Dan Handley9df48042015-03-19 18:58:55 +000063#endif
64 );
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +010065 enable_mmu_el1(0);
Dan Handley9df48042015-03-19 18:58:55 +000066}