1 // THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2 
3 /**
4  * Copyright (c) 2024 Raspberry Pi Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 // =============================================================================
9 // Register block : ROSC
10 // Version        : 1
11 // Bus type       : apb
12 // =============================================================================
13 #ifndef _HARDWARE_REGS_ROSC_H
14 #define _HARDWARE_REGS_ROSC_H
15 // =============================================================================
16 // Register    : ROSC_CTRL
17 // Description : Ring Oscillator control
18 #define ROSC_CTRL_OFFSET _u(0x00000000)
19 #define ROSC_CTRL_BITS   _u(0x00ffffff)
20 #define ROSC_CTRL_RESET  _u(0x00000aa0)
21 // -----------------------------------------------------------------------------
22 // Field       : ROSC_CTRL_ENABLE
23 // Description : On power-up this field is initialised to ENABLE
24 //               The system clock must be switched to another source before
25 //               setting this field to DISABLE otherwise the chip will lock up
26 //               The 12-bit code is intended to give some protection against
27 //               accidental writes. An invalid setting will enable the
28 //               oscillator.
29 //               0xd1e -> DISABLE
30 //               0xfab -> ENABLE
31 #define ROSC_CTRL_ENABLE_RESET  "-"
32 #define ROSC_CTRL_ENABLE_BITS   _u(0x00fff000)
33 #define ROSC_CTRL_ENABLE_MSB    _u(23)
34 #define ROSC_CTRL_ENABLE_LSB    _u(12)
35 #define ROSC_CTRL_ENABLE_ACCESS "RW"
36 #define ROSC_CTRL_ENABLE_VALUE_DISABLE _u(0xd1e)
37 #define ROSC_CTRL_ENABLE_VALUE_ENABLE _u(0xfab)
38 // -----------------------------------------------------------------------------
39 // Field       : ROSC_CTRL_FREQ_RANGE
40 // Description : Controls the number of delay stages in the ROSC ring
41 //               LOW uses stages 0 to 7
42 //               MEDIUM uses stages 2 to 7
43 //               HIGH uses stages 4 to 7
44 //               TOOHIGH uses stages 6 to 7 and should not be used because its
45 //               frequency exceeds design specifications
46 //               The clock output will not glitch when changing the range up one
47 //               step at a time
48 //               The clock output will glitch when changing the range down
49 //               Note: the values here are gray coded which is why HIGH comes
50 //               before TOOHIGH
51 //               0xfa4 -> LOW
52 //               0xfa5 -> MEDIUM
53 //               0xfa7 -> HIGH
54 //               0xfa6 -> TOOHIGH
55 #define ROSC_CTRL_FREQ_RANGE_RESET  _u(0xaa0)
56 #define ROSC_CTRL_FREQ_RANGE_BITS   _u(0x00000fff)
57 #define ROSC_CTRL_FREQ_RANGE_MSB    _u(11)
58 #define ROSC_CTRL_FREQ_RANGE_LSB    _u(0)
59 #define ROSC_CTRL_FREQ_RANGE_ACCESS "RW"
60 #define ROSC_CTRL_FREQ_RANGE_VALUE_LOW _u(0xfa4)
61 #define ROSC_CTRL_FREQ_RANGE_VALUE_MEDIUM _u(0xfa5)
62 #define ROSC_CTRL_FREQ_RANGE_VALUE_HIGH _u(0xfa7)
63 #define ROSC_CTRL_FREQ_RANGE_VALUE_TOOHIGH _u(0xfa6)
64 // =============================================================================
65 // Register    : ROSC_FREQA
66 // Description : The FREQA & FREQB registers control the frequency by
67 //               controlling the drive strength of each stage
68 //               The drive strength has 4 levels determined by the number of
69 //               bits set
70 //               Increasing the number of bits set increases the drive strength
71 //               and increases the oscillation frequency
72 //               0 bits set is the default drive strength
73 //               1 bit set doubles the drive strength
74 //               2 bits set triples drive strength
75 //               3 bits set quadruples drive strength
76 //               For frequency randomisation set both DS0_RANDOM=1 &
77 //               DS1_RANDOM=1
78 #define ROSC_FREQA_OFFSET _u(0x00000004)
79 #define ROSC_FREQA_BITS   _u(0xffff77ff)
80 #define ROSC_FREQA_RESET  _u(0x00000000)
81 // -----------------------------------------------------------------------------
82 // Field       : ROSC_FREQA_PASSWD
83 // Description : Set to 0x9696 to apply the settings
84 //               Any other value in this field will set all drive strengths to 0
85 //               0x9696 -> PASS
86 #define ROSC_FREQA_PASSWD_RESET  _u(0x0000)
87 #define ROSC_FREQA_PASSWD_BITS   _u(0xffff0000)
88 #define ROSC_FREQA_PASSWD_MSB    _u(31)
89 #define ROSC_FREQA_PASSWD_LSB    _u(16)
90 #define ROSC_FREQA_PASSWD_ACCESS "RW"
91 #define ROSC_FREQA_PASSWD_VALUE_PASS _u(0x9696)
92 // -----------------------------------------------------------------------------
93 // Field       : ROSC_FREQA_DS3
94 // Description : Stage 3 drive strength
95 #define ROSC_FREQA_DS3_RESET  _u(0x0)
96 #define ROSC_FREQA_DS3_BITS   _u(0x00007000)
97 #define ROSC_FREQA_DS3_MSB    _u(14)
98 #define ROSC_FREQA_DS3_LSB    _u(12)
99 #define ROSC_FREQA_DS3_ACCESS "RW"
100 // -----------------------------------------------------------------------------
101 // Field       : ROSC_FREQA_DS2
102 // Description : Stage 2 drive strength
103 #define ROSC_FREQA_DS2_RESET  _u(0x0)
104 #define ROSC_FREQA_DS2_BITS   _u(0x00000700)
105 #define ROSC_FREQA_DS2_MSB    _u(10)
106 #define ROSC_FREQA_DS2_LSB    _u(8)
107 #define ROSC_FREQA_DS2_ACCESS "RW"
108 // -----------------------------------------------------------------------------
109 // Field       : ROSC_FREQA_DS1_RANDOM
110 // Description : Randomises the stage 1 drive strength
111 #define ROSC_FREQA_DS1_RANDOM_RESET  _u(0x0)
112 #define ROSC_FREQA_DS1_RANDOM_BITS   _u(0x00000080)
113 #define ROSC_FREQA_DS1_RANDOM_MSB    _u(7)
114 #define ROSC_FREQA_DS1_RANDOM_LSB    _u(7)
115 #define ROSC_FREQA_DS1_RANDOM_ACCESS "RW"
116 // -----------------------------------------------------------------------------
117 // Field       : ROSC_FREQA_DS1
118 // Description : Stage 1 drive strength
119 #define ROSC_FREQA_DS1_RESET  _u(0x0)
120 #define ROSC_FREQA_DS1_BITS   _u(0x00000070)
121 #define ROSC_FREQA_DS1_MSB    _u(6)
122 #define ROSC_FREQA_DS1_LSB    _u(4)
123 #define ROSC_FREQA_DS1_ACCESS "RW"
124 // -----------------------------------------------------------------------------
125 // Field       : ROSC_FREQA_DS0_RANDOM
126 // Description : Randomises the stage 0 drive strength
127 #define ROSC_FREQA_DS0_RANDOM_RESET  _u(0x0)
128 #define ROSC_FREQA_DS0_RANDOM_BITS   _u(0x00000008)
129 #define ROSC_FREQA_DS0_RANDOM_MSB    _u(3)
130 #define ROSC_FREQA_DS0_RANDOM_LSB    _u(3)
131 #define ROSC_FREQA_DS0_RANDOM_ACCESS "RW"
132 // -----------------------------------------------------------------------------
133 // Field       : ROSC_FREQA_DS0
134 // Description : Stage 0 drive strength
135 #define ROSC_FREQA_DS0_RESET  _u(0x0)
136 #define ROSC_FREQA_DS0_BITS   _u(0x00000007)
137 #define ROSC_FREQA_DS0_MSB    _u(2)
138 #define ROSC_FREQA_DS0_LSB    _u(0)
139 #define ROSC_FREQA_DS0_ACCESS "RW"
140 // =============================================================================
141 // Register    : ROSC_FREQB
142 // Description : For a detailed description see freqa register
143 #define ROSC_FREQB_OFFSET _u(0x00000008)
144 #define ROSC_FREQB_BITS   _u(0xffff7777)
145 #define ROSC_FREQB_RESET  _u(0x00000000)
146 // -----------------------------------------------------------------------------
147 // Field       : ROSC_FREQB_PASSWD
148 // Description : Set to 0x9696 to apply the settings
149 //               Any other value in this field will set all drive strengths to 0
150 //               0x9696 -> PASS
151 #define ROSC_FREQB_PASSWD_RESET  _u(0x0000)
152 #define ROSC_FREQB_PASSWD_BITS   _u(0xffff0000)
153 #define ROSC_FREQB_PASSWD_MSB    _u(31)
154 #define ROSC_FREQB_PASSWD_LSB    _u(16)
155 #define ROSC_FREQB_PASSWD_ACCESS "RW"
156 #define ROSC_FREQB_PASSWD_VALUE_PASS _u(0x9696)
157 // -----------------------------------------------------------------------------
158 // Field       : ROSC_FREQB_DS7
159 // Description : Stage 7 drive strength
160 #define ROSC_FREQB_DS7_RESET  _u(0x0)
161 #define ROSC_FREQB_DS7_BITS   _u(0x00007000)
162 #define ROSC_FREQB_DS7_MSB    _u(14)
163 #define ROSC_FREQB_DS7_LSB    _u(12)
164 #define ROSC_FREQB_DS7_ACCESS "RW"
165 // -----------------------------------------------------------------------------
166 // Field       : ROSC_FREQB_DS6
167 // Description : Stage 6 drive strength
168 #define ROSC_FREQB_DS6_RESET  _u(0x0)
169 #define ROSC_FREQB_DS6_BITS   _u(0x00000700)
170 #define ROSC_FREQB_DS6_MSB    _u(10)
171 #define ROSC_FREQB_DS6_LSB    _u(8)
172 #define ROSC_FREQB_DS6_ACCESS "RW"
173 // -----------------------------------------------------------------------------
174 // Field       : ROSC_FREQB_DS5
175 // Description : Stage 5 drive strength
176 #define ROSC_FREQB_DS5_RESET  _u(0x0)
177 #define ROSC_FREQB_DS5_BITS   _u(0x00000070)
178 #define ROSC_FREQB_DS5_MSB    _u(6)
179 #define ROSC_FREQB_DS5_LSB    _u(4)
180 #define ROSC_FREQB_DS5_ACCESS "RW"
181 // -----------------------------------------------------------------------------
182 // Field       : ROSC_FREQB_DS4
183 // Description : Stage 4 drive strength
184 #define ROSC_FREQB_DS4_RESET  _u(0x0)
185 #define ROSC_FREQB_DS4_BITS   _u(0x00000007)
186 #define ROSC_FREQB_DS4_MSB    _u(2)
187 #define ROSC_FREQB_DS4_LSB    _u(0)
188 #define ROSC_FREQB_DS4_ACCESS "RW"
189 // =============================================================================
190 // Register    : ROSC_RANDOM
191 // Description : Loads a value to the LFSR randomiser
192 #define ROSC_RANDOM_OFFSET _u(0x0000000c)
193 #define ROSC_RANDOM_BITS   _u(0xffffffff)
194 #define ROSC_RANDOM_RESET  _u(0x3f04b16d)
195 // -----------------------------------------------------------------------------
196 // Field       : ROSC_RANDOM_SEED
197 #define ROSC_RANDOM_SEED_RESET  _u(0x3f04b16d)
198 #define ROSC_RANDOM_SEED_BITS   _u(0xffffffff)
199 #define ROSC_RANDOM_SEED_MSB    _u(31)
200 #define ROSC_RANDOM_SEED_LSB    _u(0)
201 #define ROSC_RANDOM_SEED_ACCESS "RW"
202 // =============================================================================
203 // Register    : ROSC_DORMANT
204 // Description : Ring Oscillator pause control
205 //               This is used to save power by pausing the ROSC
206 //               On power-up this field is initialised to WAKE
207 //               An invalid write will also select WAKE
208 //               Warning: setup the irq before selecting dormant mode
209 //               0x636f6d61 -> dormant
210 //               0x77616b65 -> WAKE
211 #define ROSC_DORMANT_OFFSET _u(0x00000010)
212 #define ROSC_DORMANT_BITS   _u(0xffffffff)
213 #define ROSC_DORMANT_RESET  "-"
214 #define ROSC_DORMANT_MSB    _u(31)
215 #define ROSC_DORMANT_LSB    _u(0)
216 #define ROSC_DORMANT_ACCESS "RW"
217 #define ROSC_DORMANT_VALUE_DORMANT _u(0x636f6d61)
218 #define ROSC_DORMANT_VALUE_WAKE _u(0x77616b65)
219 // =============================================================================
220 // Register    : ROSC_DIV
221 // Description : Controls the output divider
222 //               set to 0xaa00 + div where
223 //               div = 0 divides by 128
224 //               div = 1-127 divides by div
225 //               any other value sets div=128
226 //               this register resets to div=32
227 //               0xaa00 -> PASS
228 #define ROSC_DIV_OFFSET _u(0x00000014)
229 #define ROSC_DIV_BITS   _u(0x0000ffff)
230 #define ROSC_DIV_RESET  "-"
231 #define ROSC_DIV_MSB    _u(15)
232 #define ROSC_DIV_LSB    _u(0)
233 #define ROSC_DIV_ACCESS "RW"
234 #define ROSC_DIV_VALUE_PASS _u(0xaa00)
235 // =============================================================================
236 // Register    : ROSC_PHASE
237 // Description : Controls the phase shifted output
238 #define ROSC_PHASE_OFFSET _u(0x00000018)
239 #define ROSC_PHASE_BITS   _u(0x00000fff)
240 #define ROSC_PHASE_RESET  _u(0x00000008)
241 // -----------------------------------------------------------------------------
242 // Field       : ROSC_PHASE_PASSWD
243 // Description : set to 0xaa
244 //               any other value enables the output with shift=0
245 #define ROSC_PHASE_PASSWD_RESET  _u(0x00)
246 #define ROSC_PHASE_PASSWD_BITS   _u(0x00000ff0)
247 #define ROSC_PHASE_PASSWD_MSB    _u(11)
248 #define ROSC_PHASE_PASSWD_LSB    _u(4)
249 #define ROSC_PHASE_PASSWD_ACCESS "RW"
250 // -----------------------------------------------------------------------------
251 // Field       : ROSC_PHASE_ENABLE
252 // Description : enable the phase-shifted output
253 //               this can be changed on-the-fly
254 #define ROSC_PHASE_ENABLE_RESET  _u(0x1)
255 #define ROSC_PHASE_ENABLE_BITS   _u(0x00000008)
256 #define ROSC_PHASE_ENABLE_MSB    _u(3)
257 #define ROSC_PHASE_ENABLE_LSB    _u(3)
258 #define ROSC_PHASE_ENABLE_ACCESS "RW"
259 // -----------------------------------------------------------------------------
260 // Field       : ROSC_PHASE_FLIP
261 // Description : invert the phase-shifted output
262 //               this is ignored when div=1
263 #define ROSC_PHASE_FLIP_RESET  _u(0x0)
264 #define ROSC_PHASE_FLIP_BITS   _u(0x00000004)
265 #define ROSC_PHASE_FLIP_MSB    _u(2)
266 #define ROSC_PHASE_FLIP_LSB    _u(2)
267 #define ROSC_PHASE_FLIP_ACCESS "RW"
268 // -----------------------------------------------------------------------------
269 // Field       : ROSC_PHASE_SHIFT
270 // Description : phase shift the phase-shifted output by SHIFT input clocks
271 //               this can be changed on-the-fly
272 //               must be set to 0 before setting div=1
273 #define ROSC_PHASE_SHIFT_RESET  _u(0x0)
274 #define ROSC_PHASE_SHIFT_BITS   _u(0x00000003)
275 #define ROSC_PHASE_SHIFT_MSB    _u(1)
276 #define ROSC_PHASE_SHIFT_LSB    _u(0)
277 #define ROSC_PHASE_SHIFT_ACCESS "RW"
278 // =============================================================================
279 // Register    : ROSC_STATUS
280 // Description : Ring Oscillator Status
281 #define ROSC_STATUS_OFFSET _u(0x0000001c)
282 #define ROSC_STATUS_BITS   _u(0x81011000)
283 #define ROSC_STATUS_RESET  _u(0x00000000)
284 // -----------------------------------------------------------------------------
285 // Field       : ROSC_STATUS_STABLE
286 // Description : Oscillator is running and stable
287 #define ROSC_STATUS_STABLE_RESET  _u(0x0)
288 #define ROSC_STATUS_STABLE_BITS   _u(0x80000000)
289 #define ROSC_STATUS_STABLE_MSB    _u(31)
290 #define ROSC_STATUS_STABLE_LSB    _u(31)
291 #define ROSC_STATUS_STABLE_ACCESS "RO"
292 // -----------------------------------------------------------------------------
293 // Field       : ROSC_STATUS_BADWRITE
294 // Description : An invalid value has been written to CTRL_ENABLE or
295 //               CTRL_FREQ_RANGE or FREQA or FREQB or DIV or PHASE or DORMANT
296 #define ROSC_STATUS_BADWRITE_RESET  _u(0x0)
297 #define ROSC_STATUS_BADWRITE_BITS   _u(0x01000000)
298 #define ROSC_STATUS_BADWRITE_MSB    _u(24)
299 #define ROSC_STATUS_BADWRITE_LSB    _u(24)
300 #define ROSC_STATUS_BADWRITE_ACCESS "WC"
301 // -----------------------------------------------------------------------------
302 // Field       : ROSC_STATUS_DIV_RUNNING
303 // Description : post-divider is running
304 //               this resets to 0 but transitions to 1 during chip startup
305 #define ROSC_STATUS_DIV_RUNNING_RESET  "-"
306 #define ROSC_STATUS_DIV_RUNNING_BITS   _u(0x00010000)
307 #define ROSC_STATUS_DIV_RUNNING_MSB    _u(16)
308 #define ROSC_STATUS_DIV_RUNNING_LSB    _u(16)
309 #define ROSC_STATUS_DIV_RUNNING_ACCESS "RO"
310 // -----------------------------------------------------------------------------
311 // Field       : ROSC_STATUS_ENABLED
312 // Description : Oscillator is enabled but not necessarily running and stable
313 //               this resets to 0 but transitions to 1 during chip startup
314 #define ROSC_STATUS_ENABLED_RESET  "-"
315 #define ROSC_STATUS_ENABLED_BITS   _u(0x00001000)
316 #define ROSC_STATUS_ENABLED_MSB    _u(12)
317 #define ROSC_STATUS_ENABLED_LSB    _u(12)
318 #define ROSC_STATUS_ENABLED_ACCESS "RO"
319 // =============================================================================
320 // Register    : ROSC_RANDOMBIT
321 // Description : This just reads the state of the oscillator output so
322 //               randomness is compromised if the ring oscillator is stopped or
323 //               run at a harmonic of the bus frequency
324 #define ROSC_RANDOMBIT_OFFSET _u(0x00000020)
325 #define ROSC_RANDOMBIT_BITS   _u(0x00000001)
326 #define ROSC_RANDOMBIT_RESET  _u(0x00000001)
327 #define ROSC_RANDOMBIT_MSB    _u(0)
328 #define ROSC_RANDOMBIT_LSB    _u(0)
329 #define ROSC_RANDOMBIT_ACCESS "RO"
330 // =============================================================================
331 // Register    : ROSC_COUNT
332 // Description : A down counter running at the ROSC frequency which counts to
333 //               zero and stops.
334 //               To start the counter write a non-zero value.
335 //               Can be used for short software pauses when setting up time
336 //               sensitive hardware.
337 #define ROSC_COUNT_OFFSET _u(0x00000024)
338 #define ROSC_COUNT_BITS   _u(0x0000ffff)
339 #define ROSC_COUNT_RESET  _u(0x00000000)
340 #define ROSC_COUNT_MSB    _u(15)
341 #define ROSC_COUNT_LSB    _u(0)
342 #define ROSC_COUNT_ACCESS "RW"
343 // =============================================================================
344 #endif // _HARDWARE_REGS_ROSC_H
345 
346