blob: 772477fecf3339815cb488de0227d5326bf8e96f [file] [log] [blame]
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05301/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2018-2020, Arm Limited and Contributors. All rights reserved.
Michal Simek01297072023-04-25 14:14:06 +02003 * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05304 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <common/debug.h>
9#include <drivers/generic_delay_timer.h>
10#include <lib/mmio.h>
Michal Simek058251a2023-04-13 13:19:11 +020011#include <lib/xlat_tables/xlat_tables_v2.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000012#include <plat/common/platform.h>
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053013
Akshay Belsare589ccce2023-05-08 19:00:53 +053014#include <plat_common.h>
15#include <plat_ipi.h>
16#include <plat_private.h>
17#include <pm_api_sys.h>
18#include <versal_def.h>
19
20uint32_t platform_id, platform_version;
Prasad Kummari2038bd62023-12-14 10:52:24 +053021uint32_t cpu_clock = VERSAL_CPU_CLOCK;
Akshay Belsare589ccce2023-05-08 19:00:53 +053022
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053023/*
24 * Table of regions to map using the MMU.
25 * This doesn't include TZRAM as the 'mem_layout' argument passed to
26 * configure_mmu_elx() will give the available subset of that,
27 */
28const mmap_region_t plat_versal_mmap[] = {
29 MAP_REGION_FLAT(DEVICE0_BASE, DEVICE0_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
30 MAP_REGION_FLAT(DEVICE1_BASE, DEVICE1_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
31 MAP_REGION_FLAT(CRF_BASE, CRF_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
Michal Simek467e16e2023-04-14 08:39:49 +020032 MAP_REGION_FLAT(PLAT_ARM_CCI_BASE, PLAT_ARM_CCI_SIZE, MT_DEVICE | MT_RW |
Tejas Patel54d13192019-02-27 18:44:55 +053033 MT_SECURE),
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053034 { 0 }
35};
36
Prasad Kummari0b377142023-10-26 16:32:26 +053037const mmap_region_t *plat_get_mmap(void)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053038{
39 return plat_versal_mmap;
40}
41
42static void versal_print_platform_name(void)
43{
Akshay Belsarebdffd362023-01-18 17:04:22 +053044 NOTICE("TF-A running on %s\n", PLATFORM_NAME);
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053045}
46
47void versal_config_setup(void)
48{
Tejas Patel354fe572018-12-14 00:55:37 -080049 /* Configure IPI data for versal */
50 versal_ipi_config_table_init();
51
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053052 versal_print_platform_name();
53
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053054 generic_delay_timer_init();
55}
56
Akshay Belsare589ccce2023-05-08 19:00:53 +053057void board_detection(void)
58{
59 uint32_t plat_info[2];
60
61 if (pm_get_chipid(plat_info) != PM_RET_SUCCESS) {
62 /* If the call is failed we cannot proceed with further
63 * setup. TF-A to panic in this situation.
64 */
65 NOTICE("Failed to read the chip information");
66 panic();
67 }
68
69 platform_id = FIELD_GET(PLATFORM_MASK, plat_info[1]);
70 platform_version = FIELD_GET(PLATFORM_VERSION_MASK, plat_info[1]);
71}
Prasad Kummarie7e8f862023-10-04 10:20:30 +053072
73uint32_t get_uart_clk(void)
74{
75 return UART_CLOCK;
76}