Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / include / linux / mfd / idt8a340_reg.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Based on 5.2.0, Family Programming Guide (Sept 30, 2020)
4  *
5  * Copyright (C) 2021 Integrated Device Technology, Inc., a Renesas Company.
6  */
7 #ifndef HAVE_IDT8A340_REG
8 #define HAVE_IDT8A340_REG
9
10 #define PAGE_ADDR_BASE                    0x0000
11 #define PAGE_ADDR                         0x00fc
12
13 #define HW_REVISION                       0x8180
14 #define REV_ID                            0x007a
15
16 #define HW_DPLL_0                         (0x8a00)
17 #define HW_DPLL_1                         (0x8b00)
18 #define HW_DPLL_2                         (0x8c00)
19 #define HW_DPLL_3                         (0x8d00)
20 #define HW_DPLL_4                         (0x8e00)
21 #define HW_DPLL_5                         (0x8f00)
22 #define HW_DPLL_6                         (0x9000)
23 #define HW_DPLL_7                         (0x9100)
24
25 #define HW_DPLL_TOD_SW_TRIG_ADDR__0       (0x080)
26 #define HW_DPLL_TOD_CTRL_1                (0x089)
27 #define HW_DPLL_TOD_CTRL_2                (0x08A)
28 #define HW_DPLL_TOD_OVR__0                (0x098)
29 #define HW_DPLL_TOD_OUT_0__0              (0x0B0)
30
31 #define HW_Q0_Q1_CH_SYNC_CTRL_0           (0xa740)
32 #define HW_Q0_Q1_CH_SYNC_CTRL_1           (0xa741)
33 #define HW_Q2_Q3_CH_SYNC_CTRL_0           (0xa742)
34 #define HW_Q2_Q3_CH_SYNC_CTRL_1           (0xa743)
35 #define HW_Q4_Q5_CH_SYNC_CTRL_0           (0xa744)
36 #define HW_Q4_Q5_CH_SYNC_CTRL_1           (0xa745)
37 #define HW_Q6_Q7_CH_SYNC_CTRL_0           (0xa746)
38 #define HW_Q6_Q7_CH_SYNC_CTRL_1           (0xa747)
39 #define HW_Q8_CH_SYNC_CTRL_0              (0xa748)
40 #define HW_Q8_CH_SYNC_CTRL_1              (0xa749)
41 #define HW_Q9_CH_SYNC_CTRL_0              (0xa74a)
42 #define HW_Q9_CH_SYNC_CTRL_1              (0xa74b)
43 #define HW_Q10_CH_SYNC_CTRL_0             (0xa74c)
44 #define HW_Q10_CH_SYNC_CTRL_1             (0xa74d)
45 #define HW_Q11_CH_SYNC_CTRL_0             (0xa74e)
46 #define HW_Q11_CH_SYNC_CTRL_1             (0xa74f)
47
48 #define SYNC_SOURCE_DPLL0_TOD_PPS       0x14
49 #define SYNC_SOURCE_DPLL1_TOD_PPS       0x15
50 #define SYNC_SOURCE_DPLL2_TOD_PPS       0x16
51 #define SYNC_SOURCE_DPLL3_TOD_PPS       0x17
52
53 #define SYNCTRL1_MASTER_SYNC_RST        BIT(7)
54 #define SYNCTRL1_MASTER_SYNC_TRIG       BIT(5)
55 #define SYNCTRL1_TOD_SYNC_TRIG          BIT(4)
56 #define SYNCTRL1_FBDIV_FRAME_SYNC_TRIG  BIT(3)
57 #define SYNCTRL1_FBDIV_SYNC_TRIG        BIT(2)
58 #define SYNCTRL1_Q1_DIV_SYNC_TRIG       BIT(1)
59 #define SYNCTRL1_Q0_DIV_SYNC_TRIG       BIT(0)
60
61 #define HW_Q8_CTRL_SPARE  (0xa7d4)
62 #define HW_Q11_CTRL_SPARE (0xa7ec)
63
64 /**
65  * Select FOD5 as sync_trigger for Q8 divider.
66  * Transition from logic zero to one
67  * sets trigger to sync Q8 divider.
68  *
69  * Unused when FOD4 is driving Q8 divider (normal operation).
70  */
71 #define Q9_TO_Q8_SYNC_TRIG  BIT(1)
72
73 /**
74  * Enable FOD5 as driver for clock and sync for Q8 divider.
75  * Enable fanout buffer for FOD5.
76  *
77  * Unused when FOD4 is driving Q8 divider (normal operation).
78  */
79 #define Q9_TO_Q8_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK  (BIT(0) | BIT(2))
80
81 /**
82  * Select FOD6 as sync_trigger for Q11 divider.
83  * Transition from logic zero to one
84  * sets trigger to sync Q11 divider.
85  *
86  * Unused when FOD7 is driving Q11 divider (normal operation).
87  */
88 #define Q10_TO_Q11_SYNC_TRIG  BIT(1)
89
90 /**
91  * Enable FOD6 as driver for clock and sync for Q11 divider.
92  * Enable fanout buffer for FOD6.
93  *
94  * Unused when FOD7 is driving Q11 divider (normal operation).
95  */
96 #define Q10_TO_Q11_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK  (BIT(0) | BIT(2))
97
98 #define RESET_CTRL                        0xc000
99 #define SM_RESET                          0x0012
100 #define SM_RESET_V520                     0x0013
101 #define SM_RESET_CMD                      0x5A
102
103 #define GENERAL_STATUS                    0xc014
104 #define BOOT_STATUS                       0x0000
105 #define HW_REV_ID                         0x000A
106 #define BOND_ID                           0x000B
107 #define HW_CSR_ID                         0x000C
108 #define HW_IRQ_ID                         0x000E
109 #define MAJ_REL                           0x0010
110 #define MIN_REL                           0x0011
111 #define HOTFIX_REL                        0x0012
112 #define PIPELINE_ID                       0x0014
113 #define BUILD_ID                          0x0018
114 #define JTAG_DEVICE_ID                    0x001c
115 #define PRODUCT_ID                        0x001e
116 #define OTP_SCSR_CONFIG_SELECT            0x0022
117
118 #define STATUS                            0xc03c
119 #define DPLL0_STATUS                      0x0018
120 #define DPLL1_STATUS                      0x0019
121 #define DPLL2_STATUS                      0x001a
122 #define DPLL3_STATUS                      0x001b
123 #define DPLL4_STATUS                      0x001c
124 #define DPLL5_STATUS                      0x001d
125 #define DPLL6_STATUS                      0x001e
126 #define DPLL7_STATUS                      0x001f
127 #define DPLL_SYS_STATUS                   0x0020
128 #define DPLL_SYS_APLL_STATUS              0x0021
129 #define DPLL0_FILTER_STATUS               0x0044
130 #define DPLL1_FILTER_STATUS               0x004c
131 #define DPLL2_FILTER_STATUS               0x0054
132 #define DPLL3_FILTER_STATUS               0x005c
133 #define DPLL4_FILTER_STATUS               0x0064
134 #define DPLL5_FILTER_STATUS               0x006c
135 #define DPLL6_FILTER_STATUS               0x0074
136 #define DPLL7_FILTER_STATUS               0x007c
137 #define DPLLSYS_FILTER_STATUS             0x0084
138 #define USER_GPIO0_TO_7_STATUS            0x008a
139 #define USER_GPIO8_TO_15_STATUS           0x008b
140
141 #define GPIO_USER_CONTROL                 0xc160
142 #define GPIO0_TO_7_OUT                    0x0000
143 #define GPIO8_TO_15_OUT                   0x0001
144 #define GPIO0_TO_7_OUT_V520               0x0002
145 #define GPIO8_TO_15_OUT_V520              0x0003
146
147 #define STICKY_STATUS_CLEAR               0xc164
148
149 #define GPIO_TOD_NOTIFICATION_CLEAR       0xc16c
150
151 #define ALERT_CFG                         0xc188
152
153 #define SYS_DPLL_XO                       0xc194
154
155 #define SYS_APLL                          0xc19c
156
157 #define INPUT_0                           0xc1b0
158 #define INPUT_1                           0xc1c0
159 #define INPUT_2                           0xc1d0
160 #define INPUT_3                           0xc200
161 #define INPUT_4                           0xc210
162 #define INPUT_5                           0xc220
163 #define INPUT_6                           0xc230
164 #define INPUT_7                           0xc240
165 #define INPUT_8                           0xc250
166 #define INPUT_9                           0xc260
167 #define INPUT_10                          0xc280
168 #define INPUT_11                          0xc290
169 #define INPUT_12                          0xc2a0
170 #define INPUT_13                          0xc2b0
171 #define INPUT_14                          0xc2c0
172 #define INPUT_15                          0xc2d0
173
174 #define REF_MON_0                         0xc2e0
175 #define REF_MON_1                         0xc2ec
176 #define REF_MON_2                         0xc300
177 #define REF_MON_3                         0xc30c
178 #define REF_MON_4                         0xc318
179 #define REF_MON_5                         0xc324
180 #define REF_MON_6                         0xc330
181 #define REF_MON_7                         0xc33c
182 #define REF_MON_8                         0xc348
183 #define REF_MON_9                         0xc354
184 #define REF_MON_10                        0xc360
185 #define REF_MON_11                        0xc36c
186 #define REF_MON_12                        0xc380
187 #define REF_MON_13                        0xc38c
188 #define REF_MON_14                        0xc398
189 #define REF_MON_15                        0xc3a4
190
191 #define DPLL_0                            0xc3b0
192 #define DPLL_CTRL_REG_0                   0x0002
193 #define DPLL_CTRL_REG_1                   0x0003
194 #define DPLL_CTRL_REG_2                   0x0004
195 #define DPLL_TOD_SYNC_CFG                 0x0031
196 #define DPLL_COMBO_SLAVE_CFG_0            0x0032
197 #define DPLL_COMBO_SLAVE_CFG_1            0x0033
198 #define DPLL_SLAVE_REF_CFG                0x0034
199 #define DPLL_REF_MODE                     0x0035
200 #define DPLL_PHASE_MEASUREMENT_CFG        0x0036
201 #define DPLL_MODE                         0x0037
202 #define DPLL_MODE_V520                    0x003B
203 #define DPLL_1                            0xc400
204 #define DPLL_2                            0xc438
205 #define DPLL_2_V520                       0xc43c
206 #define DPLL_3                            0xc480
207 #define DPLL_4                            0xc4b8
208 #define DPLL_4_V520                       0xc4bc
209 #define DPLL_5                            0xc500
210 #define DPLL_6                            0xc538
211 #define DPLL_6_V520                       0xc53c
212 #define DPLL_7                            0xc580
213 #define SYS_DPLL                          0xc5b8
214 #define SYS_DPLL_V520                     0xc5bc
215
216 #define DPLL_CTRL_0                       0xc600
217 #define DPLL_CTRL_DPLL_MANU_REF_CFG       0x0001
218 #define DPLL_CTRL_DPLL_FOD_FREQ           0x001c
219 #define DPLL_CTRL_COMBO_MASTER_CFG        0x003a
220 #define DPLL_CTRL_1                       0xc63c
221 #define DPLL_CTRL_2                       0xc680
222 #define DPLL_CTRL_3                       0xc6bc
223 #define DPLL_CTRL_4                       0xc700
224 #define DPLL_CTRL_5                       0xc73c
225 #define DPLL_CTRL_6                       0xc780
226 #define DPLL_CTRL_7                       0xc7bc
227 #define SYS_DPLL_CTRL                     0xc800
228
229 #define DPLL_PHASE_0                      0xc818
230 /* Signed 42-bit FFO in units of 2^(-53) */
231 #define DPLL_WR_PHASE                     0x0000
232 #define DPLL_PHASE_1                      0xc81c
233 #define DPLL_PHASE_2                      0xc820
234 #define DPLL_PHASE_3                      0xc824
235 #define DPLL_PHASE_4                      0xc828
236 #define DPLL_PHASE_5                      0xc82c
237 #define DPLL_PHASE_6                      0xc830
238 #define DPLL_PHASE_7                      0xc834
239
240 #define DPLL_FREQ_0                       0xc838
241 /* Signed 42-bit FFO in units of 2^(-53) */
242 #define DPLL_WR_FREQ                      0x0000
243 #define DPLL_FREQ_1                       0xc840
244 #define DPLL_FREQ_2                       0xc848
245 #define DPLL_FREQ_3                       0xc850
246 #define DPLL_FREQ_4                       0xc858
247 #define DPLL_FREQ_5                       0xc860
248 #define DPLL_FREQ_6                       0xc868
249 #define DPLL_FREQ_7                       0xc870
250
251 #define DPLL_PHASE_PULL_IN_0              0xc880
252 #define PULL_IN_OFFSET                    0x0000 /* Signed 32 bit */
253 #define PULL_IN_SLOPE_LIMIT               0x0004 /* Unsigned 24 bit */
254 #define PULL_IN_CTRL                      0x0007
255 #define DPLL_PHASE_PULL_IN_1              0xc888
256 #define DPLL_PHASE_PULL_IN_2              0xc890
257 #define DPLL_PHASE_PULL_IN_3              0xc898
258 #define DPLL_PHASE_PULL_IN_4              0xc8a0
259 #define DPLL_PHASE_PULL_IN_5              0xc8a8
260 #define DPLL_PHASE_PULL_IN_6              0xc8b0
261 #define DPLL_PHASE_PULL_IN_7              0xc8b8
262
263 #define GPIO_CFG                          0xc8c0
264 #define GPIO_CFG_GBL                      0x0000
265 #define GPIO_0                            0xc8c2
266 #define GPIO_DCO_INC_DEC                  0x0000
267 #define GPIO_OUT_CTRL_0                   0x0001
268 #define GPIO_OUT_CTRL_1                   0x0002
269 #define GPIO_TOD_TRIG                     0x0003
270 #define GPIO_DPLL_INDICATOR               0x0004
271 #define GPIO_LOS_INDICATOR                0x0005
272 #define GPIO_REF_INPUT_DSQ_0              0x0006
273 #define GPIO_REF_INPUT_DSQ_1              0x0007
274 #define GPIO_REF_INPUT_DSQ_2              0x0008
275 #define GPIO_REF_INPUT_DSQ_3              0x0009
276 #define GPIO_MAN_CLK_SEL_0                0x000a
277 #define GPIO_MAN_CLK_SEL_1                0x000b
278 #define GPIO_MAN_CLK_SEL_2                0x000c
279 #define GPIO_SLAVE                        0x000d
280 #define GPIO_ALERT_OUT_CFG                0x000e
281 #define GPIO_TOD_NOTIFICATION_CFG         0x000f
282 #define GPIO_CTRL                         0x0010
283 #define GPIO_CTRL_V520                    0x0011
284 #define GPIO_1                            0xc8d4
285 #define GPIO_2                            0xc8e6
286 #define GPIO_3                            0xc900
287 #define GPIO_4                            0xc912
288 #define GPIO_5                            0xc924
289 #define GPIO_6                            0xc936
290 #define GPIO_7                            0xc948
291 #define GPIO_8                            0xc95a
292 #define GPIO_9                            0xc980
293 #define GPIO_10                           0xc992
294 #define GPIO_11                           0xc9a4
295 #define GPIO_12                           0xc9b6
296 #define GPIO_13                           0xc9c8
297 #define GPIO_14                           0xc9da
298 #define GPIO_15                           0xca00
299
300 #define OUT_DIV_MUX                       0xca12
301 #define OUTPUT_0                          0xca14
302 #define OUTPUT_0_V520                     0xca20
303 /* FOD frequency output divider value */
304 #define OUT_DIV                           0x0000
305 #define OUT_DUTY_CYCLE_HIGH               0x0004
306 #define OUT_CTRL_0                        0x0008
307 #define OUT_CTRL_1                        0x0009
308 /* Phase adjustment in FOD cycles */
309 #define OUT_PHASE_ADJ                     0x000c
310 #define OUTPUT_1                          0xca24
311 #define OUTPUT_1_V520                     0xca30
312 #define OUTPUT_2                          0xca34
313 #define OUTPUT_2_V520                     0xca40
314 #define OUTPUT_3                          0xca44
315 #define OUTPUT_3_V520                     0xca50
316 #define OUTPUT_4                          0xca54
317 #define OUTPUT_4_V520                     0xca60
318 #define OUTPUT_5                          0xca64
319 #define OUTPUT_5_V520                     0xca80
320 #define OUTPUT_6                          0xca80
321 #define OUTPUT_6_V520                     0xca90
322 #define OUTPUT_7                          0xca90
323 #define OUTPUT_7_V520                     0xcaa0
324 #define OUTPUT_8                          0xcaa0
325 #define OUTPUT_8_V520                     0xcab0
326 #define OUTPUT_9                          0xcab0
327 #define OUTPUT_9_V520                     0xcac0
328 #define OUTPUT_10                         0xcac0
329 #define OUTPUT_10_V520                     0xcad0
330 #define OUTPUT_11                         0xcad0
331 #define OUTPUT_11_V520                    0xcae0
332
333 #define SERIAL                            0xcae0
334 #define SERIAL_V520                       0xcaf0
335
336 #define PWM_ENCODER_0                     0xcb00
337 #define PWM_ENCODER_1                     0xcb08
338 #define PWM_ENCODER_2                     0xcb10
339 #define PWM_ENCODER_3                     0xcb18
340 #define PWM_ENCODER_4                     0xcb20
341 #define PWM_ENCODER_5                     0xcb28
342 #define PWM_ENCODER_6                     0xcb30
343 #define PWM_ENCODER_7                     0xcb38
344 #define PWM_DECODER_0                     0xcb40
345 #define PWM_DECODER_1                     0xcb48
346 #define PWM_DECODER_1_V520                0xcb4a
347 #define PWM_DECODER_2                     0xcb50
348 #define PWM_DECODER_2_V520                0xcb54
349 #define PWM_DECODER_3                     0xcb58
350 #define PWM_DECODER_3_V520                0xcb5e
351 #define PWM_DECODER_4                     0xcb60
352 #define PWM_DECODER_4_V520                0xcb68
353 #define PWM_DECODER_5                     0xcb68
354 #define PWM_DECODER_5_V520                0xcb80
355 #define PWM_DECODER_6                     0xcb70
356 #define PWM_DECODER_6_V520                0xcb8a
357 #define PWM_DECODER_7                     0xcb80
358 #define PWM_DECODER_7_V520                0xcb94
359 #define PWM_DECODER_8                     0xcb88
360 #define PWM_DECODER_8_V520                0xcb9e
361 #define PWM_DECODER_9                     0xcb90
362 #define PWM_DECODER_9_V520                0xcba8
363 #define PWM_DECODER_10                    0xcb98
364 #define PWM_DECODER_10_V520               0xcbb2
365 #define PWM_DECODER_11                    0xcba0
366 #define PWM_DECODER_11_V520               0xcbbc
367 #define PWM_DECODER_12                    0xcba8
368 #define PWM_DECODER_12_V520               0xcbc6
369 #define PWM_DECODER_13                    0xcbb0
370 #define PWM_DECODER_13_V520               0xcbd0
371 #define PWM_DECODER_14                    0xcbb8
372 #define PWM_DECODER_14_V520               0xcbda
373 #define PWM_DECODER_15                    0xcbc0
374 #define PWM_DECODER_15_V520               0xcbe4
375 #define PWM_USER_DATA                     0xcbc8
376 #define PWM_USER_DATA_V520                0xcbf0
377
378 #define TOD_0                             0xcbcc
379 #define TOD_0_V520                        0xcc00
380 /* Enable TOD counter, output channel sync and even-PPS mode */
381 #define TOD_CFG                           0x0000
382 #define TOD_CFG_V520                      0x0001
383 #define TOD_1                             0xcbce
384 #define TOD_1_V520                        0xcc02
385 #define TOD_2                             0xcbd0
386 #define TOD_2_V520                        0xcc04
387 #define TOD_3                             0xcbd2
388 #define TOD_3_V520                        0xcc06
389
390 #define TOD_WRITE_0                       0xcc00
391 #define TOD_WRITE_0_V520                  0xcc10
392 /* 8-bit subns, 32-bit ns, 48-bit seconds */
393 #define TOD_WRITE                         0x0000
394 /* Counter increments after TOD write is completed */
395 #define TOD_WRITE_COUNTER                 0x000c
396 /* TOD write trigger configuration */
397 #define TOD_WRITE_SELECT_CFG_0            0x000d
398 /* TOD write trigger selection */
399 #define TOD_WRITE_CMD                     0x000f
400 #define TOD_WRITE_1                       0xcc10
401 #define TOD_WRITE_1_V520                  0xcc20
402 #define TOD_WRITE_2                       0xcc20
403 #define TOD_WRITE_2_V520                  0xcc30
404 #define TOD_WRITE_3                       0xcc30
405 #define TOD_WRITE_3_V520                  0xcc40
406
407 #define TOD_READ_PRIMARY_0                0xcc40
408 #define TOD_READ_PRIMARY_0_V520           0xcc50
409 /* 8-bit subns, 32-bit ns, 48-bit seconds */
410 #define TOD_READ_PRIMARY                  0x0000
411 /* Counter increments after TOD write is completed */
412 #define TOD_READ_PRIMARY_COUNTER          0x000b
413 /* Read trigger configuration */
414 #define TOD_READ_PRIMARY_SEL_CFG_0        0x000c
415 /* Read trigger selection */
416 #define TOD_READ_PRIMARY_CMD              0x000e
417 #define TOD_READ_PRIMARY_CMD_V520         0x000f
418 #define TOD_READ_PRIMARY_1                0xcc50
419 #define TOD_READ_PRIMARY_1_V520           0xcc60
420 #define TOD_READ_PRIMARY_2                0xcc60
421 #define TOD_READ_PRIMARY_2_V520           0xcc80
422 #define TOD_READ_PRIMARY_3                0xcc80
423 #define TOD_READ_PRIMARY_3_V520           0xcc90
424
425 #define TOD_READ_SECONDARY_0              0xcc90
426 #define TOD_READ_SECONDARY_0_V520         0xcca0
427 #define TOD_READ_SECONDARY_1              0xcca0
428 #define TOD_READ_SECONDARY_1_V520         0xccb0
429 #define TOD_READ_SECONDARY_2              0xccb0
430 #define TOD_READ_SECONDARY_2_V520         0xccc0
431 #define TOD_READ_SECONDARY_3              0xccc0
432 #define TOD_READ_SECONDARY_3_V520         0xccd0
433
434 #define OUTPUT_TDC_CFG                    0xccd0
435 #define OUTPUT_TDC_CFG_V520               0xcce0
436 #define OUTPUT_TDC_0                      0xcd00
437 #define OUTPUT_TDC_1                      0xcd08
438 #define OUTPUT_TDC_2                      0xcd10
439 #define OUTPUT_TDC_3                      0xcd18
440 #define INPUT_TDC                         0xcd20
441
442 #define SCRATCH                           0xcf50
443 #define SCRATCH_V520                      0xcf4c
444
445 #define EEPROM                            0xcf68
446 #define EEPROM_V520                       0xcf64
447
448 #define OTP                               0xcf70
449
450 #define BYTE                              0xcf80
451
452 /* Bit definitions for the MAJ_REL register */
453 #define MAJOR_SHIFT                       (1)
454 #define MAJOR_MASK                        (0x7f)
455 #define PR_BUILD                          BIT(0)
456
457 /* Bit definitions for the USER_GPIO0_TO_7_STATUS register */
458 #define GPIO0_LEVEL                       BIT(0)
459 #define GPIO1_LEVEL                       BIT(1)
460 #define GPIO2_LEVEL                       BIT(2)
461 #define GPIO3_LEVEL                       BIT(3)
462 #define GPIO4_LEVEL                       BIT(4)
463 #define GPIO5_LEVEL                       BIT(5)
464 #define GPIO6_LEVEL                       BIT(6)
465 #define GPIO7_LEVEL                       BIT(7)
466
467 /* Bit definitions for the USER_GPIO8_TO_15_STATUS register */
468 #define GPIO8_LEVEL                       BIT(0)
469 #define GPIO9_LEVEL                       BIT(1)
470 #define GPIO10_LEVEL                      BIT(2)
471 #define GPIO11_LEVEL                      BIT(3)
472 #define GPIO12_LEVEL                      BIT(4)
473 #define GPIO13_LEVEL                      BIT(5)
474 #define GPIO14_LEVEL                      BIT(6)
475 #define GPIO15_LEVEL                      BIT(7)
476
477 /* Bit definitions for the GPIO0_TO_7_OUT register */
478 #define GPIO0_DRIVE_LEVEL                 BIT(0)
479 #define GPIO1_DRIVE_LEVEL                 BIT(1)
480 #define GPIO2_DRIVE_LEVEL                 BIT(2)
481 #define GPIO3_DRIVE_LEVEL                 BIT(3)
482 #define GPIO4_DRIVE_LEVEL                 BIT(4)
483 #define GPIO5_DRIVE_LEVEL                 BIT(5)
484 #define GPIO6_DRIVE_LEVEL                 BIT(6)
485 #define GPIO7_DRIVE_LEVEL                 BIT(7)
486
487 /* Bit definitions for the GPIO8_TO_15_OUT register */
488 #define GPIO8_DRIVE_LEVEL                 BIT(0)
489 #define GPIO9_DRIVE_LEVEL                 BIT(1)
490 #define GPIO10_DRIVE_LEVEL                BIT(2)
491 #define GPIO11_DRIVE_LEVEL                BIT(3)
492 #define GPIO12_DRIVE_LEVEL                BIT(4)
493 #define GPIO13_DRIVE_LEVEL                BIT(5)
494 #define GPIO14_DRIVE_LEVEL                BIT(6)
495 #define GPIO15_DRIVE_LEVEL                BIT(7)
496
497 /* Bit definitions for the DPLL_TOD_SYNC_CFG register */
498 #define TOD_SYNC_SOURCE_SHIFT             (1)
499 #define TOD_SYNC_SOURCE_MASK              (0x3)
500 #define TOD_SYNC_EN                       BIT(0)
501
502 /* Bit definitions for the DPLL_MODE register */
503 #define WRITE_TIMER_MODE                  BIT(6)
504 #define PLL_MODE_SHIFT                    (3)
505 #define PLL_MODE_MASK                     (0x7)
506 #define STATE_MODE_SHIFT                  (0)
507 #define STATE_MODE_MASK                   (0x7)
508
509 /* Bit definitions for the GPIO_CFG_GBL register */
510 #define SUPPLY_MODE_SHIFT                 (0)
511 #define SUPPLY_MODE_MASK                  (0x3)
512
513 /* Bit definitions for the GPIO_DCO_INC_DEC register */
514 #define INCDEC_DPLL_INDEX_SHIFT           (0)
515 #define INCDEC_DPLL_INDEX_MASK            (0x7)
516
517 /* Bit definitions for the GPIO_OUT_CTRL_0 register */
518 #define CTRL_OUT_0                        BIT(0)
519 #define CTRL_OUT_1                        BIT(1)
520 #define CTRL_OUT_2                        BIT(2)
521 #define CTRL_OUT_3                        BIT(3)
522 #define CTRL_OUT_4                        BIT(4)
523 #define CTRL_OUT_5                        BIT(5)
524 #define CTRL_OUT_6                        BIT(6)
525 #define CTRL_OUT_7                        BIT(7)
526
527 /* Bit definitions for the GPIO_OUT_CTRL_1 register */
528 #define CTRL_OUT_8                        BIT(0)
529 #define CTRL_OUT_9                        BIT(1)
530 #define CTRL_OUT_10                       BIT(2)
531 #define CTRL_OUT_11                       BIT(3)
532 #define CTRL_OUT_12                       BIT(4)
533 #define CTRL_OUT_13                       BIT(5)
534 #define CTRL_OUT_14                       BIT(6)
535 #define CTRL_OUT_15                       BIT(7)
536
537 /* Bit definitions for the GPIO_TOD_TRIG register */
538 #define TOD_TRIG_0                        BIT(0)
539 #define TOD_TRIG_1                        BIT(1)
540 #define TOD_TRIG_2                        BIT(2)
541 #define TOD_TRIG_3                        BIT(3)
542
543 /* Bit definitions for the GPIO_DPLL_INDICATOR register */
544 #define IND_DPLL_INDEX_SHIFT              (0)
545 #define IND_DPLL_INDEX_MASK               (0x7)
546
547 /* Bit definitions for the GPIO_LOS_INDICATOR register */
548 #define REFMON_INDEX_SHIFT                (0)
549 #define REFMON_INDEX_MASK                 (0xf)
550 /* Active level of LOS indicator, 0=low 1=high */
551 #define ACTIVE_LEVEL                      BIT(4)
552
553 /* Bit definitions for the GPIO_REF_INPUT_DSQ_0 register */
554 #define DSQ_INP_0                         BIT(0)
555 #define DSQ_INP_1                         BIT(1)
556 #define DSQ_INP_2                         BIT(2)
557 #define DSQ_INP_3                         BIT(3)
558 #define DSQ_INP_4                         BIT(4)
559 #define DSQ_INP_5                         BIT(5)
560 #define DSQ_INP_6                         BIT(6)
561 #define DSQ_INP_7                         BIT(7)
562
563 /* Bit definitions for the GPIO_REF_INPUT_DSQ_1 register */
564 #define DSQ_INP_8                         BIT(0)
565 #define DSQ_INP_9                         BIT(1)
566 #define DSQ_INP_10                        BIT(2)
567 #define DSQ_INP_11                        BIT(3)
568 #define DSQ_INP_12                        BIT(4)
569 #define DSQ_INP_13                        BIT(5)
570 #define DSQ_INP_14                        BIT(6)
571 #define DSQ_INP_15                        BIT(7)
572
573 /* Bit definitions for the GPIO_REF_INPUT_DSQ_2 register */
574 #define DSQ_DPLL_0                        BIT(0)
575 #define DSQ_DPLL_1                        BIT(1)
576 #define DSQ_DPLL_2                        BIT(2)
577 #define DSQ_DPLL_3                        BIT(3)
578 #define DSQ_DPLL_4                        BIT(4)
579 #define DSQ_DPLL_5                        BIT(5)
580 #define DSQ_DPLL_6                        BIT(6)
581 #define DSQ_DPLL_7                        BIT(7)
582
583 /* Bit definitions for the GPIO_REF_INPUT_DSQ_3 register */
584 #define DSQ_DPLL_SYS                      BIT(0)
585 #define GPIO_DSQ_LEVEL                    BIT(1)
586
587 /* Bit definitions for the GPIO_TOD_NOTIFICATION_CFG register */
588 #define DPLL_TOD_SHIFT                    (0)
589 #define DPLL_TOD_MASK                     (0x3)
590 #define TOD_READ_SECONDARY                BIT(2)
591 #define GPIO_ASSERT_LEVEL                 BIT(3)
592
593 /* Bit definitions for the GPIO_CTRL register */
594 #define GPIO_FUNCTION_EN                  BIT(0)
595 #define GPIO_CMOS_OD_MODE                 BIT(1)
596 #define GPIO_CONTROL_DIR                  BIT(2)
597 #define GPIO_PU_PD_MODE                   BIT(3)
598 #define GPIO_FUNCTION_SHIFT               (4)
599 #define GPIO_FUNCTION_MASK                (0xf)
600
601 /* Bit definitions for the OUT_CTRL_1 register */
602 #define OUT_SYNC_DISABLE                  BIT(7)
603 #define SQUELCH_VALUE                     BIT(6)
604 #define SQUELCH_DISABLE                   BIT(5)
605 #define PAD_VDDO_SHIFT                    (2)
606 #define PAD_VDDO_MASK                     (0x7)
607 #define PAD_CMOSDRV_SHIFT                 (0)
608 #define PAD_CMOSDRV_MASK                  (0x3)
609
610 /* Bit definitions for the TOD_CFG register */
611 #define TOD_EVEN_PPS_MODE                 BIT(2)
612 #define TOD_OUT_SYNC_ENABLE               BIT(1)
613 #define TOD_ENABLE                        BIT(0)
614
615 /* Bit definitions for the TOD_WRITE_SELECT_CFG_0 register */
616 #define WR_PWM_DECODER_INDEX_SHIFT        (4)
617 #define WR_PWM_DECODER_INDEX_MASK         (0xf)
618 #define WR_REF_INDEX_SHIFT                (0)
619 #define WR_REF_INDEX_MASK                 (0xf)
620
621 /* Bit definitions for the TOD_WRITE_CMD register */
622 #define TOD_WRITE_SELECTION_SHIFT         (0)
623 #define TOD_WRITE_SELECTION_MASK          (0xf)
624 /* 4.8.7 */
625 #define TOD_WRITE_TYPE_SHIFT              (4)
626 #define TOD_WRITE_TYPE_MASK               (0x3)
627
628 /* Bit definitions for the TOD_READ_PRIMARY_SEL_CFG_0 register */
629 #define RD_PWM_DECODER_INDEX_SHIFT        (4)
630 #define RD_PWM_DECODER_INDEX_MASK         (0xf)
631 #define RD_REF_INDEX_SHIFT                (0)
632 #define RD_REF_INDEX_MASK                 (0xf)
633
634 /* Bit definitions for the TOD_READ_PRIMARY_CMD register */
635 #define TOD_READ_TRIGGER_MODE             BIT(4)
636 #define TOD_READ_TRIGGER_SHIFT            (0)
637 #define TOD_READ_TRIGGER_MASK             (0xf)
638
639 /* Bit definitions for the DPLL_CTRL_COMBO_MASTER_CFG register */
640 #define COMBO_MASTER_HOLD                 BIT(0)
641
642 /* Bit definitions for DPLL_SYS_STATUS register */
643 #define DPLL_SYS_STATE_MASK               (0xf)
644
645 /* Bit definitions for SYS_APLL_STATUS register */
646 #define SYS_APLL_LOSS_LOCK_LIVE_MASK       BIT(0)
647 #define SYS_APLL_LOSS_LOCK_LIVE_LOCKED     0
648 #define SYS_APLL_LOSS_LOCK_LIVE_UNLOCKED   1
649
650 /* Bit definitions for the DPLL0_STATUS register */
651 #define DPLL_STATE_MASK                   (0xf)
652 #define DPLL_STATE_SHIFT                  (0x0)
653
654 /* Values of DPLL_N.DPLL_MODE.PLL_MODE */
655 enum pll_mode {
656         PLL_MODE_MIN = 0,
657         PLL_MODE_NORMAL = PLL_MODE_MIN,
658         PLL_MODE_WRITE_PHASE = 1,
659         PLL_MODE_WRITE_FREQUENCY = 2,
660         PLL_MODE_GPIO_INC_DEC = 3,
661         PLL_MODE_SYNTHESIS = 4,
662         PLL_MODE_PHASE_MEASUREMENT = 5,
663         PLL_MODE_DISABLED = 6,
664         PLL_MODE_MAX = PLL_MODE_DISABLED,
665 };
666
667 enum hw_tod_write_trig_sel {
668         HW_TOD_WR_TRIG_SEL_MIN = 0,
669         HW_TOD_WR_TRIG_SEL_MSB = HW_TOD_WR_TRIG_SEL_MIN,
670         HW_TOD_WR_TRIG_SEL_RESERVED = 1,
671         HW_TOD_WR_TRIG_SEL_TOD_PPS = 2,
672         HW_TOD_WR_TRIG_SEL_IRIGB_PPS = 3,
673         HW_TOD_WR_TRIG_SEL_PWM_PPS = 4,
674         HW_TOD_WR_TRIG_SEL_GPIO = 5,
675         HW_TOD_WR_TRIG_SEL_FOD_SYNC = 6,
676         WR_TRIG_SEL_MAX = HW_TOD_WR_TRIG_SEL_FOD_SYNC,
677 };
678
679 enum scsr_read_trig_sel {
680         /* CANCEL CURRENT TOD READ; MODULE BECOMES IDLE - NO TRIGGER OCCURS */
681         SCSR_TOD_READ_TRIG_SEL_DISABLE = 0,
682         /* TRIGGER IMMEDIATELY */
683         SCSR_TOD_READ_TRIG_SEL_IMMEDIATE = 1,
684         /* TRIGGER ON RISING EDGE OF INTERNAL TOD PPS SIGNAL */
685         SCSR_TOD_READ_TRIG_SEL_TODPPS = 2,
686         /* TRGGER ON RISING EDGE OF SELECTED REFERENCE INPUT */
687         SCSR_TOD_READ_TRIG_SEL_REFCLK = 3,
688         /* TRIGGER ON RISING EDGE OF SELECTED PWM DECODER 1PPS OUTPUT */
689         SCSR_TOD_READ_TRIG_SEL_PWMPPS = 4,
690         SCSR_TOD_READ_TRIG_SEL_RESERVED = 5,
691         /* TRIGGER WHEN WRITE FREQUENCY EVENT OCCURS  */
692         SCSR_TOD_READ_TRIG_SEL_WRITEFREQUENCYEVENT = 6,
693         /* TRIGGER ON SELECTED GPIO */
694         SCSR_TOD_READ_TRIG_SEL_GPIO = 7,
695         SCSR_TOD_READ_TRIG_SEL_MAX = SCSR_TOD_READ_TRIG_SEL_GPIO,
696 };
697
698 /* Values STATUS.DPLL_SYS_STATUS.DPLL_SYS_STATE */
699 enum dpll_state {
700         DPLL_STATE_MIN = 0,
701         DPLL_STATE_FREERUN = DPLL_STATE_MIN,
702         DPLL_STATE_LOCKACQ = 1,
703         DPLL_STATE_LOCKREC = 2,
704         DPLL_STATE_LOCKED = 3,
705         DPLL_STATE_HOLDOVER = 4,
706         DPLL_STATE_OPEN_LOOP = 5,
707         DPLL_STATE_MAX = DPLL_STATE_OPEN_LOOP,
708 };
709
710 /* 4.8.7 only */
711 enum scsr_tod_write_trig_sel {
712         SCSR_TOD_WR_TRIG_SEL_DISABLE = 0,
713         SCSR_TOD_WR_TRIG_SEL_IMMEDIATE = 1,
714         SCSR_TOD_WR_TRIG_SEL_REFCLK = 2,
715         SCSR_TOD_WR_TRIG_SEL_PWMPPS = 3,
716         SCSR_TOD_WR_TRIG_SEL_TODPPS = 4,
717         SCSR_TOD_WR_TRIG_SEL_SYNCFOD = 5,
718         SCSR_TOD_WR_TRIG_SEL_GPIO = 6,
719         SCSR_TOD_WR_TRIG_SEL_MAX = SCSR_TOD_WR_TRIG_SEL_GPIO,
720 };
721
722 /* 4.8.7 only */
723 enum scsr_tod_write_type_sel {
724         SCSR_TOD_WR_TYPE_SEL_ABSOLUTE = 0,
725         SCSR_TOD_WR_TYPE_SEL_DELTA_PLUS = 1,
726         SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS = 2,
727         SCSR_TOD_WR_TYPE_SEL_MAX = SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS,
728 };
729 #endif