1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
2344c8376SSimon Glass /*
3344c8376SSimon Glass  * Copyright (c) 2014 MundoReader S.L.
4344c8376SSimon Glass  * Author: Heiko Stuebner <heiko@sntech.de>
5344c8376SSimon Glass  */
6344c8376SSimon Glass 
7344c8376SSimon Glass /* core clocks */
8344c8376SSimon Glass #define PLL_APLL		1
9344c8376SSimon Glass #define PLL_DPLL		2
10344c8376SSimon Glass #define PLL_CPLL		3
11344c8376SSimon Glass #define PLL_GPLL		4
12344c8376SSimon Glass #define PLL_NPLL		5
13344c8376SSimon Glass #define ARMCLK			6
14344c8376SSimon Glass 
15344c8376SSimon Glass /* sclk gates (special clocks) */
16344c8376SSimon Glass #define SCLK_GPU		64
17344c8376SSimon Glass #define SCLK_SPI0		65
18344c8376SSimon Glass #define SCLK_SPI1		66
19344c8376SSimon Glass #define SCLK_SPI2		67
20344c8376SSimon Glass #define SCLK_SDMMC		68
21344c8376SSimon Glass #define SCLK_SDIO0		69
22344c8376SSimon Glass #define SCLK_SDIO1		70
23344c8376SSimon Glass #define SCLK_EMMC		71
24344c8376SSimon Glass #define SCLK_TSADC		72
25344c8376SSimon Glass #define SCLK_SARADC		73
26344c8376SSimon Glass #define SCLK_PS2C		74
27344c8376SSimon Glass #define SCLK_NANDC0		75
28344c8376SSimon Glass #define SCLK_NANDC1		76
29344c8376SSimon Glass #define SCLK_UART0		77
30344c8376SSimon Glass #define SCLK_UART1		78
31344c8376SSimon Glass #define SCLK_UART2		79
32344c8376SSimon Glass #define SCLK_UART3		80
33344c8376SSimon Glass #define SCLK_UART4		81
34344c8376SSimon Glass #define SCLK_I2S0		82
35344c8376SSimon Glass #define SCLK_SPDIF		83
36344c8376SSimon Glass #define SCLK_SPDIF8CH		84
37344c8376SSimon Glass #define SCLK_TIMER0		85
38344c8376SSimon Glass #define SCLK_TIMER1		86
39344c8376SSimon Glass #define SCLK_TIMER2		87
40344c8376SSimon Glass #define SCLK_TIMER3		88
41344c8376SSimon Glass #define SCLK_TIMER4		89
42344c8376SSimon Glass #define SCLK_TIMER5		90
43344c8376SSimon Glass #define SCLK_TIMER6		91
44344c8376SSimon Glass #define SCLK_HSADC		92
45344c8376SSimon Glass #define SCLK_OTGPHY0		93
46344c8376SSimon Glass #define SCLK_OTGPHY1		94
47344c8376SSimon Glass #define SCLK_OTGPHY2		95
48344c8376SSimon Glass #define SCLK_OTG_ADP		96
49344c8376SSimon Glass #define SCLK_HSICPHY480M	97
50344c8376SSimon Glass #define SCLK_HSICPHY12M		98
51344c8376SSimon Glass #define SCLK_MACREF		99
52344c8376SSimon Glass #define SCLK_LCDC_PWM0		100
53344c8376SSimon Glass #define SCLK_LCDC_PWM1		101
54344c8376SSimon Glass #define SCLK_MAC_RX		102
55344c8376SSimon Glass #define SCLK_MAC_TX		103
56344c8376SSimon Glass #define SCLK_EDP_24M		104
57344c8376SSimon Glass #define SCLK_EDP		105
58344c8376SSimon Glass #define SCLK_RGA		106
59344c8376SSimon Glass #define SCLK_ISP		107
60344c8376SSimon Glass #define SCLK_ISP_JPE		108
61344c8376SSimon Glass #define SCLK_HDMI_HDCP		109
62344c8376SSimon Glass #define SCLK_HDMI_CEC		110
63344c8376SSimon Glass #define SCLK_HEVC_CABAC		111
64344c8376SSimon Glass #define SCLK_HEVC_CORE		112
65344c8376SSimon Glass #define SCLK_I2S0_OUT		113
66344c8376SSimon Glass #define SCLK_SDMMC_DRV		114
67344c8376SSimon Glass #define SCLK_SDIO0_DRV		115
68344c8376SSimon Glass #define SCLK_SDIO1_DRV		116
69344c8376SSimon Glass #define SCLK_EMMC_DRV		117
70344c8376SSimon Glass #define SCLK_SDMMC_SAMPLE	118
71344c8376SSimon Glass #define SCLK_SDIO0_SAMPLE	119
72344c8376SSimon Glass #define SCLK_SDIO1_SAMPLE	120
73344c8376SSimon Glass #define SCLK_EMMC_SAMPLE	121
74344c8376SSimon Glass #define SCLK_USBPHY480M_SRC	122
75344c8376SSimon Glass #define SCLK_PVTM_CORE		123
76344c8376SSimon Glass #define SCLK_PVTM_GPU		124
77344c8376SSimon Glass 
7801c60eafSDavid Wu #define SCLK_MAC_PLL		150
79344c8376SSimon Glass #define SCLK_MAC		151
80344c8376SSimon Glass #define SCLK_MACREF_OUT		152
81344c8376SSimon Glass 
82344c8376SSimon Glass #define DCLK_VOP0		190
83344c8376SSimon Glass #define DCLK_VOP1		191
84344c8376SSimon Glass 
85344c8376SSimon Glass /* aclk gates */
86344c8376SSimon Glass #define ACLK_GPU		192
87344c8376SSimon Glass #define ACLK_DMAC1		193
88344c8376SSimon Glass #define ACLK_DMAC2		194
89344c8376SSimon Glass #define ACLK_MMU		195
90344c8376SSimon Glass #define ACLK_GMAC		196
91344c8376SSimon Glass #define ACLK_VOP0		197
92344c8376SSimon Glass #define ACLK_VOP1		198
93344c8376SSimon Glass #define ACLK_CRYPTO		199
94344c8376SSimon Glass #define ACLK_RGA		200
95344c8376SSimon Glass #define ACLK_RGA_NIU		201
96344c8376SSimon Glass #define ACLK_IEP		202
97344c8376SSimon Glass #define ACLK_VIO0_NIU		203
98344c8376SSimon Glass #define ACLK_VIP		204
99344c8376SSimon Glass #define ACLK_ISP		205
100344c8376SSimon Glass #define ACLK_VIO1_NIU		206
101344c8376SSimon Glass #define ACLK_HEVC		207
102344c8376SSimon Glass #define ACLK_VCODEC		208
103344c8376SSimon Glass #define ACLK_CPU		209
104344c8376SSimon Glass #define ACLK_PERI		210
105344c8376SSimon Glass 
106344c8376SSimon Glass /* pclk gates */
107344c8376SSimon Glass #define PCLK_GPIO0		320
108344c8376SSimon Glass #define PCLK_GPIO1		321
109344c8376SSimon Glass #define PCLK_GPIO2		322
110344c8376SSimon Glass #define PCLK_GPIO3		323
111344c8376SSimon Glass #define PCLK_GPIO4		324
112344c8376SSimon Glass #define PCLK_GPIO5		325
113344c8376SSimon Glass #define PCLK_GPIO6		326
114344c8376SSimon Glass #define PCLK_GPIO7		327
115344c8376SSimon Glass #define PCLK_GPIO8		328
116344c8376SSimon Glass #define PCLK_GRF		329
117344c8376SSimon Glass #define PCLK_SGRF		330
118344c8376SSimon Glass #define PCLK_PMU		331
119344c8376SSimon Glass #define PCLK_I2C0		332
120344c8376SSimon Glass #define PCLK_I2C1		333
121344c8376SSimon Glass #define PCLK_I2C2		334
122344c8376SSimon Glass #define PCLK_I2C3		335
123344c8376SSimon Glass #define PCLK_I2C4		336
124344c8376SSimon Glass #define PCLK_I2C5		337
125344c8376SSimon Glass #define PCLK_SPI0		338
126344c8376SSimon Glass #define PCLK_SPI1		339
127344c8376SSimon Glass #define PCLK_SPI2		340
128344c8376SSimon Glass #define PCLK_UART0		341
129344c8376SSimon Glass #define PCLK_UART1		342
130344c8376SSimon Glass #define PCLK_UART2		343
131344c8376SSimon Glass #define PCLK_UART3		344
132344c8376SSimon Glass #define PCLK_UART4		345
133344c8376SSimon Glass #define PCLK_TSADC		346
134344c8376SSimon Glass #define PCLK_SARADC		347
135344c8376SSimon Glass #define PCLK_SIM		348
136344c8376SSimon Glass #define PCLK_GMAC		349
137344c8376SSimon Glass #define PCLK_PWM		350
138344c8376SSimon Glass #define PCLK_RKPWM		351
139344c8376SSimon Glass #define PCLK_PS2C		352
140344c8376SSimon Glass #define PCLK_TIMER		353
141344c8376SSimon Glass #define PCLK_TZPC		354
142344c8376SSimon Glass #define PCLK_EDP_CTRL		355
143344c8376SSimon Glass #define PCLK_MIPI_DSI0		356
144344c8376SSimon Glass #define PCLK_MIPI_DSI1		357
145344c8376SSimon Glass #define PCLK_MIPI_CSI		358
146344c8376SSimon Glass #define PCLK_LVDS_PHY		359
147344c8376SSimon Glass #define PCLK_HDMI_CTRL		360
148344c8376SSimon Glass #define PCLK_VIO2_H2P		361
149344c8376SSimon Glass #define PCLK_CPU		362
150344c8376SSimon Glass #define PCLK_PERI		363
151344c8376SSimon Glass #define PCLK_DDRUPCTL0		364
152344c8376SSimon Glass #define PCLK_PUBL0		365
153344c8376SSimon Glass #define PCLK_DDRUPCTL1		366
154344c8376SSimon Glass #define PCLK_PUBL1		367
155344c8376SSimon Glass #define PCLK_WDT		368
156344c8376SSimon Glass 
157344c8376SSimon Glass /* hclk gates */
158344c8376SSimon Glass #define HCLK_GPS		448
159344c8376SSimon Glass #define HCLK_OTG0		449
160344c8376SSimon Glass #define HCLK_USBHOST0		450
161344c8376SSimon Glass #define HCLK_USBHOST1		451
162344c8376SSimon Glass #define HCLK_HSIC		452
163344c8376SSimon Glass #define HCLK_NANDC0		453
164344c8376SSimon Glass #define HCLK_NANDC1		454
165344c8376SSimon Glass #define HCLK_TSP		455
166344c8376SSimon Glass #define HCLK_SDMMC		456
167344c8376SSimon Glass #define HCLK_SDIO0		457
168344c8376SSimon Glass #define HCLK_SDIO1		458
169344c8376SSimon Glass #define HCLK_EMMC		459
170344c8376SSimon Glass #define HCLK_HSADC		460
171344c8376SSimon Glass #define HCLK_CRYPTO		461
172344c8376SSimon Glass #define HCLK_I2S0		462
173344c8376SSimon Glass #define HCLK_SPDIF		463
174344c8376SSimon Glass #define HCLK_SPDIF8CH		464
175344c8376SSimon Glass #define HCLK_VOP0		465
176344c8376SSimon Glass #define HCLK_VOP1		466
177344c8376SSimon Glass #define HCLK_ROM		467
178344c8376SSimon Glass #define HCLK_IEP		468
179344c8376SSimon Glass #define HCLK_ISP		469
180344c8376SSimon Glass #define HCLK_RGA		470
181344c8376SSimon Glass #define HCLK_VIO_AHB_ARBI	471
182344c8376SSimon Glass #define HCLK_VIO_NIU		472
183344c8376SSimon Glass #define HCLK_VIP		473
184344c8376SSimon Glass #define HCLK_VIO2_H2P		474
185344c8376SSimon Glass #define HCLK_HEVC		475
186344c8376SSimon Glass #define HCLK_VCODEC		476
187344c8376SSimon Glass #define HCLK_CPU		477
188344c8376SSimon Glass #define HCLK_PERI		478
189344c8376SSimon Glass 
190344c8376SSimon Glass #define CLK_NR_CLKS		(HCLK_PERI + 1)
191344c8376SSimon Glass 
192344c8376SSimon Glass /* soft-reset indices */
193344c8376SSimon Glass #define SRST_CORE0		0
194344c8376SSimon Glass #define SRST_CORE1		1
195344c8376SSimon Glass #define SRST_CORE2		2
196344c8376SSimon Glass #define SRST_CORE3		3
197344c8376SSimon Glass #define SRST_CORE0_PO		4
198344c8376SSimon Glass #define SRST_CORE1_PO		5
199344c8376SSimon Glass #define SRST_CORE2_PO		6
200344c8376SSimon Glass #define SRST_CORE3_PO		7
201344c8376SSimon Glass #define SRST_PDCORE_STRSYS	8
202344c8376SSimon Glass #define SRST_PDBUS_STRSYS	9
203344c8376SSimon Glass #define SRST_L2C		10
204344c8376SSimon Glass #define SRST_TOPDBG		11
205344c8376SSimon Glass #define SRST_CORE0_DBG		12
206344c8376SSimon Glass #define SRST_CORE1_DBG		13
207344c8376SSimon Glass #define SRST_CORE2_DBG		14
208344c8376SSimon Glass #define SRST_CORE3_DBG		15
209344c8376SSimon Glass 
210344c8376SSimon Glass #define SRST_PDBUG_AHB_ARBITOR	16
211344c8376SSimon Glass #define SRST_EFUSE256		17
212344c8376SSimon Glass #define SRST_DMAC1		18
213344c8376SSimon Glass #define SRST_INTMEM		19
214344c8376SSimon Glass #define SRST_ROM		20
215344c8376SSimon Glass #define SRST_SPDIF8CH		21
216344c8376SSimon Glass #define SRST_TIMER		22
217344c8376SSimon Glass #define SRST_I2S0		23
218344c8376SSimon Glass #define SRST_SPDIF		24
219344c8376SSimon Glass #define SRST_TIMER0		25
220344c8376SSimon Glass #define SRST_TIMER1		26
221344c8376SSimon Glass #define SRST_TIMER2		27
222344c8376SSimon Glass #define SRST_TIMER3		28
223344c8376SSimon Glass #define SRST_TIMER4		29
224344c8376SSimon Glass #define SRST_TIMER5		30
225344c8376SSimon Glass #define SRST_EFUSE		31
226344c8376SSimon Glass 
227344c8376SSimon Glass #define SRST_GPIO0		32
228344c8376SSimon Glass #define SRST_GPIO1		33
229344c8376SSimon Glass #define SRST_GPIO2		34
230344c8376SSimon Glass #define SRST_GPIO3		35
231344c8376SSimon Glass #define SRST_GPIO4		36
232344c8376SSimon Glass #define SRST_GPIO5		37
233344c8376SSimon Glass #define SRST_GPIO6		38
234344c8376SSimon Glass #define SRST_GPIO7		39
235344c8376SSimon Glass #define SRST_GPIO8		40
236344c8376SSimon Glass #define SRST_I2C0		42
237344c8376SSimon Glass #define SRST_I2C1		43
238344c8376SSimon Glass #define SRST_I2C2		44
239344c8376SSimon Glass #define SRST_I2C3		45
240344c8376SSimon Glass #define SRST_I2C4		46
241344c8376SSimon Glass #define SRST_I2C5		47
242344c8376SSimon Glass 
243344c8376SSimon Glass #define SRST_DWPWM		48
244344c8376SSimon Glass #define SRST_MMC_PERI		49
245344c8376SSimon Glass #define SRST_PERIPH_MMU		50
246344c8376SSimon Glass #define SRST_DAP		51
247344c8376SSimon Glass #define SRST_DAP_SYS		52
248344c8376SSimon Glass #define SRST_TPIU		53
249344c8376SSimon Glass #define SRST_PMU_APB		54
250344c8376SSimon Glass #define SRST_GRF		55
251344c8376SSimon Glass #define SRST_PMU		56
252344c8376SSimon Glass #define SRST_PERIPH_AXI		57
253344c8376SSimon Glass #define SRST_PERIPH_AHB		58
254344c8376SSimon Glass #define SRST_PERIPH_APB		59
255344c8376SSimon Glass #define SRST_PERIPH_NIU		60
256344c8376SSimon Glass #define SRST_PDPERI_AHB_ARBI	61
257344c8376SSimon Glass #define SRST_EMEM		62
258344c8376SSimon Glass #define SRST_USB_PERI		63
259344c8376SSimon Glass 
260344c8376SSimon Glass #define SRST_DMAC2		64
261344c8376SSimon Glass #define SRST_MAC		66
262344c8376SSimon Glass #define SRST_GPS		67
263344c8376SSimon Glass #define SRST_RKPWM		69
264344c8376SSimon Glass #define SRST_CCP		71
265344c8376SSimon Glass #define SRST_USBHOST0		72
266344c8376SSimon Glass #define SRST_HSIC		73
267344c8376SSimon Glass #define SRST_HSIC_AUX		74
268344c8376SSimon Glass #define SRST_HSIC_PHY		75
269344c8376SSimon Glass #define SRST_HSADC		76
270344c8376SSimon Glass #define SRST_NANDC0		77
271344c8376SSimon Glass #define SRST_NANDC1		78
272344c8376SSimon Glass 
273344c8376SSimon Glass #define SRST_TZPC		80
274344c8376SSimon Glass #define SRST_SPI0		83
275344c8376SSimon Glass #define SRST_SPI1		84
276344c8376SSimon Glass #define SRST_SPI2		85
277344c8376SSimon Glass #define SRST_SARADC		87
278344c8376SSimon Glass #define SRST_PDALIVE_NIU	88
279344c8376SSimon Glass #define SRST_PDPMU_INTMEM	89
280344c8376SSimon Glass #define SRST_PDPMU_NIU		90
281344c8376SSimon Glass #define SRST_SGRF		91
282344c8376SSimon Glass 
283344c8376SSimon Glass #define SRST_VIO_ARBI		96
284344c8376SSimon Glass #define SRST_RGA_NIU		97
285344c8376SSimon Glass #define SRST_VIO0_NIU_AXI	98
286344c8376SSimon Glass #define SRST_VIO_NIU_AHB	99
287344c8376SSimon Glass #define SRST_LCDC0_AXI		100
288344c8376SSimon Glass #define SRST_LCDC0_AHB		101
289344c8376SSimon Glass #define SRST_LCDC0_DCLK		102
290344c8376SSimon Glass #define SRST_VIO1_NIU_AXI	103
291344c8376SSimon Glass #define SRST_VIP		104
292344c8376SSimon Glass #define SRST_RGA_CORE		105
293344c8376SSimon Glass #define SRST_IEP_AXI		106
294344c8376SSimon Glass #define SRST_IEP_AHB		107
295344c8376SSimon Glass #define SRST_RGA_AXI		108
296344c8376SSimon Glass #define SRST_RGA_AHB		109
297344c8376SSimon Glass #define SRST_ISP		110
298344c8376SSimon Glass #define SRST_EDP		111
299344c8376SSimon Glass 
300344c8376SSimon Glass #define SRST_VCODEC_AXI		112
301344c8376SSimon Glass #define SRST_VCODEC_AHB		113
302344c8376SSimon Glass #define SRST_VIO_H2P		114
303344c8376SSimon Glass #define SRST_MIPIDSI0		115
304344c8376SSimon Glass #define SRST_MIPIDSI1		116
305344c8376SSimon Glass #define SRST_MIPICSI		117
306344c8376SSimon Glass #define SRST_LVDS_PHY		118
307344c8376SSimon Glass #define SRST_LVDS_CON		119
308344c8376SSimon Glass #define SRST_GPU		120
309344c8376SSimon Glass #define SRST_HDMI		121
310344c8376SSimon Glass #define SRST_CORE_PVTM		124
311344c8376SSimon Glass #define SRST_GPU_PVTM		125
312344c8376SSimon Glass 
313344c8376SSimon Glass #define SRST_MMC0		128
314344c8376SSimon Glass #define SRST_SDIO0		129
315344c8376SSimon Glass #define SRST_SDIO1		130
316344c8376SSimon Glass #define SRST_EMMC		131
317344c8376SSimon Glass #define SRST_USBOTG_AHB		132
318344c8376SSimon Glass #define SRST_USBOTG_PHY		133
319344c8376SSimon Glass #define SRST_USBOTG_CON		134
320344c8376SSimon Glass #define SRST_USBHOST0_AHB	135
321344c8376SSimon Glass #define SRST_USBHOST0_PHY	136
322344c8376SSimon Glass #define SRST_USBHOST0_CON	137
323344c8376SSimon Glass #define SRST_USBHOST1_AHB	138
324344c8376SSimon Glass #define SRST_USBHOST1_PHY	139
325344c8376SSimon Glass #define SRST_USBHOST1_CON	140
326344c8376SSimon Glass #define SRST_USB_ADP		141
327344c8376SSimon Glass #define SRST_ACC_EFUSE		142
328344c8376SSimon Glass 
329344c8376SSimon Glass #define SRST_CORESIGHT		144
330344c8376SSimon Glass #define SRST_PD_CORE_AHB_NOC	145
331344c8376SSimon Glass #define SRST_PD_CORE_APB_NOC	146
332344c8376SSimon Glass #define SRST_PD_CORE_MP_AXI	147
333344c8376SSimon Glass #define SRST_GIC		148
334344c8376SSimon Glass #define SRST_LCDC_PWM0		149
335344c8376SSimon Glass #define SRST_LCDC_PWM1		150
336344c8376SSimon Glass #define SRST_VIO0_H2P_BRG	151
337344c8376SSimon Glass #define SRST_VIO1_H2P_BRG	152
338344c8376SSimon Glass #define SRST_RGA_H2P_BRG	153
339344c8376SSimon Glass #define SRST_HEVC		154
340344c8376SSimon Glass #define SRST_TSADC		159
341344c8376SSimon Glass 
342344c8376SSimon Glass #define SRST_DDRPHY0		160
343344c8376SSimon Glass #define SRST_DDRPHY0_APB	161
344344c8376SSimon Glass #define SRST_DDRCTRL0		162
345344c8376SSimon Glass #define SRST_DDRCTRL0_APB	163
346344c8376SSimon Glass #define SRST_DDRPHY0_CTRL	164
347344c8376SSimon Glass #define SRST_DDRPHY1		165
348344c8376SSimon Glass #define SRST_DDRPHY1_APB	166
349344c8376SSimon Glass #define SRST_DDRCTRL1		167
350344c8376SSimon Glass #define SRST_DDRCTRL1_APB	168
351344c8376SSimon Glass #define SRST_DDRPHY1_CTRL	169
352344c8376SSimon Glass #define SRST_DDRMSCH0		170
353344c8376SSimon Glass #define SRST_DDRMSCH1		171
354344c8376SSimon Glass #define SRST_CRYPTO		174
355344c8376SSimon Glass #define SRST_C2C_HOST		175
356344c8376SSimon Glass 
357344c8376SSimon Glass #define SRST_LCDC1_AXI		176
358344c8376SSimon Glass #define SRST_LCDC1_AHB		177
359344c8376SSimon Glass #define SRST_LCDC1_DCLK		178
360344c8376SSimon Glass #define SRST_UART0		179
361344c8376SSimon Glass #define SRST_UART1		180
362344c8376SSimon Glass #define SRST_UART2		181
363344c8376SSimon Glass #define SRST_UART3		182
364344c8376SSimon Glass #define SRST_UART4		183
365344c8376SSimon Glass #define SRST_SIMC		186
366344c8376SSimon Glass #define SRST_PS2C		187
367344c8376SSimon Glass #define SRST_TSP		188
368344c8376SSimon Glass #define SRST_TSP_CLKIN0		189
369344c8376SSimon Glass #define SRST_TSP_CLKIN1		190
370344c8376SSimon Glass #define SRST_TSP_27M		191
371