-
Notifications
You must be signed in to change notification settings - Fork 2
/
mmio.inc
335 lines (327 loc) · 8.15 KB
/
mmio.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
.include "config.inc"
;;;
;;; GPIO MMIO
;;;
GPIO_BASE = 0x7e200000
GPIO_GPFSEL0 = 0x00 ; Function Select 0
GPIO_GPFSEL1 = 0x04 ; Function Select 1
GPIO_GPFSEL2 = 0x08 ; Function Select 2
GPIO_GPFSEL2 = 0x0c ; Function Select 3
GPIO_GPFSEL2 = 0x10 ; Function Select 4
GPIO_GPFSEL2 = 0x14 ; Function Select 5
GPIO_GPSET0 = 0x1c ; Pin Output Set 0
GPIO_GPSET1 = 0x20 ; Pin Output Set 1
GPIO_GPCLR0 = 0x28 ; Pin Output Clear 0
GPIO_GPCLR1 = 0x2c ; Pin Output Clear 1
GPIO_GPLEV0 = 0x34 ; Pin Level 0
GPIO_GPLEV1 = 0x38 ; Pin Level 1
GPIO_GPEDS0 = 0x40 ; Pin Event Detect Status 0
GPIO_GPEDS1 = 0x44 ; Pin Event Detect Status 1
GPIO_GPREN0 = 0x4c ; Pin Rising Edge Detect Enable 0
GPIO_GPREN1 = 0x50 ; Pin Rising Edge Detect Enable 1
GPIO_GPFEN0 = 0x58 ; Pin Falling Edge Detect Enable 0
GPIO_GPFEN1 = 0x5c ; Pin Falling Edge Detect Enable 1
GPIO_GPHEN0 = 0x64 ; Pin High Detect Enable 0
GPIO_GPHEN1 = 0x68 ; Pin High Detect Enable 1
GPIO_GPLEN0 = 0x70 ; Pin Low Detect Enable 0
GPIO_GPLEN1 = 0x74 ; Pin Low Detect Enable 1
GPIO_GPAREN0 = 0x7c ; Pin Async Rising Edge Detect 0
GPIO_GPAREN1 = 0x80 ; Pin Async Rising Edge Detect 1
GPIO_GPAFEN0 = 0x88 ; Pin Async Falling Edge Detect 0
GPIO_GPAFEN1 = 0x8c ; Pin Async Falling Edge Detect 1
GPIO_GPPUD = 0x94 ; Pin Pull-up/down Enable
GPIO_GPPUDCLK0 = 0x98 ; Pin Pull-up/down Enable Clock 0
GPIO_GPPUDCLK0 = 0x9c ; Pin Pull-up/down Enable Clock 1
;;;
;;; UART1 MMIO
;;;
UART1_BASE = 0x7e215000
UART_AUX_IRQ = 0x00
UART_AUX_ENABLES = 0x04
UART_AUX_MU_IO_REG = 0x40
UART_AUX_MU_IER_REG = 0x44
UART_AUX_MU_IIR_REG = 0x48
UART_AUX_MU_LCR_REG = 0x4C
UART_AUX_MU_MCR_REG = 0x50
UART_AUX_MU_LSR_REG = 0x54
UART_AUX_MU_MSR_REG = 0x58
UART_AUX_MU_SCRATCH = 0x5C
UART_AUX_MU_CNTL_REG = 0x60
UART_AUX_MU_STAT_REG = 0x64
UART_AUX_MU_BAUD_REG = 0x68
;;;
;;; OTP MMIO
;;;
OTP_BASE = 0x7e20f000
OTP_BOOTMODE_REG = 0x00
OTP_CONFIG_REG = 0x04
OTP_CTRL_LO_REG = 0x08
OTP_CTRL_HI_REG = 0x0c
OTP_STATUS_REG = 0x10
OTP_BITSEL_REG = 0x14
OTP_DATA_REG = 0x18
OTP_ADDR_REG = 0x1c
OTP_WRITE_DATA_READ_REG = 0x20
OTP_INIT_STATUS_REG = 0x24
.if RPI_MODEL < 4
OTP_STAT_CMD_DONE_BIT = 0
.else
OTP_STAT_CMD_DONE_BIT = 1
.endif
;;;
;;; APB-to-wtap control
;;;
A2W_BASE = 0x7e102000
A2WR_BASE = 0x7e102800
A2W_PLLA_DIG0 = 0x000
A2W_PLLA_DIG1 = 0x004
A2W_PLLA_DIG2 = 0x008
A2W_PLLA_DIG3 = 0x00c
A2W_PLLA_ANA0 = 0x010
A2W_PLLA_ANA1 = 0x014
A2W_PLLA_ANA2 = 0x018
A2W_PLLA_ANA3 = 0x01c
A2W_PLLC_DIG0 = 0x020
A2W_PLLC_DIG1 = 0x024
A2W_PLLC_DIG2 = 0x028
A2W_PLLC_DIG3 = 0x02c
A2W_PLLC_ANA0 = 0x030
A2W_PLLC_ANA1 = 0x034
A2W_PLLC_ANA2 = 0x038
A2W_PLLC_ANA3 = 0x03c
A2W_PLLD_DIG0 = 0x040
A2W_PLLD_DIG1 = 0x044
A2W_PLLD_DIG2 = 0x048
A2W_PLLD_DIG3 = 0x04c
A2W_PLLD_ANA0 = 0x050
A2W_PLLD_ANA1 = 0x054
A2W_PLLD_ANA2 = 0x058
A2W_PLLD_ANA3 = 0x05c
A2W_PLLH_DIG0 = 0x060
A2W_PLLH_DIG1 = 0x064
A2W_PLLH_DIG2 = 0x068
A2W_PLLH_DIG3 = 0x06c
A2W_PLLH_ANA0 = 0x070
A2W_PLLH_ANA1 = 0x074
A2W_PLLH_ANA2 = 0x078
A2W_PLLH_ANA3 = 0x07c
A2W_HDMI_CTL0 = 0x080
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EN = 0x280
A2W_XOSC_CPR = 0x290
A2W_SMPS_A_VOLTS = 0x2a0
A2W_SMPS_C_CTL = 0x2c0
A2W_SMPS_L_SPA = 0x2d0
A2W_PLLB_FRAC = 0x2e0
A2W_PLLB_ANA_SSCL = 0x2f0
A2W_PLLA_DSI0 = 0x300
A2W_PLLA_ANA_KAIP = 0x310
A2W_PLLC_CORE2 = 0x320
A2W_PLLC_ANA_KAIP = 0x330
A2W_PLLD_DSI0 = 0x340
A2W_PLLD_ANA_KAIP = 0x350
A2W_PLLH_AUX = 0x360
A2W_PLLH_ANA_KAIP = 0x370
A2W_XOSC_BIAS = 0x390
A2W_SMPS_A_GAIN = 0x3a0
A2W_SMPS_L_SCV = 0x3d0
A2W_PLLB_ARM = 0x3e0
A2W_PLLB_ANA_KAIP = 0x3f0
A2W_PLLA_CORE = 0x400
A2W_PLLA_ANA_STAT = 0x410
A2W_PLLC_CORE1 = 0x420
A2W_PLLC_ANA_STAT = 0x430
A2W_PLLD_CORE = 0x440
A2W_PLLD_ANA_STAT = 0x450
A2W_PLLH_RCAL = 0x460
A2W_XOSC_PWR = 0x490
A2W_SMPS_L_SCA = 0x4d0
A2W_PLLB_SP0 = 0x4e0
A2W_PLLB_ANA_STAT = 0x4f0
A2W_PLLA_PER = 0x500
A2W_PLLA_ANA_SCTL = 0x510
A2W_PLLC_PER = 0x520
A2W_PLLC_ANA_SCTL = 0x530
A2W_PLLD_PER = 0x540
A2W_PLLD_ANA_SCTL = 0x550
A2W_PLLH_PIX = 0x560
A2W_PLLH_ANA_SCTL = 0x570
A2W_SMPS_L_SIV = 0x5d0
A2W_PLLB_SP1 = 0x5e0
A2W_PLLB_ANA_SCTL = 0x5f0
A2W_PLLA_CCP2 = 0x600
A2W_PLLA_ANA_VCO = 0x610
A2W_PLLC_CORE0 = 0x620
A2W_PLLC_ANA_VCO = 0x630
A2W_PLLD_DSI1 = 0x640
A2W_PLLD_ANA_VCO = 0x650
A2W_PLLH_ANA_STAT = 0x660
A2W_PLLH_ANA_VCO = 0x670
A2W_SMPS_L_SIA = 0x6d0
A2W_PLLB_SP2 = 0x6e0
A2W_PLLB_ANA_VCO = 0x6f0
A2W_PLLA_MULTI = 0xf00
A2W_PLLA_ANA_MULTI = 0xf10
A2W_PLLC_MULTI = 0xf20
A2W_PLLC_ANA_MULTI = 0xf30
A2W_PLLD_MULTI = 0xf40
A2W_PLLD_ANA_MULTI = 0xf50
A2W_PLLH_MULTI = 0xf60
A2W_PLLH_ANA_MULTI = 0xf70
A2W_HDMI_CTL_MULTI = 0xf80
A2W_XOSC_MULTI = 0xf90
A2W_SMPS_A_MULTI = 0xfa0
A2W_SMPS_B_MULTI = 0xfb0
A2W_SMPS_C_MULTI = 0xfc0
A2W_SMPS_L_MULTI = 0xfd0
A2W_PLLB_MULTI = 0xfe0
A2W_PLLB_ANA_MULTI = 0xff0
;;;
;;; Clock Manager
;;;
CM_BASE = 0x7e101000
CM_GNRICCTL = 0x000
CM_GNRICDIV = 0x004
CM_VPUCTL = 0x008
CM_VPUDIV = 0x00c
CM_SYSCTL = 0x010
CM_SYSDIV = 0x014
CM_PERIACTL = 0x018
CM_PERIADIV = 0x01c
CM_PERIICTL = 0x020
CM_PERIIDIV = 0x024
CM_H264CTL = 0x028
CM_H264DIV = 0x02c
CM_ISPCTL = 0x030
CM_ISPDIV = 0x034
CM_V3DCTL = 0x038
CM_V3DDIV = 0x03c
CM_CAM0CTL = 0x040
CM_CAM0DIV = 0x044
CM_CAM1CTL = 0x048
CM_CAM1DIV = 0x04c
CM_CCP2CTL = 0x050
CM_CCP2DIV = 0x054
CM_DSI0ECTL = 0x058
CM_DSI0EDIV = 0x05c
CM_DSI0PCTL = 0x060
CM_DSI0PDIV = 0x064
CM_DPICTL = 0x068
CM_DPIDIV = 0x06c
CM_GP0CTL = 0x070
CM_GP0DIV = 0x074
CM_GP1CTL = 0x078
CM_GP1DIV = 0x07c
CM_GP2CTL = 0x080
CM_GP2DIV = 0x084
CM_HSMCTL = 0x088
CM_HSMDIV = 0x08c
CM_OTPCTL = 0x090
CM_OTPDIV = 0x094
CM_PCMCTL = 0x098
CM_PCMDIV = 0x09c
CM_PWMCTL = 0x0a0
CM_PWMDIV = 0x0a4
CM_SLIMCTL = 0x0a8
CM_SLIMDIV = 0x0ac
CM_SMICTL = 0x0b0
CM_SMIDIV = 0x0b4
CM_TCNTCTL = 0x0c0
CM_TCNTCNT = 0x0c4
CM_TECCTL = 0x0c8
CM_TECDIV = 0x0cc
CM_TD0CTL = 0x0d0
CM_TD0DIV = 0x0d4
CM_TD1CTL = 0x0d8
CM_TD1DIV = 0x0dc
CM_TSENSCTL = 0x0e0
CM_TSENSDIV = 0x0e4
CM_TIMERCTL = 0x0e8
CM_TIMERDIV = 0x0ec
CM_UARTCTL = 0x0f0
CM_UARTDIV = 0x0f4
CM_VECCTL = 0x0f8
CM_VECDIV = 0x0fc
CM_OSCCOUNT = 0x100
CM_PLLA = 0x104
CM_PLLC = 0x108
CM_PLLD = 0x10c
CM_PLLH = 0x110
CM_LOCK = 0x114
CM_EVENT = 0x118
CM_INTEN = 0x11c
CM_DSI0HSCK = 0x120
CM_CKSM = 0x124
CM_OSCFREQI = 0x128
CM_OSCFREQF = 0x12c
CM_PLLTCTL = 0x130
CM_PLLTCNT0 = 0x134
CM_PLLTCNT1 = 0x138
CM_PLLTCNT2 = 0x13c
CM_PLLTCNT3 = 0x140
CM_TDCLKEN = 0x144
CM_BURSTCTL = 0x148
CM_BURSTCNT = 0x14c
CM_DSI1ECTL = 0x158
CM_DSI1EDIV = 0x15c
CM_DSI1PCTL = 0x160
CM_DSI1PDIV = 0x164
CM_DFTCTL = 0x168
CM_DFTDIV = 0x16c
CM_PLLB = 0x170
CM_PULSECTL = 0x190
CM_PULSEDIV = 0x194
CM_SDCCTL = 0x1a8
CM_SDCDIV = 0x1ac
CM_ARMCTL = 0x1b0
CM_ARMDIV = 0x1b4
CM_AVEOCTL = 0x1b8
CM_AVEODIV = 0x1bc
CM_EMMCCTL = 0x1c0
CM_EMMCDIV = 0x1c4