xref: /rk3399_ARM-atf/plat/xilinx/versal/include/versal_def.h (revision 5d1c211e225d40d2926bf34483c90f907a6c5dc3)
1ab36d097STejas Patel /*
20b25f404SVenkatesh Yadav Abbarapu  * Copyright (c) 2018-2021, ARM Limited and Contributors. All rights reserved.
3ab36d097STejas Patel  *
4ab36d097STejas Patel  * SPDX-License-Identifier: BSD-3-Clause
5ab36d097STejas Patel  */
6ab36d097STejas Patel 
7ab36d097STejas Patel #ifndef VERSAL_DEF_H
8ab36d097STejas Patel #define VERSAL_DEF_H
9ab36d097STejas Patel 
1053adebadSManish V Badarkhe #include <plat/arm/common/smccc_def.h>
11ab36d097STejas Patel #include <plat/common/common_def.h>
12ab36d097STejas Patel 
13ab36d097STejas Patel /* List all consoles */
14ab36d097STejas Patel #define VERSAL_CONSOLE_ID_pl011	1
15ab36d097STejas Patel #define VERSAL_CONSOLE_ID_pl011_0	1
16ab36d097STejas Patel #define VERSAL_CONSOLE_ID_pl011_1	2
17ab36d097STejas Patel #define VERSAL_CONSOLE_ID_dcc		3
18ab36d097STejas Patel 
19ab36d097STejas Patel #define VERSAL_CONSOLE_IS(con)	(VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE)
20ab36d097STejas Patel 
21ab36d097STejas Patel /* List all supported platforms */
22ab36d097STejas Patel #define VERSAL_PLATFORM_ID_versal_virt	1
23d69bbd0eSSiva Durga Prasad Paladugu #define VERSAL_PLATFORM_ID_silicon	4
24ab36d097STejas Patel 
25ab36d097STejas Patel #define VERSAL_PLATFORM_IS(con)	(VERSAL_PLATFORM_ID_ ## con == VERSAL_PLATFORM)
26ab36d097STejas Patel 
27ab36d097STejas Patel /* Firmware Image Package */
28ab36d097STejas Patel #define VERSAL_PRIMARY_CPU	0
29ab36d097STejas Patel 
30ab36d097STejas Patel /*******************************************************************************
31ab36d097STejas Patel  * memory map related constants
32ab36d097STejas Patel  ******************************************************************************/
33ab36d097STejas Patel #define DEVICE0_BASE		0xFF000000
34ab36d097STejas Patel #define DEVICE0_SIZE		0x00E00000
35ab36d097STejas Patel #define DEVICE1_BASE		0xF9000000
36ab36d097STejas Patel #define DEVICE1_SIZE		0x00800000
37ab36d097STejas Patel 
38ab36d097STejas Patel /* CRL */
39ab36d097STejas Patel #define VERSAL_CRL				0xFF5E0000
40ab36d097STejas Patel #define VERSAL_CRL_TIMESTAMP_REF_CTRL		(VERSAL_CRL + 0x14C)
41ab36d097STejas Patel #define VERSAL_CRL_RST_TIMESTAMP_OFFSET	(VERSAL_CRL + 0x348)
42ab36d097STejas Patel 
43ab36d097STejas Patel #define VERSAL_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT	(1 << 25)
44ab36d097STejas Patel 
45ab36d097STejas Patel /* IOU SCNTRS */
46ab36d097STejas Patel #define VERSAL_IOU_SCNTRS			 0xFF140000
47ab36d097STejas Patel #define VERSAL_IOU_SCNTRS_COUNTER_CONTROL_REG	(VERSAL_IOU_SCNTRS + 0x0)
48ab36d097STejas Patel #define VERSAL_IOU_SCNTRS_BASE_FREQ		(VERSAL_IOU_SCNTRS + 0x20)
49ab36d097STejas Patel 
50ab36d097STejas Patel #define VERSAL_IOU_SCNTRS_CONTROL_EN	1
51ab36d097STejas Patel 
52ab36d097STejas Patel /*******************************************************************************
53ab36d097STejas Patel  * IRQ constants
54ab36d097STejas Patel  ******************************************************************************/
55ab36d097STejas Patel #define VERSAL_IRQ_SEC_PHY_TIMER		29
56ab36d097STejas Patel 
57ab36d097STejas Patel /*******************************************************************************
585a8ffeabSTejas Patel  * CCI-400 related constants
595a8ffeabSTejas Patel  ******************************************************************************/
605a8ffeabSTejas Patel #define PLAT_ARM_CCI_BASE		0xFD000000
615a8ffeabSTejas Patel #define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX	4
625a8ffeabSTejas Patel #define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX	5
635a8ffeabSTejas Patel 
645a8ffeabSTejas Patel /*******************************************************************************
65ab36d097STejas Patel  * UART related constants
66ab36d097STejas Patel  ******************************************************************************/
67ab36d097STejas Patel #define VERSAL_UART0_BASE		0xFF000000
68ab36d097STejas Patel #define VERSAL_UART1_BASE		0xFF010000
69ab36d097STejas Patel 
700b25f404SVenkatesh Yadav Abbarapu #if VERSAL_CONSOLE_IS(pl011) || VERSAL_CONSOLE_IS(dcc)
71ab36d097STejas Patel # define VERSAL_UART_BASE	VERSAL_UART0_BASE
72ab36d097STejas Patel #elif VERSAL_CONSOLE_IS(pl011_1)
73ab36d097STejas Patel # define VERSAL_UART_BASE	VERSAL_UART1_BASE
74ab36d097STejas Patel #else
75ab36d097STejas Patel # error "invalid VERSAL_CONSOLE"
76ab36d097STejas Patel #endif
77ab36d097STejas Patel 
78ab36d097STejas Patel #define PLAT_VERSAL_CRASH_UART_BASE		VERSAL_UART_BASE
79ab36d097STejas Patel #define PLAT_VERSAL_CRASH_UART_CLK_IN_HZ	VERSAL_UART_CLOCK
80ab36d097STejas Patel #define VERSAL_CONSOLE_BAUDRATE			VERSAL_UART_BAUDRATE
81ab36d097STejas Patel 
82ab36d097STejas Patel /*******************************************************************************
83ab36d097STejas Patel  * Platform related constants
84ab36d097STejas Patel  ******************************************************************************/
85ab36d097STejas Patel #if VERSAL_PLATFORM_IS(versal_virt)
86ab36d097STejas Patel # define PLATFORM_NAME		"Versal Virt"
87ab36d097STejas Patel # define VERSAL_UART_CLOCK	25000000
88ab36d097STejas Patel # define VERSAL_UART_BAUDRATE	115200
89c959c479SSiva Durga Prasad Paladugu # define VERSAL_CPU_CLOCK	2720000
90d69bbd0eSSiva Durga Prasad Paladugu #elif VERSAL_PLATFORM_IS(silicon)
91d69bbd0eSSiva Durga Prasad Paladugu # define PLATFORM_NAME		"Versal Silicon"
92d69bbd0eSSiva Durga Prasad Paladugu # define VERSAL_UART_CLOCK	100000000
93d69bbd0eSSiva Durga Prasad Paladugu # define VERSAL_UART_BAUDRATE	115200
94d69bbd0eSSiva Durga Prasad Paladugu # define VERSAL_CPU_CLOCK	100000000
95ab36d097STejas Patel #endif
96ab36d097STejas Patel 
97ab36d097STejas Patel /* Access control register defines */
98ab36d097STejas Patel #define ACTLR_EL3_L2ACTLR_BIT	(1 << 6)
99ab36d097STejas Patel #define ACTLR_EL3_CPUACTLR_BIT	(1 << 0)
100ab36d097STejas Patel 
101ab36d097STejas Patel /* For cpu reset APU space here too 0xFE5F1000 CRF_APB*/
102ab36d097STejas Patel #define CRF_BASE		0xFD1A0000
103ab36d097STejas Patel #define CRF_SIZE		0x00600000
104ab36d097STejas Patel 
105ab36d097STejas Patel /* CRF registers and bitfields */
106ab36d097STejas Patel #define CRF_RST_APU	(CRF_BASE + 0X00000300)
107ab36d097STejas Patel 
108ab36d097STejas Patel #define CRF_RST_APU_ACPU_RESET		(1 << 0)
109ab36d097STejas Patel #define CRF_RST_APU_ACPU_PWRON_RESET	(1 << 10)
110ab36d097STejas Patel 
1115a8ffeabSTejas Patel #define FPD_MAINCCI_BASE	0xFD000000
1125a8ffeabSTejas Patel #define FPD_MAINCCI_SIZE	0x00100000
1135a8ffeabSTejas Patel 
114ab36d097STejas Patel /* APU registers and bitfields */
115*5d1c211eSAbhyuday Godhasara #define FPD_APU_BASE		0xFD5C0000U
116*5d1c211eSAbhyuday Godhasara #define FPD_APU_CONFIG_0	(FPD_APU_BASE + 0x20U)
117*5d1c211eSAbhyuday Godhasara #define FPD_APU_RVBAR_L_0	(FPD_APU_BASE + 0x40U)
118*5d1c211eSAbhyuday Godhasara #define FPD_APU_RVBAR_H_0	(FPD_APU_BASE + 0x44U)
119*5d1c211eSAbhyuday Godhasara #define FPD_APU_PWRCTL		(FPD_APU_BASE + 0x90U)
120ab36d097STejas Patel 
121*5d1c211eSAbhyuday Godhasara #define FPD_APU_CONFIG_0_VINITHI_SHIFT	8U
122*5d1c211eSAbhyuday Godhasara #define APU_0_PWRCTL_CPUPWRDWNREQ_MASK	1U
123*5d1c211eSAbhyuday Godhasara #define APU_1_PWRCTL_CPUPWRDWNREQ_MASK	2U
124ab36d097STejas Patel 
12531ce893eSVenkatesh Yadav Abbarapu /* PMC registers and bitfields */
126*5d1c211eSAbhyuday Godhasara #define PMC_GLOBAL_BASE			0xF1110000U
127*5d1c211eSAbhyuday Godhasara #define PMC_GLOBAL_GLOB_GEN_STORAGE4	(PMC_GLOBAL_BASE + 0x40U)
12831ce893eSVenkatesh Yadav Abbarapu 
129c73a90e5STejas Patel /* IPI registers and bitfields */
130c73a90e5STejas Patel #define IPI0_REG_BASE		0xFF330000
131c73a90e5STejas Patel #define IPI0_TRIG_BIT		(1 << 2)
132c73a90e5STejas Patel #define PMC_IPI_TRIG_BIT	(1 << 1)
133c73a90e5STejas Patel #define IPI1_REG_BASE		0xFF340000
134c73a90e5STejas Patel #define IPI1_TRIG_BIT		(1 << 3)
135c73a90e5STejas Patel #define IPI2_REG_BASE		0xFF350000
136c73a90e5STejas Patel #define IPI2_TRIG_BIT		(1 << 4)
137c73a90e5STejas Patel #define IPI3_REG_BASE		0xFF360000
138c73a90e5STejas Patel #define IPI3_TRIG_BIT		(1 << 5)
139c73a90e5STejas Patel #define IPI4_REG_BASE		0xFF370000
140c73a90e5STejas Patel #define IPI4_TRIG_BIT		(1 << 5)
141c73a90e5STejas Patel #define IPI5_REG_BASE		0xFF380000
142c73a90e5STejas Patel #define IPI5_TRIG_BIT		(1 << 6)
143c73a90e5STejas Patel 
144ab36d097STejas Patel #endif /* VERSAL_DEF_H */
145