-
Notifications
You must be signed in to change notification settings - Fork 5
/
if_alxreg.h
2296 lines (2055 loc) · 91.2 KB
/
if_alxreg.h
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
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2012 Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef ALX_REG_H
#define ALX_REG_H
/**********************************************************************/
/* following registers are mapped to both pci config and memory space */
/**********************************************************************/
#define ALX_VENDOR_ID PCI_VENDOR_ID_ATTANSIC
/* pci dev-ids */
#define ALX_DEV_ID_AR8161 0x1091
#define ALX_DEV_ID_AR8162 0x1090
#define ALX_DEV_ID_AR8171 0x10A1
#define ALX_DEV_ID_AR8172 0x10A0
#define ALX_DEV_ID_KI2201 0xE091
/* rev definition,
* bit(0): with xD support
* bit(1): with Card Reader function
* bit(7:2): real revision
*/
#define ALX_PCI_REVID_WTH_CR BIT(1)
#define ALX_PCI_REVID_WTH_XD BIT(0)
#define ALX_PCI_REVID_MASK 0x1FU
#define ALX_PCI_REVID_SHIFT 3
#define ALX_REV_A0 0
#define ALX_REV_A1 1
#define ALX_REV_B0 2
#define ALX_REV_C0 3
#define ALX_PM_CSR 0x0044
#define ALX_PM_CSR_PME_STAT BIT(15)
#define ALX_PM_CSR_DSCAL_MASK 0x3U
#define ALX_PM_CSR_DSCAL_SHIFT 13
#define ALX_PM_CSR_DSEL_MASK 0xFU
#define ALX_PM_CSR_DSEL_SHIFT 9
#define ALX_PM_CSR_PME_EN BIT(8)
#define ALX_PM_CSR_PWST_MASK 0x3U
#define ALX_PM_CSR_PWST_SHIFT 0
#define ALX_DEV_CAP 0x005C
#define ALX_DEV_CAP_SPLSL_MASK 0x3UL
#define ALX_DEV_CAP_SPLSL_SHIFT 26
#define ALX_DEV_CAP_SPLV_MASK 0xFFUL
#define ALX_DEV_CAP_SPLV_SHIFT 18
#define ALX_DEV_CAP_RBER BIT(15)
#define ALX_DEV_CAP_PIPRS BIT(14)
#define ALX_DEV_CAP_AIPRS BIT(13)
#define ALX_DEV_CAP_ABPRS BIT(12)
#define ALX_DEV_CAP_L1ACLAT_MASK 0x7UL
#define ALX_DEV_CAP_L1ACLAT_SHIFT 9
#define ALX_DEV_CAP_L0SACLAT_MASK 0x7UL
#define ALX_DEV_CAP_L0SACLAT_SHIFT 6
#define ALX_DEV_CAP_EXTAG BIT(5)
#define ALX_DEV_CAP_PHANTOM BIT(4)
#define ALX_DEV_CAP_MPL_MASK 0x7UL
#define ALX_DEV_CAP_MPL_SHIFT 0
#define ALX_DEV_CAP_MPL_128 1
#define ALX_DEV_CAP_MPL_256 2
#define ALX_DEV_CAP_MPL_512 3
#define ALX_DEV_CAP_MPL_1024 4
#define ALX_DEV_CAP_MPL_2048 5
#define ALX_DEV_CAP_MPL_4096 6
#define ALX_DEV_CTRL 0x0060
#define ALX_DEV_CTRL_MAXRRS_MASK 0x7U
#define ALX_DEV_CTRL_MAXRRS_SHIFT 12
#define ALX_DEV_CTRL_MAXRRS_MIN 2
#define ALX_DEV_CTRL_NOSNP_EN BIT(11)
#define ALX_DEV_CTRL_AUXPWR_EN BIT(10)
#define ALX_DEV_CTRL_PHANTOM_EN BIT(9)
#define ALX_DEV_CTRL_EXTAG_EN BIT(8)
#define ALX_DEV_CTRL_MPL_MASK 0x7U
#define ALX_DEV_CTRL_MPL_SHIFT 5
#define ALX_DEV_CTRL_RELORD_EN BIT(4)
#define ALX_DEV_CTRL_URR_EN BIT(3)
#define ALX_DEV_CTRL_FERR_EN BIT(2)
#define ALX_DEV_CTRL_NFERR_EN BIT(1)
#define ALX_DEV_CTRL_CERR_EN BIT(0)
#define ALX_DEV_STAT 0x0062
#define ALX_DEV_STAT_XS_PEND BIT(5)
#define ALX_DEV_STAT_AUXPWR BIT(4)
#define ALX_DEV_STAT_UR BIT(3)
#define ALX_DEV_STAT_FERR BIT(2)
#define ALX_DEV_STAT_NFERR BIT(1)
#define ALX_DEV_STAT_CERR BIT(0)
#define ALX_LNK_CAP 0x0064
#define ALX_LNK_CAP_PRTNUM_MASK 0xFFUL
#define ALX_LNK_CAP_PRTNUM_SHIFT 24
#define ALX_LNK_CAP_CLK_PM BIT(18)
#define ALX_LNK_CAP_L1EXTLAT_MASK 0x7UL
#define ALX_LNK_CAP_L1EXTLAT_SHIFT 15
#define ALX_LNK_CAP_L0SEXTLAT_MASK 0x7UL
#define ALX_LNK_CAP_L0SEXTLAT_SHIFT 12
#define ALX_LNK_CAP_ASPM_SUP_MASK 0x3UL
#define ALX_LNK_CAP_ASPM_SUP_SHIFT 10
#define ALX_LNK_CAP_ASPM_SUP_L0S 1
#define ALX_LNK_CAP_ASPM_SUP_L0SL1 3
#define ALX_LNK_CAP_MAX_LWH_MASK 0x3FUL
#define ALX_LNK_CAP_MAX_LWH_SHIFT 4
#define ALX_LNK_CAP_MAX_LSPD_MASK 0xFUL
#define ALX_LNK_CAP_MAX_LSPD_SHIFT 0
#define ALX_LNK_CTRL 0x0068
#define ALX_LNK_CTRL_CLK_PM_EN BIT(8)
#define ALX_LNK_CTRL_EXTSYNC BIT(7)
#define ALX_LNK_CTRL_CMNCLK_CFG BIT(6)
#define ALX_LNK_CTRL_RCB_128B BIT(3)
#define ALX_LNK_CTRL_ASPM_MASK 0x3U
#define ALX_LNK_CTRL_ASPM_SHIFT 0
#define ALX_LNK_CTRL_ASPM_DIS 0
#define ALX_LNK_CTRL_ASPM_ENL0S 1
#define ALX_LNK_CTRL_ASPM_ENL1 2
#define ALX_LNK_CTRL_ASPM_ENL0SL1 3
#define ALX_LNK_STAT 0x006A
#define ALX_LNK_STAT_SCLKCFG BIT(12)
#define ALX_LNK_STAT_LNKTRAIN BIT(11)
#define ALX_LNK_STAT_TRNERR BIT(10)
#define ALX_LNK_STAT_LNKSPD_MASK 0xFU
#define ALX_LNK_STAT_LNKSPD_SHIFT 0
#define ALX_LNK_STAT_NEGLW_MASK 0x3FU
#define ALX_LNK_STAT_NEGLW_SHIFT 4
#define ALX_MSIX_MASK 0x0090
#define ALX_MSIX_PENDING 0x0094
#define ALX_UE_SVRT 0x010C
#define ALX_UE_SVRT_UR BIT(20)
#define ALX_UE_SVRT_ECRCERR BIT(19)
#define ALX_UE_SVRT_MTLP BIT(18)
#define ALX_UE_SVRT_RCVOVFL BIT(17)
#define ALX_UE_SVRT_UNEXPCPL BIT(16)
#define ALX_UE_SVRT_CPLABRT BIT(15)
#define ALX_UE_SVRT_CPLTO BIT(14)
#define ALX_UE_SVRT_FCPROTERR BIT(13)
#define ALX_UE_SVRT_PTLP BIT(12)
#define ALX_UE_SVRT_DLPROTERR BIT(4)
#define ALX_UE_SVRT_TRNERR BIT(0)
/* eeprom & flash load register */
#define ALX_EFLD 0x0204
#define ALX_EFLD_F_ENDADDR_MASK 0x3FFUL
#define ALX_EFLD_F_ENDADDR_SHIFT 16
#define ALX_EFLD_F_EXIST BIT(10)
#define ALX_EFLD_E_EXIST BIT(9)
#define ALX_EFLD_EXIST BIT(8)
#define ALX_EFLD_STAT BIT(5)
#define ALX_EFLD_IDLE BIT(4)
#define ALX_EFLD_START BIT(0)
/* eFuse load register */
#define ALX_SLD 0x0218
#define ALX_SLD_FREQ_MASK 0x3UL
#define ALX_SLD_FREQ_SHIFT 24
#define ALX_SLD_FREQ_100K 0
#define ALX_SLD_FREQ_200K 1
#define ALX_SLD_FREQ_300K 2
#define ALX_SLD_FREQ_400K 3
#define ALX_SLD_EXIST BIT(23)
#define ALX_SLD_SLVADDR_MASK 0x7FUL
#define ALX_SLD_SLVADDR_SHIFT 16
#define ALX_SLD_IDLE BIT(13)
#define ALX_SLD_STAT BIT(12)
#define ALX_SLD_START BIT(11)
#define ALX_SLD_STARTADDR_MASK 0xFFUL
#define ALX_SLD_STARTADDR_SHIFT 0
#define ALX_SLD_MAX_TO 100
#define ALX_PCIE_MSIC 0x021C
#define ALX_PCIE_MSIC_MSIX_DIS BIT(22)
#define ALX_PCIE_MSIC_MSI_DIS BIT(21)
#define ALX_PPHY_MISC1 0x1000
#define ALX_PPHY_MISC1_RCVDET BIT(2)
#define ALX_PPHY_MISC1_NFTS_MASK 0xFFUL
#define ALX_PPHY_MISC1_NFTS_SHIFT 16
#define ALX_PPHY_MISC1_NFTS_HIPERF 0xA0
#define ALX_PPHY_MISC2 0x1004
#define ALX_PPHY_MISC2_L0S_TH_MASK 0x3UL
#define ALX_PPHY_MISC2_L0S_TH_SHIFT 18
#define ALX_PPHY_MISC2_CDR_BW_MASK 0x3UL
#define ALX_PPHY_MISC2_CDR_BW_SHIFT 16
#define ALX_PDLL_TRNS1 0x1104
#define ALX_PDLL_TRNS1_D3PLLOFF_EN BIT(11)
#define ALX_PDLL_TRNS1_REGCLK_SEL_NORM BIT(10)
#define ALX_PDLL_TRNS1_REPLY_TO_MASK 0x3FFUL
#define ALX_PDLL_TRNS1_REPLY_TO_SHIFT 0
#define ALX_TLEXTN_STATS 0x1208
#define ALX_TLEXTN_STATS_DEVNO_MASK 0x1FUL
#define ALX_TLEXTN_STATS_DEVNO_SHIFT 16
#define ALX_TLEXTN_STATS_BUSNO_MASK 0xFFUL
#define ALX_TLEXTN_STATS_BUSNO_SHIFT 8
#define ALX_EFUSE_CTRL 0x12C0
#define ALX_EFUSE_CTRL_FLAG BIT(31)
#define ALX_EUFSE_CTRL_ACK BIT(30)
#define ALX_EFUSE_CTRL_ADDR_MASK 0x3FFUL
#define ALX_EFUSE_CTRL_ADDR_SHIFT 16
#define ALX_EFUSE_DATA 0x12C4
#define ALX_SPI_OP1 0x12C8
#define ALX_SPI_OP1_RDID_MASK 0xFFUL
#define ALX_SPI_OP1_RDID_SHIFT 24
#define ALX_SPI_OP1_CE_MASK 0xFFUL
#define ALX_SPI_OP1_CE_SHIFT 16
#define ALX_SPI_OP1_SE_MASK 0xFFUL
#define ALX_SPI_OP1_SE_SHIFT 8
#define ALX_SPI_OP1_PRGRM_MASK 0xFFUL
#define ALX_SPI_OP1_PRGRM_SHIFT 0
#define ALX_SPI_OP2 0x12CC
#define ALX_SPI_OP2_READ_MASK 0xFFUL
#define ALX_SPI_OP2_READ_SHIFT 24
#define ALX_SPI_OP2_WRSR_MASK 0xFFUL
#define ALX_SPI_OP2_WRSR_SHIFT 16
#define ALX_SPI_OP2_RDSR_MASK 0xFFUL
#define ALX_SPI_OP2_RDSR_SHIFT 8
#define ALX_SPI_OP2_WREN_MASK 0xFFUL
#define ALX_SPI_OP2_WREN_SHIFT 0
#define ALX_SPI_OP3 0x12E4
#define ALX_SPI_OP3_WRDI_MASK 0xFFUL
#define ALX_SPI_OP3_WRDI_SHIFT 8
#define ALX_SPI_OP3_EWSR_MASK 0xFFUL
#define ALX_SPI_OP3_EWSR_SHIFT 0
#define ALX_EF_CTRL 0x12D0
#define ALX_EF_CTRL_FSTS_MASK 0xFFUL
#define ALX_EF_CTRL_FSTS_SHIFT 20
#define ALX_EF_CTRL_CLASS_MASK 0x7UL
#define ALX_EF_CTRL_CLASS_SHIFT 16
#define ALX_EF_CTRL_CLASS_F_UNKNOWN 0
#define ALX_EF_CTRL_CLASS_F_STD 1
#define ALX_EF_CTRL_CLASS_F_SST 2
#define ALX_EF_CTRL_CLASS_E_UNKNOWN 0
#define ALX_EF_CTRL_CLASS_E_1K 1
#define ALX_EF_CTRL_CLASS_E_4K 2
#define ALX_EF_CTRL_FRET BIT(15)
#define ALX_EF_CTRL_TYP_MASK 0x3UL
#define ALX_EF_CTRL_TYP_SHIFT 12
#define ALX_EF_CTRL_TYP_NONE 0
#define ALX_EF_CTRL_TYP_F 1
#define ALX_EF_CTRL_TYP_E 2
#define ALX_EF_CTRL_TYP_UNKNOWN 3
#define ALX_EF_CTRL_ONE_CLK BIT(10)
#define ALX_EF_CTRL_ECLK_MASK 0x3UL
#define ALX_EF_CTRL_ECLK_SHIFT 8
#define ALX_EF_CTRL_ECLK_125K 0
#define ALX_EF_CTRL_ECLK_250K 1
#define ALX_EF_CTRL_ECLK_500K 2
#define ALX_EF_CTRL_ECLK_1M 3
#define ALX_EF_CTRL_FBUSY BIT(7)
#define ALX_EF_CTRL_ACTION BIT(6)
#define ALX_EF_CTRL_AUTO_OP BIT(5)
#define ALX_EF_CTRL_SST_MODE BIT(4)
#define ALX_EF_CTRL_INST_MASK 0xFUL
#define ALX_EF_CTRL_INST_SHIFT 0
#define ALX_EF_CTRL_INST_NONE 0
#define ALX_EF_CTRL_INST_READ 1
#define ALX_EF_CTRL_INST_RDID 2
#define ALX_EF_CTRL_INST_RDSR 3
#define ALX_EF_CTRL_INST_WREN 4
#define ALX_EF_CTRL_INST_PRGRM 5
#define ALX_EF_CTRL_INST_SE 6
#define ALX_EF_CTRL_INST_CE 7
#define ALX_EF_CTRL_INST_WRSR 10
#define ALX_EF_CTRL_INST_EWSR 11
#define ALX_EF_CTRL_INST_WRDI 12
#define ALX_EF_CTRL_INST_WRITE 2
#define ALX_EF_ADDR 0x12D4
#define ALX_EF_DATA 0x12D8
#define ALX_SPI_ID 0x12DC
#define ALX_SPI_CFG_START 0x12E0
#define ALX_PMCTRL 0x12F8
#define ALX_PMCTRL_HOTRST_WTEN BIT(31)
/* bit30: L0s/L1 controlled by MAC based on throughput(setting in 15A0) */
#define ALX_PMCTRL_ASPM_FCEN BIT(30)
#define ALX_PMCTRL_SADLY_EN BIT(29)
#define ALX_PMCTRL_L0S_BUFSRX_EN BIT(28)
#define ALX_PMCTRL_LCKDET_TIMER_MASK 0xFUL
#define ALX_PMCTRL_LCKDET_TIMER_SHIFT 24
#define ALX_PMCTRL_LCKDET_TIMER_DEF 0xC
/* bit[23:20] if pm_request_l1 time > @, then enter L0s not L1 */
#define ALX_PMCTRL_L1REQ_TO_MASK 0xFUL
#define ALX_PMCTRL_L1REQ_TO_SHIFT 20
#define ALX_PMCTRL_L1REG_TO_DEF 0xF
#define ALX_PMCTRL_TXL1_AFTER_L0S BIT(19)
#define ALX_PMCTRL_L1_TIMER_MASK 0x7UL
#define ALX_PMCTRL_L1_TIMER_SHIFT 16
#define ALX_PMCTRL_L1_TIMER_DIS 0
#define ALX_PMCTRL_L1_TIMER_2US 1
#define ALX_PMCTRL_L1_TIMER_4US 2
#define ALX_PMCTRL_L1_TIMER_8US 3
#define ALX_PMCTRL_L1_TIMER_16US 4
#define ALX_PMCTRL_L1_TIMER_24US 5
#define ALX_PMCTRL_L1_TIMER_32US 6
#define ALX_PMCTRL_L1_TIMER_63US 7
#define ALX_PMCTRL_RCVR_WT_1US BIT(15)
#define ALX_PMCTRL_PWM_VER_11 BIT(14)
/* bit13: enable pcie clk switch in L1 state */
#define ALX_PMCTRL_L1_CLKSW_EN BIT(13)
#define ALX_PMCTRL_L0S_EN BIT(12)
#define ALX_PMCTRL_RXL1_AFTER_L0S BIT(11)
#define ALX_PMCTRL_L0S_TIMER_MASK 0x7UL
#define ALX_PMCTRL_L0S_TIMER_SHIFT 8
#define ALX_PMCTRL_L1_BUFSRX_EN BIT(7)
/* bit6: power down serdes RX */
#define ALX_PMCTRL_L1_SRDSRX_PWD BIT(6)
#define ALX_PMCTRL_L1_SRDSPLL_EN BIT(5)
#define ALX_PMCTRL_L1_SRDS_EN BIT(4)
#define ALX_PMCTRL_L1_EN BIT(3)
#define ALX_PMCTRL_CLKREQ_EN BIT(2)
#define ALX_PMCTRL_RBER_EN BIT(1)
#define ALX_PMCTRL_SPRSDWER_EN BIT(0)
#define ALX_LTSSM_CTRL 0x12FC
#define ALX_LTSSM_WRO_EN BIT(12)
/*******************************************************/
/* following registers are mapped only to memory space */
/*******************************************************/
#define ALX_MASTER 0x1400
#define ALX_MASTER_OTP_FLG BIT(31)
#define ALX_MASTER_DEV_NUM_MASK 0x7FUL
#define ALX_MASTER_DEV_NUM_SHIFT 24
#define ALX_MASTER_REV_NUM_MASK 0xFFUL
#define ALX_MASTER_REV_NUM_SHIFT 16
#define ALX_MASTER_DEASSRT BIT(15)
#define ALX_MASTER_RDCLR_INT BIT(14)
#define ALX_MASTER_DMA_RST BIT(13)
/* bit12: 1:alwys select pclk from serdes, not sw to 25M */
#define ALX_MASTER_PCLKSEL_SRDS BIT(12)
/* bit11: irq moduration for rx */
#define ALX_MASTER_IRQMOD2_EN BIT(11)
/* bit10: irq moduration for tx/rx */
#define ALX_MASTER_IRQMOD1_EN BIT(10)
#define ALX_MASTER_MANU_INT BIT(9)
#define ALX_MASTER_MANUTIMER_EN BIT(8)
#define ALX_MASTER_SYSALVTIMER_EN BIT(7)
#define ALX_MASTER_OOB_DIS BIT(6)
/* bit5: wakeup without pcie clk */
#define ALX_MASTER_WAKEN_25M BIT(5)
#define ALX_MASTER_BERT_START BIT(4)
#define ALX_MASTER_PCIE_TSTMOD_MASK 0x3UL
#define ALX_MASTER_PCIE_TSTMOD_SHIFT 2
#define ALX_MASTER_PCIE_RST BIT(1)
/* bit0: MAC & DMA reset */
#define ALX_MASTER_DMA_MAC_RST BIT(0)
#define ALX_DMA_MAC_RST_TO 50
#define ALX_MANU_TIMER 0x1404
#define ALX_IRQ_MODU_TIMER 0x1408
/* hi-16bit is only for RX */
#define ALX_IRQ_MODU_TIMER2_MASK 0xFFFFUL
#define ALX_IRQ_MODU_TIMER2_SHIFT 16
#define ALX_IRQ_MODU_TIMER1_MASK 0xFFFFUL
#define ALX_IRQ_MODU_TIMER1_SHIFT 0
#define ALX_PHY_CTRL 0x140C
#define ALX_PHY_CTRL_ADDR_MASK 0x1FUL
#define ALX_PHY_CTRL_ADDR_SHIFT 19
#define ALX_PHY_CTRL_BP_VLTGSW BIT(18)
#define ALX_PHY_CTRL_100AB_EN BIT(17)
#define ALX_PHY_CTRL_10AB_EN BIT(16)
#define ALX_PHY_CTRL_PLL_BYPASS BIT(15)
/* bit14: affect MAC & PHY, go to low power sts */
#define ALX_PHY_CTRL_POWER_DOWN BIT(14)
/* bit13: 1:pll always ON, 0:can switch in lpw */
#define ALX_PHY_CTRL_PLL_ON BIT(13)
#define ALX_PHY_CTRL_RST_ANALOG BIT(12)
#define ALX_PHY_CTRL_HIB_PULSE BIT(11)
#define ALX_PHY_CTRL_HIB_EN BIT(10)
#define ALX_PHY_CTRL_GIGA_DIS BIT(9)
/* bit8: poweron rst */
#define ALX_PHY_CTRL_IDDQ_DIS BIT(8)
/* bit7: while reboot, it affects bit8 */
#define ALX_PHY_CTRL_IDDQ BIT(7)
#define ALX_PHY_CTRL_LPW_EXIT BIT(6)
#define ALX_PHY_CTRL_GATE_25M BIT(5)
#define ALX_PHY_CTRL_RVRS_ANEG BIT(4)
#define ALX_PHY_CTRL_ANEG_NOW BIT(3)
#define ALX_PHY_CTRL_LED_MODE BIT(2)
#define ALX_PHY_CTRL_RTL_MODE BIT(1)
/* bit0: out of dsp RST state */
#define ALX_PHY_CTRL_DSPRST_OUT BIT(0)
#define ALX_PHY_CTRL_DSPRST_TO 80
#define ALX_PHY_CTRL_CLS (\
ALX_PHY_CTRL_LED_MODE |\
ALX_PHY_CTRL_100AB_EN |\
ALX_PHY_CTRL_PLL_ON)
#define ALX_MAC_STS 0x1410
#define ALX_MAC_STS_SFORCE_MASK 0xFUL
#define ALX_MAC_STS_SFORCE_SHIFT 14
#define ALX_MAC_STS_CALIB_DONE BIT13
#define ALX_MAC_STS_CALIB_RES_MASK 0x1FUL
#define ALX_MAC_STS_CALIB_RES_SHIFT 8
#define ALX_MAC_STS_CALIBERR_MASK 0xFUL
#define ALX_MAC_STS_CALIBERR_SHIFT 4
#define ALX_MAC_STS_TXQ_BUSY BIT(3)
#define ALX_MAC_STS_RXQ_BUSY BIT(2)
#define ALX_MAC_STS_TXMAC_BUSY BIT(1)
#define ALX_MAC_STS_RXMAC_BUSY BIT(0)
#define ALX_MAC_STS_IDLE (\
ALX_MAC_STS_TXQ_BUSY |\
ALX_MAC_STS_RXQ_BUSY |\
ALX_MAC_STS_TXMAC_BUSY |\
ALX_MAC_STS_RXMAC_BUSY)
#define ALX_MDIO 0x1414
#define ALX_MDIO_MODE_EXT BIT(30)
#define ALX_MDIO_POST_READ BIT(29)
#define ALX_MDIO_AUTO_POLLING BIT(28)
#define ALX_MDIO_BUSY BIT(27)
#define ALX_MDIO_CLK_SEL_MASK 0x7UL
#define ALX_MDIO_CLK_SEL_SHIFT 24
#define ALX_MDIO_CLK_SEL_25MD4 0
#define ALX_MDIO_CLK_SEL_25MD6 2
#define ALX_MDIO_CLK_SEL_25MD8 3
#define ALX_MDIO_CLK_SEL_25MD10 4
#define ALX_MDIO_CLK_SEL_25MD32 5
#define ALX_MDIO_CLK_SEL_25MD64 6
#define ALX_MDIO_CLK_SEL_25MD128 7
#define ALX_MDIO_START BIT(23)
#define ALX_MDIO_SPRES_PRMBL BIT(22)
/* bit21: 1:read,0:write */
#define ALX_MDIO_OP_READ BIT(21)
#define ALX_MDIO_REG_MASK 0x1FUL
#define ALX_MDIO_REG_SHIFT 16
#define ALX_MDIO_DATA_MASK 0xFFFFUL
#define ALX_MDIO_DATA_SHIFT 0
#define ALX_MDIO_MAX_AC_TO 120
#define ALX_MDIO_EXTN 0x1448
#define ALX_MDIO_EXTN_PORTAD_MASK 0x1FUL
#define ALX_MDIO_EXTN_PORTAD_SHIFT 21
#define ALX_MDIO_EXTN_DEVAD_MASK 0x1FUL
#define ALX_MDIO_EXTN_DEVAD_SHIFT 16
#define ALX_MDIO_EXTN_REG_MASK 0xFFFFUL
#define ALX_MDIO_EXTN_REG_SHIFT 0
#define ALX_PHY_STS 0x1418
#define ALX_PHY_STS_LPW BIT(31)
#define ALX_PHY_STS_LPI BIT(30)
#define ALX_PHY_STS_PWON_STRIP_MASK 0xFFFUL
#define ALX_PHY_STS_PWON_STRIP_SHIFT 16
#define ALX_PHY_STS_DUPLEX BIT(3)
#define ALX_PHY_STS_LINKUP BIT(2)
#define ALX_PHY_STS_SPEED_MASK 0x3UL
#define ALX_PHY_STS_SPEED_SHIFT 0
#define ALX_PHY_STS_SPEED_1000M 2
#define ALX_PHY_STS_SPEED_100M 1
#define ALX_PHY_STS_SPEED_10M 0
#define ALX_BIST0 0x141C
#define ALX_BIST0_COL_MASK 0x3FUL
#define ALX_BIST0_COL_SHIFT 24
#define ALX_BIST0_ROW_MASK 0xFFFUL
#define ALX_BIST0_ROW_SHIFT 12
#define ALX_BIST0_STEP_MASK 0xFUL
#define ALX_BIST0_STEP_SHIFT 8
#define ALX_BIST0_PATTERN_MASK 0x7UL
#define ALX_BIST0_PATTERN_SHIFT 4
#define ALX_BIST0_CRIT BIT(3)
#define ALX_BIST0_FIXED BIT(2)
#define ALX_BIST0_FAIL BIT(1)
#define ALX_BIST0_START BIT(0)
#define ALX_BIST1 0x1420
#define ALX_BIST1_COL_MASK 0x3FUL
#define ALX_BIST1_COL_SHIFT 24
#define ALX_BIST1_ROW_MASK 0xFFFUL
#define ALX_BIST1_ROW_SHIFT 12
#define ALX_BIST1_STEP_MASK 0xFUL
#define ALX_BIST1_STEP_SHIFT 8
#define ALX_BIST1_PATTERN_MASK 0x7UL
#define ALX_BIST1_PATTERN_SHIFT 4
#define ALX_BIST1_CRIT BIT(3)
#define ALX_BIST1_FIXED BIT(2)
#define ALX_BIST1_FAIL BIT(1)
#define ALX_BIST1_START BIT(0)
#define ALX_SERDES 0x1424
#define ALX_SERDES_PHYCLK_SLWDWN BIT(18)
#define ALX_SERDES_MACCLK_SLWDWN BIT(17)
#define ALX_SERDES_SELFB_PLL_MASK 0x3UL
#define ALX_SERDES_SELFB_PLL_SHIFT 14
/* bit13: 1:gtx_clk, 0:25M */
#define ALX_SERDES_PHYCLK_SEL_GTX BIT(13)
/* bit12: 1:serdes,0:25M */
#define ALX_SERDES_PCIECLK_SEL_SRDS BIT(12)
#define ALX_SERDES_BUFS_RX_EN BIT(11)
#define ALX_SERDES_PD_RX BIT(10)
#define ALX_SERDES_PLL_EN BIT(9)
#define ALX_SERDES_EN BIT(8)
/* bit6: 0:state-machine,1:csr */
#define ALX_SERDES_SELFB_PLL_SEL_CSR BIT(6)
#define ALX_SERDES_SELFB_PLL_CSR_MASK 0x3UL
#define ALX_SERDES_SELFB_PLL_CSR_SHIFT 4
/* 4-12% OV-CLK */
#define ALX_SERDES_SELFB_PLL_CSR_4 3
/* 0-4% OV-CLK */
#define ALX_SERDES_SELFB_PLL_CSR_0 2
/* 12-18% OV-CLK */
#define ALX_SERDES_SELFB_PLL_CSR_12 1
/* 18-25% OV-CLK */
#define ALX_SERDES_SELFB_PLL_CSR_18 0
#define ALX_SERDES_VCO_SLOW BIT(3)
#define ALX_SERDES_VCO_FAST BIT(2)
#define ALX_SERDES_LOCKDCT_EN BIT(1)
#define ALX_SERDES_LOCKDCTED BIT(0)
#define ALX_LED_CTRL 0x1428
#define ALX_LED_CTRL_PATMAP2_MASK 0x3UL
#define ALX_LED_CTRL_PATMAP2_SHIFT 8
#define ALX_LED_CTRL_PATMAP1_MASK 0x3UL
#define ALX_LED_CTRL_PATMAP1_SHIFT 6
#define ALX_LED_CTRL_PATMAP0_MASK 0x3UL
#define ALX_LED_CTRL_PATMAP0_SHIFT 4
#define ALX_LED_CTRL_D3_MODE_MASK 0x3UL
#define ALX_LED_CTRL_D3_MODE_SHIFT 2
#define ALX_LED_CTRL_D3_MODE_NORMAL 0
#define ALX_LED_CTRL_D3_MODE_WOL_DIS 1
#define ALX_LED_CTRL_D3_MODE_WOL_ANY 2
#define ALX_LED_CTRL_D3_MODE_WOL_EN 3
#define ALX_LED_CTRL_DUTY_CYCL_MASK 0x3UL
#define ALX_LED_CTRL_DUTY_CYCL_SHIFT 0
/* 50% */
#define ALX_LED_CTRL_DUTY_CYCL_50 0
/* 12.5% */
#define ALX_LED_CTRL_DUTY_CYCL_125 1
/* 25% */
#define ALX_LED_CTRL_DUTY_CYCL_25 2
/* 75% */
#define ALX_LED_CTRL_DUTY_CYCL_75 3
#define ALX_LED_PATN 0x142C
#define ALX_LED_PATN1_MASK 0xFFFFUL
#define ALX_LED_PATN1_SHIFT 16
#define ALX_LED_PATN0_MASK 0xFFFFUL
#define ALX_LED_PATN0_SHIFT 0
#define ALX_LED_PATN2 0x1430
#define ALX_LED_PATN2_MASK 0xFFFFUL
#define ALX_LED_PATN2_SHIFT 0
#define ALX_SYSALV 0x1434
#define ALX_SYSALV_FLAG BIT(0)
#define ALX_PCIERR_INST 0x1438
#define ALX_PCIERR_INST_TX_RATE_MASK 0xFUL
#define ALX_PCIERR_INST_TX_RATE_SHIFT 4
#define ALX_PCIERR_INST_RX_RATE_MASK 0xFUL
#define ALX_PCIERR_INST_RX_RATE_SHIFT 0
#define ALX_LPI_DECISN_TIMER 0x143C
#define ALX_LPI_CTRL 0x1440
#define ALX_LPI_CTRL_CHK_DA BIT(31)
#define ALX_LPI_CTRL_ENH_TO_MASK 0x1FFFUL
#define ALX_LPI_CTRL_ENH_TO_SHIFT 12
#define ALX_LPI_CTRL_ENH_TH_MASK 0x1FUL
#define ALX_LPI_CTRL_ENH_TH_SHIFT 6
#define ALX_LPI_CTRL_ENH_EN BIT(5)
#define ALX_LPI_CTRL_CHK_RX BIT(4)
#define ALX_LPI_CTRL_CHK_STATE BIT(3)
#define ALX_LPI_CTRL_GMII BIT(2)
#define ALX_LPI_CTRL_TO_PHY BIT(1)
#define ALX_LPI_CTRL_EN BIT(0)
#define ALX_LPI_WAIT 0x1444
#define ALX_LPI_WAIT_TIMER_MASK 0xFFFFUL
#define ALX_LPI_WAIT_TIMER_SHIFT 0
/* heart-beat, for swoi/cifs */
#define ALX_HRTBT_VLAN 0x1450
#define ALX_HRTBT_VLANID_MASK 0xFFFFUL
#define ALX_HRRBT_VLANID_SHIFT 0
#define ALX_HRTBT_CTRL 0x1454
#define ALX_HRTBT_CTRL_EN BIT(31)
#define ALX_HRTBT_CTRL_PERIOD_MASK 0x3FUL
#define ALX_HRTBT_CTRL_PERIOD_SHIFT 25
#define ALX_HRTBT_CTRL_HASVLAN BIT(24)
#define ALX_HRTBT_CTRL_HDRADDR_MASK 0xFFFUL
#define ALX_HRTBT_CTRL_HDRADDR_SHIFT 12
#define ALX_HRTBT_CTRL_HDRADDRB0_MASK 0x7FFUL
#define ALX_HRTBT_CTRL_HDRADDRB0_SHIFT 13
#define ALX_HRTBT_CTRL_PKT_FRAG BIT(12)
#define ALX_HRTBT_CTRL_PKTLEN_MASK 0xFFFUL
#define ALX_HRTBT_CTRL_PKTLEN_SHIFT 0
/* for B0+, bit[13..] for C0+ */
#define ALX_HRTBT_EXT_CTRL 0x1AD0
#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_MASK 0x3FUL
#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_SHIFT 24
#define L1F_HRTBT_EXT_CTRL_SWOI_STARTUP_PKT_EN BIT(23)
#define L1F_HRTBT_EXT_CTRL_IOAC_2_FRAGMENTED BIT(22)
#define L1F_HRTBT_EXT_CTRL_IOAC_1_FRAGMENTED BIT(21)
#define L1F_HRTBT_EXT_CTRL_IOAC_1_KEEPALIVE_EN BIT(20)
#define L1F_HRTBT_EXT_CTRL_IOAC_1_HAS_VLAN BIT(19)
#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_8023 BIT(18)
#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_IPV6 BIT(17)
#define L1F_HRTBT_EXT_CTRL_IOAC_2_KEEPALIVE_EN BIT(16)
#define L1F_HRTBT_EXT_CTRL_IOAC_2_HAS_VLAN BIT(15)
#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_8023 BIT(14)
#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_IPV6 BIT(13)
#define ALX_HRTBT_EXT_CTRL_NS_EN BIT(12)
#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_MASK 0xFFUL
#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_SHIFT 4
#define ALX_HRTBT_EXT_CTRL_IS_8023 BIT(3)
#define ALX_HRTBT_EXT_CTRL_IS_IPV6 BIT(2)
#define ALX_HRTBT_EXT_CTRL_WAKEUP_EN BIT(1)
#define ALX_HRTBT_EXT_CTRL_ARP_EN BIT(0)
#define ALX_HRTBT_REM_IPV4_ADDR 0x1AD4
#define ALX_HRTBT_HOST_IPV4_ADDR 0x1478
#define ALX_HRTBT_REM_IPV6_ADDR3 0x1AD8
#define ALX_HRTBT_REM_IPV6_ADDR2 0x1ADC
#define ALX_HRTBT_REM_IPV6_ADDR1 0x1AE0
#define ALX_HRTBT_REM_IPV6_ADDR0 0x1AE4
/* 1B8C ~ 1B94 for C0+ */
#define ALX_SWOI_ACER_CTRL 0x1B8C
#define ALX_SWOI_ORIG_ACK_NAK_EN BIT(20)
#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_MASK 0XFFUL
#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_SHIFT 12
#define ALX_SWOI_ORIG_ACK_ADDR_MASK 0XFFFUL
#define ALX_SWOI_ORIG_ACK_ADDR_SHIFT 0
#define ALX_SWOI_IOAC_CTRL_2 0x1B90
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_MASK 0xFFUL
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_SHIFT 24
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_MASK 0xFFFUL
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_SHIFT 12
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_MASK 0xFFFUL
#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_SHIFT 0
#define ALX_SWOI_IOAC_CTRL_3 0x1B94
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_MASK 0xFFUL
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_SHIFT 24
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_MASK 0xFFFUL
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_SHIFT 12
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_MASK 0xFFFUL
#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_SHIFT 0
/*SWOI_HOST_IPV6_ADDR reuse reg1a60-1a6c, 1a70-1a7c, 1aa0-1aac, 1ab0-1abc.*/
#define ALX_HRTBT_WAKEUP_PORT 0x1AE8
#define ALX_HRTBT_WAKEUP_PORT_SRC_MASK 0xFFFFUL
#define ALX_HRTBT_WAKEUP_PORT_SRC_SHIFT 16
#define ALX_HRTBT_WAKEUP_PORT_DEST_MASK 0xFFFFUL
#define ALX_HRTBT_WAKEUP_PORT_DEST_SHIFT 0
#define ALX_HRTBT_WAKEUP_DATA7 0x1AEC
#define ALX_HRTBT_WAKEUP_DATA6 0x1AF0
#define ALX_HRTBT_WAKEUP_DATA5 0x1AF4
#define ALX_HRTBT_WAKEUP_DATA4 0x1AF8
#define ALX_HRTBT_WAKEUP_DATA3 0x1AFC
#define ALX_HRTBT_WAKEUP_DATA2 0x1B80
#define ALX_HRTBT_WAKEUP_DATA1 0x1B84
#define ALX_HRTBT_WAKEUP_DATA0 0x1B88
#define ALX_RXPARSE 0x1458
#define ALX_RXPARSE_FLT6_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT6_L4_SHIFT 30
#define ALX_RXPARSE_FLT6_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT6_L3_SHIFT 28
#define ALX_RXPARSE_FLT5_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT5_L4_SHIFT 26
#define ALX_RXPARSE_FLT5_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT5_L3_SHIFT 24
#define ALX_RXPARSE_FLT4_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT4_L4_SHIFT 22
#define ALX_RXPARSE_FLT4_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT4_L3_SHIFT 20
#define ALX_RXPARSE_FLT3_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT3_L4_SHIFT 18
#define ALX_RXPARSE_FLT3_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT3_L3_SHIFT 16
#define ALX_RXPARSE_FLT2_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT2_L4_SHIFT 14
#define ALX_RXPARSE_FLT2_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT2_L3_SHIFT 12
#define ALX_RXPARSE_FLT1_L4_MASK 0x3UL
#define ALX_RXPARSE_FLT1_L4_SHIFT 10
#define ALX_RXPARSE_FLT1_L3_MASK 0x3UL
#define ALX_RXPARSE_FLT1_L3_SHIFT 8
#define ALX_RXPARSE_FLT6_EN BIT(5)
#define ALX_RXPARSE_FLT5_EN BIT(4)
#define ALX_RXPARSE_FLT4_EN BIT(3)
#define ALX_RXPARSE_FLT3_EN BIT(2)
#define ALX_RXPARSE_FLT2_EN BIT(1)
#define ALX_RXPARSE_FLT1_EN BIT(0)
#define ALX_RXPARSE_FLT_L4_UDP 0
#define ALX_RXPARSE_FLT_L4_TCP 1
#define ALX_RXPARSE_FLT_L4_BOTH 2
#define ALX_RXPARSE_FLT_L4_NONE 3
#define ALX_RXPARSE_FLT_L3_IPV6 0
#define ALX_RXPARSE_FLT_L3_IPV4 1
#define ALX_RXPARSE_FLT_L3_BOTH 2
/* Terodo support */
#define ALX_TRD_CTRL 0x145C
#define ALX_TRD_CTRL_EN BIT(31)
#define ALX_TRD_CTRL_BUBBLE_WAKE_EN BIT(30)
#define ALX_TRD_CTRL_PREFIX_CMP_HW BIT(28)
#define ALX_TRD_CTRL_RSHDR_ADDR_MASK 0xFFFUL
#define ALX_TRD_CTRL_RSHDR_ADDR_SHIFT 16
#define ALX_TRD_CTRL_SINTV_MAX_MASK 0xFFUL
#define ALX_TRD_CTRL_SINTV_MAX_SHIFT 8
#define ALX_TRD_CTRL_SINTV_MIN_MASK 0xFFUL
#define ALX_TRD_CTRL_SINTV_MIN_SHIFT 0
#define ALX_TRD_RS 0x1460
#define ALX_TRD_RS_SZ_MASK 0xFFFUL
#define ALX_TRD_RS_SZ_SHIFT 20
#define ALX_TRD_RS_NONCE_OFS_MASK 0xFFFUL
#define ALX_TRD_RS_NONCE_OFS_SHIFT 8
#define ALX_TRD_RS_SEQ_OFS_MASK 0xFFUL
#define ALX_TRD_RS_SEQ_OFS_SHIFT 0
#define ALX_TRD_SRV_IP4 0x1464
#define ALX_TRD_CLNT_EXTNL_IP4 0x1468
#define ALX_TRD_PORT 0x146C
#define ALX_TRD_PORT_CLNT_EXTNL_MASK 0xFFFFUL
#define ALX_TRD_PORT_CLNT_EXTNL_SHIFT 16
#define ALX_TRD_PORT_SRV_MASK 0xFFFFUL
#define ALX_TRD_PORT_SRV_SHIFT 0
#define ALX_TRD_PREFIX 0x1470
#define ALX_TRD_BUBBLE_DA_IP4 0x1478
#define ALX_TRD_BUBBLE_DA_PORT 0x147C
/* for B0 */
#define ALX_IDLE_DECISN_TIMER 0x1474
/* 1ms */
#define ALX_IDLE_DECISN_TIMER_DEF 0x400
#define ALX_MAC_CTRL 0x1480
#define ALX_MAC_CTRL_FAST_PAUSE BIT(31)
#define ALX_MAC_CTRL_WOLSPED_SWEN BIT(30)
/* bit29: 1:legacy(hi5b), 0:marvl(lo5b)*/
#define ALX_MAC_CTRL_MHASH_ALG_HI5B BIT(29)
#define ALX_MAC_CTRL_SPAUSE_EN BIT(28)
#define ALX_MAC_CTRL_DBG_EN BIT(27)
#define ALX_MAC_CTRL_BRD_EN BIT(26)
#define ALX_MAC_CTRL_MULTIALL_EN BIT(25)
#define ALX_MAC_CTRL_RX_XSUM_EN BIT(24)
#define ALX_MAC_CTRL_THUGE BIT(23)
#define ALX_MAC_CTRL_MBOF BIT(22)
#define ALX_MAC_CTRL_SPEED_MASK 0x3UL
#define ALX_MAC_CTRL_SPEED_SHIFT 20
#define ALX_MAC_CTRL_SPEED_10_100 1
#define ALX_MAC_CTRL_SPEED_1000 2
#define ALX_MAC_CTRL_SIMR BIT(19)
#define ALX_MAC_CTRL_SSTCT BIT(17)
#define ALX_MAC_CTRL_TPAUSE BIT(16)
#define ALX_MAC_CTRL_PROMISC_EN BIT(15)
#define ALX_MAC_CTRL_VLANSTRIP BIT(14)
#define ALX_MAC_CTRL_PRMBLEN_MASK 0xFUL
#define ALX_MAC_CTRL_PRMBLEN_SHIFT 10
#define ALX_MAC_CTRL_RHUGE_EN BIT(9)
#define ALX_MAC_CTRL_FLCHK BIT(8)
#define ALX_MAC_CTRL_PCRCE BIT(7)
#define ALX_MAC_CTRL_CRCE BIT(6)
#define ALX_MAC_CTRL_FULLD BIT(5)
#define ALX_MAC_CTRL_LPBACK_EN BIT(4)
#define ALX_MAC_CTRL_RXFC_EN BIT(3)
#define ALX_MAC_CTRL_TXFC_EN BIT(2)
#define ALX_MAC_CTRL_RX_EN BIT(1)
#define ALX_MAC_CTRL_TX_EN BIT(0)
#define ALX_GAP 0x1484
#define ALX_GAP_IPGR2_MASK 0x7FUL
#define ALX_GAP_IPGR2_SHIFT 24
#define ALX_GAP_IPGR1_MASK 0x7FUL
#define ALX_GAP_IPGR1_SHIFT 16
#define ALX_GAP_MIN_IFG_MASK 0xFFUL
#define ALX_GAP_MIN_IFG_SHIFT 8
#define ALX_GAP_IPGT_MASK 0x7FUL
#define ALX_GAP_IPGT_SHIFT 0
#define ALX_STAD0 0x1488
#define ALX_STAD1 0x148C
#define ALX_HASH_TBL0 0x1490
#define ALX_HASH_TBL1 0x1494
#define ALX_HALFD 0x1498
#define ALX_HALFD_JAM_IPG_MASK 0xFUL
#define ALX_HALFD_JAM_IPG_SHIFT 24
#define ALX_HALFD_ABEBT_MASK 0xFUL
#define ALX_HALFD_ABEBT_SHIFT 20
#define ALX_HALFD_ABEBE BIT(19)
#define ALX_HALFD_BPNB BIT(18)
#define ALX_HALFD_NOBO BIT(17)
#define ALX_HALFD_EDXSDFR BIT(16)
#define ALX_HALFD_RETRY_MASK 0xFUL
#define ALX_HALFD_RETRY_SHIFT 12
#define ALX_HALFD_LCOL_MASK 0x3FFUL
#define ALX_HALFD_LCOL_SHIFT 0
#define ALX_MTU 0x149C
#define ALX_MTU_JUMBO_TH 1514
#define ALX_MTU_STD_ALGN 1536
#define ALX_MTU_MIN 64
#define ALX_SRAM0 0x1500
#define ALX_SRAM_RFD_TAIL_ADDR_MASK 0xFFFUL
#define ALX_SRAM_RFD_TAIL_ADDR_SHIFT 16
#define ALX_SRAM_RFD_HEAD_ADDR_MASK 0xFFFUL
#define ALX_SRAM_RFD_HEAD_ADDR_SHIFT 0
#define ALX_SRAM1 0x1510
#define ALX_SRAM_RFD_LEN_MASK 0xFFFUL
#define ALX_SRAM_RFD_LEN_SHIFT 0
#define ALX_SRAM2 0x1518
#define ALX_SRAM_TRD_TAIL_ADDR_MASK 0xFFFUL
#define ALX_SRAM_TRD_TAIL_ADDR_SHIFT 16
#define ALX_SRMA_TRD_HEAD_ADDR_MASK 0xFFFUL
#define ALX_SRAM_TRD_HEAD_ADDR_SHIFT 0
#define ALX_SRAM3 0x151C
#define ALX_SRAM_TRD_LEN_MASK 0xFFFUL
#define ALX_SRAM_TRD_LEN_SHIFT 0
#define ALX_SRAM4 0x1520
#define ALX_SRAM_RXF_TAIL_ADDR_MASK 0xFFFUL
#define ALX_SRAM_RXF_TAIL_ADDR_SHIFT 16
#define ALX_SRAM_RXF_HEAD_ADDR_MASK 0xFFFUL
#define ALX_SRAM_RXF_HEAD_ADDR_SHIFT 0
#define ALX_SRAM5 0x1524
#define ALX_SRAM_RXF_LEN_MASK 0xFFFUL
#define ALX_SRAM_RXF_LEN_SHIFT 0
#define ALX_SRAM_RXF_LEN_8K (8*1024)
#define ALX_SRAM6 0x1528
#define ALX_SRAM_TXF_TAIL_ADDR_MASK 0xFFFUL
#define ALX_SRAM_TXF_TAIL_ADDR_SHIFT 16
#define ALX_SRAM_TXF_HEAD_ADDR_MASK 0xFFFUL
#define ALX_SRAM_TXF_HEAD_ADDR_SHIFT 0
#define ALX_SRAM7 0x152C
#define ALX_SRAM_TXF_LEN_MASK 0xFFFUL
#define ALX_SRAM_TXF_LEN_SHIFT 0
#define ALX_SRAM8 0x1530
#define ALX_SRAM_PATTERN_ADDR_MASK 0xFFFUL
#define ALX_SRAM_PATTERN_ADDR_SHIFT 16
#define ALX_SRAM_TSO_ADDR_MASK 0xFFFUL
#define ALX_SRAM_TSO_ADDR_SHIFT 0
#define ALX_SRAM9 0x1534
#define ALX_SRAM_LOAD_PTR BIT(0)
#define ALX_RX_BASE_ADDR_HI 0x1540
#define ALX_TX_BASE_ADDR_HI 0x1544
#define ALX_RFD_ADDR_LO 0x1550
#define ALX_RFD_RING_SZ 0x1560
#define ALX_RFD_BUF_SZ 0x1564
#define ALX_RFD_BUF_SZ_MASK 0xFFFFUL
#define ALX_RFD_BUF_SZ_SHIFT 0
#define ALX_RRD_ADDR_LO 0x1568
#define ALX_RRD_RING_SZ 0x1578
#define ALX_RRD_RING_SZ_MASK 0xFFFUL
#define ALX_RRD_RING_SZ_SHIFT 0
/* pri3: highest, pri0: lowest */
#define ALX_TPD_PRI3_ADDR_LO 0x14E4
#define ALX_TPD_PRI2_ADDR_LO 0x14E0
#define ALX_TPD_PRI1_ADDR_LO 0x157C
#define ALX_TPD_PRI0_ADDR_LO 0x1580
/* producer index is 16bit */
#define ALX_TPD_PRI3_PIDX 0x1618
#define ALX_TPD_PRI2_PIDX 0x161A
#define ALX_TPD_PRI1_PIDX 0x15F0
#define ALX_TPD_PRI0_PIDX 0x15F2
/* consumer index is 16bit */
#define ALX_TPD_PRI3_CIDX 0x161C
#define ALX_TPD_PRI2_CIDX 0x161E
#define ALX_TPD_PRI1_CIDX 0x15F4
#define ALX_TPD_PRI0_CIDX 0x15F6
#define ALX_TPD_RING_SZ 0x1584
#define ALX_TPD_RING_SZ_MASK 0xFFFFUL
#define ALX_TPD_RING_SZ_SHIFT 0
#define ALX_CMB_ADDR_LO 0x1588
#define ALX_TXQ0 0x1590
#define ALX_TXQ0_TXF_BURST_PREF_MASK 0xFFFFUL
#define ALX_TXQ0_TXF_BURST_PREF_SHIFT 16
#define ALX_TXQ_TXF_BURST_PREF_DEF 0x200
#define ALX_TXQ0_PEDING_CLR BIT(8)
#define ALX_TXQ0_LSO_8023_EN BIT(7)
#define ALX_TXQ0_MODE_ENHANCE BIT(6)
#define ALX_TXQ0_EN BIT(5)
#define ALX_TXQ0_SUPT_IPOPT BIT(4)
#define ALX_TXQ0_TPD_BURSTPREF_MASK 0xFUL
#define ALX_TXQ0_TPD_BURSTPREF_SHIFT 0
#define ALX_TXQ_TPD_BURSTPREF_DEF 5
#define ALX_TXQ1 0x1594
/* bit11: drop large packet, len > (rfd buf) */
#define ALX_TXQ1_ERRLGPKT_DROP_EN BIT(11)
/* bit[9:0]: 8bytes unit */
#define ALX_TXQ1_JUMBO_TSOTHR_MASK 0x7FFUL
#define ALX_TXQ1_JUMBO_TSOTHR_SHIFT 0
#define ALX_TXQ1_JUMBO_TSO_TH (7*1024)
/* L1 entrance control */
#define ALX_TXQ2 0x1598
#define ALX_TXQ2_BURST_EN BIT(31)
#define ALX_TXQ2_BURST_HI_WM_MASK 0xFFFUL
#define ALX_TXQ2_BURST_HI_WM_SHIFT 16
#define ALX_TXQ2_BURST_LO_WM_MASK 0xFFFUL
#define ALX_TXQ2_BURST_LO_WM_SHIFT 0
#define ALX_RXQ0 0x15A0
#define ALX_RXQ0_EN BIT(31)
#define ALX_RXQ0_CUT_THRU_EN BIT(30)
#define ALX_RXQ0_RSS_HASH_EN BIT(29)
/* bit28: 0:goto Q0, 1:as table */
#define ALX_RXQ0_NON_IP_QTBL BIT(28)
#define ALX_RXQ0_RSS_MODE_MASK 0x3UL
#define ALX_RXQ0_RSS_MODE_SHIFT 26
#define ALX_RXQ0_RSS_MODE_DIS 0
#define ALX_RXQ0_RSS_MODE_SQSI 1
#define ALX_RXQ0_RSS_MODE_MQSI 2
#define ALX_RXQ0_RSS_MODE_MQMI 3
#define ALX_RXQ0_NUM_RFD_PREF_MASK 0x3FUL
#define ALX_RXQ0_NUM_RFD_PREF_SHIFT 20
#define ALX_RXQ0_NUM_RFD_PREF_DEF 8
#define ALX_RXQ0_IDT_TBL_SIZE_MASK 0x1FFUL
#define ALX_RXQ0_IDT_TBL_SIZE_SHIFT 8
#define ALX_RXQ0_IDT_TBL_SIZE_DEF 0x100
#define ALX_RXQ0_IPV6_PARSE_EN BIT(7)
#define ALX_RXQ0_RSS_HSTYP_MASK 0xFUL
#define ALX_RXQ0_RSS_HSTYP_SHIFT 2
#define ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN BIT(5)
#define ALX_RXQ0_RSS_HSTYP_IPV6_EN BIT(4)
#define ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN BIT(3)
#define ALX_RXQ0_RSS_HSTYP_IPV4_EN BIT(2)
#define ALX_RXQ0_RSS_HSTYP_ALL (\
ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN |\
ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN |\
ALX_RXQ0_RSS_HSTYP_IPV6_EN |\
ALX_RXQ0_RSS_HSTYP_IPV4_EN)
#define ALX_RXQ0_ASPM_THRESH_MASK 0x3UL
#define ALX_RXQ0_ASPM_THRESH_SHIFT 0
#define ALX_RXQ0_ASPM_THRESH_NO 0
#define ALX_RXQ0_ASPM_THRESH_1M 1
#define ALX_RXQ0_ASPM_THRESH_10M 2
#define ALX_RXQ0_ASPM_THRESH_100M 3
#define ALX_RXQ1 0x15A4
/* 32bytes unit */
#define ALX_RXQ1_JUMBO_LKAH_MASK 0xFUL
#define ALX_RXQ1_JUMBO_LKAH_SHIFT 12