blob: 6d46058a9633f9834c24dad674a000b71e0784b4 [file] [log] [blame]
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05301/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
Tanmay Shahfdae9e82022-08-26 15:06:00 -07003 * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
Maheedhar Bollapalliae8e0132024-07-24 09:54:15 +05304 * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05305 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef VERSAL_DEF_H
10#define VERSAL_DEF_H
11
Manish V Badarkhe55861512020-03-27 13:25:51 +000012#include <plat/arm/common/smccc_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000013#include <plat/common/common_def.h>
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053014
Akshay Belsare589ccce2023-05-08 19:00:53 +053015#define PLATFORM_MASK GENMASK(27U, 24U)
16#define PLATFORM_VERSION_MASK GENMASK(31U, 28U)
17
Tanmay Shahfdae9e82022-08-26 15:06:00 -070018/* number of interrupt handlers. increase as required */
19#define MAX_INTR_EL3 2
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053020/* 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
Prasad Kummari3d18a932024-03-19 22:42:32 +053025#define VERSAL_CONSOLE_ID_dtb 4
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053026
Michal Simekc56e5482023-09-27 13:58:06 +020027#define CONSOLE_IS(con) (VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053028
Prasad Kummarie0abe5f2024-03-19 22:37:12 +053029/* Runtime console */
30#define RT_CONSOLE_ID_pl011 1
31#define RT_CONSOLE_ID_pl011_0 1
32#define RT_CONSOLE_ID_pl011_1 2
33#define RT_CONSOLE_ID_dcc 3
34#define RT_CONSOLE_ID_dtb 4
35
36#define RT_CONSOLE_IS(con) (RT_CONSOLE_ID_ ## con == CONSOLE_RUNTIME)
37
Maheedhar Bollapalliae8e0132024-07-24 09:54:15 +053038/* List of platforms */
39#define VERSAL_SILICON U(0)
40#define VERSAL_SPP U(1)
41#define VERSAL_EMU U(2)
42#define VERSAL_QEMU U(3)
Akshay Belsarefc74bf12024-09-13 15:56:00 +053043#define VERSAL_COSIM U(7)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053044
45/* Firmware Image Package */
46#define VERSAL_PRIMARY_CPU 0
47
48/*******************************************************************************
49 * memory map related constants
50 ******************************************************************************/
51#define DEVICE0_BASE 0xFF000000
52#define DEVICE0_SIZE 0x00E00000
53#define DEVICE1_BASE 0xF9000000
54#define DEVICE1_SIZE 0x00800000
55
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053056/*******************************************************************************
57 * IRQ constants
58 ******************************************************************************/
Abhyuday Godhasara096f5cc2021-08-13 06:45:32 -070059#define VERSAL_IRQ_SEC_PHY_TIMER U(29)
Prasad Kummari6dee9fb2023-10-31 15:20:00 +053060#define ARM_IRQ_SEC_PHY_TIMER 29
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053061
62/*******************************************************************************
Tejas Patel54d13192019-02-27 18:44:55 +053063 * CCI-400 related constants
64 ******************************************************************************/
65#define PLAT_ARM_CCI_BASE 0xFD000000
Michal Simek467e16e2023-04-14 08:39:49 +020066#define PLAT_ARM_CCI_SIZE 0x00100000
Tejas Patel54d13192019-02-27 18:44:55 +053067#define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX 4
68#define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX 5
69
70/*******************************************************************************
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053071 * UART related constants
72 ******************************************************************************/
73#define VERSAL_UART0_BASE 0xFF000000
74#define VERSAL_UART1_BASE 0xFF010000
75
Prasad Kummari3d18a932024-03-19 22:42:32 +053076#if CONSOLE_IS(pl011) || CONSOLE_IS(dtb)
Michal Simekc56e5482023-09-27 13:58:06 +020077# define UART_BASE VERSAL_UART0_BASE
Prasad Kummarie0abe5f2024-03-19 22:37:12 +053078# define UART_TYPE CONSOLE_PL011
Michal Simekc56e5482023-09-27 13:58:06 +020079#elif CONSOLE_IS(pl011_1)
80# define UART_BASE VERSAL_UART1_BASE
Prasad Kummarie0abe5f2024-03-19 22:37:12 +053081# define UART_TYPE CONSOLE_PL011
82#elif CONSOLE_IS(dcc)
83# define UART_BASE 0x0
84# define UART_TYPE CONSOLE_DCC
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053085#else
86# error "invalid VERSAL_CONSOLE"
87#endif
88
Prasad Kummarie0abe5f2024-03-19 22:37:12 +053089/* Runtime console */
90#if defined(CONSOLE_RUNTIME)
91#if RT_CONSOLE_IS(pl011) || RT_CONSOLE_IS(dtb)
92# define RT_UART_BASE VERSAL_UART0_BASE
93# define RT_UART_TYPE CONSOLE_PL011
94#elif RT_CONSOLE_IS(pl011_1)
95# define RT_UART_BASE VERSAL_UART1_BASE
96# define RT_UART_TYPE CONSOLE_PL011
97#elif RT_CONSOLE_IS(dcc)
98# define RT_UART_BASE 0x0
99# define RT_UART_TYPE CONSOLE_DCC
100#else
101# error "invalid CONSOLE_RUNTIME"
102#endif
103#endif
104
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530105/*******************************************************************************
106 * Platform related constants
107 ******************************************************************************/
Maheedhar Bollapalliae8e0132024-07-24 09:54:15 +0530108#define UART_BAUDRATE 115200
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530109
110/* Access control register defines */
111#define ACTLR_EL3_L2ACTLR_BIT (1 << 6)
112#define ACTLR_EL3_CPUACTLR_BIT (1 << 0)
113
114/* For cpu reset APU space here too 0xFE5F1000 CRF_APB*/
115#define CRF_BASE 0xFD1A0000
116#define CRF_SIZE 0x00600000
117
118/* CRF registers and bitfields */
119#define CRF_RST_APU (CRF_BASE + 0X00000300)
120
121#define CRF_RST_APU_ACPU_RESET (1 << 0)
122#define CRF_RST_APU_ACPU_PWRON_RESET (1 << 10)
123
Prasad Kummari2038bd62023-12-14 10:52:24 +0530124/* IOU SCNTRS */
125#define IOU_SCNTRS_BASE U(0xFF140000)
126#define IOU_SCNTRS_BASE_FREQ_OFFSET U(0x20)
127
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530128/* APU registers and bitfields */
Abhyuday Godhasaraedc38ae2021-08-04 23:58:46 -0700129#define FPD_APU_BASE 0xFD5C0000U
130#define FPD_APU_CONFIG_0 (FPD_APU_BASE + 0x20U)
131#define FPD_APU_RVBAR_L_0 (FPD_APU_BASE + 0x40U)
132#define FPD_APU_RVBAR_H_0 (FPD_APU_BASE + 0x44U)
133#define FPD_APU_PWRCTL (FPD_APU_BASE + 0x90U)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530134
Abhyuday Godhasaraedc38ae2021-08-04 23:58:46 -0700135#define FPD_APU_CONFIG_0_VINITHI_SHIFT 8U
136#define APU_0_PWRCTL_CPUPWRDWNREQ_MASK 1U
137#define APU_1_PWRCTL_CPUPWRDWNREQ_MASK 2U
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530138
Venkatesh Yadav Abbarapu9156ffd2020-01-22 21:23:20 -0700139/* PMC registers and bitfields */
Abhyuday Godhasaraedc38ae2021-08-04 23:58:46 -0700140#define PMC_GLOBAL_BASE 0xF1110000U
141#define PMC_GLOBAL_GLOB_GEN_STORAGE4 (PMC_GLOBAL_BASE + 0x40U)
Venkatesh Yadav Abbarapu9156ffd2020-01-22 21:23:20 -0700142
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +0530143#endif /* VERSAL_DEF_H */