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