1 /* 2 * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved. 3 * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved. 4 * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef VERSAL_DEF_H 10 #define VERSAL_DEF_H 11 12 #include <plat/arm/common/smccc_def.h> 13 #include <plat/common/common_def.h> 14 15 #define PLATFORM_MASK GENMASK(27U, 24U) 16 #define PLATFORM_VERSION_MASK GENMASK(31U, 28U) 17 18 /* number of interrupt handlers. increase as required */ 19 #define MAX_INTR_EL3 2 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 26 #define VERSAL_CONSOLE_IS(con) (VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE) 27 28 /* List all supported platforms */ 29 #define VERSAL_PLATFORM_ID_versal_virt 1 30 #define VERSAL_PLATFORM_ID_spp_itr6 2 31 #define VERSAL_PLATFORM_ID_emu_itr6 3 32 #define VERSAL_PLATFORM_ID_silicon 4 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 47 /******************************************************************************* 48 * IRQ constants 49 ******************************************************************************/ 50 #define VERSAL_IRQ_SEC_PHY_TIMER U(29) 51 52 /******************************************************************************* 53 * CCI-400 related constants 54 ******************************************************************************/ 55 #define PLAT_ARM_CCI_BASE 0xFD000000 56 #define PLAT_ARM_CCI_SIZE 0x00100000 57 #define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX 4 58 #define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX 5 59 60 /******************************************************************************* 61 * UART related constants 62 ******************************************************************************/ 63 #define VERSAL_UART0_BASE 0xFF000000 64 #define VERSAL_UART1_BASE 0xFF010000 65 66 #if VERSAL_CONSOLE_IS(pl011) || VERSAL_CONSOLE_IS(dcc) 67 # define VERSAL_UART_BASE VERSAL_UART0_BASE 68 #elif VERSAL_CONSOLE_IS(pl011_1) 69 # define VERSAL_UART_BASE VERSAL_UART1_BASE 70 #else 71 # error "invalid VERSAL_CONSOLE" 72 #endif 73 74 #define PLAT_VERSAL_CRASH_UART_BASE VERSAL_UART_BASE 75 #define PLAT_VERSAL_CRASH_UART_CLK_IN_HZ VERSAL_UART_CLOCK 76 #define VERSAL_CONSOLE_BAUDRATE VERSAL_UART_BAUDRATE 77 78 /******************************************************************************* 79 * Platform related constants 80 ******************************************************************************/ 81 #if VERSAL_PLATFORM_IS(versal_virt) 82 # define PLATFORM_NAME "Versal Virt" 83 # define VERSAL_UART_CLOCK 25000000 84 # define VERSAL_UART_BAUDRATE 115200 85 # define VERSAL_CPU_CLOCK 2720000 86 #elif VERSAL_PLATFORM_IS(silicon) 87 # define PLATFORM_NAME "Versal Silicon" 88 # define VERSAL_UART_CLOCK 100000000 89 # define VERSAL_UART_BAUDRATE 115200 90 # define VERSAL_CPU_CLOCK 100000000 91 #elif VERSAL_PLATFORM_IS(spp_itr6) 92 # define PLATFORM_NAME "SPP ITR6" 93 # define VERSAL_UART_CLOCK 25000000 94 # define VERSAL_UART_BAUDRATE 115200 95 # define VERSAL_CPU_CLOCK 2720000 96 #elif VERSAL_PLATFORM_IS(emu_itr6) 97 # define PLATFORM_NAME "EMU ITR6" 98 # define VERSAL_UART_CLOCK 212000 99 # define VERSAL_UART_BAUDRATE 9600 100 # define VERSAL_CPU_CLOCK 212000 101 #endif 102 103 /* Access control register defines */ 104 #define ACTLR_EL3_L2ACTLR_BIT (1 << 6) 105 #define ACTLR_EL3_CPUACTLR_BIT (1 << 0) 106 107 /* For cpu reset APU space here too 0xFE5F1000 CRF_APB*/ 108 #define CRF_BASE 0xFD1A0000 109 #define CRF_SIZE 0x00600000 110 111 /* CRF registers and bitfields */ 112 #define CRF_RST_APU (CRF_BASE + 0X00000300) 113 114 #define CRF_RST_APU_ACPU_RESET (1 << 0) 115 #define CRF_RST_APU_ACPU_PWRON_RESET (1 << 10) 116 117 /* APU registers and bitfields */ 118 #define FPD_APU_BASE 0xFD5C0000U 119 #define FPD_APU_CONFIG_0 (FPD_APU_BASE + 0x20U) 120 #define FPD_APU_RVBAR_L_0 (FPD_APU_BASE + 0x40U) 121 #define FPD_APU_RVBAR_H_0 (FPD_APU_BASE + 0x44U) 122 #define FPD_APU_PWRCTL (FPD_APU_BASE + 0x90U) 123 124 #define FPD_APU_CONFIG_0_VINITHI_SHIFT 8U 125 #define APU_0_PWRCTL_CPUPWRDWNREQ_MASK 1U 126 #define APU_1_PWRCTL_CPUPWRDWNREQ_MASK 2U 127 128 /* PMC registers and bitfields */ 129 #define PMC_GLOBAL_BASE 0xF1110000U 130 #define PMC_GLOBAL_GLOB_GEN_STORAGE4 (PMC_GLOBAL_BASE + 0x40U) 131 132 #endif /* VERSAL_DEF_H */ 133