xref: /linux/drivers/net/ethernet/cavium/thunder/nic_reg.h (revision 4863dea3fab01734768c9f7fc2c1590a8f1f6266)
1*4863dea3SSunil Goutham /*
2*4863dea3SSunil Goutham  * Copyright (C) 2015 Cavium, Inc.
3*4863dea3SSunil Goutham  *
4*4863dea3SSunil Goutham  * This program is free software; you can redistribute it and/or modify it
5*4863dea3SSunil Goutham  * under the terms of version 2 of the GNU General Public License
6*4863dea3SSunil Goutham  * as published by the Free Software Foundation.
7*4863dea3SSunil Goutham  */
8*4863dea3SSunil Goutham 
9*4863dea3SSunil Goutham #ifndef NIC_REG_H
10*4863dea3SSunil Goutham #define NIC_REG_H
11*4863dea3SSunil Goutham 
12*4863dea3SSunil Goutham #define   NIC_PF_REG_COUNT			29573
13*4863dea3SSunil Goutham #define   NIC_VF_REG_COUNT			249
14*4863dea3SSunil Goutham 
15*4863dea3SSunil Goutham /* Physical function register offsets */
16*4863dea3SSunil Goutham #define   NIC_PF_CFG				(0x0000)
17*4863dea3SSunil Goutham #define   NIC_PF_STATUS				(0x0010)
18*4863dea3SSunil Goutham #define   NIC_PF_INTR_TIMER_CFG			(0x0030)
19*4863dea3SSunil Goutham #define   NIC_PF_BIST_STATUS			(0x0040)
20*4863dea3SSunil Goutham #define   NIC_PF_SOFT_RESET			(0x0050)
21*4863dea3SSunil Goutham #define   NIC_PF_TCP_TIMER			(0x0060)
22*4863dea3SSunil Goutham #define   NIC_PF_BP_CFG				(0x0080)
23*4863dea3SSunil Goutham #define   NIC_PF_RRM_CFG			(0x0088)
24*4863dea3SSunil Goutham #define   NIC_PF_CQM_CF				(0x00A0)
25*4863dea3SSunil Goutham #define   NIC_PF_CNM_CF				(0x00A8)
26*4863dea3SSunil Goutham #define   NIC_PF_CNM_STATUS			(0x00B0)
27*4863dea3SSunil Goutham #define   NIC_PF_CQ_AVG_CFG			(0x00C0)
28*4863dea3SSunil Goutham #define   NIC_PF_RRM_AVG_CFG			(0x00C8)
29*4863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_SEND_CFG		(0x0200)
30*4863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_CFG		(0x0208)
31*4863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_DIS_0_1		(0x0210)
32*4863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_SW_0_1		(0x0220)
33*4863dea3SSunil Goutham #define   NIC_PF_RBDR_BP_STATE_0_3		(0x0240)
34*4863dea3SSunil Goutham #define   NIC_PF_MAILBOX_INT			(0x0410)
35*4863dea3SSunil Goutham #define   NIC_PF_MAILBOX_INT_W1S		(0x0430)
36*4863dea3SSunil Goutham #define   NIC_PF_MAILBOX_ENA_W1C		(0x0450)
37*4863dea3SSunil Goutham #define   NIC_PF_MAILBOX_ENA_W1S		(0x0470)
38*4863dea3SSunil Goutham #define   NIC_PF_RX_ETYPE_0_7			(0x0500)
39*4863dea3SSunil Goutham #define   NIC_PF_PKIND_0_15_CFG			(0x0600)
40*4863dea3SSunil Goutham #define   NIC_PF_ECC0_FLIP0			(0x1000)
41*4863dea3SSunil Goutham #define   NIC_PF_ECC1_FLIP0			(0x1008)
42*4863dea3SSunil Goutham #define   NIC_PF_ECC2_FLIP0			(0x1010)
43*4863dea3SSunil Goutham #define   NIC_PF_ECC3_FLIP0			(0x1018)
44*4863dea3SSunil Goutham #define   NIC_PF_ECC0_FLIP1			(0x1080)
45*4863dea3SSunil Goutham #define   NIC_PF_ECC1_FLIP1			(0x1088)
46*4863dea3SSunil Goutham #define   NIC_PF_ECC2_FLIP1			(0x1090)
47*4863dea3SSunil Goutham #define   NIC_PF_ECC3_FLIP1			(0x1098)
48*4863dea3SSunil Goutham #define   NIC_PF_ECC0_CDIS			(0x1100)
49*4863dea3SSunil Goutham #define   NIC_PF_ECC1_CDIS			(0x1108)
50*4863dea3SSunil Goutham #define   NIC_PF_ECC2_CDIS			(0x1110)
51*4863dea3SSunil Goutham #define   NIC_PF_ECC3_CDIS			(0x1118)
52*4863dea3SSunil Goutham #define   NIC_PF_BIST0_STATUS			(0x1280)
53*4863dea3SSunil Goutham #define   NIC_PF_BIST1_STATUS			(0x1288)
54*4863dea3SSunil Goutham #define   NIC_PF_BIST2_STATUS			(0x1290)
55*4863dea3SSunil Goutham #define   NIC_PF_BIST3_STATUS			(0x1298)
56*4863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_INT			(0x2000)
57*4863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_INT_W1S		(0x2008)
58*4863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_ENA_W1C		(0x2010)
59*4863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_ENA_W1S		(0x2018)
60*4863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_INT			(0x2100)
61*4863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_INT_W1S		(0x2108)
62*4863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_ENA_W1C		(0x2110)
63*4863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_ENA_W1S		(0x2118)
64*4863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_INT			(0x2200)
65*4863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_INT_W1S		(0x2208)
66*4863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_ENA_W1C		(0x2210)
67*4863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_ENA_W1S		(0x2218)
68*4863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_INT			(0x2300)
69*4863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_INT_W1S		(0x2308)
70*4863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_ENA_W1C		(0x2310)
71*4863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_ENA_W1S		(0x2318)
72*4863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_INT			(0x2400)
73*4863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_INT_W1S		(0x2408)
74*4863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_ENA_W1C		(0x2410)
75*4863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_ENA_W1S		(0x2418)
76*4863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_INT			(0x2500)
77*4863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_INT_W1S		(0x2508)
78*4863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_ENA_W1C		(0x2510)
79*4863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_ENA_W1S		(0x2518)
80*4863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_INT			(0x2600)
81*4863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_INT_W1S		(0x2608)
82*4863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_ENA_W1C		(0x2610)
83*4863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_ENA_W1S		(0x2618)
84*4863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_INT			(0x2700)
85*4863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_INT_W1S		(0x2708)
86*4863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_ENA_W1C		(0x2710)
87*4863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_ENA_W1S		(0x2718)
88*4863dea3SSunil Goutham #define   NIC_PF_CPI_0_2047_CFG			(0x200000)
89*4863dea3SSunil Goutham #define   NIC_PF_RSSI_0_4097_RQ			(0x220000)
90*4863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_CFG			(0x240000)
91*4863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_SW_XOFF		(0x242000)
92*4863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_CREDIT		(0x244000)
93*4863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_TX_CFG		(0x400000)
94*4863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_RX_CFG		(0x420000)
95*4863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_SW_XOFF		(0x440000)
96*4863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_CREDIT		(0x460000)
97*4863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_RX_BP_CFG		(0x480000)
98*4863dea3SSunil Goutham #define   NIC_PF_SW_SYNC_RX			(0x490000)
99*4863dea3SSunil Goutham #define   NIC_PF_SW_SYNC_RX_DONE		(0x490008)
100*4863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_CFG			(0x500000)
101*4863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_PRI			(0x520000)
102*4863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_SH_STATUS		(0x580000)
103*4863dea3SSunil Goutham #define   NIC_PF_TL3A_0_63_CFG			(0x5F0000)
104*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CFG			(0x600000)
105*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CHAN			(0x620000)
106*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_PIR			(0x640000)
107*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_SW_XOFF		(0x660000)
108*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CNM_RATE		(0x680000)
109*4863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_SH_STATUS		(0x6A0000)
110*4863dea3SSunil Goutham #define   NIC_PF_TL4A_0_255_CFG			(0x6F0000)
111*4863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_CFG			(0x800000)
112*4863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_SW_XOFF		(0x820000)
113*4863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_SH_STATUS		(0x840000)
114*4863dea3SSunil Goutham #define   NIC_PF_TL4A_0_1023_CNM_RATE		(0x880000)
115*4863dea3SSunil Goutham #define   NIC_PF_TL4A_0_1023_CNM_STATUS		(0x8A0000)
116*4863dea3SSunil Goutham #define   NIC_PF_VF_0_127_MAILBOX_0_1		(0x20002030)
117*4863dea3SSunil Goutham #define   NIC_PF_VNIC_0_127_TX_STAT_0_4		(0x20004000)
118*4863dea3SSunil Goutham #define   NIC_PF_VNIC_0_127_RX_STAT_0_13	(0x20004100)
119*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_LOCK_0_15		(0x20006000)
120*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_CFG			(0x20010000)
121*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_CFG		(0x20010400)
122*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_DROP_CFG	(0x20010420)
123*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_BP_CFG	(0x20010500)
124*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_STAT_0_1	(0x20010600)
125*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_CFG		(0x20010C00)
126*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_CFG2		(0x20010C08)
127*4863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_STAT_0_1	(0x20010D00)
128*4863dea3SSunil Goutham 
129*4863dea3SSunil Goutham #define   NIC_PF_MSIX_VEC_0_18_ADDR		(0x000000)
130*4863dea3SSunil Goutham #define   NIC_PF_MSIX_VEC_0_CTL			(0x000008)
131*4863dea3SSunil Goutham #define   NIC_PF_MSIX_PBA_0			(0x0F0000)
132*4863dea3SSunil Goutham 
133*4863dea3SSunil Goutham /* Virtual function register offsets */
134*4863dea3SSunil Goutham #define   NIC_VNIC_CFG				(0x000020)
135*4863dea3SSunil Goutham #define   NIC_VF_PF_MAILBOX_0_1			(0x000130)
136*4863dea3SSunil Goutham #define   NIC_VF_INT				(0x000200)
137*4863dea3SSunil Goutham #define   NIC_VF_INT_W1S			(0x000220)
138*4863dea3SSunil Goutham #define   NIC_VF_ENA_W1C			(0x000240)
139*4863dea3SSunil Goutham #define   NIC_VF_ENA_W1S			(0x000260)
140*4863dea3SSunil Goutham 
141*4863dea3SSunil Goutham #define   NIC_VNIC_RSS_CFG			(0x0020E0)
142*4863dea3SSunil Goutham #define   NIC_VNIC_RSS_KEY_0_4			(0x002200)
143*4863dea3SSunil Goutham #define   NIC_VNIC_TX_STAT_0_4			(0x004000)
144*4863dea3SSunil Goutham #define   NIC_VNIC_RX_STAT_0_13			(0x004100)
145*4863dea3SSunil Goutham #define   NIC_QSET_RQ_GEN_CFG			(0x010010)
146*4863dea3SSunil Goutham 
147*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_CFG			(0x010400)
148*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_CFG2			(0x010408)
149*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_THRESH		(0x010410)
150*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_BASE			(0x010420)
151*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_HEAD			(0x010428)
152*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_TAIL			(0x010430)
153*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_DOOR			(0x010438)
154*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_STATUS		(0x010440)
155*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_STATUS2		(0x010448)
156*4863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_DEBUG			(0x010450)
157*4863dea3SSunil Goutham 
158*4863dea3SSunil Goutham #define   NIC_QSET_RQ_0_7_CFG			(0x010600)
159*4863dea3SSunil Goutham #define   NIC_QSET_RQ_0_7_STAT_0_1		(0x010700)
160*4863dea3SSunil Goutham 
161*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_CFG			(0x010800)
162*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_THRESH		(0x010810)
163*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_BASE			(0x010820)
164*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_HEAD			(0x010828)
165*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_TAIL			(0x010830)
166*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_DOOR			(0x010838)
167*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_STATUS		(0x010840)
168*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_DEBUG			(0x010848)
169*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_CNM_CHG		(0x010860)
170*4863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_STAT_0_1		(0x010900)
171*4863dea3SSunil Goutham 
172*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_CFG			(0x010C00)
173*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_THRESH		(0x010C10)
174*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_BASE		(0x010C20)
175*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_HEAD		(0x010C28)
176*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_TAIL		(0x010C30)
177*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_DOOR		(0x010C38)
178*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_STATUS0		(0x010C40)
179*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_STATUS1		(0x010C48)
180*4863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_PREFETCH_STATUS	(0x010C50)
181*4863dea3SSunil Goutham 
182*4863dea3SSunil Goutham #define   NIC_VF_MSIX_VECTOR_0_19_ADDR		(0x000000)
183*4863dea3SSunil Goutham #define   NIC_VF_MSIX_VECTOR_0_19_CTL		(0x000008)
184*4863dea3SSunil Goutham #define   NIC_VF_MSIX_PBA			(0x0F0000)
185*4863dea3SSunil Goutham 
186*4863dea3SSunil Goutham /* Offsets within registers */
187*4863dea3SSunil Goutham #define   NIC_MSIX_VEC_SHIFT			4
188*4863dea3SSunil Goutham #define   NIC_Q_NUM_SHIFT			18
189*4863dea3SSunil Goutham #define   NIC_QS_ID_SHIFT			21
190*4863dea3SSunil Goutham #define   NIC_VF_NUM_SHIFT			21
191*4863dea3SSunil Goutham 
192*4863dea3SSunil Goutham /* Port kind configuration register */
193*4863dea3SSunil Goutham struct pkind_cfg {
194*4863dea3SSunil Goutham #if defined(__BIG_ENDIAN_BITFIELD)
195*4863dea3SSunil Goutham 	u64 reserved_42_63:22;
196*4863dea3SSunil Goutham 	u64 hdr_sl:5;	/* Header skip length */
197*4863dea3SSunil Goutham 	u64 rx_hdr:3;	/* TNS Receive header present */
198*4863dea3SSunil Goutham 	u64 lenerr_en:1;/* L2 length error check enable */
199*4863dea3SSunil Goutham 	u64 reserved_32_32:1;
200*4863dea3SSunil Goutham 	u64 maxlen:16;	/* Max frame size */
201*4863dea3SSunil Goutham 	u64 minlen:16;	/* Min frame size */
202*4863dea3SSunil Goutham #elif defined(__LITTLE_ENDIAN_BITFIELD)
203*4863dea3SSunil Goutham 	u64 minlen:16;
204*4863dea3SSunil Goutham 	u64 maxlen:16;
205*4863dea3SSunil Goutham 	u64 reserved_32_32:1;
206*4863dea3SSunil Goutham 	u64 lenerr_en:1;
207*4863dea3SSunil Goutham 	u64 rx_hdr:3;
208*4863dea3SSunil Goutham 	u64 hdr_sl:5;
209*4863dea3SSunil Goutham 	u64 reserved_42_63:22;
210*4863dea3SSunil Goutham #endif
211*4863dea3SSunil Goutham };
212*4863dea3SSunil Goutham 
213*4863dea3SSunil Goutham #endif /* NIC_REG_H */
214