Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 1 | /* |
Michal Simek | 2a47faa | 2023-04-14 08:43:51 +0200 | [diff] [blame] | 2 | * Copyright (c) 2018-2020, Arm Limited and Contributors. All rights reserved. |
Michal Simek | 0129707 | 2023-04-25 14:14:06 +0200 | [diff] [blame] | 3 | * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved. |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: BSD-3-Clause |
| 6 | */ |
| 7 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <common/debug.h> |
| 9 | #include <drivers/generic_delay_timer.h> |
| 10 | #include <lib/mmio.h> |
Michal Simek | 058251a | 2023-04-13 13:19:11 +0200 | [diff] [blame] | 11 | #include <lib/xlat_tables/xlat_tables_v2.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 12 | #include <plat/common/platform.h> |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 13 | |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 14 | #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 | |
| 20 | uint32_t platform_id, platform_version; |
| 21 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 22 | /* |
| 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 | */ |
| 27 | const 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 Simek | 467e16e | 2023-04-14 08:39:49 +0200 | [diff] [blame] | 31 | MAP_REGION_FLAT(PLAT_ARM_CCI_BASE, PLAT_ARM_CCI_SIZE, MT_DEVICE | MT_RW | |
Tejas Patel | 54d1319 | 2019-02-27 18:44:55 +0530 | [diff] [blame] | 32 | MT_SECURE), |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 33 | { 0 } |
| 34 | }; |
| 35 | |
| 36 | const mmap_region_t *plat_versal_get_mmap(void) |
| 37 | { |
| 38 | return plat_versal_mmap; |
| 39 | } |
| 40 | |
| 41 | static void versal_print_platform_name(void) |
| 42 | { |
Akshay Belsare | bdffd36 | 2023-01-18 17:04:22 +0530 | [diff] [blame] | 43 | NOTICE("TF-A running on %s\n", PLATFORM_NAME); |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | void versal_config_setup(void) |
| 47 | { |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 48 | /* Configure IPI data for versal */ |
| 49 | versal_ipi_config_table_init(); |
| 50 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 51 | versal_print_platform_name(); |
| 52 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 53 | generic_delay_timer_init(); |
| 54 | } |
| 55 | |
Venkatesh Yadav Abbarapu | bde8759 | 2022-05-24 11:11:12 +0530 | [diff] [blame] | 56 | uint32_t plat_get_syscnt_freq2(void) |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 57 | { |
| 58 | return VERSAL_CPU_CLOCK; |
| 59 | } |
| 60 | |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 61 | void 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 | } |