blob: a53cad955edc43f50e9dc8d11b6ccb9337f93506 [file] [log] [blame]
Michal Simek91794362022-08-31 16:45:14 +02001/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
Michal Simek91794362022-08-31 16:45:14 +02003 * Copyright (c) 2021-2022, Xilinx, Inc. All rights reserved.
Michal Simek01297072023-04-25 14:14:06 +02004 * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
Michal Simek91794362022-08-31 16:45:14 +02005 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef VERSAL_NET_DEF_H
10#define VERSAL_NET_DEF_H
11
12#include <plat/arm/common/smccc_def.h>
13#include <plat/common/common_def.h>
14
Jay Buddhabhattic6daff02022-09-05 02:56:32 -070015#define MAX_INTR_EL3 2
Michal Simek91794362022-08-31 16:45:14 +020016
17/* List all consoles */
18#define VERSAL_NET_CONSOLE_ID_pl011 U(1)
19#define VERSAL_NET_CONSOLE_ID_pl011_0 U(1)
20#define VERSAL_NET_CONSOLE_ID_pl011_1 U(2)
Akshay Belsare50a29682023-01-18 15:54:12 +053021#define VERSAL_NET_CONSOLE_ID_dcc U(3)
Michal Simek91794362022-08-31 16:45:14 +020022
Michal Simekc56e5482023-09-27 13:58:06 +020023#define CONSOLE_IS(con) (VERSAL_NET_CONSOLE_ID_ ## con == VERSAL_NET_CONSOLE)
Michal Simek91794362022-08-31 16:45:14 +020024
25/* List all platforms */
26#define VERSAL_NET_SILICON U(0)
27#define VERSAL_NET_SPP U(1)
28#define VERSAL_NET_EMU U(2)
29#define VERSAL_NET_QEMU U(3)
Sai Pavan Boddu7524b222022-09-08 16:09:04 +053030#define VERSAL_NET_QEMU_COSIM U(7)
Michal Simek91794362022-08-31 16:45:14 +020031
32/* For platform detection */
33#define PMC_TAP U(0xF11A0000)
34#define PMC_TAP_VERSION (PMC_TAP + 0x4U)
35# define PLATFORM_MASK GENMASK(27U, 24U)
36# define PLATFORM_VERSION_MASK GENMASK(31U, 28U)
37
38/* Global timer reset */
39#define PSX_CRF U(0xEC200000)
Michal Simekdc708ac2022-09-19 13:52:54 +020040#define ACPU0_CLK_CTRL U(0x10C)
41#define ACPU_CLK_CTRL_CLKACT BIT(25)
42
43#define RST_APU0_OFFSET U(0x300)
44#define RST_APU_COLD_RESET BIT(0)
45#define RST_APU_WARN_RESET BIT(4)
46#define RST_APU_CLUSTER_COLD_RESET BIT(8)
47#define RST_APU_CLUSTER_WARM_RESET BIT(9)
48
Michal Simek91794362022-08-31 16:45:14 +020049#define PSX_CRF_RST_TIMESTAMP_OFFSET U(0x33C)
50
Jay Buddhabhatti3d832ea2023-01-09 04:33:25 -080051#define APU_PCLI (0xECB10000ULL)
52#define APU_PCLI_CPU_STEP (0x30ULL)
53#define APU_PCLI_CLUSTER_CPU_STEP (4ULL * APU_PCLI_CPU_STEP)
Michal Simekdc708ac2022-09-19 13:52:54 +020054#define APU_PCLI_CLUSTER_OFFSET U(0x8000)
55#define APU_PCLI_CLUSTER_STEP U(0x1000)
56#define PCLI_PREQ_OFFSET U(0x4)
57#define PREQ_CHANGE_REQUEST BIT(0)
58#define PCLI_PSTATE_OFFSET U(0x8)
59#define PCLI_PSTATE_VAL_SET U(0x48)
60#define PCLI_PSTATE_VAL_CLEAR U(0x38)
61
Michal Simek91794362022-08-31 16:45:14 +020062/* Firmware Image Package */
63#define VERSAL_NET_PRIMARY_CPU U(0)
64
Jay Buddhabhattiedfadb72022-12-29 22:21:00 -080065#define CORE_0_ISR_WAKE_OFFSET (0x00000020ULL)
66#define APU_PCIL_CORE_X_ISR_WAKE_REG(cpu_id) (APU_PCLI + (CORE_0_ISR_WAKE_OFFSET + \
67 (APU_PCLI_CPU_STEP * (cpu_id))))
68#define APU_PCIL_CORE_X_ISR_WAKE_MASK (0x00000001U)
69#define CORE_0_IEN_WAKE_OFFSET (0x00000028ULL)
70#define APU_PCIL_CORE_X_IEN_WAKE_REG(cpu_id) (APU_PCLI + (CORE_0_IEN_WAKE_OFFSET + \
71 (APU_PCLI_CPU_STEP * (cpu_id))))
72#define APU_PCIL_CORE_X_IEN_WAKE_MASK (0x00000001U)
73#define CORE_0_IDS_WAKE_OFFSET (0x0000002CULL)
74#define APU_PCIL_CORE_X_IDS_WAKE_REG(cpu_id) (APU_PCLI + (CORE_0_IDS_WAKE_OFFSET + \
75 (APU_PCLI_CPU_STEP * (cpu_id))))
76#define APU_PCIL_CORE_X_IDS_WAKE_MASK (0x00000001U)
Jay Buddhabhattic2358652022-12-29 21:47:54 -080077#define CORE_0_ISR_POWER_OFFSET (0x00000010ULL)
78#define APU_PCIL_CORE_X_ISR_POWER_REG(cpu_id) (APU_PCLI + (CORE_0_ISR_POWER_OFFSET + \
79 (APU_PCLI_CPU_STEP * (cpu_id))))
80#define APU_PCIL_CORE_X_ISR_POWER_MASK U(0x00000001)
Jay Buddhabhatti3d832ea2023-01-09 04:33:25 -080081#define CORE_0_IEN_POWER_OFFSET (0x00000018ULL)
Jay Buddhabhattic6daff02022-09-05 02:56:32 -070082#define APU_PCIL_CORE_X_IEN_POWER_REG(cpu_id) (APU_PCLI + (CORE_0_IEN_POWER_OFFSET + \
Jay Buddhabhatti43cbf7e2023-01-09 04:46:54 -080083 (APU_PCLI_CPU_STEP * (cpu_id))))
Jay Buddhabhattic6daff02022-09-05 02:56:32 -070084#define APU_PCIL_CORE_X_IEN_POWER_MASK (0x00000001U)
Jay Buddhabhatti3d832ea2023-01-09 04:33:25 -080085#define CORE_0_IDS_POWER_OFFSET (0x0000001CULL)
Jay Buddhabhattic6daff02022-09-05 02:56:32 -070086#define APU_PCIL_CORE_X_IDS_POWER_REG(cpu_id) (APU_PCLI + (CORE_0_IDS_POWER_OFFSET + \
Jay Buddhabhatti43cbf7e2023-01-09 04:46:54 -080087 (APU_PCLI_CPU_STEP * (cpu_id))))
Jay Buddhabhattic6daff02022-09-05 02:56:32 -070088#define APU_PCIL_CORE_X_IDS_POWER_MASK (0x00000001U)
89#define CORE_PWRDN_EN_BIT_MASK (0x1U)
90
Michal Simek91794362022-08-31 16:45:14 +020091/*******************************************************************************
92 * memory map related constants
93 ******************************************************************************/
94/* IPP 1.2/SPP 0.9 mapping */
95#define DEVICE0_BASE U(0xE8000000) /* psx, crl, iou */
96#define DEVICE0_SIZE U(0x08000000)
97#define DEVICE1_BASE U(0xE2000000) /* gic */
98#define DEVICE1_SIZE U(0x00800000)
99#define DEVICE2_BASE U(0xF1000000) /* uart, pmc_tap */
100#define DEVICE2_SIZE U(0x01000000)
101#define CRF_BASE U(0xFD1A0000)
102#define CRF_SIZE U(0x00600000)
Michal Simekaa5443e2022-09-19 14:04:55 +0200103#define IPI_BASE U(0xEB300000)
104#define IPI_SIZE U(0x00100000)
Michal Simek91794362022-08-31 16:45:14 +0200105
106/* CRL */
107#define VERSAL_NET_CRL U(0xEB5E0000)
108#define VERSAL_NET_CRL_TIMESTAMP_REF_CTRL_OFFSET U(0x14C)
109#define VERSAL_NET_CRL_RST_TIMESTAMP_OFFSET U(0x348)
110
111#define VERSAL_NET_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT (1U << 25U)
112
113/* IOU SCNTRS */
114#define VERSAL_NET_IOU_SCNTRS U(0xEC920000)
115#define VERSAL_NET_IOU_SCNTRS_COUNTER_CONTROL_REG_OFFSET U(0)
116#define VERSAL_NET_IOU_SCNTRS_BASE_FREQ_OFFSET U(0x20)
117
118#define VERSAL_NET_IOU_SCNTRS_CONTROL_EN U(1)
119
Michal Simekdc708ac2022-09-19 13:52:54 +0200120#define APU_CLUSTER0 U(0xECC00000)
121#define APU_RVBAR_L_0 U(0x40)
122#define APU_RVBAR_H_0 U(0x44)
123#define APU_CLUSTER_STEP U(0x100000)
124
125#define SLCR_OSPI_QSPI_IOU_AXI_MUX_SEL U(0xF1060504)
126
Michal Simek91794362022-08-31 16:45:14 +0200127/*******************************************************************************
128 * IRQ constants
129 ******************************************************************************/
130#define VERSAL_NET_IRQ_SEC_PHY_TIMER U(29)
131
132/*******************************************************************************
133 * UART related constants
134 ******************************************************************************/
135#define VERSAL_NET_UART0_BASE U(0xF1920000)
Akshay Belsare0babc5f2023-01-13 14:40:37 +0530136#define VERSAL_NET_UART1_BASE U(0xF1930000)
137
Prasad Kummariec9fcba2023-10-04 11:37:51 +0530138#define UART_BAUDRATE 115200
Michal Simek91794362022-08-31 16:45:14 +0200139
Michal Simekc56e5482023-09-27 13:58:06 +0200140#if CONSOLE_IS(pl011_1)
141#define UART_BASE VERSAL_NET_UART1_BASE
Akshay Belsare0babc5f2023-01-13 14:40:37 +0530142#else
Akshay Belsare50a29682023-01-18 15:54:12 +0530143/* Default console is UART0 */
Michal Simekc56e5482023-09-27 13:58:06 +0200144#define UART_BASE VERSAL_NET_UART0_BASE
Akshay Belsare0babc5f2023-01-13 14:40:37 +0530145#endif
Michal Simek91794362022-08-31 16:45:14 +0200146
Jay Buddhabhattic6daff02022-09-05 02:56:32 -0700147/* Processor core device IDs */
148#define PM_DEV_CLUSTER0_ACPU_0 (0x1810C0AFU)
149#define PM_DEV_CLUSTER0_ACPU_1 (0x1810C0B0U)
150#define PM_DEV_CLUSTER0_ACPU_2 (0x1810C0B1U)
151#define PM_DEV_CLUSTER0_ACPU_3 (0x1810C0B2U)
152
153#define PM_DEV_CLUSTER1_ACPU_0 (0x1810C0B3U)
154#define PM_DEV_CLUSTER1_ACPU_1 (0x1810C0B4U)
155#define PM_DEV_CLUSTER1_ACPU_2 (0x1810C0B5U)
156#define PM_DEV_CLUSTER1_ACPU_3 (0x1810C0B6U)
157
158#define PM_DEV_CLUSTER2_ACPU_0 (0x1810C0B7U)
159#define PM_DEV_CLUSTER2_ACPU_1 (0x1810C0B8U)
160#define PM_DEV_CLUSTER2_ACPU_2 (0x1810C0B9U)
161#define PM_DEV_CLUSTER2_ACPU_3 (0x1810C0BAU)
162
163#define PM_DEV_CLUSTER3_ACPU_0 (0x1810C0BBU)
164#define PM_DEV_CLUSTER3_ACPU_1 (0x1810C0BCU)
165#define PM_DEV_CLUSTER3_ACPU_2 (0x1810C0BDU)
166#define PM_DEV_CLUSTER3_ACPU_3 (0x1810C0BEU)
167
Michal Simek91794362022-08-31 16:45:14 +0200168#endif /* VERSAL_NET_DEF_H */