1 /* SPDX-License-Identifier: Apache-2.0 */
2 /*
3  * Copyright 2018 Broadcom.
4  */
5 
6 #ifndef SOC_H
7 #define SOC_H
8 
9 #include <sys/util.h>
10 #include <toolchain.h>
11 
12 #ifndef _ASMLANGUAGE
13 
14 #include <devicetree.h>
15 
16 /* Interrupt Number Definition */
17 typedef enum IRQn {
18 	/* CORTEX-M7 Processor Exceptions Numbers */
19 	NonMaskableInt_IRQn       = -14, /*< 2  Non Maskable Interrupt            */
20 	HardFault_IRQn            = -13, /*< 3  HardFault Interrupt               */
21 	MemoryManagement_IRQn     = -12, /*< 4  Cortex-M7 Memory Management Interrupt */
22 	BusFault_IRQn             = -11, /*< 5  Cortex-M7 Bus Fault Interrupt     */
23 	UsageFault_IRQn           = -10, /*< 6  Cortex-M7 Usage Fault Interrupt   */
24 	SVCall_IRQn               = -5,  /*< 11 Cortex-M7 SV Call Interrupt       */
25 	DebugMonitor_IRQn         = -4,  /*< 12 Cortex-M7 Debug Monitor Interrupt */
26 	PendSV_IRQn               = -2,  /*< 14 Cortex-M7 Pend SV Interrupt       */
27 	SysTick_IRQn              = -1,  /*< 15 Cortex-M7 System Tick Interrupt   */
28 
29 	/*  VALKYRIE_MPU Specific Interrupt Numbers  */
30 	M7_RESERVED_0                                     = 0,
31 	M7_MCU_AON_UART_INTR                              = 1,
32 	M7_MCU_AON_GPIO_INTR                              = 2,
33 	M7_CHIPCOMMONG_WDOG_RESET                         = 3,
34 	M7_RESERVED_4                                     = 4,
35 	M7_RESERVED_5                                     = 5,
36 	M7_MCU_SMBUS_INTR                                 = 6,
37 	M7_MCU_TIMER_INTR                                 = 7,
38 	M7_MCU_WDOG_INTR                                  = 8,
39 	M7_MCU_ERROR_LOG_INTR                             = 9,
40 	M7_MCU_POWER_LOG_INTR                             = 10,
41 	M7_MCU_RESET_LOG_INTR                             = 11,
42 	M7_RESERVED_12                                    = 12,
43 	M7_RESERVED_13                                    = 13,
44 	M7_MCU_SECURITY_INTR                              = 14,
45 	M7_AVS_MONITOR_INTR                               = 15,
46 	M7_AVS_TEMP_RESET_INTR                            = 16,
47 	M7_GIC_AXI_ERR_INITR                              = 17,
48 	M7_GIC_ECC_ERR_INITR                              = 18,
49 	M7_RESERVED_19                                    = 19,
50 	M7_RESERVED_20                                    = 20,
51 	M7_RESERVED_21                                    = 21,
52 	M7_RESERVED_22                                    = 22,
53 	M7_RESERVED_23                                    = 23,
54 	M7_RESERVED_24                                    = 24,
55 	M7_MCU_MAILBOX1_EVENT                             = 25,
56 	M7_RESERVED_26                                    = 26,
57 	M7_RESERVED_27                                    = 27,
58 	M7_RESERVED_28                                    = 28,
59 	M7_MCU_IPROC_STANDBYWFE_EVENT                     = 29,
60 	M7_MCU_IPROC_STANDBYWFI_EVENT                     = 30,
61 	M7_MCU_MAILBOX_EVENT                              = 31,
62 	M7_MCU_TIMER1_INTR                                = 32,
63 	M7_MCU_TIMER2_INTR                                = 33,
64 	M7_MCU_COMB_IDM_INTR                              = 34,
65 	M7_RESERVED_35                                    = 35,
66 	M7_RESERVED_36                                    = 36,
67 	M7_RESERVED_37                                    = 37,
68 	M7_RESERVED_38                                    = 38,
69 	M7_RESERVED_39                                    = 39,
70 	M7_MCU_NS_MAILBOX0_EVENT                          = 40,
71 	M7_MCU_NS_MAILBOX1_EVENT                          = 41,
72 	M7_MCU_NS_MAILBOX2_EVENT                          = 42,
73 	M7_MCU_NS_MAILBOX3_EVENT                          = 43,
74 	M7_PCIE0_PERSTB_EVENT                             = 44,
75 	M7_PCIE1_PERSTB_EVENT                             = 45,
76 	M7_PCIE0_INB_PERSTB_EVENT                         = 46,
77 	M7_PCIE1_INB_PERSTB_EVENT                         = 47,
78 	M7_SSIM2_IRQ                                      = 48,
79 	M7_SSIM2_AFBC_IRQ                                 = 49,
80 	M7_SSIM2_AFBC_IRQ_AXI_ERR                         = 50,
81 	M7_SSIM2_AFBC_IRQ_CONFIG_SWAP                     = 51,
82 	M7_SSIM2_AFBC_IRQ_DECODE_ERR                      = 52,
83 	M7_SSIM2_AFBC_IRQ_DETLING_ERR                     = 53,
84 	M7_SSIM2_AFBC_IRQ_SECURE_ID_ERR                   = 54,
85 	M7_SSIM2_AFBC_IRQ_SURFACES_DONE                   = 55,
86 	M7_SSIM1_IRQ                                      = 56,
87 	M7_SSIM1_AFBC_IRQ                                 = 57,
88 	M7_SSIM1_AFBC_IRQ_AXI_ERR                         = 58,
89 	M7_SSIM1_AFBC_IRQ_CONFIG_SWAP                     = 59,
90 	M7_SSIM1_AFBC_IRQ_DECODE_ERR                      = 60,
91 	M7_SSIM1_AFBC_IRQ_DETLING_ERR                     = 61,
92 	M7_SSIM1_AFBC_IRQ_SECURE_ID_ERR                   = 62,
93 	M7_SSIM1_AFBC_IRQ_SURFACES_DONE                   = 63,
94 	M7_SSIM0_IRQ                                      = 64,
95 	M7_SSIM0_AFBC_IRQ                                 = 65,
96 	M7_SSIM0_AFBC_IRQ_AXI_ERR                         = 66,
97 	M7_SSIM0_AFBC_IRQ_CONFIG_SWAP                     = 67,
98 	M7_SSIM0_AFBC_IRQ_DECODE_ERR                      = 68,
99 	M7_SSIM0_AFBC_IRQ_DETLING_ERR                     = 69,
100 	M7_SSIM0_AFBC_IRQ_SECURE_ID_ERR                   = 70,
101 	M7_SSIM0_AFBC_IRQ_SURFACES_DONE                   = 71,
102 	M7_SCL1_IRQ                                       = 72,
103 	M7_SCL0_IRQ                                       = 73,
104 	M7_ENC2_IRQ                                       = 74,
105 	M7_ENC1_IRQ                                       = 75,
106 	M7_ENC0_IRQ                                       = 76,
107 	M7_DEC1_IRQ                                       = 77,
108 	M7_DEC0_IRQ                                       = 78,
109 	M7_IHOST_CRM_INTERRUPT                            = 79,
110 	M7_IHOST_NEXTERRIRQ                               = 80,
111 	M7_IHOST_NINTERRIRQ                               = 81,
112 	M7_PAXB0_AXI_IBUF_INTR                            = 82,
113 	M7_PAXB0_GIC_INTR0                                = 83,
114 	M7_PAXB0_GIC_INTR1                                = 84,
115 	M7_PAXB0_GIC_INTR2                                = 85,
116 	M7_PAXB0_GIC_INTR3                                = 86,
117 	M7_PAXB0_GIC_INTR4                                = 87,
118 	M7_PAXB0_GIC_INTR5                                = 88,
119 	M7_PAXB0_GIC_MEM_ERR_INTR                         = 89,
120 	M7_PAXB0_MSIX_INTR0                               = 90,
121 	M7_PAXB0_MSIX_INTR1                               = 91,
122 	M7_PAXB0_MSIX_INTR2                               = 92,
123 	M7_PAXB0_MSIX_INTR3                               = 93,
124 	M7_PAXB0_MSIX_INTR4                               = 94,
125 	M7_PAXB0_MSIX_INTR5                               = 95,
126 	M7_PAXB0_MSIX_INTR6                               = 96,
127 	M7_PAXB0_MSIX_INTR7                               = 97,
128 	M7_PAXB0_MSIX_INTR8                               = 98,
129 	M7_PAXB0_MSIX_INTR9                               = 99,
130 	M7_PAXB0_MSIX_INTR10                              = 100,
131 	M7_PAXB0_MSIX_INTR11                              = 101,
132 	M7_PAXB0_MSIX_INTR12                              = 102,
133 	M7_PAXB0_MSIX_INTR13                              = 103,
134 	M7_PAXB0_MSIX_INTR14                              = 104,
135 	M7_PAXB0_MSIX_INTR15                              = 105,
136 	M7_PAXB1_AXI_IBUF_INTR                            = 106,
137 	M7_PAXB1_GIC_INTR0                                = 107,
138 	M7_PAXB1_GIC_INTR1                                = 108,
139 	M7_PAXB1_GIC_INTR2                                = 109,
140 	M7_PAXB1_GIC_INTR3                                = 110,
141 	M7_PAXB1_GIC_INTR4                                = 111,
142 	M7_PAXB1_GIC_INTR5                                = 112,
143 	M7_PAXB1_GIC_MEM_ERR_INTR                         = 113,
144 	M7_PAXB1_MSIX_INTR0                               = 114,
145 	M7_PAXB1_MSIX_INTR1                               = 115,
146 	M7_PAXB1_MSIX_INTR2                               = 116,
147 	M7_PAXB1_MSIX_INTR3                               = 117,
148 	M7_PAXB1_MSIX_INTR4                               = 118,
149 	M7_PAXB1_MSIX_INTR5                               = 119,
150 	M7_PAXB1_MSIX_INTR6                               = 120,
151 	M7_PAXB1_MSIX_INTR7                               = 121,
152 	M7_PAXB1_MSIX_INTR8                               = 122,
153 	M7_PAXB1_MSIX_INTR9                               = 123,
154 	M7_PAXB1_MSIX_INTR10                              = 124,
155 	M7_PAXB1_MSIX_INTR11                              = 125,
156 	M7_PAXB1_MSIX_INTR12                              = 126,
157 	M7_PAXB1_MSIX_INTR13                              = 127,
158 	M7_PAXB1_MSIX_INTR14                              = 128,
159 	M7_PAXB1_MSIX_INTR15                              = 129,
160 	M7_IRQ_PCIE_S0_PINS_BUS                           = 130,
161 	M7_IRQ_PCIE_S1_PINS_BUS                           = 131,
162 	M7_IRQ_PCIE_NIC_S_PINS_BUS                        = 132,
163 	M7_PCIE_GLOBAL_ERR_INTR                           = 133,
164 	M7_PCIE_ARB_ERR_INTR                              = 134,
165 	M7_PCIE_RM_ERR_INTR                               = 135,
166 	M7_VID_MSTR_RESP_ERR_INTR                         = 136,
167 	M7_SPI_RESERVED3_0                                = 137,
168 	M7_SPI_RESERVED3_1                                = 138,
169 	M7_SPI_RESERVED3_2                                = 139,
170 	M7_SPI_RESERVED3_3                                = 140,
171 	M7_IRQ_APB_SCR1_PINS_BUS                          = 141,
172 	M7_IRQ_APB_SCR2_PINS_BUS                          = 142,
173 	M7_IRQ_CRMU_M0_PINS_BUS                           = 143,
174 	M7_IRQ_CRMU_S0_PINS_BUS                           = 144,
175 	M7_IRQ_GIC_S0_PINS_BUS                            = 145,
176 	M7_SCR_SRAM_INTERRUPT                             = 146,
177 	M7_SRAM_TZC_INTERRUPT                             = 147,
178 	M7_PMON_INTERRUPT                                 = 148,
179 	M7_SPI_RESERVED4_0                                = 149,
180 	M7_DDR0_TZC_INTERRUPT                             = 150,
181 	M7_DDR1_TZC_INTERRUPT                             = 151,
182 	M7_DDR0_INTERRUPT0                                = 152,
183 	M7_DDR0_INTERRUPT1                                = 153,
184 	M7_DDR0_INTERRUPT2                                = 154,
185 	M7_DDR0_INTERRUPT3                                = 155,
186 	M7_DDR1_INTERRUPT0                                = 156,
187 	M7_DDR1_INTERRUPT1                                = 157,
188 	M7_DDR1_INTERRUPT2                                = 158,
189 	M7_DDR1_INTERRUPT3                                = 159,
190 	M7_SPI_RESERVED5_0                                = 160,
191 	M7_SPI_RESERVED5_1                                = 161,
192 	M7_SPI_RESERVED5_2                                = 162,
193 	M7_SPI_RESERVED5_3                                = 163,
194 	M7_SPI_RESERVED5_4                                = 164,
195 	M7_SPI_RESERVED5_5                                = 165,
196 	M7_SPI_RESERVED5_6                                = 166,
197 	M7_SPI_RESERVED5_7                                = 167,
198 	M7_DMAC_IRQ0                                      = 168,
199 	M7_DMAC_IRQ1                                      = 169,
200 	M7_DMAC_IRQ2                                      = 170,
201 	M7_DMAC_IRQ3                                      = 171,
202 	M7_DMAC_IRQ4                                      = 172,
203 	M7_DMAC_IRQ5                                      = 173,
204 	M7_DMAC_IRQ6                                      = 174,
205 	M7_DMAC_IRQ7                                      = 175,
206 	M7_DMAC_IRQ_ABORT                                 = 176,
207 	M7_ETIMER_0_TM_INTR0                              = 177,
208 	M7_ETIMER_0_TM_INTR1                              = 178,
209 	M7_ETIMER_0_TM_INTR2                              = 179,
210 	M7_ETIMER_0_TM_INTR3                              = 180,
211 	M7_ETIMER_1_TM_INTR0                              = 181,
212 	M7_ETIMER_1_TM_INTR1                              = 182,
213 	M7_ETIMER_1_TM_INTR2                              = 183,
214 	M7_ETIMER_1_TM_INTR3                              = 184,
215 	M7_CHIPCOMMONG_MIIM_LINK_SCAN_STATUS_CHANGE_INTR  = 185,
216 	M7_CHIPCOMMONG_MIIM_OP_DONE_INTR                  = 186,
217 	M7_CHIPCOMMONG_MIIM_PAUSE_SCAN_STATUS_CHANGE_INTR = 187,
218 	M7_CHIPCOMMONG_SMBUS0_INTR                        = 188,
219 	M7_CHIPCOMMONG_SMBUS1_INTR                        = 189,
220 	M7_CHIPCOMMONG_SPI0_INTR                          = 190,
221 	M7_CHIPCOMMONG_SPI1_INTR                          = 191,
222 	M7_CHIPCOMMONG_SPI2_INTR                          = 192,
223 	M7_CHIPCOMMONG_TIM0_INTR                          = 193,
224 	M7_CHIPCOMMONG_TIM1_INTR                          = 194,
225 	M7_CHIPCOMMONG_TIM2_INTR                          = 195,
226 	M7_CHIPCOMMONG_TIM3_INTR                          = 196,
227 	M7_CHIPCOMMONG_UART0_INTR                         = 197,
228 	M7_CHIPCOMMONG_UART1_INTR                         = 198,
229 	M7_CHIPCOMMONG_UART2_INTR                         = 199,
230 	M7_CHIPCOMMONG_UART3_INTR                         = 200,
231 	M7_CHIPCOMMONG_WDOG_INTR                          = 201,
232 	M7_CHIPCOMMONS_RNG_INTR                           = 202,
233 	M7_LS_GPIO_INTR                                   = 203,
234 	M7_NAND_INTERRUPT_O                               = 204,
235 	M7_QSPI_INTERRUPT_O                               = 205,
236 	M7_IRQ_APB_LS1_PINS_BUS                           = 206,
237 	M7_IRQ_APB_LS2_PINS_BUS                           = 207,
238 	M7_IRQ_APB_LS3_PINS_BUS                           = 208,
239 	M7_IRQ_CORESIGHT_M0_PINS_BUS                      = 209,
240 	M7_DMA_ARB_ERR_INTR                               = 210,
241 	M7_IRQ_NAND_S0_PINS_BUS                           = 211,
242 	M7_IRQ_QSPI_S0_PINS_BUS                           = 212,
243 	M7_IRQ_ROM_S0_PINS_BUS                            = 213,
244 	M7_IRQ_SMAU_S0_PINS_BUS                           = 214,
245 	M7_SMU_INTR                                       = 215,
246 	M7_SMU_DMU_PAR_ERR                                = 216,
247 	M7_SMU_DMU_AUTH_ERR                               = 217,
248 	M7_SPI_RESERVED6_0                                = 218,
249 	M7_SPI_RESERVED6_1                                = 219,
250 	M7_SPI_RESERVED6_2                                = 220,
251 	M7_SPI_RESERVED6_3                                = 221,
252 	M7_SPI_RESERVED6_4                                = 222,
253 	M7_SPI_RESERVED6_5                                = 223,
254 	M7_SPI_RESERVED6_6                                = 224,
255 	M7_SPI_RESERVED6_7                                = 225,
256 	M7_SPI_RESERVED6_8                                = 226,
257 	M7_SPI_RESERVED6_9                                = 227,
258 	M7_SPI_RESERVED6_10                               = 228,
259 	M7_SPI_RESERVED6_11                               = 229,
260 	M7_SPI_RESERVED6_12                               = 230,
261 	M7_SPI_RESERVED6_13                               = 231,
262 	M7_SPI_RESERVED7_0                                = 232,
263 	M7_SPI_RESERVED7_1                                = 233,
264 	M7_SPI_RESERVED7_2                                = 234,
265 	M7_SPI_RESERVED7_3                                = 235,
266 	M7_SPI_RESERVED7_4                                = 236,
267 	M7_SPI_RESERVED7_5                                = 237,
268 	M7_SPI_RESERVED7_6                                = 238,
269 	M7_SPI_RESERVED7_7                                = 239,
270 } IRQn_Type;
271 
272 #endif
273 
274 /*
275  * Processor and Core Peripheral Section
276  */
277 
278 /*
279  * \brief Configuration of the CORTEX-M7 Processor and Core Peripherals
280  */
281 
282 #define __MPU_PRESENT           1
283 #define __NVIC_PRIO_BITS        NUM_IRQ_PRIO_BITS
284 
285 /* CRMU registers block */
286 #define CRMU_MCU_EXTRA_EVENT_STATUS	0x40070054
287 #define CRMU_MCU_EXTRA_EVENT_CLEAR	0x4007005c
288 #define CRMU_MCU_EXTRA_EVENT_MASK	0x40070064
289 #define PCIE0_PERST_INTR		BIT(4)
290 #define PCIE0_PERST_INB_INTR		BIT(6)
291 
292 #define PCIE_PERSTB_INTR_CTL_STS	0x400700e4
293 #define PCIE0_PERST_FE_INTR		BIT(1)
294 #define PCIE0_PERST_INB_FE_INTR		BIT(3)
295 
296 #endif
297