blob: 4ed8c7e6a5e5260a2bf03d80a8f2e370527512ef [file] [log] [blame]
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03001/*
2 * Copyright (C) 2018 Marvell International Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 * https://spdx.org/licenses
6 */
7
8#ifndef __A8K_PLAT_DEF_H__
9#define __A8K_PLAT_DEF_H__
10
11#include <marvell_def.h>
12
13#define MVEBU_PRIMARY_CPU 0x0
14#define MVEBU_AP0 0x0
15
16/* APN806 revision ID */
17#define MVEBU_CSS_GWD_CTRL_IIDR2_REG (MVEBU_REGS_BASE + 0x610FCC)
18#define GWD_IIDR2_REV_ID_OFFSET 12
19#define GWD_IIDR2_REV_ID_MASK 0xF
20#define GWD_IIDR2_CHIP_ID_OFFSET 20
21#define GWD_IIDR2_CHIP_ID_MASK (0xFFF << GWD_IIDR2_CHIP_ID_OFFSET)
22
23#define CHIP_ID_AP806 0x806
24#define CHIP_ID_AP807 0x807
25
26#define COUNTER_FREQUENCY 25000000
27
28#define MVEBU_REGS_BASE 0xF0000000
29#define MVEBU_REGS_BASE_MASK 0xF0000000
30#define MVEBU_REGS_BASE_AP(ap) MVEBU_REGS_BASE
31#define MVEBU_CP_REGS_BASE(cp_index) (0xF2000000 + (cp_index) * 0x2000000)
32#define MVEBU_RFU_BASE (MVEBU_REGS_BASE + 0x6F0000)
33#define MVEBU_IO_WIN_BASE(ap_index) (MVEBU_RFU_BASE)
34#define MVEBU_IO_WIN_GCR_OFFSET (0x70)
35#define MVEBU_IO_WIN_MAX_WINS (7)
36
37/* Misc SoC configurations Base */
38#define MVEBU_MISC_SOC_BASE (MVEBU_REGS_BASE + 0x6F4300)
39
40#define MVEBU_CCU_BASE(ap_index) (MVEBU_REGS_BASE + 0x4000)
41#define MVEBU_CCU_MAX_WINS (8)
42
43#define MVEBU_LLC_BASE(ap_index) (MVEBU_REGS_BASE + 0x8000)
44#define MVEBU_DRAM_MAC_BASE (MVEBU_REGS_BASE + 0x20000)
45#define MVEBU_DRAM_PHY_BASE (MVEBU_REGS_BASE + 0x20000)
46#define MVEBU_SMMU_BASE (MVEBU_REGS_BASE + 0x100000)
47#define MVEBU_CP_MPP_REGS(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
48 0x440000 + ((n) << 2))
49#define MVEBU_PM_MPP_REGS(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
50 0x440000 + ((n / 8) << 2))
51#define MVEBU_CP_GPIO_DATA_OUT(cp_index, n) \
52 (MVEBU_CP_REGS_BASE(cp_index) + \
53 0x440100 + ((n > 32) ? 0x40 : 0x00))
54#define MVEBU_CP_GPIO_DATA_OUT_EN(cp_index, n) \
55 (MVEBU_CP_REGS_BASE(cp_index) + \
56 0x440104 + ((n > 32) ? 0x40 : 0x00))
57#define MVEBU_CP_GPIO_DATA_IN(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
58 0x440110 + ((n > 32) ? 0x40 : 0x00))
59#define MVEBU_AP_MPP_REGS(n) (MVEBU_RFU_BASE + 0x4000 + ((n) << 2))
60#define MVEBU_AP_GPIO_REGS (MVEBU_RFU_BASE + 0x5040)
61#define MVEBU_AP_GPIO_DATA_IN (MVEBU_AP_GPIO_REGS + 0x10)
62#define MVEBU_AP_I2C_BASE (MVEBU_REGS_BASE + 0x511000)
63#define MVEBU_CP0_I2C_BASE (MVEBU_CP_REGS_BASE(0) + 0x701000)
64#define MVEBU_AP_EXT_TSEN_BASE (MVEBU_RFU_BASE + 0x8084)
65
66#define MVEBU_AP_MC_TRUSTZONE_REG_LOW(ap, win) (MVEBU_REGS_BASE_AP(ap) + \
67 0x20080 + ((win) * 0x8))
68#define MVEBU_AP_MC_TRUSTZONE_REG_HIGH(ap, win) (MVEBU_REGS_BASE_AP(ap) + \
69 0x20084 + ((win) * 0x8))
70
71/* MCI indirect access definitions */
72#define MCI_MAX_UNIT_ID 2
73/* SoC RFU / IHBx4 Control */
74#define MCIX4_REG_START_ADDRESS_REG(unit_id) (MVEBU_RFU_BASE + \
75 0x4218 + (unit_id * 0x20))
76#define MCI_REMAP_OFF_SHIFT 8
77
78#define MVEBU_MCI_REG_BASE_REMAP(index) (0xFD000000 + \
79 ((index) * 0x1000000))
80
81#define MVEBU_PCIE_X4_MAC_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x600000)
82#define MVEBU_COMPHY_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x441000)
83#define MVEBU_HPIPE_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x120000)
84#define MVEBU_CP_DFX_OFFSET (0x400200)
85
86/*****************************************************************************
87 * MVEBU memory map related constants
88 *****************************************************************************
89 */
90/* Aggregate of all devices in the first GB */
91#define DEVICE0_BASE MVEBU_REGS_BASE
92#define DEVICE0_SIZE 0x10000000
93
94/*****************************************************************************
95 * GIC-400 & interrupt handling related constants
96 *****************************************************************************
97 */
98/* Base MVEBU compatible GIC memory map */
99#define MVEBU_GICD_BASE 0x210000
100#define MVEBU_GICC_BASE 0x220000
101
102
103/*****************************************************************************
104 * AXI Configuration
105 *****************************************************************************
106 */
107#define MVEBU_AXI_ATTR_ARCACHE_OFFSET 4
108#define MVEBU_AXI_ATTR_ARCACHE_MASK (0xF << \
109 MVEBU_AXI_ATTR_ARCACHE_OFFSET)
110#define MVEBU_AXI_ATTR_ARDOMAIN_OFFSET 12
111#define MVEBU_AXI_ATTR_ARDOMAIN_MASK (0x3 << \
112 MVEBU_AXI_ATTR_ARDOMAIN_OFFSET)
113#define MVEBU_AXI_ATTR_AWCACHE_OFFSET 20
114#define MVEBU_AXI_ATTR_AWCACHE_MASK (0xF << \
115 MVEBU_AXI_ATTR_AWCACHE_OFFSET)
116#define MVEBU_AXI_ATTR_AWDOMAIN_OFFSET 28
117#define MVEBU_AXI_ATTR_AWDOMAIN_MASK (0x3 << \
118 MVEBU_AXI_ATTR_AWDOMAIN_OFFSET)
119
120/* SATA MBUS to AXI configuration */
121#define MVEBU_SATA_M2A_AXI_ARCACHE_OFFSET 1
122#define MVEBU_SATA_M2A_AXI_ARCACHE_MASK (0xF << \
123 MVEBU_SATA_M2A_AXI_ARCACHE_OFFSET)
124#define MVEBU_SATA_M2A_AXI_AWCACHE_OFFSET 5
125#define MVEBU_SATA_M2A_AXI_AWCACHE_MASK (0xF << \
126 MVEBU_SATA_M2A_AXI_AWCACHE_OFFSET)
127
128/* ARM cache attributes */
129#define CACHE_ATTR_BUFFERABLE 0x1
130#define CACHE_ATTR_CACHEABLE 0x2
131#define CACHE_ATTR_READ_ALLOC 0x4
132#define CACHE_ATTR_WRITE_ALLOC 0x8
133/* Domain */
134#define DOMAIN_NON_SHAREABLE 0x0
135#define DOMAIN_INNER_SHAREABLE 0x1
136#define DOMAIN_OUTER_SHAREABLE 0x2
137#define DOMAIN_SYSTEM_SHAREABLE 0x3
138
139/************************************************************************
140 * Required platform porting definitions common to all
141 * Management Compute SubSystems (MSS)
142 ************************************************************************
143 */
144/*
145 * Load address of SCP_BL2
146 * SCP_BL2 is loaded to the same place as BL31.
147 * Once SCP_BL2 is transferred to the SCP,
148 * it is discarded and BL31 is loaded over the top.
149 */
150#ifdef SCP_IMAGE
151#define SCP_BL2_BASE BL31_BASE
152#endif
153
154#ifndef __ASSEMBLER__
155enum ap806_sar_target_dev {
156 SAR_PIDI_MCIX2 = 0x0,
157 SAR_MCIX4 = 0x1,
158 SAR_SPI = 0x2,
159 SAR_SD = 0x3,
160 SAR_PIDI_MCIX2_BD = 0x4, /* BootRom disabled */
161 SAR_MCIX4_DB = 0x5, /* BootRom disabled */
162 SAR_SPI_DB = 0x6, /* BootRom disabled */
163 SAR_EMMC = 0x7
164};
165
166enum io_win_target_ids {
167 MCI_0_TID = 0x0,
168 MCI_1_TID = 0x1,
169 MCI_2_TID = 0x2,
170 PIDI_TID = 0x3,
171 SPI_TID = 0x4,
172 STM_TID = 0x5,
173 BOOTROM_TID = 0x6,
174 IO_WIN_MAX_TID
175};
176
177enum ccu_target_ids {
178 IO_0_TID = 0x00,
179 DRAM_0_TID = 0x03,
180 IO_1_TID = 0x0F,
181 CFG_REG_TID = 0x10,
182 RAR_TID = 0x20,
183 SRAM_TID = 0x40,
184 DRAM_1_TID = 0xC0,
185 CCU_MAX_TID,
186 INVALID_TID = 0xFF
187};
188#endif /* __ASSEMBLER__ */
189
190#endif /* __A8K_PLAT_DEF_H__ */