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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
|
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* (C) Copyright 2016 Rockchip Electronics Co., Ltd
*/
#ifndef __SOC_ROCKCHIP_RK3399_GRF_H__
#define __SOC_ROCKCHIP_RK3399_GRF_H__
struct rk3399_grf_regs {
u32 reserved[0x800];
u32 usb3_perf_con0;
u32 usb3_perf_con1;
u32 usb3_perf_con2;
u32 usb3_perf_rd_max_latency_num;
u32 usb3_perf_rd_latency_samp_num;
u32 usb3_perf_rd_latency_acc_num;
u32 usb3_perf_rd_axi_total_byte;
u32 usb3_perf_wr_axi_total_byte;
u32 usb3_perf_working_cnt;
u32 reserved1[0x103];
u32 usb3otg0_con0;
u32 usb3otg0_con1;
u32 reserved2[2];
u32 usb3otg1_con0;
u32 usb3otg1_con1;
u32 reserved3[2];
u32 usb3otg0_status_lat0;
u32 usb3otg0_status_lat1;
u32 usb3otg0_status_cb;
u32 reserved4;
u32 usb3otg1_status_lat0;
u32 usb3otg1_status_lat1;
u32 usb3ogt1_status_cb;
u32 reserved5[0x6e5];
u32 pcie_perf_con0;
u32 pcie_perf_con1;
u32 pcie_perf_con2;
u32 pcie_perf_rd_max_latency_num;
u32 pcie_perf_rd_latency_samp_num;
u32 pcie_perf_rd_laterncy_acc_num;
u32 pcie_perf_rd_axi_total_byte;
u32 pcie_perf_wr_axi_total_byte;
u32 pcie_perf_working_cnt;
u32 reserved6[0x37];
u32 usb20_host0_con0;
u32 usb20_host0_con1;
u32 reserved7[2];
u32 usb20_host1_con0;
u32 usb20_host1_con1;
u32 reserved8[2];
u32 hsic_con0;
u32 hsic_con1;
u32 reserved9[6];
u32 grf_usbhost0_status;
u32 grf_usbhost1_Status;
u32 grf_hsic_status;
u32 reserved10[0xc9];
u32 hsicphy_con0;
u32 reserved11[3];
u32 usbphy0_ctrl[26];
u32 reserved12[6];
u32 usbphy1[26];
u32 reserved13[0x72f];
u32 soc_con9;
u32 reserved14[0x0a];
u32 soc_con20;
u32 soc_con21;
u32 soc_con22;
u32 soc_con23;
u32 soc_con24;
u32 soc_con25;
u32 soc_con26;
u32 reserved15[0xf65];
u32 cpu_con[4];
u32 reserved16[0x1c];
u32 cpu_status[6];
u32 reserved17[0x1a];
u32 a53_perf_con[4];
u32 a53_perf_rd_mon_st;
u32 a53_perf_rd_mon_end;
u32 a53_perf_wr_mon_st;
u32 a53_perf_wr_mon_end;
u32 a53_perf_rd_max_latency_num;
u32 a53_perf_rd_latency_samp_num;
u32 a53_perf_rd_laterncy_acc_num;
u32 a53_perf_rd_axi_total_byte;
u32 a53_perf_wr_axi_total_byte;
u32 a53_perf_working_cnt;
u32 a53_perf_int_status;
u32 reserved18[0x31];
u32 a72_perf_con[4];
u32 a72_perf_rd_mon_st;
u32 a72_perf_rd_mon_end;
u32 a72_perf_wr_mon_st;
u32 a72_perf_wr_mon_end;
u32 a72_perf_rd_max_latency_num;
u32 a72_perf_rd_latency_samp_num;
u32 a72_perf_rd_laterncy_acc_num;
u32 a72_perf_rd_axi_total_byte;
u32 a72_perf_wr_axi_total_byte;
u32 a72_perf_working_cnt;
u32 a72_perf_int_status;
u32 reserved19[0x7f6];
u32 soc_con5;
u32 soc_con6;
u32 reserved20[0x779];
u32 gpio2a_iomux;
union {
u32 iomux_spi2;
u32 gpio2b_iomux;
};
union {
u32 gpio2c_iomux;
u32 iomux_spi5;
};
u32 gpio2d_iomux;
union {
u32 gpio3a_iomux;
u32 iomux_spi0;
};
u32 gpio3b_iomux;
u32 gpio3c_iomux;
union {
u32 iomux_i2s0;
u32 gpio3d_iomux;
};
union {
u32 iomux_i2sclk;
u32 gpio4a_iomux;
};
union {
u32 iomux_sdmmc;
u32 iomux_uart2a;
u32 gpio4b_iomux;
};
union {
u32 iomux_pwm_0;
u32 iomux_pwm_1;
u32 iomux_uart2b;
u32 iomux_uart2c;
u32 iomux_edp_hotplug;
u32 gpio4c_iomux;
};
u32 gpio4d_iomux;
u32 reserved21[4];
u32 gpio2_p[4];
u32 gpio3_p[4];
u32 gpio4_p[4];
u32 reserved22[4];
u32 gpio2_sr[3][4];
u32 reserved23[4];
u32 gpio2_smt[3][4];
u32 reserved24[(0xe100 - 0xe0ec)/4 - 1];
u32 gpio2_e[4];
u32 gpio3_e[7];
u32 gpio4_e[5];
u32 reserved24a[(0xe200 - 0xe13c)/4 - 1];
u32 soc_con0;
u32 soc_con1;
u32 soc_con2;
u32 soc_con3;
u32 soc_con4;
u32 soc_con5_pcie;
u32 reserved25;
u32 soc_con7;
u32 soc_con8;
u32 soc_con9_pcie;
u32 reserved26[0x1e];
u32 soc_status[6];
u32 reserved27[0x32];
u32 ddrc0_con0;
u32 ddrc0_con1;
u32 ddrc1_con0;
u32 ddrc1_con1;
u32 reserved28[0xac];
u32 io_vsel;
u32 saradc_testbit;
u32 tsadc_testbit_l;
u32 tsadc_testbit_h;
u32 reserved29[0x6c];
u32 chip_id_addr;
u32 reserved30[0x1f];
u32 fast_boot_addr;
u32 reserved31[0x1df];
u32 emmccore_con[12];
u32 reserved32[4];
u32 emmccore_status[4];
u32 reserved33[0x1cc];
u32 emmcphy_con[7];
u32 reserved34;
u32 emmcphy_status;
};
check_member(rk3399_grf_regs, emmcphy_status, 0xf7a0);
struct rk3399_pmugrf_regs {
union {
u32 iomux_pwm_3a;
u32 gpio0a_iomux;
};
u32 gpio0b_iomux;
u32 reserved0[2];
union {
u32 spi1_rxd;
u32 tsadc_int;
u32 gpio1a_iomux;
};
union {
u32 spi1_csclktx;
u32 iomux_pwm_3b;
u32 iomux_i2c0_sda;
u32 gpio1b_iomux;
};
union {
u32 iomux_pwm_2;
u32 iomux_i2c0_scl;
u32 gpio1c_iomux;
};
u32 gpio1d_iomux;
u32 reserved1[8];
u32 gpio0_p[2];
u32 reserved2[2];
u32 gpio1_p[4];
u32 reserved3[8];
u32 gpio0a_e;
u32 reserved4;
u32 gpio0b_e;
u32 reserved5[5];
u32 gpio1a_e;
u32 reserved6;
u32 gpio1b_e;
u32 reserved7;
u32 gpio1c_e;
u32 reserved8;
u32 gpio1d_e;
u32 reserved9[0x11];
u32 gpio0l_sr;
u32 reserved10;
u32 gpio1l_sr;
u32 gpio1h_sr;
u32 reserved11[4];
u32 gpio0a_smt;
u32 gpio0b_smt;
u32 reserved12[2];
u32 gpio1a_smt;
u32 gpio1b_smt;
u32 gpio1c_smt;
u32 gpio1d_smt;
u32 reserved13[8];
u32 gpio0l_he;
u32 reserved14;
u32 gpio1l_he;
u32 gpio1h_he;
u32 reserved15[4];
u32 soc_con0;
u32 reserved16[9];
u32 soc_con10;
u32 soc_con11;
u32 reserved17[0x24];
u32 pmupvtm_con0;
u32 pmupvtm_con1;
u32 pmupvtm_status0;
u32 pmupvtm_status1;
u32 grf_osc_e;
u32 reserved18[0x2b];
u32 os_reg0;
u32 os_reg1;
u32 os_reg2;
u32 os_reg3;
};
check_member(rk3399_pmugrf_regs, os_reg3, 0x30c);
struct rk3399_pmusgrf_regs {
u32 ddr_rgn_con[35];
u32 reserved[0x1fe5];
u32 soc_con8;
u32 soc_con9;
u32 soc_con10;
u32 soc_con11;
u32 soc_con12;
u32 soc_con13;
u32 soc_con14;
u32 soc_con15;
u32 reserved1[3];
u32 soc_con19;
u32 soc_con20;
u32 soc_con21;
u32 soc_con22;
u32 reserved2[0x29];
u32 perilp_con[9];
u32 reserved4[7];
u32 perilp_status;
u32 reserved5[0xfaf];
u32 soc_con0;
u32 soc_con1;
u32 reserved6[0x3e];
u32 pmu_con[9];
u32 reserved7[0x17];
u32 fast_boot_addr;
u32 reserved8[0x1f];
u32 efuse_prg_mask;
u32 efuse_read_mask;
u32 reserved9[0x0e];
u32 pmu_slv_con0;
u32 pmu_slv_con1;
u32 reserved10[0x771];
u32 soc_con3;
u32 soc_con4;
u32 soc_con5;
u32 soc_con6;
u32 soc_con7;
u32 reserved11[8];
u32 soc_con16;
u32 soc_con17;
u32 soc_con18;
u32 reserved12[0xdd];
u32 slv_secure_con0;
u32 slv_secure_con1;
u32 reserved13;
u32 slv_secure_con2;
u32 slv_secure_con3;
u32 slv_secure_con4;
};
check_member(rk3399_pmusgrf_regs, slv_secure_con4, 0xe3d4);
enum {
/* GRF_GPIO2A_IOMUX */
GRF_GPIO2A0_SEL_SHIFT = 0,
GRF_GPIO2A0_SEL_MASK = 3 << GRF_GPIO2A0_SEL_SHIFT,
GRF_I2C2_SDA = 2,
GRF_GPIO2A1_SEL_SHIFT = 2,
GRF_GPIO2A1_SEL_MASK = 3 << GRF_GPIO2A1_SEL_SHIFT,
GRF_I2C2_SCL = 2,
GRF_GPIO2A7_SEL_SHIFT = 14,
GRF_GPIO2A7_SEL_MASK = 3 << GRF_GPIO2A7_SEL_SHIFT,
GRF_I2C7_SDA = 2,
/* GRF_GPIO2B_IOMUX */
GRF_GPIO2B0_SEL_SHIFT = 0,
GRF_GPIO2B0_SEL_MASK = 3 << GRF_GPIO2B0_SEL_SHIFT,
GRF_I2C7_SCL = 2,
GRF_GPIO2B1_SEL_SHIFT = 2,
GRF_GPIO2B1_SEL_MASK = 3 << GRF_GPIO2B1_SEL_SHIFT,
GRF_SPI2TPM_RXD = 1,
GRF_I2C6_SDA = 2,
GRF_GPIO2B2_SEL_SHIFT = 4,
GRF_GPIO2B2_SEL_MASK = 3 << GRF_GPIO2B2_SEL_SHIFT,
GRF_SPI2TPM_TXD = 1,
GRF_I2C6_SCL = 2,
GRF_GPIO2B3_SEL_SHIFT = 6,
GRF_GPIO2B3_SEL_MASK =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_GMAC_PHY_INTF_SEL_SHIFT),
RK3399_GMAC_CLK_SEL_SHIFT = 4,
RK3399_GMAC_CLK_SEL_MASK = (3 << RK3399_GMAC_CLK_SEL_SHIFT),
RK3399_GMAC_CLK_SEL_125M = (0 << RK3399_GMAC_CLK_SEL_SHIFT),
RK3399_GMAC_CLK_SEL_25M = (3 << RK3399_GMAC_CLK_SEL_SHIFT),
RK3399_GMAC_CLK_SEL_2_5M = (2 << RK3399_GMAC_CLK_SEL_SHIFT),
};
/* GRF_SOC_CON6 */
enum {
RK3399_RXCLK_DLY_ENA_GMAC_SHIFT = 15,
RK3399_RXCLK_DLY_ENA_GMAC_MASK =
(1 << RK3399_RXCLK_DLY_ENA_GMAC_SHIFT),
RK3399_RXCLK_DLY_ENA_GMAC_DISABLE = 0,
RK3399_RXCLK_DLY_ENA_GMAC_ENABLE =
(1 << RK3399_RXCLK_DLY_ENA_GMAC_SHIFT),
RK3399_TXCLK_DLY_ENA_GMAC_SHIFT = 7,
RK3399_TXCLK_DLY_ENA_GMAC_MASK =
(1 << RK3399_TXCLK_DLY_ENA_GMAC_SHIFT),
RK3399_TXCLK_DLY_ENA_GMAC_DISABLE = 0,
RK3399_TXCLK_DLY_ENA_GMAC_ENABLE =
(1 << RK3399_TXCLK_DLY_ENA_GMAC_SHIFT),
RK3399_CLK_RX_DL_CFG_GMAC_SHIFT = 8,
RK3399_CLK_RX_DL_CFG_GMAC_MASK =
(0x7f << RK3399_CLK_RX_DL_CFG_GMAC_SHIFT),
RK3399_CLK_TX_DL_CFG_GMAC_SHIFT = 0,
RK3399_CLK_TX_DL_CFG_GMAC_MASK =
(0x7f << RK3399_CLK_TX_DL_CFG_GMAC_SHIFT),
};
#endif /* __SOC_ROCKCHIP_RK3399_GRF_H__ */
|