• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2019, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef STM32MP1_RCC_H
8 #define STM32MP1_RCC_H
9 
10 #include <lib/utils_def.h>
11 
12 #define RCC_TZCR			U(0x00)
13 #define RCC_OCENSETR			U(0x0C)
14 #define RCC_OCENCLRR			U(0x10)
15 #define RCC_HSICFGR			U(0x18)
16 #define RCC_CSICFGR			U(0x1C)
17 #define RCC_MPCKSELR			U(0x20)
18 #define RCC_ASSCKSELR			U(0x24)
19 #define RCC_RCK12SELR			U(0x28)
20 #define RCC_MPCKDIVR			U(0x2C)
21 #define RCC_AXIDIVR			U(0x30)
22 #define RCC_APB4DIVR			U(0x3C)
23 #define RCC_APB5DIVR			U(0x40)
24 #define RCC_RTCDIVR			U(0x44)
25 #define RCC_MSSCKSELR			U(0x48)
26 #define RCC_PLL1CR			U(0x80)
27 #define RCC_PLL1CFGR1			U(0x84)
28 #define RCC_PLL1CFGR2			U(0x88)
29 #define RCC_PLL1FRACR			U(0x8C)
30 #define RCC_PLL1CSGR			U(0x90)
31 #define RCC_PLL2CR			U(0x94)
32 #define RCC_PLL2CFGR1			U(0x98)
33 #define RCC_PLL2CFGR2			U(0x9C)
34 #define RCC_PLL2FRACR			U(0xA0)
35 #define RCC_PLL2CSGR			U(0xA4)
36 #define RCC_I2C46CKSELR			U(0xC0)
37 #define RCC_SPI6CKSELR			U(0xC4)
38 #define RCC_UART1CKSELR			U(0xC8)
39 #define RCC_RNG1CKSELR			U(0xCC)
40 #define RCC_CPERCKSELR			U(0xD0)
41 #define RCC_STGENCKSELR			U(0xD4)
42 #define RCC_DDRITFCR			U(0xD8)
43 #define RCC_MP_BOOTCR			U(0x100)
44 #define RCC_MP_SREQSETR			U(0x104)
45 #define RCC_MP_SREQCLRR			U(0x108)
46 #define RCC_MP_GCR			U(0x10C)
47 #define RCC_MP_APRSTCR			U(0x110)
48 #define RCC_MP_APRSTSR			U(0x114)
49 #define RCC_BDCR			U(0x140)
50 #define RCC_RDLSICR			U(0x144)
51 #define RCC_APB4RSTSETR			U(0x180)
52 #define RCC_APB4RSTCLRR			U(0x184)
53 #define RCC_APB5RSTSETR			U(0x188)
54 #define RCC_APB5RSTCLRR			U(0x18C)
55 #define RCC_AHB5RSTSETR			U(0x190)
56 #define RCC_AHB5RSTCLRR			U(0x194)
57 #define RCC_AHB6RSTSETR			U(0x198)
58 #define RCC_AHB6RSTCLRR			U(0x19C)
59 #define RCC_TZAHB6RSTSETR		U(0x1A0)
60 #define RCC_TZAHB6RSTCLRR		U(0x1A4)
61 #define RCC_MP_APB4ENSETR		U(0x200)
62 #define RCC_MP_APB4ENCLRR		U(0x204)
63 #define RCC_MP_APB5ENSETR		U(0x208)
64 #define RCC_MP_APB5ENCLRR		U(0x20C)
65 #define RCC_MP_AHB5ENSETR		U(0x210)
66 #define RCC_MP_AHB5ENCLRR		U(0x214)
67 #define RCC_MP_AHB6ENSETR		U(0x218)
68 #define RCC_MP_AHB6ENCLRR		U(0x21C)
69 #define RCC_MP_TZAHB6ENSETR		U(0x220)
70 #define RCC_MP_TZAHB6ENCLRR		U(0x224)
71 #define RCC_MC_APB4ENSETR		U(0x280)
72 #define RCC_MC_APB4ENCLRR		U(0x284)
73 #define RCC_MC_APB5ENSETR		U(0x288)
74 #define RCC_MC_APB5ENCLRR		U(0x28C)
75 #define RCC_MC_AHB5ENSETR		U(0x290)
76 #define RCC_MC_AHB5ENCLRR		U(0x294)
77 #define RCC_MC_AHB6ENSETR		U(0x298)
78 #define RCC_MC_AHB6ENCLRR		U(0x29C)
79 #define RCC_MP_APB4LPENSETR		U(0x300)
80 #define RCC_MP_APB4LPENCLRR		U(0x304)
81 #define RCC_MP_APB5LPENSETR		U(0x308)
82 #define RCC_MP_APB5LPENCLRR		U(0x30C)
83 #define RCC_MP_AHB5LPENSETR		U(0x310)
84 #define RCC_MP_AHB5LPENCLRR		U(0x314)
85 #define RCC_MP_AHB6LPENSETR		U(0x318)
86 #define RCC_MP_AHB6LPENCLRR		U(0x31C)
87 #define RCC_MP_TZAHB6LPENSETR		U(0x320)
88 #define RCC_MP_TZAHB6LPENCLRR		U(0x324)
89 #define RCC_MC_APB4LPENSETR		U(0x380)
90 #define RCC_MC_APB4LPENCLRR		U(0x384)
91 #define RCC_MC_APB5LPENSETR		U(0x388)
92 #define RCC_MC_APB5LPENCLRR		U(0x38C)
93 #define RCC_MC_AHB5LPENSETR		U(0x390)
94 #define RCC_MC_AHB5LPENCLRR		U(0x394)
95 #define RCC_MC_AHB6LPENSETR		U(0x398)
96 #define RCC_MC_AHB6LPENCLRR		U(0x39C)
97 #define RCC_BR_RSTSCLRR			U(0x400)
98 #define RCC_MP_GRSTCSETR		U(0x404)
99 #define RCC_MP_RSTSCLRR			U(0x408)
100 #define RCC_MP_IWDGFZSETR		U(0x40C)
101 #define RCC_MP_IWDGFZCLRR		U(0x410)
102 #define RCC_MP_CIER			U(0x414)
103 #define RCC_MP_CIFR			U(0x418)
104 #define RCC_PWRLPDLYCR			U(0x41C)
105 #define RCC_MP_RSTSSETR			U(0x420)
106 #define RCC_MCO1CFGR			U(0x800)
107 #define RCC_MCO2CFGR			U(0x804)
108 #define RCC_OCRDYR			U(0x808)
109 #define RCC_DBGCFGR			U(0x80C)
110 #define RCC_RCK3SELR			U(0x820)
111 #define RCC_RCK4SELR			U(0x824)
112 #define RCC_TIMG1PRER			U(0x828)
113 #define RCC_TIMG2PRER			U(0x82C)
114 #define RCC_MCUDIVR			U(0x830)
115 #define RCC_APB1DIVR			U(0x834)
116 #define RCC_APB2DIVR			U(0x838)
117 #define RCC_APB3DIVR			U(0x83C)
118 #define RCC_PLL3CR			U(0x880)
119 #define RCC_PLL3CFGR1			U(0x884)
120 #define RCC_PLL3CFGR2			U(0x888)
121 #define RCC_PLL3FRACR			U(0x88C)
122 #define RCC_PLL3CSGR			U(0x890)
123 #define RCC_PLL4CR			U(0x894)
124 #define RCC_PLL4CFGR1			U(0x898)
125 #define RCC_PLL4CFGR2			U(0x89C)
126 #define RCC_PLL4FRACR			U(0x8A0)
127 #define RCC_PLL4CSGR			U(0x8A4)
128 #define RCC_I2C12CKSELR			U(0x8C0)
129 #define RCC_I2C35CKSELR			U(0x8C4)
130 #define RCC_SAI1CKSELR			U(0x8C8)
131 #define RCC_SAI2CKSELR			U(0x8CC)
132 #define RCC_SAI3CKSELR			U(0x8D0)
133 #define RCC_SAI4CKSELR			U(0x8D4)
134 #define RCC_SPI2S1CKSELR		U(0x8D8)
135 #define RCC_SPI2S23CKSELR		U(0x8DC)
136 #define RCC_SPI45CKSELR			U(0x8E0)
137 #define RCC_UART6CKSELR			U(0x8E4)
138 #define RCC_UART24CKSELR		U(0x8E8)
139 #define RCC_UART35CKSELR		U(0x8EC)
140 #define RCC_UART78CKSELR		U(0x8F0)
141 #define RCC_SDMMC12CKSELR		U(0x8F4)
142 #define RCC_SDMMC3CKSELR		U(0x8F8)
143 #define RCC_ETHCKSELR			U(0x8FC)
144 #define RCC_QSPICKSELR			U(0x900)
145 #define RCC_FMCCKSELR			U(0x904)
146 #define RCC_FDCANCKSELR			U(0x90C)
147 #define RCC_SPDIFCKSELR			U(0x914)
148 #define RCC_CECCKSELR			U(0x918)
149 #define RCC_USBCKSELR			U(0x91C)
150 #define RCC_RNG2CKSELR			U(0x920)
151 #define RCC_DSICKSELR			U(0x924)
152 #define RCC_ADCCKSELR			U(0x928)
153 #define RCC_LPTIM45CKSELR		U(0x92C)
154 #define RCC_LPTIM23CKSELR		U(0x930)
155 #define RCC_LPTIM1CKSELR		U(0x934)
156 #define RCC_APB1RSTSETR			U(0x980)
157 #define RCC_APB1RSTCLRR			U(0x984)
158 #define RCC_APB2RSTSETR			U(0x988)
159 #define RCC_APB2RSTCLRR			U(0x98C)
160 #define RCC_APB3RSTSETR			U(0x990)
161 #define RCC_APB3RSTCLRR			U(0x994)
162 #define RCC_AHB2RSTSETR			U(0x998)
163 #define RCC_AHB2RSTCLRR			U(0x99C)
164 #define RCC_AHB3RSTSETR			U(0x9A0)
165 #define RCC_AHB3RSTCLRR			U(0x9A4)
166 #define RCC_AHB4RSTSETR			U(0x9A8)
167 #define RCC_AHB4RSTCLRR			U(0x9AC)
168 #define RCC_MP_APB1ENSETR		U(0xA00)
169 #define RCC_MP_APB1ENCLRR		U(0xA04)
170 #define RCC_MP_APB2ENSETR		U(0xA08)
171 #define RCC_MP_APB2ENCLRR		U(0xA0C)
172 #define RCC_MP_APB3ENSETR		U(0xA10)
173 #define RCC_MP_APB3ENCLRR		U(0xA14)
174 #define RCC_MP_AHB2ENSETR		U(0xA18)
175 #define RCC_MP_AHB2ENCLRR		U(0xA1C)
176 #define RCC_MP_AHB3ENSETR		U(0xA20)
177 #define RCC_MP_AHB3ENCLRR		U(0xA24)
178 #define RCC_MP_AHB4ENSETR		U(0xA28)
179 #define RCC_MP_AHB4ENCLRR		U(0xA2C)
180 #define RCC_MP_MLAHBENSETR		U(0xA38)
181 #define RCC_MP_MLAHBENCLRR		U(0xA3C)
182 #define RCC_MC_APB1ENSETR		U(0xA80)
183 #define RCC_MC_APB1ENCLRR		U(0xA84)
184 #define RCC_MC_APB2ENSETR		U(0xA88)
185 #define RCC_MC_APB2ENCLRR		U(0xA8C)
186 #define RCC_MC_APB3ENSETR		U(0xA90)
187 #define RCC_MC_APB3ENCLRR		U(0xA94)
188 #define RCC_MC_AHB2ENSETR		U(0xA98)
189 #define RCC_MC_AHB2ENCLRR		U(0xA9C)
190 #define RCC_MC_AHB3ENSETR		U(0xAA0)
191 #define RCC_MC_AHB3ENCLRR		U(0xAA4)
192 #define RCC_MC_AHB4ENSETR		U(0xAA8)
193 #define RCC_MC_AHB4ENCLRR		U(0xAAC)
194 #define RCC_MC_AXIMENSETR		U(0xAB0)
195 #define RCC_MC_AXIMENCLRR		U(0xAB4)
196 #define RCC_MC_MLAHBENSETR		U(0xAB8)
197 #define RCC_MC_MLAHBENCLRR		U(0xABC)
198 #define RCC_MP_APB1LPENSETR		U(0xB00)
199 #define RCC_MP_APB1LPENCLRR		U(0xB04)
200 #define RCC_MP_APB2LPENSETR		U(0xB08)
201 #define RCC_MP_APB2LPENCLRR		U(0xB0C)
202 #define RCC_MP_APB3LPENSETR		U(0xB10)
203 #define RCC_MP_APB3LPENCLRR		U(0xB14)
204 #define RCC_MP_AHB2LPENSETR		U(0xB18)
205 #define RCC_MP_AHB2LPENCLRR		U(0xB1C)
206 #define RCC_MP_AHB3LPENSETR		U(0xB20)
207 #define RCC_MP_AHB3LPENCLRR		U(0xB24)
208 #define RCC_MP_AHB4LPENSETR		U(0xB28)
209 #define RCC_MP_AHB4LPENCLRR		U(0xB2C)
210 #define RCC_MP_AXIMLPENSETR		U(0xB30)
211 #define RCC_MP_AXIMLPENCLRR		U(0xB34)
212 #define RCC_MP_MLAHBLPENSETR		U(0xB38)
213 #define RCC_MP_MLAHBLPENCLRR		U(0xB3C)
214 #define RCC_MC_APB1LPENSETR		U(0xB80)
215 #define RCC_MC_APB1LPENCLRR		U(0xB84)
216 #define RCC_MC_APB2LPENSETR		U(0xB88)
217 #define RCC_MC_APB2LPENCLRR		U(0xB8C)
218 #define RCC_MC_APB3LPENSETR		U(0xB90)
219 #define RCC_MC_APB3LPENCLRR		U(0xB94)
220 #define RCC_MC_AHB2LPENSETR		U(0xB98)
221 #define RCC_MC_AHB2LPENCLRR		U(0xB9C)
222 #define RCC_MC_AHB3LPENSETR		U(0xBA0)
223 #define RCC_MC_AHB3LPENCLRR		U(0xBA4)
224 #define RCC_MC_AHB4LPENSETR		U(0xBA8)
225 #define RCC_MC_AHB4LPENCLRR		U(0xBAC)
226 #define RCC_MC_AXIMLPENSETR		U(0xBB0)
227 #define RCC_MC_AXIMLPENCLRR		U(0xBB4)
228 #define RCC_MC_MLAHBLPENSETR		U(0xBB8)
229 #define RCC_MC_MLAHBLPENCLRR		U(0xBBC)
230 #define RCC_MC_RSTSCLRR			U(0xC00)
231 #define RCC_MC_CIER			U(0xC14)
232 #define RCC_MC_CIFR			U(0xC18)
233 #define RCC_VERR			U(0xFF4)
234 #define RCC_IDR				U(0xFF8)
235 #define RCC_SIDR			U(0xFFC)
236 
237 #define RCC_OFFSET_MASK			GENMASK(11, 0)
238 
239 /* Values for RCC_TZCR register */
240 #define RCC_TZCR_TZEN			BIT(0)
241 #define RCC_TZCR_MCKPROT		BIT(1)
242 
243 /* Used for most of RCC_<x>SELR registers */
244 #define RCC_SELR_SRC_MASK		GENMASK(2, 0)
245 #define RCC_SELR_REFCLK_SRC_MASK	GENMASK(1, 0)
246 #define RCC_SELR_SRCRDY			BIT(31)
247 
248 /* Values of RCC_MPCKSELR register */
249 #define RCC_MPCKSELR_HSI		0x00000000
250 #define RCC_MPCKSELR_HSE		0x00000001
251 #define RCC_MPCKSELR_PLL		0x00000002
252 #define RCC_MPCKSELR_PLL_MPUDIV		0x00000003
253 #define RCC_MPCKSELR_MPUSRC_MASK	GENMASK(1, 0)
254 #define RCC_MPCKSELR_MPUSRC_SHIFT	0
255 
256 /* Values of RCC_ASSCKSELR register */
257 #define RCC_ASSCKSELR_HSI		0x00000000
258 #define RCC_ASSCKSELR_HSE		0x00000001
259 #define RCC_ASSCKSELR_PLL		0x00000002
260 
261 /* Values of RCC_MSSCKSELR register */
262 #define RCC_MSSCKSELR_HSI		0x00000000
263 #define RCC_MSSCKSELR_HSE		0x00000001
264 #define RCC_MSSCKSELR_CSI		0x00000002
265 #define RCC_MSSCKSELR_PLL		0x00000003
266 
267 /* Values of RCC_CPERCKSELR register */
268 #define RCC_CPERCKSELR_HSI		0x00000000
269 #define RCC_CPERCKSELR_CSI		0x00000001
270 #define RCC_CPERCKSELR_HSE		0x00000002
271 #define RCC_CPERCKSELR_PERSRC_MASK	GENMASK(1, 0)
272 #define RCC_CPERCKSELR_PERSRC_SHIFT	0
273 
274 /* Used for most of DIVR register: max div for RTC */
275 #define RCC_DIVR_DIV_MASK		GENMASK(5, 0)
276 #define RCC_DIVR_DIVRDY			BIT(31)
277 
278 /* Masks for specific DIVR registers */
279 #define RCC_APBXDIV_MASK		GENMASK(2, 0)
280 #define RCC_MPUDIV_MASK			GENMASK(2, 0)
281 #define RCC_AXIDIV_MASK			GENMASK(2, 0)
282 #define RCC_MCUDIV_MASK			GENMASK(3, 0)
283 
284 /* Used for TIMER Prescaler */
285 #define RCC_TIMGXPRER_TIMGXPRE		BIT(0)
286 
287 /* Offset between RCC_MP_xxxENSETR and RCC_MP_xxxENCLRR registers */
288 #define RCC_MP_ENCLRR_OFFSET		U(4)
289 
290 /* Offset between RCC_xxxRSTSETR and RCC_xxxRSTCLRR registers */
291 #define RCC_RSTCLRR_OFFSET		U(4)
292 
293 /* Fields of RCC_BDCR register */
294 #define RCC_BDCR_LSEON			BIT(0)
295 #define RCC_BDCR_LSEBYP			BIT(1)
296 #define RCC_BDCR_LSERDY			BIT(2)
297 #define RCC_BDCR_DIGBYP			BIT(3)
298 #define RCC_BDCR_LSEDRV_MASK		GENMASK(5, 4)
299 #define RCC_BDCR_LSEDRV_SHIFT		4
300 #define RCC_BDCR_LSECSSON		BIT(8)
301 #define RCC_BDCR_RTCCKEN		BIT(20)
302 #define RCC_BDCR_RTCSRC_MASK		GENMASK(17, 16)
303 #define RCC_BDCR_RTCSRC_SHIFT		16
304 #define RCC_BDCR_VSWRST			BIT(31)
305 
306 /* Fields of RCC_RDLSICR register */
307 #define RCC_RDLSICR_LSION		BIT(0)
308 #define RCC_RDLSICR_LSIRDY		BIT(1)
309 
310 /* Used for all RCC_PLL<n>CR registers */
311 #define RCC_PLLNCR_PLLON		BIT(0)
312 #define RCC_PLLNCR_PLLRDY		BIT(1)
313 #define RCC_PLLNCR_SSCG_CTRL		BIT(2)
314 #define RCC_PLLNCR_DIVPEN		BIT(4)
315 #define RCC_PLLNCR_DIVQEN		BIT(5)
316 #define RCC_PLLNCR_DIVREN		BIT(6)
317 #define RCC_PLLNCR_DIVEN_SHIFT		4
318 
319 /* Used for all RCC_PLL<n>CFGR1 registers */
320 #define RCC_PLLNCFGR1_DIVM_SHIFT	16
321 #define RCC_PLLNCFGR1_DIVM_MASK		GENMASK(21, 16)
322 #define RCC_PLLNCFGR1_DIVN_SHIFT	0
323 #define RCC_PLLNCFGR1_DIVN_MASK		GENMASK(8, 0)
324 /* Only for PLL3 and PLL4 */
325 #define RCC_PLLNCFGR1_IFRGE_SHIFT	24
326 #define RCC_PLLNCFGR1_IFRGE_MASK	GENMASK(25, 24)
327 
328 /* Used for all RCC_PLL<n>CFGR2 registers */
329 #define RCC_PLLNCFGR2_DIVX_MASK		GENMASK(6, 0)
330 #define RCC_PLLNCFGR2_DIVP_SHIFT	0
331 #define RCC_PLLNCFGR2_DIVP_MASK		GENMASK(6, 0)
332 #define RCC_PLLNCFGR2_DIVQ_SHIFT	8
333 #define RCC_PLLNCFGR2_DIVQ_MASK		GENMASK(14, 8)
334 #define RCC_PLLNCFGR2_DIVR_SHIFT	16
335 #define RCC_PLLNCFGR2_DIVR_MASK		GENMASK(22, 16)
336 
337 /* Used for all RCC_PLL<n>FRACR registers */
338 #define RCC_PLLNFRACR_FRACV_SHIFT	3
339 #define RCC_PLLNFRACR_FRACV_MASK	GENMASK(15, 3)
340 #define RCC_PLLNFRACR_FRACLE		BIT(16)
341 
342 /* Used for all RCC_PLL<n>CSGR registers */
343 #define RCC_PLLNCSGR_INC_STEP_SHIFT	16
344 #define RCC_PLLNCSGR_INC_STEP_MASK	GENMASK(30, 16)
345 #define RCC_PLLNCSGR_MOD_PER_SHIFT	0
346 #define RCC_PLLNCSGR_MOD_PER_MASK	GENMASK(12, 0)
347 #define RCC_PLLNCSGR_SSCG_MODE_SHIFT	15
348 #define RCC_PLLNCSGR_SSCG_MODE_MASK	BIT(15)
349 
350 /* Used for RCC_OCENSETR and RCC_OCENCLRR registers */
351 #define RCC_OCENR_HSION			BIT(0)
352 #define RCC_OCENR_HSIKERON		BIT(1)
353 #define RCC_OCENR_CSION			BIT(4)
354 #define RCC_OCENR_CSIKERON		BIT(5)
355 #define RCC_OCENR_DIGBYP		BIT(7)
356 #define RCC_OCENR_HSEON			BIT(8)
357 #define RCC_OCENR_HSEKERON		BIT(9)
358 #define RCC_OCENR_HSEBYP		BIT(10)
359 #define RCC_OCENR_HSECSSON		BIT(11)
360 
361 /* Fields of RCC_OCRDYR register */
362 #define RCC_OCRDYR_HSIRDY		BIT(0)
363 #define RCC_OCRDYR_HSIDIVRDY		BIT(2)
364 #define RCC_OCRDYR_CSIRDY		BIT(4)
365 #define RCC_OCRDYR_HSERDY		BIT(8)
366 
367 /* Fields of RCC_DDRITFCR register */
368 #define RCC_DDRITFCR_DDRC1EN		BIT(0)
369 #define RCC_DDRITFCR_DDRC1LPEN		BIT(1)
370 #define RCC_DDRITFCR_DDRC2EN		BIT(2)
371 #define RCC_DDRITFCR_DDRC2LPEN		BIT(3)
372 #define RCC_DDRITFCR_DDRPHYCEN		BIT(4)
373 #define RCC_DDRITFCR_DDRPHYCLPEN	BIT(5)
374 #define RCC_DDRITFCR_DDRCAPBEN		BIT(6)
375 #define RCC_DDRITFCR_DDRCAPBLPEN	BIT(7)
376 #define RCC_DDRITFCR_AXIDCGEN		BIT(8)
377 #define RCC_DDRITFCR_DDRPHYCAPBEN	BIT(9)
378 #define RCC_DDRITFCR_DDRPHYCAPBLPEN	BIT(10)
379 #define RCC_DDRITFCR_DDRCAPBRST		BIT(14)
380 #define RCC_DDRITFCR_DDRCAXIRST		BIT(15)
381 #define RCC_DDRITFCR_DDRCORERST		BIT(16)
382 #define RCC_DDRITFCR_DPHYAPBRST		BIT(17)
383 #define RCC_DDRITFCR_DPHYRST		BIT(18)
384 #define RCC_DDRITFCR_DPHYCTLRST		BIT(19)
385 #define RCC_DDRITFCR_DDRCKMOD_MASK	GENMASK(22, 20)
386 #define RCC_DDRITFCR_DDRCKMOD_SHIFT	20
387 #define RCC_DDRITFCR_DDRCKMOD_SSR	0
388 #define RCC_DDRITFCR_DDRCKMOD_ASR1	BIT(20)
389 #define RCC_DDRITFCR_DDRCKMOD_HSR1	BIT(21)
390 #define RCC_DDRITFCR_GSKPCTRL		BIT(24)
391 
392 /* Fields of RCC_HSICFGR register */
393 #define RCC_HSICFGR_HSIDIV_MASK		GENMASK(1, 0)
394 #define RCC_HSICFGR_HSITRIM_SHIFT	8
395 #define RCC_HSICFGR_HSITRIM_MASK	GENMASK(14, 8)
396 #define RCC_HSICFGR_HSICAL_SHIFT	16
397 #define RCC_HSICFGR_HSICAL_MASK		GENMASK(27, 16)
398 
399 /* Fields of RCC_CSICFGR register */
400 #define RCC_CSICFGR_CSITRIM_SHIFT	8
401 #define RCC_CSICFGR_CSITRIM_MASK	GENMASK(12, 8)
402 #define RCC_CSICFGR_CSICAL_SHIFT	16
403 #define RCC_CSICFGR_CSICAL_MASK		GENMASK(23, 16)
404 
405 /* Used for RCC_MCO related operations */
406 #define RCC_MCOCFG_MCOON		BIT(12)
407 #define RCC_MCOCFG_MCODIV_MASK		GENMASK(7, 4)
408 #define RCC_MCOCFG_MCODIV_SHIFT		4
409 #define RCC_MCOCFG_MCOSRC_MASK		GENMASK(2, 0)
410 
411 /* Fields of RCC_DBGCFGR register */
412 #define RCC_DBGCFGR_DBGCKEN		BIT(8)
413 
414 /* RCC register fields for reset reasons */
415 #define RCC_MP_RSTSCLRR_PORRSTF		BIT(0)
416 #define RCC_MP_RSTSCLRR_BORRSTF		BIT(1)
417 #define RCC_MP_RSTSCLRR_PADRSTF		BIT(2)
418 #define RCC_MP_RSTSCLRR_HCSSRSTF	BIT(3)
419 #define RCC_MP_RSTSCLRR_VCORERSTF	BIT(4)
420 #define RCC_MP_RSTSCLRR_MPSYSRSTF	BIT(6)
421 #define RCC_MP_RSTSCLRR_MCSYSRSTF	BIT(7)
422 #define RCC_MP_RSTSCLRR_IWDG1RSTF	BIT(8)
423 #define RCC_MP_RSTSCLRR_IWDG2RSTF	BIT(9)
424 #define RCC_MP_RSTSCLRR_STDBYRSTF	BIT(11)
425 #define RCC_MP_RSTSCLRR_CSTDBYRSTF	BIT(12)
426 #define RCC_MP_RSTSCLRR_MPUP0RSTF	BIT(13)
427 #define RCC_MP_RSTSCLRR_MPUP1RSTF	BIT(14)
428 
429 /* Global Reset Register */
430 #define RCC_MP_GRSTCSETR_MPSYSRST	BIT(0)
431 #define RCC_MP_GRSTCSETR_MCURST		BIT(1)
432 #define RCC_MP_GRSTCSETR_MPUP0RST	BIT(4)
433 #define RCC_MP_GRSTCSETR_MPUP1RST	BIT(5)
434 
435 /* Clock Source Interrupt Flag Register */
436 #define RCC_MP_CIFR_MASK		U(0x110F1F)
437 #define RCC_MP_CIFR_LSIRDYF		BIT(0)
438 #define RCC_MP_CIFR_LSERDYF		BIT(1)
439 #define RCC_MP_CIFR_HSIRDYF		BIT(2)
440 #define RCC_MP_CIFR_HSERDYF		BIT(3)
441 #define RCC_MP_CIFR_CSIRDYF		BIT(4)
442 #define RCC_MP_CIFR_PLL1DYF		BIT(8)
443 #define RCC_MP_CIFR_PLL2DYF		BIT(9)
444 #define RCC_MP_CIFR_PLL3DYF		BIT(10)
445 #define RCC_MP_CIFR_PLL4DYF		BIT(11)
446 #define RCC_MP_CIFR_WKUPF		BIT(20)
447 
448 /* Stop Request Set Register */
449 #define RCC_MP_SREQSETR_STPREQ_P0	BIT(0)
450 #define RCC_MP_SREQSETR_STPREQ_P1	BIT(1)
451 
452 /* Stop Request Clear Register */
453 #define RCC_MP_SREQCLRR_STPREQ_P0	BIT(0)
454 #define RCC_MP_SREQCLRR_STPREQ_P1	BIT(1)
455 
456 /* Values of RCC_UART24CKSELR register */
457 #define RCC_UART24CKSELR_HSI		0x00000002
458 
459 /* Values of RCC_MP_APB1ENSETR register */
460 #define RCC_MP_APB1ENSETR_UART4EN	BIT(16)
461 
462 /* Values of RCC_MP_APB5ENSETR register */
463 #define RCC_MP_APB5ENSETR_SPI6EN	BIT(0)
464 #define RCC_MP_APB5ENSETR_I2C4EN	BIT(2)
465 #define RCC_MP_APB5ENSETR_I2C6EN	BIT(3)
466 #define RCC_MP_APB5ENSETR_USART1EN	BIT(4)
467 #define RCC_MP_APB5ENSETR_RTCAPBEN	BIT(8)
468 #define RCC_MP_APB5ENSETR_IWDG1APBEN	BIT(15)
469 
470 /* Values of RCC_MP_AHB4ENSETR register */
471 #define RCC_MP_AHB4ENSETR_GPIOGEN	BIT(6)
472 #define RCC_MP_AHB4ENSETR_GPIOHEN	BIT(7)
473 
474 /* Values of RCC_MP_AHB5ENSETR register */
475 #define RCC_MP_AHB5ENSETR_GPIOZEN	BIT(0)
476 #define RCC_MP_AHB5ENSETR_CRYP1EN	BIT(4)
477 #define RCC_MP_AHB5ENSETR_HASH1EN	BIT(5)
478 #define RCC_MP_AHB5ENSETR_RNG1EN	BIT(6)
479 
480 /* Values of RCC_MP_IWDGFZSETR register */
481 #define RCC_MP_IWDGFZSETR_IWDG1		BIT(0)
482 #define RCC_MP_IWDGFZSETR_IWDG2		BIT(1)
483 
484 /* Values of RCC_PWRLPDLYCR register */
485 #define RCC_PWRLPDLYCR_PWRLP_DLY_MASK	GENMASK(21, 0)
486 
487 /* RCC_ASSCKSELR register fields */
488 #define RCC_ASSCKSELR_AXISSRC_MASK		GENMASK(2, 0)
489 #define RCC_ASSCKSELR_AXISSRC_SHIFT		0
490 
491 /* RCC_MSSCKSELR register fields */
492 #define RCC_MSSCKSELR_MCUSSRC_MASK		GENMASK(1, 0)
493 #define RCC_MSSCKSELR_MCUSSRC_SHIFT		0
494 
495 /* RCC_I2C46CKSELR register fields */
496 #define RCC_I2C46CKSELR_I2C46SRC_MASK		GENMASK(2, 0)
497 #define RCC_I2C46CKSELR_I2C46SRC_SHIFT		0
498 
499 /* RCC_SPI6CKSELR register fields */
500 #define RCC_SPI6CKSELR_SPI6SRC_MASK		GENMASK(2, 0)
501 #define RCC_SPI6CKSELR_SPI6SRC_SHIFT		0
502 
503 /* RCC_UART1CKSELR register fields */
504 #define RCC_UART1CKSELR_UART1SRC_MASK		GENMASK(2, 0)
505 #define RCC_UART1CKSELR_UART1SRC_SHIFT		0
506 
507 /* RCC_RNG1CKSELR register fields */
508 #define RCC_RNG1CKSELR_RNG1SRC_MASK		GENMASK(1, 0)
509 #define RCC_RNG1CKSELR_RNG1SRC_SHIFT		0
510 
511 /* RCC_STGENCKSELR register fields */
512 #define RCC_STGENCKSELR_STGENSRC_MASK		GENMASK(1, 0)
513 #define RCC_STGENCKSELR_STGENSRC_SHIFT		0
514 
515 /* RCC_I2C12CKSELR register fields */
516 #define RCC_I2C12CKSELR_I2C12SRC_MASK		GENMASK(2, 0)
517 #define RCC_I2C12CKSELR_I2C12SRC_SHIFT		0
518 
519 /* RCC_I2C35CKSELR register fields */
520 #define RCC_I2C35CKSELR_I2C35SRC_MASK		GENMASK(2, 0)
521 #define RCC_I2C35CKSELR_I2C35SRC_SHIFT		0
522 
523 /* RCC_UART6CKSELR register fields */
524 #define RCC_UART6CKSELR_UART6SRC_MASK		GENMASK(2, 0)
525 #define RCC_UART6CKSELR_UART6SRC_SHIFT		0
526 
527 /* RCC_UART24CKSELR register fields */
528 #define RCC_UART24CKSELR_UART24SRC_MASK		GENMASK(2, 0)
529 #define RCC_UART24CKSELR_UART24SRC_SHIFT	0
530 
531 /* RCC_UART35CKSELR register fields */
532 #define RCC_UART35CKSELR_UART35SRC_MASK		GENMASK(2, 0)
533 #define RCC_UART35CKSELR_UART35SRC_SHIFT	0
534 
535 /* RCC_UART78CKSELR register fields */
536 #define RCC_UART78CKSELR_UART78SRC_MASK		GENMASK(2, 0)
537 #define RCC_UART78CKSELR_UART78SRC_SHIFT	0
538 
539 /* RCC_SDMMC12CKSELR register fields */
540 #define RCC_SDMMC12CKSELR_SDMMC12SRC_MASK	GENMASK(2, 0)
541 #define RCC_SDMMC12CKSELR_SDMMC12SRC_SHIFT	0
542 
543 /* RCC_SDMMC3CKSELR register fields */
544 #define RCC_SDMMC3CKSELR_SDMMC3SRC_MASK		GENMASK(2, 0)
545 #define RCC_SDMMC3CKSELR_SDMMC3SRC_SHIFT	0
546 
547 /* RCC_ETHCKSELR register fields */
548 #define RCC_ETHCKSELR_ETHSRC_MASK		GENMASK(1, 0)
549 #define RCC_ETHCKSELR_ETHSRC_SHIFT		0
550 
551 /* RCC_QSPICKSELR register fields */
552 #define RCC_QSPICKSELR_QSPISRC_MASK		GENMASK(1, 0)
553 #define RCC_QSPICKSELR_QSPISRC_SHIFT		0
554 
555 /* RCC_FMCCKSELR register fields */
556 #define RCC_FMCCKSELR_FMCSRC_MASK		GENMASK(1, 0)
557 #define RCC_FMCCKSELR_FMCSRC_SHIFT		0
558 
559 /* RCC_USBCKSELR register fields */
560 #define RCC_USBCKSELR_USBPHYSRC_MASK		GENMASK(1, 0)
561 #define RCC_USBCKSELR_USBPHYSRC_SHIFT		0
562 #define RCC_USBCKSELR_USBOSRC_MASK		BIT(4)
563 #define RCC_USBCKSELR_USBOSRC_SHIFT		4
564 
565 #endif /* STM32MP1_RCC_H */
566