• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2014-2015 Hisilicon Limited.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9 
10 #ifndef _DSAF_REG_H_
11 #define _DSAF_REG_H_
12 
13 #include <linux/regmap.h>
14 #define HNS_DEBUG_RING_IRQ_IDX		0
15 #define HNS_SERVICE_RING_IRQ_IDX	59
16 #define HNSV2_SERVICE_RING_IRQ_IDX	25
17 
18 #define DSAF_MAX_PORT_NUM	6
19 #define DSAF_MAX_VM_NUM		128
20 
21 #define DSAF_COMM_DEV_NUM	1
22 #define DSAF_PPE_INODE_BASE	6
23 #define DSAF_DEBUG_NW_NUM	2
24 #define DSAF_SERVICE_NW_NUM	6
25 #define DSAF_COMM_CHN		DSAF_SERVICE_NW_NUM
26 #define DSAF_GE_NUM		((DSAF_SERVICE_NW_NUM) + (DSAF_DEBUG_NW_NUM))
27 #define DSAF_XGE_NUM		DSAF_SERVICE_NW_NUM
28 #define DSAF_PORT_TYPE_NUM 3
29 #define DSAF_NODE_NUM		18
30 #define DSAF_XOD_BIG_NUM	DSAF_NODE_NUM
31 #define DSAF_SBM_NUM		DSAF_NODE_NUM
32 #define DSAFV2_SBM_NUM		8
33 #define DSAFV2_SBM_XGE_CHN    6
34 #define DSAFV2_SBM_PPE_CHN    1
35 #define DASFV2_ROCEE_CRD_NUM  1
36 
37 #define DSAF_VOQ_NUM		DSAF_NODE_NUM
38 #define DSAF_INODE_NUM		DSAF_NODE_NUM
39 #define DSAF_XOD_NUM		8
40 #define DSAF_TBL_NUM		8
41 #define DSAF_SW_PORT_NUM	8
42 #define DSAF_TOTAL_QUEUE_NUM	129
43 
44 #define DSAF_TCAM_SUM		512
45 #define DSAF_LINE_SUM		(2048 * 14)
46 
47 #define DSAF_SUB_SC_NT_SRAM_CLK_SEL_REG			0x100
48 #define DSAF_SUB_SC_HILINK3_CRG_CTRL0_REG		0x180
49 #define DSAF_SUB_SC_HILINK3_CRG_CTRL1_REG		0x184
50 #define DSAF_SUB_SC_HILINK3_CRG_CTRL2_REG		0x188
51 #define DSAF_SUB_SC_HILINK3_CRG_CTRL3_REG		0x18C
52 #define DSAF_SUB_SC_HILINK4_CRG_CTRL0_REG		0x190
53 #define DSAF_SUB_SC_HILINK4_CRG_CTRL1_REG		0x194
54 #define DSAF_SUB_SC_DSAF_CLK_EN_REG			0x300
55 #define DSAF_SUB_SC_DSAF_CLK_DIS_REG			0x304
56 #define DSAF_SUB_SC_NT_CLK_EN_REG			0x308
57 #define DSAF_SUB_SC_NT_CLK_DIS_REG			0x30C
58 #define DSAF_SUB_SC_XGE_CLK_EN_REG			0x310
59 #define DSAF_SUB_SC_XGE_CLK_DIS_REG			0x314
60 #define DSAF_SUB_SC_GE_CLK_EN_REG			0x318
61 #define DSAF_SUB_SC_GE_CLK_DIS_REG			0x31C
62 #define DSAF_SUB_SC_PPE_CLK_EN_REG			0x320
63 #define DSAF_SUB_SC_PPE_CLK_DIS_REG			0x324
64 #define DSAF_SUB_SC_RCB_PPE_COM_CLK_EN_REG		0x350
65 #define DSAF_SUB_SC_RCB_PPE_COM_CLK_DIS_REG		0x354
66 #define DSAF_SUB_SC_XBAR_RESET_REQ_REG			0xA00
67 #define DSAF_SUB_SC_XBAR_RESET_DREQ_REG			0xA04
68 #define DSAF_SUB_SC_NT_RESET_REQ_REG			0xA08
69 #define DSAF_SUB_SC_NT_RESET_DREQ_REG			0xA0C
70 #define DSAF_SUB_SC_XGE_RESET_REQ_REG			0xA10
71 #define DSAF_SUB_SC_XGE_RESET_DREQ_REG			0xA14
72 #define DSAF_SUB_SC_GE_RESET_REQ0_REG			0xA18
73 #define DSAF_SUB_SC_GE_RESET_DREQ0_REG			0xA1C
74 #define DSAF_SUB_SC_GE_RESET_REQ1_REG			0xA20
75 #define DSAF_SUB_SC_GE_RESET_DREQ1_REG			0xA24
76 #define DSAF_SUB_SC_PPE_RESET_REQ_REG			0xA48
77 #define DSAF_SUB_SC_PPE_RESET_DREQ_REG			0xA4C
78 #define DSAF_SUB_SC_RCB_PPE_COM_RESET_REQ_REG		0xA88
79 #define DSAF_SUB_SC_RCB_PPE_COM_RESET_DREQ_REG		0xA8C
80 #define DSAF_SUB_SC_DSAF_RESET_REQ_REG			0xAA8
81 #define DSAF_SUB_SC_DSAF_RESET_DREQ_REG			0xAAC
82 #define DSAF_SUB_SC_ROCEE_RESET_REQ_REG			0xA50
83 #define DSAF_SUB_SC_ROCEE_RESET_DREQ_REG		0xA54
84 #define DSAF_SUB_SC_ROCEE_CLK_DIS_REG			0x32C
85 #define DSAF_SUB_SC_ROCEE_CLK_EN_REG			0x328
86 #define DSAF_SUB_SC_LIGHT_MODULE_DETECT_EN_REG		0x2060
87 #define DSAF_SUB_SC_TCAM_MBIST_EN_REG			0x2300
88 #define DSAF_SUB_SC_DSAF_CLK_ST_REG			0x5300
89 #define DSAF_SUB_SC_NT_CLK_ST_REG			0x5304
90 #define DSAF_SUB_SC_XGE_CLK_ST_REG			0x5308
91 #define DSAF_SUB_SC_GE_CLK_ST_REG			0x530C
92 #define DSAF_SUB_SC_PPE_CLK_ST_REG			0x5310
93 #define DSAF_SUB_SC_ROCEE_CLK_ST_REG			0x5314
94 #define DSAF_SUB_SC_CPU_CLK_ST_REG			0x5318
95 #define DSAF_SUB_SC_RCB_PPE_COM_CLK_ST_REG		0x5328
96 #define DSAF_SUB_SC_XBAR_RESET_ST_REG			0x5A00
97 #define DSAF_SUB_SC_NT_RESET_ST_REG			0x5A04
98 #define DSAF_SUB_SC_XGE_RESET_ST_REG			0x5A08
99 #define DSAF_SUB_SC_GE_RESET_ST0_REG			0x5A0C
100 #define DSAF_SUB_SC_GE_RESET_ST1_REG			0x5A10
101 #define DSAF_SUB_SC_PPE_RESET_ST_REG			0x5A24
102 #define DSAF_SUB_SC_RCB_PPE_COM_RESET_ST_REG		0x5A44
103 
104 /*serdes offset**/
105 #define HNS_MAC_HILINK3_REG DSAF_SUB_SC_HILINK3_CRG_CTRL0_REG
106 #define HNS_MAC_HILINK4_REG DSAF_SUB_SC_HILINK4_CRG_CTRL0_REG
107 #define HNS_MAC_HILINK3V2_REG DSAF_SUB_SC_HILINK3_CRG_CTRL1_REG
108 #define HNS_MAC_HILINK4V2_REG DSAF_SUB_SC_HILINK4_CRG_CTRL1_REG
109 #define HNS_MAC_LANE0_CTLEDFE_REG 0x000BFFCCULL
110 #define HNS_MAC_LANE1_CTLEDFE_REG 0x000BFFBCULL
111 #define HNS_MAC_LANE2_CTLEDFE_REG 0x000BFFACULL
112 #define HNS_MAC_LANE3_CTLEDFE_REG 0x000BFF9CULL
113 #define HNS_MAC_LANE0_STATE_REG 0x000BFFD4ULL
114 #define HNS_MAC_LANE1_STATE_REG 0x000BFFC4ULL
115 #define HNS_MAC_LANE2_STATE_REG 0x000BFFB4ULL
116 #define HNS_MAC_LANE3_STATE_REG 0x000BFFA4ULL
117 
118 #define HILINK_RESET_TIMOUT 10000
119 
120 #define DSAF_SRAM_INIT_OVER_0_REG	0x0
121 #define DSAF_CFG_0_REG			0x4
122 #define DSAF_ECC_ERR_INVERT_0_REG	0x8
123 #define DSAF_ABNORMAL_TIMEOUT_0_REG	0x1C
124 #define DSAF_FSM_TIMEOUT_0_REG		0x20
125 #define DSAF_DSA_REG_CNT_CLR_CE_REG	0x2C
126 #define DSAF_DSA_SBM_INF_FIFO_THRD_REG	0x30
127 #define DSAF_DSA_SRAM_1BIT_ECC_SEL_REG	0x34
128 #define DSAF_DSA_SRAM_1BIT_ECC_CNT_REG	0x38
129 #define DSAF_PFC_EN_0_REG		0x50
130 #define DSAF_PFC_UNIT_CNT_0_REG		0x70
131 #define DSAF_XGE_INT_MSK_0_REG		0x100
132 #define DSAF_PPE_INT_MSK_0_REG		0x120
133 #define DSAF_ROCEE_INT_MSK_0_REG	0x140
134 #define DSAF_XGE_INT_SRC_0_REG		0x160
135 #define DSAF_PPE_INT_SRC_0_REG		0x180
136 #define DSAF_ROCEE_INT_SRC_0_REG	0x1A0
137 #define DSAF_XGE_INT_STS_0_REG		0x1C0
138 #define DSAF_PPE_INT_STS_0_REG		0x1E0
139 #define DSAF_ROCEE_INT_STS_0_REG	0x200
140 #define DSAFV2_SERDES_LBK_0_REG         0x220
141 #define DSAF_PAUSE_CFG_REG		0x240
142 #define DSAF_ROCE_PORT_MAP_REG		0x2A0
143 #define DSAF_ROCE_SL_MAP_REG		0x2A4
144 #define DSAF_PPE_QID_CFG_0_REG		0x300
145 #define DSAF_SW_PORT_TYPE_0_REG		0x320
146 #define DSAF_STP_PORT_TYPE_0_REG	0x340
147 #define DSAF_MIX_DEF_QID_0_REG		0x360
148 #define DSAF_PORT_DEF_VLAN_0_REG	0x380
149 #define DSAF_VM_DEF_VLAN_0_REG		0x400
150 
151 #define DSAF_INODE_CUT_THROUGH_CFG_0_REG	0x1000
152 #define DSAF_INODE_ECC_INVERT_EN_0_REG		0x1008
153 #define DSAF_INODE_ECC_ERR_ADDR_0_REG		0x100C
154 #define DSAF_INODE_IN_PORT_NUM_0_REG		0x1018
155 #define DSAF_INODE_PRI_TC_CFG_0_REG		0x101C
156 #define DSAF_INODE_BP_STATUS_0_REG		0x1020
157 #define DSAF_INODE_PAD_DISCARD_NUM_0_REG	0x1028
158 #define DSAF_INODE_FINAL_IN_MAN_NUM_0_REG	0x102C
159 #define DSAF_INODE_FINAL_IN_PKT_NUM_0_REG	0x1030
160 #define DSAF_INODE_SBM_PID_NUM_0_REG		0x1038
161 #define DSAF_INODE_FINAL_IN_PAUSE_NUM_0_REG	0x103C
162 #define DSAFV2_INODE_FINAL_IN_PAUSE_NUM_0_REG	0x1024
163 #define DSAF_INODE_SBM_RELS_NUM_0_REG		0x104C
164 #define DSAF_INODE_SBM_DROP_NUM_0_REG		0x1050
165 #define DSAF_INODE_CRC_FALSE_NUM_0_REG		0x1054
166 #define DSAF_INODE_BP_DISCARD_NUM_0_REG		0x1058
167 #define DSAF_INODE_RSLT_DISCARD_NUM_0_REG	0x105C
168 #define DSAF_INODE_LOCAL_ADDR_FALSE_NUM_0_REG	0x1060
169 #define DSAF_INODE_VOQ_OVER_NUM_0_REG		0x1068
170 #define DSAF_INODE_BD_SAVE_STATUS_0_REG		0x1900
171 #define DSAF_INODE_BD_ORDER_STATUS_0_REG	0x1950
172 #define DSAF_INODE_SW_VLAN_TAG_DISC_0_REG	0x1A00
173 #define DSAF_INODE_IN_DATA_STP_DISC_0_REG	0x1A50
174 #define DSAF_INODE_GE_FC_EN_0_REG		0x1B00
175 #define DSAF_INODE_VC0_IN_PKT_NUM_0_REG		0x1B50
176 #define DSAF_INODE_VC1_IN_PKT_NUM_0_REG		0x1C00
177 #define DSAF_INODE_IN_PRIO_PAUSE_BASE_REG	0x1C00
178 #define DSAF_INODE_IN_PRIO_PAUSE_BASE_OFFSET	0x100
179 #define DSAF_INODE_IN_PRIO_PAUSE_OFFSET		0x50
180 
181 #define DSAF_SBM_CFG_REG_0_REG			0x2000
182 #define DSAF_SBM_BP_CFG_0_XGE_REG_0_REG		0x2004
183 #define DSAF_SBM_BP_CFG_0_PPE_REG_0_REG		0x2304
184 #define DSAF_SBM_BP_CFG_0_ROCEE_REG_0_REG	0x2604
185 #define DSAF_SBM_BP_CFG_1_REG_0_REG		0x2008
186 #define DSAF_SBM_BP_CFG_2_XGE_REG_0_REG		0x200C
187 #define DSAF_SBM_BP_CFG_2_PPE_REG_0_REG		0x230C
188 #define DSAF_SBM_BP_CFG_2_ROCEE_REG_0_REG	0x260C
189 #define DSAF_SBM_ROCEE_CFG_REG_REG		0x2380
190 #define DSAFV2_SBM_BP_CFG_2_ROCEE_REG_0_REG	0x238C
191 #define DSAF_SBM_FREE_CNT_0_0_REG		0x2010
192 #define DSAF_SBM_FREE_CNT_1_0_REG		0x2014
193 #define DSAF_SBM_BP_CNT_0_0_REG			0x2018
194 #define DSAF_SBM_BP_CNT_1_0_REG			0x201C
195 #define DSAF_SBM_BP_CNT_2_0_REG			0x2020
196 #define DSAF_SBM_BP_CNT_3_0_REG			0x2024
197 #define DSAF_SBM_INER_ST_0_REG			0x2028
198 #define DSAF_SBM_MIB_REQ_FAILED_TC_0_REG	0x202C
199 #define DSAF_SBM_LNK_INPORT_CNT_0_REG		0x2030
200 #define DSAF_SBM_LNK_DROP_CNT_0_REG		0x2034
201 #define DSAF_SBM_INF_OUTPORT_CNT_0_REG		0x2038
202 #define DSAF_SBM_LNK_INPORT_TC0_CNT_0_REG	0x203C
203 #define DSAF_SBM_LNK_INPORT_TC1_CNT_0_REG	0x2040
204 #define DSAF_SBM_LNK_INPORT_TC2_CNT_0_REG	0x2044
205 #define DSAF_SBM_LNK_INPORT_TC3_CNT_0_REG	0x2048
206 #define DSAF_SBM_LNK_INPORT_TC4_CNT_0_REG	0x204C
207 #define DSAF_SBM_LNK_INPORT_TC5_CNT_0_REG	0x2050
208 #define DSAF_SBM_LNK_INPORT_TC6_CNT_0_REG	0x2054
209 #define DSAF_SBM_LNK_INPORT_TC7_CNT_0_REG	0x2058
210 #define DSAF_SBM_LNK_REQ_CNT_0_REG		0x205C
211 #define DSAF_SBM_LNK_RELS_CNT_0_REG		0x2060
212 #define DSAF_SBM_BP_CFG_3_REG_0_REG		0x2068
213 #define DSAF_SBM_BP_CFG_4_REG_0_REG		0x206C
214 
215 #define DSAF_XOD_ETS_TSA_TC0_TC3_CFG_0_REG	0x3000
216 #define DSAF_XOD_ETS_TSA_TC4_TC7_CFG_0_REG	0x3004
217 #define DSAF_XOD_ETS_BW_TC0_TC3_CFG_0_REG	0x3008
218 #define DSAF_XOD_ETS_BW_TC4_TC7_CFG_0_REG	0x300C
219 #define DSAF_XOD_ETS_BW_OFFSET_CFG_0_REG	0x3010
220 #define DSAF_XOD_ETS_TOKEN_CFG_0_REG		0x3014
221 #define DSAF_XOD_PFS_CFG_0_0_REG		0x3018
222 #define DSAF_XOD_PFS_CFG_1_0_REG		0x301C
223 #define DSAF_XOD_PFS_CFG_2_0_REG		0x3020
224 #define DSAF_XOD_GNT_L_0_REG			0x3024
225 #define DSAF_XOD_GNT_H_0_REG			0x3028
226 #define DSAF_XOD_CONNECT_STATE_0_REG		0x302C
227 #define DSAF_XOD_RCVPKT_CNT_0_REG		0x3030
228 #define DSAF_XOD_RCVTC0_CNT_0_REG		0x3034
229 #define DSAF_XOD_RCVTC1_CNT_0_REG		0x3038
230 #define DSAF_XOD_RCVTC2_CNT_0_REG		0x303C
231 #define DSAF_XOD_RCVTC3_CNT_0_REG		0x3040
232 #define DSAF_XOD_RCVVC0_CNT_0_REG		0x3044
233 #define DSAF_XOD_RCVVC1_CNT_0_REG		0x3048
234 #define DSAF_XOD_XGE_RCVIN0_CNT_0_REG		0x304C
235 #define DSAF_XOD_XGE_RCVIN1_CNT_0_REG		0x3050
236 #define DSAF_XOD_XGE_RCVIN2_CNT_0_REG		0x3054
237 #define DSAF_XOD_XGE_RCVIN3_CNT_0_REG		0x3058
238 #define DSAF_XOD_XGE_RCVIN4_CNT_0_REG		0x305C
239 #define DSAF_XOD_XGE_RCVIN5_CNT_0_REG		0x3060
240 #define DSAF_XOD_XGE_RCVIN6_CNT_0_REG		0x3064
241 #define DSAF_XOD_XGE_RCVIN7_CNT_0_REG		0x3068
242 #define DSAF_XOD_PPE_RCVIN0_CNT_0_REG		0x306C
243 #define DSAF_XOD_PPE_RCVIN1_CNT_0_REG		0x3070
244 #define DSAF_XOD_ROCEE_RCVIN0_CNT_0_REG		0x3074
245 #define DSAF_XOD_ROCEE_RCVIN1_CNT_0_REG		0x3078
246 #define DSAF_XOD_FIFO_STATUS_0_REG		0x307C
247 #define DSAF_XOD_XGE_PFC_PRIO_CNT_BASE_REG	0x3A00
248 #define DSAF_XOD_XGE_PFC_PRIO_CNT_OFFSET	0x4
249 
250 #define DSAF_VOQ_ECC_INVERT_EN_0_REG		0x4004
251 #define DSAF_VOQ_SRAM_PKT_NUM_0_REG		0x4008
252 #define DSAF_VOQ_IN_PKT_NUM_0_REG		0x400C
253 #define DSAF_VOQ_OUT_PKT_NUM_0_REG		0x4010
254 #define DSAF_VOQ_ECC_ERR_ADDR_0_REG		0x4014
255 #define DSAF_VOQ_BP_STATUS_0_REG		0x4018
256 #define DSAF_VOQ_SPUP_IDLE_0_REG		0x401C
257 #define DSAF_VOQ_XGE_XOD_REQ_0_0_REG		0x4024
258 #define DSAF_VOQ_XGE_XOD_REQ_1_0_REG		0x4028
259 #define DSAF_VOQ_PPE_XOD_REQ_0_REG		0x402C
260 #define DSAF_VOQ_ROCEE_XOD_REQ_0_REG		0x4030
261 #define DSAF_VOQ_BP_ALL_THRD_0_REG		0x4034
262 
263 #define DSAF_TBL_CTRL_0_REG			0x5000
264 #define DSAF_TBL_INT_MSK_0_REG			0x5004
265 #define DSAF_TBL_INT_SRC_0_REG			0x5008
266 #define DSAF_TBL_INT_STS_0_REG			0x5100
267 #define DSAF_TBL_TCAM_ADDR_0_REG		0x500C
268 #define DSAF_TBL_LINE_ADDR_0_REG		0x5010
269 #define DSAF_TBL_TCAM_HIGH_0_REG		0x5014
270 #define DSAF_TBL_TCAM_LOW_0_REG			0x5018
271 #define DSAF_TBL_TCAM_MCAST_CFG_4_0_REG		0x501C
272 #define DSAF_TBL_TCAM_MCAST_CFG_3_0_REG		0x5020
273 #define DSAF_TBL_TCAM_MCAST_CFG_2_0_REG		0x5024
274 #define DSAF_TBL_TCAM_MCAST_CFG_1_0_REG		0x5028
275 #define DSAF_TBL_TCAM_MCAST_CFG_0_0_REG		0x502C
276 #define DSAF_TBL_TCAM_UCAST_CFG_0_REG		0x5030
277 #define DSAF_TBL_LIN_CFG_0_REG			0x5034
278 #define DSAF_TBL_TCAM_RDATA_HIGH_0_REG		0x5038
279 #define DSAF_TBL_TCAM_RDATA_LOW_0_REG		0x503C
280 #define DSAF_TBL_TCAM_RAM_RDATA4_0_REG		0x5040
281 #define DSAF_TBL_TCAM_RAM_RDATA3_0_REG		0x5044
282 #define DSAF_TBL_TCAM_RAM_RDATA2_0_REG		0x5048
283 #define DSAF_TBL_TCAM_RAM_RDATA1_0_REG		0x504C
284 #define DSAF_TBL_TCAM_RAM_RDATA0_0_REG		0x5050
285 #define DSAF_TBL_LIN_RDATA_0_REG		0x5054
286 #define DSAF_TBL_DA0_MIS_INFO1_0_REG		0x5058
287 #define DSAF_TBL_DA0_MIS_INFO0_0_REG		0x505C
288 #define DSAF_TBL_SA_MIS_INFO2_0_REG		0x5104
289 #define DSAF_TBL_SA_MIS_INFO1_0_REG		0x5098
290 #define DSAF_TBL_SA_MIS_INFO0_0_REG		0x509C
291 #define DSAF_TBL_PUL_0_REG			0x50A0
292 #define DSAF_TBL_OLD_RSLT_0_REG			0x50A4
293 #define DSAF_TBL_OLD_SCAN_VAL_0_REG		0x50A8
294 #define DSAF_TBL_DFX_CTRL_0_REG			0x50AC
295 #define DSAF_TBL_DFX_STAT_0_REG			0x50B0
296 #define DSAF_TBL_DFX_STAT_2_0_REG		0x5108
297 #define DSAF_TBL_LKUP_NUM_I_0_REG		0x50C0
298 #define DSAF_TBL_LKUP_NUM_O_0_REG		0x50E0
299 #define DSAF_TBL_UCAST_BCAST_MIS_INFO_0_0_REG	0x510C
300 
301 #define DSAF_INODE_FIFO_WL_0_REG		0x6000
302 #define DSAF_ONODE_FIFO_WL_0_REG		0x6020
303 #define DSAF_XGE_GE_WORK_MODE_0_REG		0x6040
304 #define DSAF_XGE_APP_RX_LINK_UP_0_REG		0x6080
305 #define DSAF_NETPORT_CTRL_SIG_0_REG		0x60A0
306 #define DSAF_XGE_CTRL_SIG_CFG_0_REG		0x60C0
307 
308 #define PPE_COM_CFG_QID_MODE_REG		0x0
309 #define PPE_COM_INTEN_REG			0x110
310 #define PPE_COM_RINT_REG			0x114
311 #define PPE_COM_INTSTS_REG			0x118
312 #define PPE_COM_COMMON_CNT_CLR_CE_REG		0x1120
313 #define PPE_COM_HIS_RX_PKT_QID_DROP_CNT_REG	0x300
314 #define PPE_COM_HIS_RX_PKT_QID_OK_CNT_REG	0x600
315 #define PPE_COM_HIS_TX_PKT_QID_ERR_CNT_REG	0x900
316 #define PPE_COM_HIS_TX_PKT_QID_OK_CNT_REG	0xC00
317 #define PPE_COM_COMMON_CNT_CLR_CE_REG		0x1120
318 
319 #define PPE_CFG_TX_FIFO_THRSLD_REG		0x0
320 #define PPE_CFG_RX_FIFO_THRSLD_REG		0x4
321 #define PPE_CFG_RX_FIFO_PAUSE_THRSLD_REG	0x8
322 #define PPE_CFG_RX_FIFO_SW_BP_THRSLD_REG	0xC
323 #define PPE_CFG_PAUSE_IDLE_CNT_REG		0x10
324 #define PPE_CFG_BUS_CTRL_REG			0x40
325 #define PPE_CFG_TNL_TO_BE_RST_REG		0x48
326 #define PPE_CURR_TNL_CAN_RST_REG		0x4C
327 #define PPE_CFG_XGE_MODE_REG			0x80
328 #define PPE_CFG_MAX_FRAME_LEN_REG		0x84
329 #define PPE_CFG_RX_PKT_MODE_REG			0x88
330 #define PPE_CFG_RX_VLAN_TAG_REG			0x8C
331 #define PPE_CFG_TAG_GEN_REG			0x90
332 #define PPE_CFG_PARSE_TAG_REG			0x94
333 #define PPE_CFG_PRO_CHECK_EN_REG		0x98
334 #define PPEV2_CFG_TSO_EN_REG			0xA0
335 #define PPEV2_VLAN_STRIP_EN_REG			0xAC
336 #define PPE_INTEN_REG				0x100
337 #define PPE_RINT_REG				0x104
338 #define PPE_INTSTS_REG				0x108
339 #define PPE_CFG_RX_PKT_INT_REG			0x140
340 #define PPE_CFG_HEAT_DECT_TIME0_REG		0x144
341 #define PPE_CFG_HEAT_DECT_TIME1_REG		0x148
342 #define PPE_HIS_RX_SW_PKT_CNT_REG		0x200
343 #define PPE_HIS_RX_WR_BD_OK_PKT_CNT_REG		0x204
344 #define PPE_HIS_RX_PKT_NO_BUF_CNT_REG		0x208
345 #define PPE_HIS_TX_BD_CNT_REG			0x20C
346 #define PPE_HIS_TX_PKT_CNT_REG			0x210
347 #define PPE_HIS_TX_PKT_OK_CNT_REG		0x214
348 #define PPE_HIS_TX_PKT_EPT_CNT_REG		0x218
349 #define PPE_HIS_TX_PKT_CS_FAIL_CNT_REG		0x21C
350 #define PPE_HIS_RX_APP_BUF_FAIL_CNT_REG		0x220
351 #define PPE_HIS_RX_APP_BUF_WAIT_CNT_REG		0x224
352 #define PPE_HIS_RX_PKT_DROP_FUL_CNT_REG		0x228
353 #define PPE_HIS_RX_PKT_DROP_PRT_CNT_REG		0x22C
354 #define PPE_TNL_0_5_CNT_CLR_CE_REG		0x300
355 #define PPE_CFG_AXI_DBG_REG			0x304
356 #define PPE_HIS_PRO_ERR_REG			0x308
357 #define PPE_HIS_TNL_FIFO_ERR_REG		0x30C
358 #define PPE_CURR_CFF_DATA_NUM_REG		0x310
359 #define PPE_CURR_RX_ST_REG			0x314
360 #define PPE_CURR_TX_ST_REG			0x318
361 #define PPE_CURR_RX_FIFO0_REG			0x31C
362 #define PPE_CURR_RX_FIFO1_REG			0x320
363 #define PPE_CURR_TX_FIFO0_REG			0x324
364 #define PPE_CURR_TX_FIFO1_REG			0x328
365 #define PPE_ECO0_REG				0x32C
366 #define PPE_ECO1_REG				0x330
367 #define PPE_ECO2_REG				0x334
368 #define PPEV2_INDRECTION_TBL_REG		0x800
369 #define PPEV2_RSS_KEY_REG			0x900
370 
371 #define RCB_COM_CFG_ENDIAN_REG			0x0
372 #define RCB_COM_CFG_SYS_FSH_REG			0xC
373 #define RCB_COM_CFG_INIT_FLAG_REG		0x10
374 #define RCB_COM_CFG_PKT_REG			0x30
375 #define RCB_COM_CFG_RINVLD_REG			0x34
376 #define RCB_COM_CFG_FNA_REG			0x38
377 #define RCB_COM_CFG_FA_REG			0x3C
378 #define RCB_COM_CFG_PKT_TC_BP_REG		0x40
379 #define RCB_COM_CFG_PPE_TNL_CLKEN_REG		0x44
380 #define RCBV2_COM_CFG_USER_REG			0x30
381 #define RCBV2_COM_CFG_TSO_MODE_REG		0x50
382 
383 #define RCB_COM_INTMSK_TX_PKT_REG		0x3A0
384 #define RCB_COM_RINT_TX_PKT_REG			0x3A8
385 #define RCB_COM_INTMASK_ECC_ERR_REG		0x400
386 #define RCB_COM_INTSTS_ECC_ERR_REG		0x408
387 #define RCB_COM_EBD_SRAM_ERR_REG		0x410
388 #define RCB_COM_RXRING_ERR_REG			0x41C
389 #define RCB_COM_TXRING_ERR_REG			0x420
390 #define RCB_COM_TX_FBD_ERR_REG			0x424
391 #define RCB_SRAM_ECC_CHK_EN_REG			0x428
392 #define RCB_SRAM_ECC_CHK0_REG			0x42C
393 #define RCB_SRAM_ECC_CHK1_REG			0x430
394 #define RCB_SRAM_ECC_CHK2_REG			0x434
395 #define RCB_SRAM_ECC_CHK3_REG			0x438
396 #define RCB_SRAM_ECC_CHK4_REG			0x43c
397 #define RCB_SRAM_ECC_CHK5_REG			0x440
398 #define RCB_ECC_ERR_ADDR0_REG			0x450
399 #define RCB_ECC_ERR_ADDR3_REG			0x45C
400 #define RCB_ECC_ERR_ADDR4_REG			0x460
401 #define RCB_ECC_ERR_ADDR5_REG			0x464
402 
403 #define RCB_COM_SF_CFG_INTMASK_RING		0x480
404 #define RCB_COM_SF_CFG_RING_STS			0x484
405 #define RCB_COM_SF_CFG_RING			0x488
406 #define RCB_COM_SF_CFG_INTMASK_BD		0x48C
407 #define RCB_COM_SF_CFG_BD_RINT_STS		0x470
408 #define RCB_COM_RCB_RD_BD_BUSY			0x490
409 #define RCB_COM_RCB_FBD_CRT_EN			0x494
410 #define RCB_COM_AXI_WR_ERR_INTMASK		0x498
411 #define RCB_COM_AXI_ERR_STS			0x49C
412 #define RCB_COM_CHK_TX_FBD_NUM_REG		0x4a0
413 
414 #define RCB_CFG_BD_NUM_REG			0x9000
415 #define RCB_CFG_PKTLINE_REG			0x9050
416 
417 #define RCB_CFG_OVERTIME_REG			0x9300
418 #define RCB_CFG_PKTLINE_INT_NUM_REG		0x9304
419 #define RCB_CFG_OVERTIME_INT_NUM_REG		0x9308
420 #define RCB_INT_GAP_TIME_REG			0x9400
421 #define RCB_PORT_CFG_OVERTIME_REG		0x9430
422 
423 #define RCB_RING_RX_RING_BASEADDR_L_REG		0x00000
424 #define RCB_RING_RX_RING_BASEADDR_H_REG		0x00004
425 #define RCB_RING_RX_RING_BD_NUM_REG		0x00008
426 #define RCB_RING_RX_RING_BD_LEN_REG		0x0000C
427 #define RCB_RING_RX_RING_PKTLINE_REG		0x00010
428 #define RCB_RING_RX_RING_TAIL_REG		0x00018
429 #define RCB_RING_RX_RING_HEAD_REG		0x0001C
430 #define RCB_RING_RX_RING_FBDNUM_REG		0x00020
431 #define RCB_RING_RX_RING_PKTNUM_RECORD_REG	0x0002C
432 
433 #define RCB_RING_TX_RING_BASEADDR_L_REG		0x00040
434 #define RCB_RING_TX_RING_BASEADDR_H_REG		0x00044
435 #define RCB_RING_TX_RING_BD_NUM_REG		0x00048
436 #define RCB_RING_TX_RING_BD_LEN_REG		0x0004C
437 #define RCB_RING_TX_RING_PKTLINE_REG		0x00050
438 #define RCB_RING_TX_RING_TAIL_REG		0x00058
439 #define RCB_RING_TX_RING_HEAD_REG		0x0005C
440 #define RCB_RING_TX_RING_FBDNUM_REG		0x00060
441 #define RCB_RING_TX_RING_OFFSET_REG		0x00064
442 #define RCB_RING_TX_RING_PKTNUM_RECORD_REG	0x0006C
443 
444 #define RCB_RING_PREFETCH_EN_REG		0x0007C
445 #define RCB_RING_CFG_VF_NUM_REG			0x00080
446 #define RCB_RING_ASID_REG			0x0008C
447 #define RCB_RING_RX_VM_REG			0x00090
448 #define RCB_RING_T0_BE_RST			0x00094
449 #define RCB_RING_COULD_BE_RST			0x00098
450 #define RCB_RING_WRR_WEIGHT_REG			0x0009c
451 
452 #define RCB_RING_INTMSK_RXWL_REG		0x000A0
453 #define RCB_RING_INTSTS_RX_RING_REG		0x000A4
454 #define RCBV2_RX_RING_INT_STS_REG		0x000A8
455 #define RCB_RING_INTMSK_TXWL_REG		0x000AC
456 #define RCB_RING_INTSTS_TX_RING_REG		0x000B0
457 #define RCBV2_TX_RING_INT_STS_REG		0x000B4
458 #define RCB_RING_INTMSK_RX_OVERTIME_REG		0x000B8
459 #define RCB_RING_INTSTS_RX_OVERTIME_REG		0x000BC
460 #define RCB_RING_INTMSK_TX_OVERTIME_REG		0x000C4
461 #define RCB_RING_INTSTS_TX_OVERTIME_REG		0x000C8
462 
463 #define GMAC_DUPLEX_TYPE_REG			0x0008UL
464 #define GMAC_FD_FC_TYPE_REG			0x000CUL
465 #define GMAC_FC_TX_TIMER_REG			0x001CUL
466 #define GMAC_FD_FC_ADDR_LOW_REG			0x0020UL
467 #define GMAC_FD_FC_ADDR_HIGH_REG		0x0024UL
468 #define GMAC_IPG_TX_TIMER_REG			0x0030UL
469 #define GMAC_PAUSE_THR_REG			0x0038UL
470 #define GMAC_MAX_FRM_SIZE_REG			0x003CUL
471 #define GMAC_PORT_MODE_REG			0x0040UL
472 #define GMAC_PORT_EN_REG			0x0044UL
473 #define GMAC_PAUSE_EN_REG			0x0048UL
474 #define GMAC_SHORT_RUNTS_THR_REG		0x0050UL
475 #define GMAC_AN_NEG_STATE_REG			0x0058UL
476 #define GMAC_TX_LOCAL_PAGE_REG			0x005CUL
477 #define GMAC_TRANSMIT_CONTROL_REG		0x0060UL
478 #define GMAC_REC_FILT_CONTROL_REG		0x0064UL
479 #define GMAC_PTP_CONFIG_REG			0x0074UL
480 
481 #define GMAC_RX_OCTETS_TOTAL_OK_REG		0x0080UL
482 #define GMAC_RX_OCTETS_BAD_REG			0x0084UL
483 #define GMAC_RX_UC_PKTS_REG			0x0088UL
484 #define GMAC_RX_MC_PKTS_REG			0x008CUL
485 #define GMAC_RX_BC_PKTS_REG			0x0090UL
486 #define GMAC_RX_PKTS_64OCTETS_REG		0x0094UL
487 #define GMAC_RX_PKTS_65TO127OCTETS_REG		0x0098UL
488 #define GMAC_RX_PKTS_128TO255OCTETS_REG		0x009CUL
489 #define GMAC_RX_PKTS_255TO511OCTETS_REG		0x00A0UL
490 #define GMAC_RX_PKTS_512TO1023OCTETS_REG	0x00A4UL
491 #define GMAC_RX_PKTS_1024TO1518OCTETS_REG	0x00A8UL
492 #define GMAC_RX_PKTS_1519TOMAXOCTETS_REG	0x00ACUL
493 #define GMAC_RX_FCS_ERRORS_REG			0x00B0UL
494 #define GMAC_RX_TAGGED_REG			0x00B4UL
495 #define GMAC_RX_DATA_ERR_REG			0x00B8UL
496 #define GMAC_RX_ALIGN_ERRORS_REG		0x00BCUL
497 #define GMAC_RX_LONG_ERRORS_REG			0x00C0UL
498 #define GMAC_RX_JABBER_ERRORS_REG		0x00C4UL
499 #define GMAC_RX_PAUSE_MACCTRL_FRAM_REG		0x00C8UL
500 #define GMAC_RX_UNKNOWN_MACCTRL_FRAM_REG	0x00CCUL
501 #define GMAC_RX_VERY_LONG_ERR_CNT_REG		0x00D0UL
502 #define GMAC_RX_RUNT_ERR_CNT_REG		0x00D4UL
503 #define GMAC_RX_SHORT_ERR_CNT_REG		0x00D8UL
504 #define GMAC_RX_FILT_PKT_CNT_REG		0x00E8UL
505 #define GMAC_RX_OCTETS_TOTAL_FILT_REG		0x00ECUL
506 #define GMAC_OCTETS_TRANSMITTED_OK_REG		0x0100UL
507 #define GMAC_OCTETS_TRANSMITTED_BAD_REG		0x0104UL
508 #define GMAC_TX_UC_PKTS_REG			0x0108UL
509 #define GMAC_TX_MC_PKTS_REG			0x010CUL
510 #define GMAC_TX_BC_PKTS_REG			0x0110UL
511 #define GMAC_TX_PKTS_64OCTETS_REG		0x0114UL
512 #define GMAC_TX_PKTS_65TO127OCTETS_REG		0x0118UL
513 #define GMAC_TX_PKTS_128TO255OCTETS_REG		0x011CUL
514 #define GMAC_TX_PKTS_255TO511OCTETS_REG		0x0120UL
515 #define GMAC_TX_PKTS_512TO1023OCTETS_REG	0x0124UL
516 #define GMAC_TX_PKTS_1024TO1518OCTETS_REG	0x0128UL
517 #define GMAC_TX_PKTS_1519TOMAXOCTETS_REG	0x012CUL
518 #define GMAC_TX_EXCESSIVE_LENGTH_DROP_REG	0x014CUL
519 #define GMAC_TX_UNDERRUN_REG			0x0150UL
520 #define GMAC_TX_TAGGED_REG			0x0154UL
521 #define GMAC_TX_CRC_ERROR_REG			0x0158UL
522 #define GMAC_TX_PAUSE_FRAMES_REG		0x015CUL
523 #define GAMC_RX_MAX_FRAME			0x0170UL
524 #define GMAC_LINE_LOOP_BACK_REG			0x01A8UL
525 #define GMAC_CF_CRC_STRIP_REG			0x01B0UL
526 #define GMAC_MODE_CHANGE_EN_REG			0x01B4UL
527 #define GMAC_SIXTEEN_BIT_CNTR_REG		0x01CCUL
528 #define GMAC_LD_LINK_COUNTER_REG		0x01D0UL
529 #define GMAC_LOOP_REG				0x01DCUL
530 #define GMAC_RECV_CONTROL_REG			0x01E0UL
531 #define GMAC_VLAN_CODE_REG			0x01E8UL
532 #define GMAC_RX_OVERRUN_CNT_REG			0x01ECUL
533 #define GMAC_RX_LENGTHFIELD_ERR_CNT_REG		0x01F4UL
534 #define GMAC_RX_FAIL_COMMA_CNT_REG		0x01F8UL
535 #define GMAC_STATION_ADDR_LOW_0_REG		0x0200UL
536 #define GMAC_STATION_ADDR_HIGH_0_REG		0x0204UL
537 #define GMAC_STATION_ADDR_LOW_1_REG		0x0208UL
538 #define GMAC_STATION_ADDR_HIGH_1_REG		0x020CUL
539 #define GMAC_STATION_ADDR_LOW_2_REG		0x0210UL
540 #define GMAC_STATION_ADDR_HIGH_2_REG		0x0214UL
541 #define GMAC_STATION_ADDR_LOW_3_REG		0x0218UL
542 #define GMAC_STATION_ADDR_HIGH_3_REG		0x021CUL
543 #define GMAC_STATION_ADDR_LOW_4_REG		0x0220UL
544 #define GMAC_STATION_ADDR_HIGH_4_REG		0x0224UL
545 #define GMAC_STATION_ADDR_LOW_5_REG		0x0228UL
546 #define GMAC_STATION_ADDR_HIGH_5_REG		0x022CUL
547 #define GMAC_STATION_ADDR_LOW_MSK_0_REG		0x0230UL
548 #define GMAC_STATION_ADDR_HIGH_MSK_0_REG	0x0234UL
549 #define GMAC_STATION_ADDR_LOW_MSK_1_REG		0x0238UL
550 #define GMAC_STATION_ADDR_HIGH_MSK_1_REG	0x023CUL
551 #define GMAC_MAC_SKIP_LEN_REG			0x0240UL
552 #define GMAC_TX_LOOP_PKT_PRI_REG		0x0378UL
553 
554 #define XGMAC_INT_STATUS_REG			0x0
555 #define XGMAC_INT_ENABLE_REG			0x4
556 #define XGMAC_INT_SET_REG			0x8
557 #define XGMAC_IERR_U_INFO_REG			0xC
558 #define XGMAC_OVF_INFO_REG			0x10
559 #define XGMAC_OVF_CNT_REG			0x14
560 #define XGMAC_PORT_MODE_REG			0x40
561 #define XGMAC_CLK_ENABLE_REG			0x44
562 #define XGMAC_RESET_REG				0x48
563 #define XGMAC_LINK_CONTROL_REG			0x50
564 #define XGMAC_LINK_STATUS_REG			0x54
565 #define XGMAC_SPARE_REG				0xC0
566 #define XGMAC_SPARE_CNT_REG			0xC4
567 
568 #define XGMAC_MAC_ENABLE_REG			0x100
569 #define XGMAC_MAC_CONTROL_REG			0x104
570 #define XGMAC_MAC_IPG_REG			0x120
571 #define XGMAC_MAC_MSG_CRC_EN_REG		0x124
572 #define XGMAC_MAC_MSG_IMG_REG			0x128
573 #define XGMAC_MAC_MSG_FC_CFG_REG		0x12C
574 #define XGMAC_MAC_MSG_TC_CFG_REG		0x130
575 #define XGMAC_MAC_PAD_SIZE_REG			0x134
576 #define XGMAC_MAC_MIN_PKT_SIZE_REG		0x138
577 #define XGMAC_MAC_MAX_PKT_SIZE_REG		0x13C
578 #define XGMAC_MAC_PAUSE_CTRL_REG		0x160
579 #define XGMAC_MAC_PAUSE_TIME_REG		0x164
580 #define XGMAC_MAC_PAUSE_GAP_REG			0x168
581 #define XGMAC_MAC_PAUSE_LOCAL_MAC_H_REG		0x16C
582 #define XGMAC_MAC_PAUSE_LOCAL_MAC_L_REG		0x170
583 #define XGMAC_MAC_PAUSE_PEER_MAC_H_REG		0x174
584 #define XGMAC_MAC_PAUSE_PEER_MAC_L_REG		0x178
585 #define XGMAC_MAC_PFC_PRI_EN_REG		0x17C
586 #define XGMAC_MAC_1588_CTRL_REG			0x180
587 #define XGMAC_MAC_1588_TX_PORT_DLY_REG		0x184
588 #define XGMAC_MAC_1588_RX_PORT_DLY_REG		0x188
589 #define XGMAC_MAC_1588_ASYM_DLY_REG		0x18C
590 #define XGMAC_MAC_1588_ADJUST_CFG_REG		0x190
591 #define XGMAC_MAC_Y1731_ETH_TYPE_REG		0x194
592 #define XGMAC_MAC_MIB_CONTROL_REG		0x198
593 #define XGMAC_MAC_WAN_RATE_ADJUST_REG		0x19C
594 #define XGMAC_MAC_TX_ERR_MARK_REG		0x1A0
595 #define XGMAC_MAC_TX_LF_RF_CONTROL_REG		0x1A4
596 #define XGMAC_MAC_RX_LF_RF_STATUS_REG		0x1A8
597 #define XGMAC_MAC_TX_RUNT_PKT_CNT_REG		0x1C0
598 #define XGMAC_MAC_RX_RUNT_PKT_CNT_REG		0x1C4
599 #define XGMAC_MAC_RX_PREAM_ERR_PKT_CNT_REG	0x1C8
600 #define XGMAC_MAC_TX_LF_RF_TERM_PKT_CNT_REG	0x1CC
601 #define XGMAC_MAC_TX_SN_MISMATCH_PKT_CNT_REG	0x1D0
602 #define XGMAC_MAC_RX_ERR_MSG_CNT_REG		0x1D4
603 #define XGMAC_MAC_RX_ERR_EFD_CNT_REG		0x1D8
604 #define XGMAC_MAC_ERR_INFO_REG			0x1DC
605 #define XGMAC_MAC_DBG_INFO_REG			0x1E0
606 
607 #define XGMAC_PCS_BASER_SYNC_THD_REG		0x330
608 #define XGMAC_PCS_STATUS1_REG			0x404
609 #define XGMAC_PCS_BASER_STATUS1_REG		0x410
610 #define XGMAC_PCS_BASER_STATUS2_REG		0x414
611 #define XGMAC_PCS_BASER_SEEDA_0_REG		0x420
612 #define XGMAC_PCS_BASER_SEEDA_1_REG		0x424
613 #define XGMAC_PCS_BASER_SEEDB_0_REG		0x428
614 #define XGMAC_PCS_BASER_SEEDB_1_REG		0x42C
615 #define XGMAC_PCS_BASER_TEST_CONTROL_REG	0x430
616 #define XGMAC_PCS_BASER_TEST_ERR_CNT_REG	0x434
617 #define XGMAC_PCS_DBG_INFO_REG			0x4C0
618 #define XGMAC_PCS_DBG_INFO1_REG			0x4C4
619 #define XGMAC_PCS_DBG_INFO2_REG			0x4C8
620 #define XGMAC_PCS_DBG_INFO3_REG			0x4CC
621 
622 #define XGMAC_PMA_ENABLE_REG			0x700
623 #define XGMAC_PMA_CONTROL_REG			0x704
624 #define XGMAC_PMA_SIGNAL_STATUS_REG		0x708
625 #define XGMAC_PMA_DBG_INFO_REG			0x70C
626 #define XGMAC_PMA_FEC_ABILITY_REG		0x740
627 #define XGMAC_PMA_FEC_CONTROL_REG		0x744
628 #define XGMAC_PMA_FEC_CORR_BLOCK_CNT__REG	0x750
629 #define XGMAC_PMA_FEC_UNCORR_BLOCK_CNT__REG	0x760
630 
631 #define XGMAC_TX_PKTS_FRAGMENT			0x0000
632 #define XGMAC_TX_PKTS_UNDERSIZE			0x0008
633 #define XGMAC_TX_PKTS_UNDERMIN			0x0010
634 #define XGMAC_TX_PKTS_64OCTETS			0x0018
635 #define XGMAC_TX_PKTS_65TO127OCTETS		0x0020
636 #define XGMAC_TX_PKTS_128TO255OCTETS		0x0028
637 #define XGMAC_TX_PKTS_256TO511OCTETS		0x0030
638 #define XGMAC_TX_PKTS_512TO1023OCTETS		0x0038
639 #define XGMAC_TX_PKTS_1024TO1518OCTETS		0x0040
640 #define XGMAC_TX_PKTS_1519TOMAXOCTETS		0x0048
641 #define XGMAC_TX_PKTS_1519TOMAXOCTETSOK		0x0050
642 #define XGMAC_TX_PKTS_OVERSIZE			0x0058
643 #define XGMAC_TX_PKTS_JABBER			0x0060
644 #define XGMAC_TX_GOODPKTS			0x0068
645 #define XGMAC_TX_GOODOCTETS			0x0070
646 #define XGMAC_TX_TOTAL_PKTS			0x0078
647 #define XGMAC_TX_TOTALOCTETS			0x0080
648 #define XGMAC_TX_UNICASTPKTS			0x0088
649 #define XGMAC_TX_MULTICASTPKTS			0x0090
650 #define XGMAC_TX_BROADCASTPKTS			0x0098
651 #define XGMAC_TX_PRI0PAUSEPKTS			0x00a0
652 #define XGMAC_TX_PRI1PAUSEPKTS			0x00a8
653 #define XGMAC_TX_PRI2PAUSEPKTS			0x00b0
654 #define XGMAC_TX_PRI3PAUSEPKTS			0x00b8
655 #define XGMAC_TX_PRI4PAUSEPKTS			0x00c0
656 #define XGMAC_TX_PRI5PAUSEPKTS			0x00c8
657 #define XGMAC_TX_PRI6PAUSEPKTS			0x00d0
658 #define XGMAC_TX_PRI7PAUSEPKTS			0x00d8
659 #define XGMAC_TX_MACCTRLPKTS			0x00e0
660 #define XGMAC_TX_1731PKTS			0x00e8
661 #define XGMAC_TX_1588PKTS			0x00f0
662 #define XGMAC_RX_FROMAPPGOODPKTS		0x00f8
663 #define XGMAC_RX_FROMAPPBADPKTS			0x0100
664 #define XGMAC_TX_ERRALLPKTS			0x0108
665 
666 #define XGMAC_RX_PKTS_FRAGMENT			0x0110
667 #define XGMAC_RX_PKTSUNDERSIZE			0x0118
668 #define XGMAC_RX_PKTS_UNDERMIN			0x0120
669 #define XGMAC_RX_PKTS_64OCTETS			0x0128
670 #define XGMAC_RX_PKTS_65TO127OCTETS		0x0130
671 #define XGMAC_RX_PKTS_128TO255OCTETS		0x0138
672 #define XGMAC_RX_PKTS_256TO511OCTETS		0x0140
673 #define XGMAC_RX_PKTS_512TO1023OCTETS		0x0148
674 #define XGMAC_RX_PKTS_1024TO1518OCTETS		0x0150
675 #define XGMAC_RX_PKTS_1519TOMAXOCTETS		0x0158
676 #define XGMAC_RX_PKTS_1519TOMAXOCTETSOK		0x0160
677 #define XGMAC_RX_PKTS_OVERSIZE			0x0168
678 #define XGMAC_RX_PKTS_JABBER			0x0170
679 #define XGMAC_RX_GOODPKTS			0x0178
680 #define XGMAC_RX_GOODOCTETS			0x0180
681 #define XGMAC_RX_TOTAL_PKTS			0x0188
682 #define XGMAC_RX_TOTALOCTETS			0x0190
683 #define XGMAC_RX_UNICASTPKTS			0x0198
684 #define XGMAC_RX_MULTICASTPKTS			0x01a0
685 #define XGMAC_RX_BROADCASTPKTS			0x01a8
686 #define XGMAC_RX_PRI0PAUSEPKTS			0x01b0
687 #define XGMAC_RX_PRI1PAUSEPKTS			0x01b8
688 #define XGMAC_RX_PRI2PAUSEPKTS			0x01c0
689 #define XGMAC_RX_PRI3PAUSEPKTS			0x01c8
690 #define XGMAC_RX_PRI4PAUSEPKTS			0x01d0
691 #define XGMAC_RX_PRI5PAUSEPKTS			0x01d8
692 #define XGMAC_RX_PRI6PAUSEPKTS			0x01e0
693 #define XGMAC_RX_PRI7PAUSEPKTS			0x01e8
694 #define XGMAC_RX_MACCTRLPKTS			0x01f0
695 #define XGMAC_TX_SENDAPPGOODPKTS		0x01f8
696 #define XGMAC_TX_SENDAPPBADPKTS			0x0200
697 #define XGMAC_RX_1731PKTS			0x0208
698 #define XGMAC_RX_SYMBOLERRPKTS			0x0210
699 #define XGMAC_RX_FCSERRPKTS			0x0218
700 
701 #define XGMAC_TRX_CORE_SRST_M			0x2080
702 
703 #define DSAF_SRAM_INIT_OVER_M 0xff
704 #define DSAFV2_SRAM_INIT_OVER_M 0x3ff
705 #define DSAF_SRAM_INIT_OVER_S 0
706 
707 #define DSAF_CFG_EN_S 0
708 #define DSAF_CFG_TC_MODE_S 1
709 #define DSAF_CFG_CRC_EN_S 2
710 #define DSAF_CFG_SBM_INIT_S 3
711 #define DSAF_CFG_MIX_MODE_S 4
712 #define DSAF_CFG_STP_MODE_S 5
713 #define DSAF_CFG_LOCA_ADDR_EN_S 6
714 #define DSAFV2_CFG_VLAN_TAG_MODE_S 17
715 
716 #define DSAF_CNT_CLR_CE_S 0
717 #define DSAF_SNAP_EN_S 1
718 
719 #define HNS_DSAF_PFC_UNIT_CNT_FOR_XGE 41
720 #define HNS_DSAF_PFC_UNIT_CNT_FOR_GE_1000 410
721 #define HNS_DSAF_PFC_UNIT_CNT_FOR_GE_2500 103
722 
723 #define DSAF_PFC_UNINT_CNT_M ((1ULL << 9) - 1)
724 #define DSAF_PFC_UNINT_CNT_S 0
725 
726 #define DSAF_MAC_PAUSE_RX_EN_B 2
727 #define DSAF_PFC_PAUSE_RX_EN_B 1
728 #define DSAF_PFC_PAUSE_TX_EN_B 0
729 
730 #define DSAF_PPE_QID_CFG_M 0xFF
731 #define DSAF_PPE_QID_CFG_S 0
732 
733 #define DSAF_SW_PORT_TYPE_M 3
734 #define DSAF_SW_PORT_TYPE_S 0
735 
736 #define DSAF_STP_PORT_TYPE_M 7
737 #define DSAF_STP_PORT_TYPE_S 0
738 
739 #define DSAF_INODE_IN_PORT_NUM_M 7
740 #define DSAF_INODE_IN_PORT_NUM_S 0
741 #define DSAFV2_INODE_IN_PORT1_NUM_M (7ULL << 3)
742 #define DSAFV2_INODE_IN_PORT1_NUM_S 3
743 #define DSAFV2_INODE_IN_PORT2_NUM_M (7ULL << 6)
744 #define DSAFV2_INODE_IN_PORT2_NUM_S 6
745 #define DSAFV2_INODE_IN_PORT3_NUM_M (7ULL << 9)
746 #define DSAFV2_INODE_IN_PORT3_NUM_S 9
747 #define DSAFV2_INODE_IN_PORT4_NUM_M (7ULL << 12)
748 #define DSAFV2_INODE_IN_PORT4_NUM_S 12
749 #define DSAFV2_INODE_IN_PORT5_NUM_M (7ULL << 15)
750 #define DSAFV2_INODE_IN_PORT5_NUM_S 15
751 
752 #define HNS_DSAF_I4TC_CFG 0x18688688
753 #define HNS_DSAF_I8TC_CFG 0x18FAC688
754 
755 #define DSAF_SBM_CFG_SHCUT_EN_S 0
756 #define DSAF_SBM_CFG_EN_S 1
757 #define DSAF_SBM_CFG_MIB_EN_S 2
758 #define DSAF_SBM_CFG_ECC_INVERT_EN_S 3
759 
760 #define DSAF_SBM_CFG0_VC1_MAX_BUF_NUM_S 0
761 #define DSAF_SBM_CFG0_VC1_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 0)
762 #define DSAF_SBM_CFG0_VC0_MAX_BUF_NUM_S 10
763 #define DSAF_SBM_CFG0_VC0_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 10)
764 #define DSAF_SBM_CFG0_COM_MAX_BUF_NUM_S 20
765 #define DSAF_SBM_CFG0_COM_MAX_BUF_NUM_M (((1ULL << 11) - 1) << 20)
766 
767 #define DSAF_SBM_CFG1_TC4_MAX_BUF_NUM_S 0
768 #define DSAF_SBM_CFG1_TC4_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 0)
769 #define DSAF_SBM_CFG1_TC0_MAX_BUF_NUM_S 10
770 #define DSAF_SBM_CFG1_TC0_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 10)
771 
772 #define DSAF_SBM_CFG2_SET_BUF_NUM_S 0
773 #define DSAF_SBM_CFG2_SET_BUF_NUM_M (((1ULL << 10) - 1) << 0)
774 #define DSAF_SBM_CFG2_RESET_BUF_NUM_S 10
775 #define DSAF_SBM_CFG2_RESET_BUF_NUM_M (((1ULL << 10) - 1) << 10)
776 
777 #define DSAF_SBM_CFG3_SET_BUF_NUM_NO_PFC_S 0
778 #define DSAF_SBM_CFG3_SET_BUF_NUM_NO_PFC_M (((1ULL << 10) - 1) << 0)
779 #define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_S 10
780 #define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_M (((1ULL << 10) - 1) << 10)
781 
782 #define DSAFV2_SBM_CFG0_VC1_MAX_BUF_NUM_S 0
783 #define DSAFV2_SBM_CFG0_VC1_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 0)
784 #define DSAFV2_SBM_CFG0_VC0_MAX_BUF_NUM_S 9
785 #define DSAFV2_SBM_CFG0_VC0_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 9)
786 #define DSAFV2_SBM_CFG0_COM_MAX_BUF_NUM_S 18
787 #define DSAFV2_SBM_CFG0_COM_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 18)
788 
789 #define DSAFV2_SBM_CFG1_TC4_MAX_BUF_NUM_S 0
790 #define DSAFV2_SBM_CFG1_TC4_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 0)
791 #define DSAFV2_SBM_CFG1_TC0_MAX_BUF_NUM_S 9
792 #define DSAFV2_SBM_CFG1_TC0_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 9)
793 
794 #define DSAFV2_SBM_CFG2_SET_BUF_NUM_S 0
795 #define DSAFV2_SBM_CFG2_SET_BUF_NUM_M (((1ULL << 9) - 1) << 0)
796 #define DSAFV2_SBM_CFG2_RESET_BUF_NUM_S 9
797 #define DSAFV2_SBM_CFG2_RESET_BUF_NUM_M (((1ULL << 9) - 1) << 9)
798 
799 #define DSAFV2_SBM_CFG3_SET_BUF_NUM_NO_PFC_S 0
800 #define DSAFV2_SBM_CFG3_SET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 0)
801 #define DSAFV2_SBM_CFG3_RESET_BUF_NUM_NO_PFC_S 9
802 #define DSAFV2_SBM_CFG3_RESET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 9)
803 
804 #define DSAFV2_SBM_CFG4_SET_BUF_NUM_NO_PFC_S 0
805 #define DSAFV2_SBM_CFG4_SET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 0)
806 #define DSAFV2_SBM_CFG4_RESET_BUF_NUM_NO_PFC_S 9
807 #define DSAFV2_SBM_CFG4_RESET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 9)
808 
809 #define DSAF_CHNS_MASK			0x3f000
810 #define DSAF_SBM_ROCEE_CFG_CRD_EN_B	2
811 #define SRST_TIME_INTERVAL		20
812 #define DSAFV2_SBM_CFG2_ROCEE_SET_BUF_NUM_S 0
813 #define DSAFV2_SBM_CFG2_ROCEE_SET_BUF_NUM_M (((1ULL << 8) - 1) << 0)
814 #define DSAFV2_SBM_CFG2_ROCEE_RESET_BUF_NUM_S 8
815 #define DSAFV2_SBM_CFG2_ROCEE_RESET_BUF_NUM_M (((1ULL << 8) - 1) << 8)
816 
817 #define DSAFV2_SBM_CFG2_PPE_SET_BUF_NUM_S (0)
818 #define DSAFV2_SBM_CFG2_PPE_SET_BUF_NUM_M (((1ULL << 6) - 1) << 0)
819 #define DSAFV2_SBM_CFG2_PPE_RESET_BUF_NUM_S (6)
820 #define DSAFV2_SBM_CFG2_PPE_RESET_BUF_NUM_M (((1ULL << 6) - 1) << 6)
821 #define DSAFV2_SBM_CFG2_PPE_CFG_USEFUL_NUM_S (12)
822 #define DSAFV2_SBM_CFG2_PPE_CFG_USEFUL_NUM_M (((1ULL << 6) - 1) << 12)
823 
824 #define DSAF_TBL_TCAM_ADDR_S 0
825 #define DSAF_TBL_TCAM_ADDR_M ((1ULL << 9) - 1)
826 
827 #define DSAF_TBL_LINE_ADDR_S 0
828 #define DSAF_TBL_LINE_ADDR_M ((1ULL << 15) - 1)
829 
830 #define DSAF_TBL_MCAST_CFG4_VM128_112_S 0
831 #define DSAF_TBL_MCAST_CFG4_VM128_112_M (((1ULL << 7) - 1) << 0)
832 #define DSAF_TBL_MCAST_CFG4_ITEM_VLD_S 7
833 #define DSAF_TBL_MCAST_CFG4_OLD_EN_S 8
834 
835 #define DSAF_TBL_MCAST_CFG0_XGE5_0_S 0
836 #define DSAF_TBL_MCAST_CFG0_XGE5_0_M (((1ULL << 6) - 1) << 0)
837 #define DSAF_TBL_MCAST_CFG0_VM25_0_S 6
838 #define DSAF_TBL_MCAST_CFG0_VM25_0_M (((1ULL << 26) - 1) << 6)
839 
840 #define DSAF_TBL_UCAST_CFG1_OUT_PORT_S 0
841 #define DSAF_TBL_UCAST_CFG1_OUT_PORT_M (((1ULL << 8) - 1) << 0)
842 #define DSAF_TBL_UCAST_CFG1_DVC_S 8
843 #define DSAF_TBL_UCAST_CFG1_MAC_DISCARD_S 9
844 #define DSAF_TBL_UCAST_CFG1_ITEM_VLD_S 10
845 #define DSAF_TBL_UCAST_CFG1_OLD_EN_S 11
846 
847 #define DSAF_TBL_LINE_CFG_OUT_PORT_S 0
848 #define DSAF_TBL_LINE_CFG_OUT_PORT_M (((1ULL << 8) - 1) << 0)
849 #define DSAF_TBL_LINE_CFG_DVC_S 8
850 #define DSAF_TBL_LINE_CFG_MAC_DISCARD_S 9
851 
852 #define DSAF_TBL_PUL_OLD_RSLT_RE_S 0
853 #define DSAF_TBL_PUL_MCAST_VLD_S 1
854 #define DSAF_TBL_PUL_TCAM_DATA_VLD_S 2
855 #define DSAF_TBL_PUL_UCAST_VLD_S 3
856 #define DSAF_TBL_PUL_LINE_VLD_S 4
857 #define DSAF_TBL_PUL_TCAM_LOAD_S 5
858 #define DSAF_TBL_PUL_LINE_LOAD_S 6
859 
860 #define DSAF_TBL_DFX_LINE_LKUP_NUM_EN_S 0
861 #define DSAF_TBL_DFX_UC_LKUP_NUM_EN_S 1
862 #define DSAF_TBL_DFX_MC_LKUP_NUM_EN_S 2
863 #define DSAF_TBL_DFX_BC_LKUP_NUM_EN_S 3
864 #define DSAF_TBL_DFX_RAM_ERR_INJECT_EN_S 4
865 
866 #define DSAF_VOQ_BP_ALL_DOWNTHRD_S 0
867 #define DSAF_VOQ_BP_ALL_DOWNTHRD_M (((1ULL << 10) - 1) << 0)
868 #define DSAF_VOQ_BP_ALL_UPTHRD_S 10
869 #define DSAF_VOQ_BP_ALL_UPTHRD_M (((1ULL << 10) - 1) << 10)
870 
871 #define DSAF_XGE_GE_WORK_MODE_S 0
872 #define DSAF_XGE_GE_LOOPBACK_S 1
873 
874 #define DSAF_FC_XGE_TX_PAUSE_S 0
875 #define DSAF_REGS_XGE_CNT_CAR_S 1
876 
877 #define PPE_CFG_QID_MODE_DEF_QID_S	0
878 #define PPE_CFG_QID_MODE_DEF_QID_M	(0xff << PPE_CFG_QID_MODE_DEF_QID_S)
879 
880 #define PPE_CFG_QID_MODE_CF_QID_MODE_S	8
881 #define PPE_CFG_QID_MODE_CF_QID_MODE_M	(0x7 << PPE_CFG_QID_MODE_CF_QID_MODE_S)
882 
883 #define PPEV2_CFG_RSS_TBL_4N0_S	0
884 #define PPEV2_CFG_RSS_TBL_4N0_M	(((1UL << 5) - 1) << PPEV2_CFG_RSS_TBL_4N0_S)
885 
886 #define PPEV2_CFG_RSS_TBL_4N1_S	8
887 #define PPEV2_CFG_RSS_TBL_4N1_M	(((1UL << 5) - 1) << PPEV2_CFG_RSS_TBL_4N1_S)
888 
889 #define PPEV2_CFG_RSS_TBL_4N2_S	16
890 #define PPEV2_CFG_RSS_TBL_4N2_M	(((1UL << 5) - 1) << PPEV2_CFG_RSS_TBL_4N2_S)
891 
892 #define PPEV2_CFG_RSS_TBL_4N3_S	24
893 #define PPEV2_CFG_RSS_TBL_4N3_M	(((1UL << 5) - 1) << PPEV2_CFG_RSS_TBL_4N3_S)
894 
895 #define DSAFV2_SERDES_LBK_EN_B  8
896 #define DSAFV2_SERDES_LBK_QID_S 0
897 #define DSAFV2_SERDES_LBK_QID_M	(((1UL << 8) - 1) << DSAFV2_SERDES_LBK_QID_S)
898 
899 #define PPE_CNT_CLR_CE_B	0
900 #define PPE_CNT_CLR_SNAP_EN_B	1
901 
902 #define PPE_INT_GAPTIME_B	0
903 #define PPE_INT_GAPTIME_M	0x3ff
904 
905 #define PPE_COMMON_CNT_CLR_CE_B	0
906 #define PPE_COMMON_CNT_CLR_SNAP_EN_B	1
907 #define RCB_COM_TSO_MODE_B	0
908 #define RCB_COM_CFG_FNA_B	1
909 #define RCB_COM_CFG_FA_B	0
910 
911 #define GMAC_DUPLEX_TYPE_B 0
912 
913 #define GMAC_FC_TX_TIMER_S 0
914 #define GMAC_FC_TX_TIMER_M 0xffff
915 
916 #define GMAC_MAX_FRM_SIZE_S 0
917 #define GMAC_MAX_FRM_SIZE_M 0xffff
918 
919 #define GMAC_PORT_MODE_S	0
920 #define GMAC_PORT_MODE_M	0xf
921 
922 #define GMAC_RGMII_1000M_DELAY_B	4
923 #define GMAC_MII_TX_EDGE_SEL_B		5
924 #define GMAC_FIFO_ERR_AUTO_RST_B	6
925 #define GMAC_DBG_CLK_LOS_MSK_B		7
926 
927 #define GMAC_PORT_RX_EN_B	1
928 #define GMAC_PORT_TX_EN_B	2
929 
930 #define GMAC_PAUSE_EN_RX_FDFC_B 0
931 #define GMAC_PAUSE_EN_TX_FDFC_B 1
932 #define GMAC_PAUSE_EN_TX_HDFC_B 2
933 
934 #define GMAC_SHORT_RUNTS_THR_S 0
935 #define GMAC_SHORT_RUNTS_THR_M 0x1f
936 
937 #define GMAC_AN_NEG_STAT_FD_B		5
938 #define GMAC_AN_NEG_STAT_HD_B		6
939 #define GMAC_AN_NEG_STAT_RF1_DUPLIEX_B	12
940 #define GMAC_AN_NEG_STAT_RF2_B		13
941 
942 #define GMAC_AN_NEG_STAT_NP_LNK_OK_B	15
943 #define GMAC_AN_NEG_STAT_RX_SYNC_OK_B	20
944 #define GMAC_AN_NEG_STAT_AN_DONE_B	21
945 
946 #define GMAC_AN_NEG_STAT_PS_S		7
947 #define GMAC_AN_NEG_STAT_PS_M		(0x3 << GMAC_AN_NEG_STAT_PS_S)
948 
949 #define GMAC_AN_NEG_STAT_SPEED_S	10
950 #define GMAC_AN_NEG_STAT_SPEED_M	(0x3 << GMAC_AN_NEG_STAT_SPEED_S)
951 
952 #define GMAC_TX_AN_EN_B		5
953 #define GMAC_TX_CRC_ADD_B	6
954 #define GMAC_TX_PAD_EN_B	7
955 
956 #define GMAC_LINE_LOOPBACK_B	0
957 
958 #define GMAC_LP_REG_CF_EXT_DRV_LP_B	1
959 #define GMAC_LP_REG_CF2MI_LP_EN_B	2
960 
961 #define GMAC_MODE_CHANGE_EB_B	0
962 #define GMAC_UC_MATCH_EN_B	0
963 #define GMAC_ADDR_EN_B		16
964 
965 #define GMAC_RECV_CTRL_STRIP_PAD_EN_B	3
966 #define GMAC_RECV_CTRL_RUNT_PKT_EN_B	4
967 
968 #define GMAC_TX_LOOP_PKT_HIG_PRI_B	0
969 #define GMAC_TX_LOOP_PKT_EN_B		1
970 
971 #define XGMAC_PORT_MODE_TX_S		0x0
972 #define XGMAC_PORT_MODE_TX_M		(0x3 << XGMAC_PORT_MODE_TX_S)
973 #define XGMAC_PORT_MODE_TX_40G_B	0x3
974 #define XGMAC_PORT_MODE_RX_S		0x4
975 #define XGMAC_PORT_MODE_RX_M		(0x3 << XGMAC_PORT_MODE_RX_S)
976 #define XGMAC_PORT_MODE_RX_40G_B	0x7
977 
978 #define XGMAC_ENABLE_TX_B		0
979 #define XGMAC_ENABLE_RX_B		1
980 
981 #define XGMAC_CTL_TX_FCS_B		0
982 #define XGMAC_CTL_TX_PAD_B		1
983 #define XGMAC_CTL_TX_PREAMBLE_TRANS_B	3
984 #define XGMAC_CTL_TX_UNDER_MIN_ERR_B	4
985 #define XGMAC_CTL_TX_TRUNCATE_B		5
986 #define XGMAC_CTL_TX_1588_B		8
987 #define XGMAC_CTL_TX_1731_B		9
988 #define XGMAC_CTL_TX_PFC_B		10
989 #define XGMAC_CTL_RX_FCS_B		16
990 #define XGMAC_CTL_RX_FCS_STRIP_B	17
991 #define XGMAC_CTL_RX_PREAMBLE_TRANS_B	19
992 #define XGMAC_CTL_RX_UNDER_MIN_ERR_B	20
993 #define XGMAC_CTL_RX_TRUNCATE_B		21
994 #define XGMAC_CTL_RX_1588_B		24
995 #define XGMAC_CTL_RX_1731_B		25
996 #define XGMAC_CTL_RX_PFC_B		26
997 
998 #define XGMAC_PMA_FEC_CTL_TX_B		0
999 #define XGMAC_PMA_FEC_CTL_RX_B		1
1000 #define XGMAC_PMA_FEC_CTL_ERR_EN	2
1001 #define XGMAC_PMA_FEC_CTL_ERR_SH	3
1002 
1003 #define XGMAC_PAUSE_CTL_TX_B		0
1004 #define XGMAC_PAUSE_CTL_RX_B		1
1005 #define XGMAC_PAUSE_CTL_RSP_MODE_B	2
1006 #define XGMAC_PAUSE_CTL_TX_XOFF_B	3
1007 
dsaf_write_reg(void __iomem * base,u32 reg,u32 value)1008 static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value)
1009 {
1010 	writel(value, base + reg);
1011 }
1012 
1013 #define dsaf_write_dev(a, reg, value) \
1014 	dsaf_write_reg((a)->io_base, (reg), (value))
1015 
dsaf_read_reg(u8 __iomem * base,u32 reg)1016 static inline u32 dsaf_read_reg(u8 __iomem *base, u32 reg)
1017 {
1018 	return readl(base + reg);
1019 }
1020 
dsaf_write_syscon(struct regmap * base,u32 reg,u32 value)1021 static inline void dsaf_write_syscon(struct regmap *base, u32 reg, u32 value)
1022 {
1023 	regmap_write(base, reg, value);
1024 }
1025 
dsaf_read_syscon(struct regmap * base,u32 reg)1026 static inline u32 dsaf_read_syscon(struct regmap *base, u32 reg)
1027 {
1028 	unsigned int val;
1029 
1030 	regmap_read(base, reg, &val);
1031 	return val;
1032 }
1033 
1034 #define dsaf_read_dev(a, reg) \
1035 	dsaf_read_reg((a)->io_base, (reg))
1036 
1037 #define dsaf_set_field(origin, mask, shift, val) \
1038 	do { \
1039 		(origin) &= (~(mask)); \
1040 		(origin) |= (((val) << (shift)) & (mask)); \
1041 	} while (0)
1042 
1043 #define dsaf_set_bit(origin, shift, val) \
1044 	dsaf_set_field((origin), (1ull << (shift)), (shift), (val))
1045 
dsaf_set_reg_field(void __iomem * base,u32 reg,u32 mask,u32 shift,u32 val)1046 static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask,
1047 				      u32 shift, u32 val)
1048 {
1049 	u32 origin = dsaf_read_reg(base, reg);
1050 
1051 	dsaf_set_field(origin, mask, shift, val);
1052 	dsaf_write_reg(base, reg, origin);
1053 }
1054 
1055 #define dsaf_set_dev_field(dev, reg, mask, shift, val) \
1056 	dsaf_set_reg_field((dev)->io_base, (reg), (mask), (shift), (val))
1057 
1058 #define dsaf_set_dev_bit(dev, reg, bit, val) \
1059 	dsaf_set_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit), (val))
1060 
1061 #define dsaf_get_field(origin, mask, shift) (((origin) & (mask)) >> (shift))
1062 
1063 #define dsaf_get_bit(origin, shift) \
1064 	dsaf_get_field((origin), (1ull << (shift)), (shift))
1065 
dsaf_get_reg_field(void __iomem * base,u32 reg,u32 mask,u32 shift)1066 static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask,
1067 				     u32 shift)
1068 {
1069 	u32 origin;
1070 
1071 	origin = dsaf_read_reg(base, reg);
1072 	return dsaf_get_field(origin, mask, shift);
1073 }
1074 
1075 #define dsaf_get_dev_field(dev, reg, mask, shift) \
1076 	dsaf_get_reg_field((dev)->io_base, (reg), (mask), (shift))
1077 
1078 #define dsaf_get_dev_bit(dev, reg, bit) \
1079 	dsaf_get_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit))
1080 
1081 #define dsaf_write_b(addr, data)\
1082 	writeb((data), (__iomem unsigned char *)(addr))
1083 #define dsaf_read_b(addr)\
1084 	readb((__iomem unsigned char *)(addr))
1085 
1086 #define hns_mac_reg_read64(drv, offset) \
1087 	readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset))))
1088 
1089 #endif	/* _DSAF_REG_H */
1090