blob: 93deedc63b10a7a54e0fc2a58103009e7171708c [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;
21
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053022/*
23 * Table of regions to map using the MMU.
24 * This doesn't include TZRAM as the 'mem_layout' argument passed to
25 * configure_mmu_elx() will give the available subset of that,
26 */
27const mmap_region_t plat_versal_mmap[] = {
28 MAP_REGION_FLAT(DEVICE0_BASE, DEVICE0_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
29 MAP_REGION_FLAT(DEVICE1_BASE, DEVICE1_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
30 MAP_REGION_FLAT(CRF_BASE, CRF_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
Michal Simek467e16e2023-04-14 08:39:49 +020031 MAP_REGION_FLAT(PLAT_ARM_CCI_BASE, PLAT_ARM_CCI_SIZE, MT_DEVICE | MT_RW |
Tejas Patel54d13192019-02-27 18:44:55 +053032 MT_SECURE),
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053033 { 0 }
34};
35
36const mmap_region_t *plat_versal_get_mmap(void)
37{
38 return plat_versal_mmap;
39}
40
41static void versal_print_platform_name(void)
42{
Akshay Belsarebdffd362023-01-18 17:04:22 +053043 NOTICE("TF-A running on %s\n", PLATFORM_NAME);
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053044}
45
46void versal_config_setup(void)
47{
Tejas Patel354fe572018-12-14 00:55:37 -080048 /* Configure IPI data for versal */
49 versal_ipi_config_table_init();
50
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053051 versal_print_platform_name();
52
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053053 generic_delay_timer_init();
54}
55
Venkatesh Yadav Abbarapubde87592022-05-24 11:11:12 +053056uint32_t plat_get_syscnt_freq2(void)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053057{
58 return VERSAL_CPU_CLOCK;
59}
60
Akshay Belsare589ccce2023-05-08 19:00:53 +053061void board_detection(void)
62{
63 uint32_t plat_info[2];
64
65 if (pm_get_chipid(plat_info) != PM_RET_SUCCESS) {
66 /* If the call is failed we cannot proceed with further
67 * setup. TF-A to panic in this situation.
68 */
69 NOTICE("Failed to read the chip information");
70 panic();
71 }
72
73 platform_id = FIELD_GET(PLATFORM_MASK, plat_info[1]);
74 platform_version = FIELD_GET(PLATFORM_VERSION_MASK, plat_info[1]);
75}