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-2022, Arm Limited and Contributors. All rights reserved. |
Tanmay Shah | fdae9e8 | 2022-08-26 15:06:00 -0700 | [diff] [blame] | 3 | * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 4 | * 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] | 5 | * |
| 6 | * SPDX-License-Identifier: BSD-3-Clause |
| 7 | */ |
| 8 | |
| 9 | #ifndef VERSAL_DEF_H |
| 10 | #define VERSAL_DEF_H |
| 11 | |
Manish V Badarkhe | 5586151 | 2020-03-27 13:25:51 +0000 | [diff] [blame] | 12 | #include <plat/arm/common/smccc_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | #include <plat/common/common_def.h> |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 14 | |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 15 | #define PLATFORM_MASK GENMASK(27U, 24U) |
| 16 | #define PLATFORM_VERSION_MASK GENMASK(31U, 28U) |
| 17 | |
Tanmay Shah | fdae9e8 | 2022-08-26 15:06:00 -0700 | [diff] [blame] | 18 | /* number of interrupt handlers. increase as required */ |
| 19 | #define MAX_INTR_EL3 2 |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 20 | /* List all consoles */ |
| 21 | #define VERSAL_CONSOLE_ID_pl011 1 |
| 22 | #define VERSAL_CONSOLE_ID_pl011_0 1 |
| 23 | #define VERSAL_CONSOLE_ID_pl011_1 2 |
| 24 | #define VERSAL_CONSOLE_ID_dcc 3 |
| 25 | |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 26 | #define CONSOLE_IS(con) (VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE) |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 27 | |
| 28 | /* List all supported platforms */ |
| 29 | #define VERSAL_PLATFORM_ID_versal_virt 1 |
Venkatesh Yadav Abbarapu | 9c3b77b | 2022-04-13 09:04:53 +0530 | [diff] [blame] | 30 | #define VERSAL_PLATFORM_ID_spp_itr6 2 |
| 31 | #define VERSAL_PLATFORM_ID_emu_itr6 3 |
Siva Durga Prasad Paladugu | 2f4cc71 | 2019-05-03 16:35:25 +0530 | [diff] [blame] | 32 | #define VERSAL_PLATFORM_ID_silicon 4 |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 33 | |
| 34 | #define VERSAL_PLATFORM_IS(con) (VERSAL_PLATFORM_ID_ ## con == VERSAL_PLATFORM) |
| 35 | |
| 36 | /* Firmware Image Package */ |
| 37 | #define VERSAL_PRIMARY_CPU 0 |
| 38 | |
| 39 | /******************************************************************************* |
| 40 | * memory map related constants |
| 41 | ******************************************************************************/ |
| 42 | #define DEVICE0_BASE 0xFF000000 |
| 43 | #define DEVICE0_SIZE 0x00E00000 |
| 44 | #define DEVICE1_BASE 0xF9000000 |
| 45 | #define DEVICE1_SIZE 0x00800000 |
| 46 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 47 | /******************************************************************************* |
| 48 | * IRQ constants |
| 49 | ******************************************************************************/ |
Abhyuday Godhasara | 096f5cc | 2021-08-13 06:45:32 -0700 | [diff] [blame] | 50 | #define VERSAL_IRQ_SEC_PHY_TIMER U(29) |
Prasad Kummari | 6dee9fb | 2023-10-31 15:20:00 +0530 | [diff] [blame] | 51 | #define ARM_IRQ_SEC_PHY_TIMER 29 |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 52 | |
| 53 | /******************************************************************************* |
Tejas Patel | 54d1319 | 2019-02-27 18:44:55 +0530 | [diff] [blame] | 54 | * CCI-400 related constants |
| 55 | ******************************************************************************/ |
| 56 | #define PLAT_ARM_CCI_BASE 0xFD000000 |
Michal Simek | 467e16e | 2023-04-14 08:39:49 +0200 | [diff] [blame] | 57 | #define PLAT_ARM_CCI_SIZE 0x00100000 |
Tejas Patel | 54d1319 | 2019-02-27 18:44:55 +0530 | [diff] [blame] | 58 | #define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX 4 |
| 59 | #define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX 5 |
| 60 | |
| 61 | /******************************************************************************* |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 62 | * UART related constants |
| 63 | ******************************************************************************/ |
| 64 | #define VERSAL_UART0_BASE 0xFF000000 |
| 65 | #define VERSAL_UART1_BASE 0xFF010000 |
| 66 | |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 67 | #if CONSOLE_IS(pl011) || CONSOLE_IS(dcc) |
| 68 | # define UART_BASE VERSAL_UART0_BASE |
| 69 | #elif CONSOLE_IS(pl011_1) |
| 70 | # define UART_BASE VERSAL_UART1_BASE |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 71 | #else |
| 72 | # error "invalid VERSAL_CONSOLE" |
| 73 | #endif |
| 74 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 75 | /******************************************************************************* |
| 76 | * Platform related constants |
| 77 | ******************************************************************************/ |
| 78 | #if VERSAL_PLATFORM_IS(versal_virt) |
| 79 | # define PLATFORM_NAME "Versal Virt" |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 80 | # define UART_CLOCK 25000000 |
| 81 | # define UART_BAUDRATE 115200 |
Siva Durga Prasad Paladugu | 10161e5 | 2019-04-27 11:23:20 +0530 | [diff] [blame] | 82 | # define VERSAL_CPU_CLOCK 2720000 |
Siva Durga Prasad Paladugu | 2f4cc71 | 2019-05-03 16:35:25 +0530 | [diff] [blame] | 83 | #elif VERSAL_PLATFORM_IS(silicon) |
| 84 | # define PLATFORM_NAME "Versal Silicon" |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 85 | # define UART_CLOCK 100000000 |
| 86 | # define UART_BAUDRATE 115200 |
Siva Durga Prasad Paladugu | 2f4cc71 | 2019-05-03 16:35:25 +0530 | [diff] [blame] | 87 | # define VERSAL_CPU_CLOCK 100000000 |
Venkatesh Yadav Abbarapu | 9c3b77b | 2022-04-13 09:04:53 +0530 | [diff] [blame] | 88 | #elif VERSAL_PLATFORM_IS(spp_itr6) |
Venkatesh Yadav Abbarapu | d90e47b | 2022-07-28 08:50:30 +0530 | [diff] [blame] | 89 | # define PLATFORM_NAME "SPP ITR6" |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 90 | # define UART_CLOCK 25000000 |
| 91 | # define UART_BAUDRATE 115200 |
Venkatesh Yadav Abbarapu | d90e47b | 2022-07-28 08:50:30 +0530 | [diff] [blame] | 92 | # define VERSAL_CPU_CLOCK 2720000 |
Venkatesh Yadav Abbarapu | 9c3b77b | 2022-04-13 09:04:53 +0530 | [diff] [blame] | 93 | #elif VERSAL_PLATFORM_IS(emu_itr6) |
Venkatesh Yadav Abbarapu | d90e47b | 2022-07-28 08:50:30 +0530 | [diff] [blame] | 94 | # define PLATFORM_NAME "EMU ITR6" |
Michal Simek | c56e548 | 2023-09-27 13:58:06 +0200 | [diff] [blame] | 95 | # define UART_CLOCK 212000 |
| 96 | # define UART_BAUDRATE 9600 |
Venkatesh Yadav Abbarapu | d90e47b | 2022-07-28 08:50:30 +0530 | [diff] [blame] | 97 | # define VERSAL_CPU_CLOCK 212000 |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 98 | #endif |
| 99 | |
| 100 | /* Access control register defines */ |
| 101 | #define ACTLR_EL3_L2ACTLR_BIT (1 << 6) |
| 102 | #define ACTLR_EL3_CPUACTLR_BIT (1 << 0) |
| 103 | |
| 104 | /* For cpu reset APU space here too 0xFE5F1000 CRF_APB*/ |
| 105 | #define CRF_BASE 0xFD1A0000 |
| 106 | #define CRF_SIZE 0x00600000 |
| 107 | |
| 108 | /* CRF registers and bitfields */ |
| 109 | #define CRF_RST_APU (CRF_BASE + 0X00000300) |
| 110 | |
| 111 | #define CRF_RST_APU_ACPU_RESET (1 << 0) |
| 112 | #define CRF_RST_APU_ACPU_PWRON_RESET (1 << 10) |
| 113 | |
Prasad Kummari | 2038bd6 | 2023-12-14 10:52:24 +0530 | [diff] [blame^] | 114 | /* IOU SCNTRS */ |
| 115 | #define IOU_SCNTRS_BASE U(0xFF140000) |
| 116 | #define IOU_SCNTRS_BASE_FREQ_OFFSET U(0x20) |
| 117 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 118 | /* APU registers and bitfields */ |
Abhyuday Godhasara | edc38ae | 2021-08-04 23:58:46 -0700 | [diff] [blame] | 119 | #define FPD_APU_BASE 0xFD5C0000U |
| 120 | #define FPD_APU_CONFIG_0 (FPD_APU_BASE + 0x20U) |
| 121 | #define FPD_APU_RVBAR_L_0 (FPD_APU_BASE + 0x40U) |
| 122 | #define FPD_APU_RVBAR_H_0 (FPD_APU_BASE + 0x44U) |
| 123 | #define FPD_APU_PWRCTL (FPD_APU_BASE + 0x90U) |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 124 | |
Abhyuday Godhasara | edc38ae | 2021-08-04 23:58:46 -0700 | [diff] [blame] | 125 | #define FPD_APU_CONFIG_0_VINITHI_SHIFT 8U |
| 126 | #define APU_0_PWRCTL_CPUPWRDWNREQ_MASK 1U |
| 127 | #define APU_1_PWRCTL_CPUPWRDWNREQ_MASK 2U |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 128 | |
Venkatesh Yadav Abbarapu | 9156ffd | 2020-01-22 21:23:20 -0700 | [diff] [blame] | 129 | /* PMC registers and bitfields */ |
Abhyuday Godhasara | edc38ae | 2021-08-04 23:58:46 -0700 | [diff] [blame] | 130 | #define PMC_GLOBAL_BASE 0xF1110000U |
| 131 | #define PMC_GLOBAL_GLOB_GEN_STORAGE4 (PMC_GLOBAL_BASE + 0x40U) |
Venkatesh Yadav Abbarapu | 9156ffd | 2020-01-22 21:23:20 -0700 | [diff] [blame] | 132 | |
Siva Durga Prasad Paladugu | fe4af66 | 2018-09-25 18:44:58 +0530 | [diff] [blame] | 133 | #endif /* VERSAL_DEF_H */ |