Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
Ambroise Vincent | 53f193f | 2019-05-29 11:46:08 +0100 | [diff] [blame] | 2 | * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <common/bl_common.h> |
| 8 | #include <common/debug.h> |
| 9 | #include <drivers/console.h> |
Antonio Nino Diaz | bd7b740 | 2019-01-25 14:30:04 +0000 | [diff] [blame] | 10 | #include <plat/arm/common/plat_arm.h> |
Jolly Shah | 0bfd700 | 2019-01-08 11:10:47 -0800 | [diff] [blame] | 11 | #include <plat_private.h> |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 12 | #include <platform_tsp.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 14 | /******************************************************************************* |
| 15 | * Initialize the UART |
| 16 | ******************************************************************************/ |
| 17 | void tsp_early_platform_setup(void) |
| 18 | { |
| 19 | /* |
Ambroise Vincent | 53f193f | 2019-05-29 11:46:08 +0100 | [diff] [blame] | 20 | * Register a different console than already in use to display |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 21 | * messages from TSP |
| 22 | */ |
Andre Przywara | 8ccc4a4 | 2020-01-25 00:58:35 +0000 | [diff] [blame] | 23 | static console_t tsp_boot_console; |
Ambroise Vincent | 53f193f | 2019-05-29 11:46:08 +0100 | [diff] [blame] | 24 | (void)console_cdns_register(ZYNQMP_UART_BASE, |
| 25 | zynqmp_get_uart_clk(), |
| 26 | ZYNQMP_UART_BAUDRATE, |
| 27 | &tsp_boot_console); |
Andre Przywara | 8ccc4a4 | 2020-01-25 00:58:35 +0000 | [diff] [blame] | 28 | console_set_scope(&tsp_boot_console, |
Ambroise Vincent | 53f193f | 2019-05-29 11:46:08 +0100 | [diff] [blame] | 29 | CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 30 | |
| 31 | /* Initialize the platform config for future decision making */ |
| 32 | zynqmp_config_setup(); |
| 33 | } |
| 34 | |
| 35 | /******************************************************************************* |
| 36 | * Perform platform specific setup placeholder |
| 37 | ******************************************************************************/ |
| 38 | void tsp_platform_setup(void) |
| 39 | { |
| 40 | plat_arm_gic_driver_init(); |
| 41 | plat_arm_gic_init(); |
| 42 | } |
| 43 | |
| 44 | /******************************************************************************* |
| 45 | * Perform the very early platform specific architectural setup here. At the |
| 46 | * moment this is only intializes the MMU |
| 47 | ******************************************************************************/ |
| 48 | void tsp_plat_arch_setup(void) |
| 49 | { |
Daniel Boulby | 45a2c9e | 2018-07-06 16:54:44 +0100 | [diff] [blame] | 50 | const mmap_region_t bl_regions[] = { |
| 51 | MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE, |
| 52 | MT_MEMORY | MT_RW | MT_SECURE), |
| 53 | MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, |
| 54 | MT_CODE | MT_SECURE), |
| 55 | MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE, |
| 56 | MT_RO_DATA | MT_SECURE), |
| 57 | MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, |
| 58 | BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, |
| 59 | MT_DEVICE | MT_RW | MT_SECURE), |
| 60 | {0} |
| 61 | }; |
| 62 | |
Roberto Vargas | 344ff02 | 2018-10-19 16:44:18 +0100 | [diff] [blame] | 63 | setup_page_tables(bl_regions, plat_arm_get_mmap()); |
Sandrine Bailleux | 4a1267a | 2016-05-18 16:11:47 +0100 | [diff] [blame] | 64 | enable_mmu_el1(0); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 65 | } |