ksz9896_driver.h
Go to the documentation of this file.
1 /**
2  * @file ksz9896_driver.h
3  * @brief KSZ9896 6-port Gigabit Ethernet switch driver
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _KSZ9896_DRIVER_H
32 #define _KSZ9896_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //Port identifiers
38 #define KSZ9896_PORT1 1
39 #define KSZ9896_PORT2 2
40 #define KSZ9896_PORT3 3
41 #define KSZ9896_PORT4 4
42 #define KSZ9896_PORT5 5
43 #define KSZ9896_PORT6 6
44 
45 //Port masks
46 #define KSZ9896_PORT_MASK 0x3F
47 #define KSZ9896_PORT1_MASK 0x01
48 #define KSZ9896_PORT2_MASK 0x02
49 #define KSZ9896_PORT3_MASK 0x04
50 #define KSZ9896_PORT4_MASK 0x08
51 #define KSZ9896_PORT5_MASK 0x10
52 #define KSZ9896_PORT6_MASK 0x20
53 
54 //SPI command byte
55 #define KSZ9896_SPI_CMD_WRITE 0x40000000
56 #define KSZ9896_SPI_CMD_READ 0x60000000
57 #define KSZ9896_SPI_CMD_ADDR 0x001FFFE0
58 
59 //Size of static and dynamic MAC tables
60 #define KSZ9896_STATIC_MAC_TABLE_SIZE 16
61 #define KSZ9896_DYNAMIC_MAC_TABLE_SIZE 4096
62 
63 //Tail tag rules (host to KSZ9896)
64 #define KSZ9896_TAIL_TAG_NORMAL_ADDR_LOOKUP 0x0400
65 #define KSZ9896_TAIL_TAG_PORT_BLOCKING_OVERRIDE 0x0200
66 #define KSZ9896_TAIL_TAG_PRIORITY 0x0180
67 #define KSZ9896_TAIL_TAG_DEST_PORT6 0x0020
68 #define KSZ9896_TAIL_TAG_DEST_PORT5 0x0010
69 #define KSZ9896_TAIL_TAG_DEST_PORT4 0x0008
70 #define KSZ9896_TAIL_TAG_DEST_PORT3 0x0004
71 #define KSZ9896_TAIL_TAG_DEST_PORT2 0x0002
72 #define KSZ9896_TAIL_TAG_DEST_PORT1 0x0001
73 
74 //Tail tag rules (KSZ9896 to host)
75 #define KSZ9896_TAIL_TAG_PTP_MSG 0x80
76 #define KSZ9896_TAIL_TAG_SRC_PORT 0x07
77 
78 //KSZ9896 PHY registers
79 #define KSZ9896_BMCR 0x00
80 #define KSZ9896_BMSR 0x01
81 #define KSZ9896_PHYID1 0x02
82 #define KSZ9896_PHYID2 0x03
83 #define KSZ9896_ANAR 0x04
84 #define KSZ9896_ANLPAR 0x05
85 #define KSZ9896_ANER 0x06
86 #define KSZ9896_ANNPR 0x07
87 #define KSZ9896_ANLPNPR 0x08
88 #define KSZ9896_GBCR 0x09
89 #define KSZ9896_GBSR 0x0A
90 #define KSZ9896_MMDACR 0x0D
91 #define KSZ9896_MMDAADR 0x0E
92 #define KSZ9896_GBESR 0x0F
93 #define KSZ9896_RLB 0x11
94 #define KSZ9896_LINKMD 0x12
95 #define KSZ9896_DPMAPCSS 0x13
96 #define KSZ9896_RXERCTR 0x15
97 #define KSZ9896_ICSR 0x1B
98 #define KSZ9896_AUTOMDI 0x1C
99 #define KSZ9896_PHYCON 0x1F
100 
101 //KSZ9896 MMD registers
102 #define KSZ9896_MMD_LED_MODE 0x02, 0x00
103 #define KSZ9896_MMD_EEE_ADV 0x07, 0x3C
104 
105 //KSZ9896 Switch registers
106 #define KSZ9896_CHIP_ID0 0x0000
107 #define KSZ9896_CHIP_ID1 0x0001
108 #define KSZ9896_CHIP_ID2 0x0002
109 #define KSZ9896_CHIP_ID3 0x0003
110 #define KSZ9896_PME_PIN_CTRL 0x0006
111 #define KSZ9896_GLOBAL_INT_STAT 0x0010
112 #define KSZ9896_GLOBAL_INT_MASK 0x0014
113 #define KSZ9896_GLOBAL_PORT_INT_STAT 0x0018
114 #define KSZ9896_GLOBAL_PORT_INT_MASK 0x001C
115 #define KSZ9896_SERIAL_IO_CTRL 0x0100
116 #define KSZ9896_OUT_CLK_CTRL 0x0103
117 #define KSZ9896_IBA_CTRL 0x0104
118 #define KSZ9896_IO_DRIVE_STRENGTH 0x010D
119 #define KSZ9896_IBA_OP_STAT1 0x0110
120 #define KSZ9896_LED_OVERRIDE 0x0120
121 #define KSZ9896_LED_OUTPUT 0x0124
122 #define KSZ9896_PWR_DOWN_CTRL0 0x0201
123 #define KSZ9896_LED_STRAP_IN 0x0210
124 #define KSZ9896_SWITCH_OP 0x0300
125 #define KSZ9896_SWITCH_MAC_ADDR0 0x0302
126 #define KSZ9896_SWITCH_MAC_ADDR1 0x0303
127 #define KSZ9896_SWITCH_MAC_ADDR2 0x0304
128 #define KSZ9896_SWITCH_MAC_ADDR3 0x0305
129 #define KSZ9896_SWITCH_MAC_ADDR4 0x0306
130 #define KSZ9896_SWITCH_MAC_ADDR5 0x0307
131 #define KSZ9896_SWITCH_MTU 0x0308
132 #define KSZ9896_SWITCH_ISP_TPID 0x030A
133 #define KSZ9896_SWITCH_LUE_CTRL0 0x0310
134 #define KSZ9896_SWITCH_LUE_CTRL1 0x0311
135 #define KSZ9896_SWITCH_LUE_CTRL2 0x0312
136 #define KSZ9896_SWITCH_LUE_CTRL3 0x0313
137 #define KSZ9896_ALU_TABLE_INT 0x0314
138 #define KSZ9896_ALU_TABLE_MASK 0x0315
139 #define KSZ9896_ALU_TABLE_ENTRY_INDEX0 0x0316
140 #define KSZ9896_ALU_TABLE_ENTRY_INDEX1 0x0318
141 #define KSZ9896_ALU_TABLE_ENTRY_INDEX2 0x031A
142 #define KSZ9896_UNKNOWN_UNICAST_CTRL 0x0320
143 #define KSZ9896_UNKONWN_MULTICAST_CTRL 0x0324
144 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL 0x0328
145 #define KSZ9896_SWITCH_MAC_CTRL0 0x0330
146 #define KSZ9896_SWITCH_MAC_CTRL1 0x0331
147 #define KSZ9896_SWITCH_MAC_CTRL2 0x0332
148 #define KSZ9896_SWITCH_MAC_CTRL3 0x0333
149 #define KSZ9896_SWITCH_MAC_CTRL4 0x0334
150 #define KSZ9896_SWITCH_MAC_CTRL5 0x0335
151 #define KSZ9896_SWITCH_MIB_CTRL 0x0336
152 #define KSZ9896_802_1P_PRIO_MAPPING0 0x0338
153 #define KSZ9896_802_1P_PRIO_MAPPING1 0x0339
154 #define KSZ9896_802_1P_PRIO_MAPPING2 0x033A
155 #define KSZ9896_802_1P_PRIO_MAPPING3 0x033B
156 #define KSZ9896_IP_DIFFSERV_PRIO_EN 0x033E
157 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING0 0x0340
158 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING1 0x0341
159 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING2 0x0342
160 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING3 0x0343
161 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING4 0x0344
162 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING5 0x0345
163 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING6 0x0346
164 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING7 0x0347
165 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING8 0x0348
166 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING9 0x0349
167 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING10 0x034A
168 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING11 0x034B
169 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING12 0x034C
170 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING13 0x034D
171 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING14 0x034E
172 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING15 0x034F
173 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING16 0x0350
174 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING17 0x0351
175 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING18 0x0352
176 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING19 0x0353
177 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING20 0x0354
178 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING21 0x0355
179 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING22 0x0356
180 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING23 0x0357
181 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING24 0x0358
182 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING25 0x0359
183 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING26 0x035A
184 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING27 0x035B
185 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING28 0x035C
186 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING29 0x035D
187 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING30 0x035E
188 #define KSZ9896_IP_DIFFSERV_PRIO_MAPPING31 0x035F
189 #define KSZ9896_GLOBAL_PORT_MIRROR_SNOOP_CTRL 0x0370
190 #define KSZ9896_WRED_DIFFSERV_COLOR_MAPPING 0x0378
191 #define KSZ9896_QUEUE_MGMT_CTRL0 0x0390
192 #define KSZ9896_VLAN_TABLE_ENTRY0 0x0400
193 #define KSZ9896_VLAN_TABLE_ENTRY1 0x0404
194 #define KSZ9896_VLAN_TABLE_ENTRY2 0x0408
195 #define KSZ9896_VLAN_TABLE_INDEX 0x040C
196 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL 0x040E
197 #define KSZ9896_ALU_TABLE_INDEX0 0x0410
198 #define KSZ9896_ALU_TABLE_INDEX1 0x0414
199 #define KSZ9896_ALU_TABLE_CTRL 0x0418
200 #define KSZ9896_STATIC_MCAST_TABLE_CTRL 0x041C
201 #define KSZ9896_ALU_TABLE_ENTRY1 0x0420
202 #define KSZ9896_STATIC_TABLE_ENTRY1 0x0420
203 #define KSZ9896_ALU_TABLE_ENTRY2 0x0424
204 #define KSZ9896_STATIC_TABLE_ENTRY2 0x0424
205 #define KSZ9896_RES_MCAST_TABLE_ENTRY2 0x0424
206 #define KSZ9896_ALU_TABLE_ENTRY3 0x0428
207 #define KSZ9896_STATIC_TABLE_ENTRY3 0x0428
208 #define KSZ9896_ALU_TABLE_ENTRY4 0x042C
209 #define KSZ9896_STATIC_TABLE_ENTRY4 0x042C
210 #define KSZ9896_PORT1_DEFAULT_TAG0 0x1000
211 #define KSZ9896_PORT1_DEFAULT_TAG1 0x1001
212 #define KSZ9896_PORT1_PME_WOL_EVENT 0x1013
213 #define KSZ9896_PORT1_PME_WOL_EN 0x1017
214 #define KSZ9896_PORT1_INT_STATUS 0x101B
215 #define KSZ9896_PORT1_INT_MASK 0x101F
216 #define KSZ9896_PORT1_OP_CTRL0 0x1020
217 #define KSZ9896_PORT1_STATUS 0x1030
218 #define KSZ9896_PORT1_MAC_CTRL0 0x1400
219 #define KSZ9896_PORT1_MAC_CTRL1 0x1401
220 #define KSZ9896_PORT1_IG_RATE_LIMIT_CTRL 0x1403
221 #define KSZ9896_PORT1_PRIO0_IG_LIMIT_CTRL 0x1410
222 #define KSZ9896_PORT1_PRIO1_IG_LIMIT_CTRL 0x1411
223 #define KSZ9896_PORT1_PRIO2_IG_LIMIT_CTRL 0x1412
224 #define KSZ9896_PORT1_PRIO3_IG_LIMIT_CTRL 0x1413
225 #define KSZ9896_PORT1_PRIO4_IG_LIMIT_CTRL 0x1414
226 #define KSZ9896_PORT1_PRIO5_IG_LIMIT_CTRL 0x1415
227 #define KSZ9896_PORT1_PRIO6_IG_LIMIT_CTRL 0x1416
228 #define KSZ9896_PORT1_PRIO7_IG_LIMIT_CTRL 0x1417
229 #define KSZ9896_PORT1_QUEUE0_EG_LIMIT_CTRL 0x1420
230 #define KSZ9896_PORT1_QUEUE1_EG_LIMIT_CTRL 0x1421
231 #define KSZ9896_PORT1_QUEUE2_EG_LIMIT_CTRL 0x1422
232 #define KSZ9896_PORT1_QUEUE3_EG_LIMIT_CTRL 0x1423
233 #define KSZ9896_PORT1_MIB_CTRL_STAT 0x1500
234 #define KSZ9896_PORT1_MIB_DATA 0x1504
235 #define KSZ9896_PORT1_ACL_ACCESS0 0x1600
236 #define KSZ9896_PORT1_ACL_ACCESS1 0x1601
237 #define KSZ9896_PORT1_ACL_ACCESS2 0x1602
238 #define KSZ9896_PORT1_ACL_ACCESS3 0x1603
239 #define KSZ9896_PORT1_ACL_ACCESS4 0x1604
240 #define KSZ9896_PORT1_ACL_ACCESS5 0x1605
241 #define KSZ9896_PORT1_ACL_ACCESS6 0x1606
242 #define KSZ9896_PORT1_ACL_ACCESS7 0x1607
243 #define KSZ9896_PORT1_ACL_ACCESS8 0x1608
244 #define KSZ9896_PORT1_ACL_ACCESS9 0x1609
245 #define KSZ9896_PORT1_ACL_ACCESS10 0x160A
246 #define KSZ9896_PORT1_ACL_ACCESS11 0x160B
247 #define KSZ9896_PORT1_ACL_ACCESS12 0x160C
248 #define KSZ9896_PORT1_ACL_ACCESS13 0x160D
249 #define KSZ9896_PORT1_ACL_ACCESS14 0x160E
250 #define KSZ9896_PORT1_ACL_ACCESS15 0x160F
251 #define KSZ9896_PORT1_ACL_BYTE_EN_MSB 0x1610
252 #define KSZ9896_PORT1_ACL_BYTE_EN_LSB 0x1611
253 #define KSZ9896_PORT1_ACL_ACCESS_CTRL0 0x1612
254 #define KSZ9896_PORT1_MIRRORING_CTRL 0x1800
255 #define KSZ9896_PORT1_PRIO_CTRL 0x1801
256 #define KSZ9896_PORT1_IG_MAC_CTRL 0x1802
257 #define KSZ9896_PORT1_AUTH_CTRL 0x1803
258 #define KSZ9896_PORT1_PTR 0x1804
259 #define KSZ9896_PORT1_PRIO_TO_QUEUE_MAPPING 0x1808
260 #define KSZ9896_PORT1_POLICE_CTRL 0x180C
261 #define KSZ9896_PORT1_POLICE_QUEUE_RATE 0x1820
262 #define KSZ9896_PORT1_POLICE_QUEUE_BURST_SIZE 0x1824
263 #define KSZ9896_PORT1_WRED_PKT_MEM_CTRL0 0x1830
264 #define KSZ9896_PORT1_WRED_PKT_MEM_CTRL1 0x1834
265 #define KSZ9896_PORT1_WRED_QUEUE_CTRL0 0x1840
266 #define KSZ9896_PORT1_WRED_QUEUE_CTRL1 0x1844
267 #define KSZ9896_PORT1_WRED_QUEUE_PERF_MON_CTRL 0x1848
268 #define KSZ9896_PORT1_TX_QUEUE_INDEX 0x1900
269 #define KSZ9896_PORT1_TX_QUEUE_PVID 0x1904
270 #define KSZ9896_PORT1_TX_QUEUE_CTRL0 0x1914
271 #define KSZ9896_PORT1_TX_QUEUE_CTRL1 0x1915
272 #define KSZ9896_PORT1_CTRL0 0x1A00
273 #define KSZ9896_PORT1_CTRL1 0x1A04
274 #define KSZ9896_PORT1_CTRL2 0x1B00
275 #define KSZ9896_PORT1_MSTP_PTR 0x1B01
276 #define KSZ9896_PORT1_MSTP_STATE 0x1B04
277 #define KSZ9896_PORT2_DEFAULT_TAG0 0x2000
278 #define KSZ9896_PORT2_DEFAULT_TAG1 0x2001
279 #define KSZ9896_PORT2_PME_WOL_EVENT 0x2013
280 #define KSZ9896_PORT2_PME_WOL_EN 0x2017
281 #define KSZ9896_PORT2_INT_STATUS 0x201B
282 #define KSZ9896_PORT2_INT_MASK 0x201F
283 #define KSZ9896_PORT2_OP_CTRL0 0x2020
284 #define KSZ9896_PORT2_STATUS 0x2030
285 #define KSZ9896_PORT2_MAC_CTRL0 0x2400
286 #define KSZ9896_PORT2_MAC_CTRL1 0x2401
287 #define KSZ9896_PORT2_IG_RATE_LIMIT_CTRL 0x2403
288 #define KSZ9896_PORT2_PRIO0_IG_LIMIT_CTRL 0x2410
289 #define KSZ9896_PORT2_PRIO1_IG_LIMIT_CTRL 0x2411
290 #define KSZ9896_PORT2_PRIO2_IG_LIMIT_CTRL 0x2412
291 #define KSZ9896_PORT2_PRIO3_IG_LIMIT_CTRL 0x2413
292 #define KSZ9896_PORT2_PRIO4_IG_LIMIT_CTRL 0x2414
293 #define KSZ9896_PORT2_PRIO5_IG_LIMIT_CTRL 0x2415
294 #define KSZ9896_PORT2_PRIO6_IG_LIMIT_CTRL 0x2416
295 #define KSZ9896_PORT2_PRIO7_IG_LIMIT_CTRL 0x2417
296 #define KSZ9896_PORT2_QUEUE0_EG_LIMIT_CTRL 0x2420
297 #define KSZ9896_PORT2_QUEUE1_EG_LIMIT_CTRL 0x2421
298 #define KSZ9896_PORT2_QUEUE2_EG_LIMIT_CTRL 0x2422
299 #define KSZ9896_PORT2_QUEUE3_EG_LIMIT_CTRL 0x2423
300 #define KSZ9896_PORT2_MIB_CTRL_STAT 0x2500
301 #define KSZ9896_PORT2_MIB_DATA 0x2504
302 #define KSZ9896_PORT2_ACL_ACCESS0 0x2600
303 #define KSZ9896_PORT2_ACL_ACCESS1 0x2601
304 #define KSZ9896_PORT2_ACL_ACCESS2 0x2602
305 #define KSZ9896_PORT2_ACL_ACCESS3 0x2603
306 #define KSZ9896_PORT2_ACL_ACCESS4 0x2604
307 #define KSZ9896_PORT2_ACL_ACCESS5 0x2605
308 #define KSZ9896_PORT2_ACL_ACCESS6 0x2606
309 #define KSZ9896_PORT2_ACL_ACCESS7 0x2607
310 #define KSZ9896_PORT2_ACL_ACCESS8 0x2608
311 #define KSZ9896_PORT2_ACL_ACCESS9 0x2609
312 #define KSZ9896_PORT2_ACL_ACCESS10 0x260A
313 #define KSZ9896_PORT2_ACL_ACCESS11 0x260B
314 #define KSZ9896_PORT2_ACL_ACCESS12 0x260C
315 #define KSZ9896_PORT2_ACL_ACCESS13 0x260D
316 #define KSZ9896_PORT2_ACL_ACCESS14 0x260E
317 #define KSZ9896_PORT2_ACL_ACCESS15 0x260F
318 #define KSZ9896_PORT2_ACL_BYTE_EN_MSB 0x2610
319 #define KSZ9896_PORT2_ACL_BYTE_EN_LSB 0x2611
320 #define KSZ9896_PORT2_ACL_ACCESS_CTRL0 0x2612
321 #define KSZ9896_PORT2_MIRRORING_CTRL 0x2800
322 #define KSZ9896_PORT2_PRIO_CTRL 0x2801
323 #define KSZ9896_PORT2_IG_MAC_CTRL 0x2802
324 #define KSZ9896_PORT2_AUTH_CTRL 0x2803
325 #define KSZ9896_PORT2_PTR 0x2804
326 #define KSZ9896_PORT2_PRIO_TO_QUEUE_MAPPING 0x2808
327 #define KSZ9896_PORT2_POLICE_CTRL 0x280C
328 #define KSZ9896_PORT2_POLICE_QUEUE_RATE 0x2820
329 #define KSZ9896_PORT2_POLICE_QUEUE_BURST_SIZE 0x2824
330 #define KSZ9896_PORT2_WRED_PKT_MEM_CTRL0 0x2830
331 #define KSZ9896_PORT2_WRED_PKT_MEM_CTRL1 0x2834
332 #define KSZ9896_PORT2_WRED_QUEUE_CTRL0 0x2840
333 #define KSZ9896_PORT2_WRED_QUEUE_CTRL1 0x2844
334 #define KSZ9896_PORT2_WRED_QUEUE_PERF_MON_CTRL 0x2848
335 #define KSZ9896_PORT2_TX_QUEUE_INDEX 0x2900
336 #define KSZ9896_PORT2_TX_QUEUE_PVID 0x2904
337 #define KSZ9896_PORT2_TX_QUEUE_CTRL0 0x2914
338 #define KSZ9896_PORT2_TX_QUEUE_CTRL1 0x2915
339 #define KSZ9896_PORT2_CTRL0 0x2A00
340 #define KSZ9896_PORT2_CTRL1 0x2A04
341 #define KSZ9896_PORT2_CTRL2 0x2B00
342 #define KSZ9896_PORT2_MSTP_PTR 0x2B01
343 #define KSZ9896_PORT2_MSTP_STATE 0x2B04
344 #define KSZ9896_PORT3_DEFAULT_TAG0 0x3000
345 #define KSZ9896_PORT3_DEFAULT_TAG1 0x3001
346 #define KSZ9896_PORT3_PME_WOL_EVENT 0x3013
347 #define KSZ9896_PORT3_PME_WOL_EN 0x3017
348 #define KSZ9896_PORT3_INT_STATUS 0x301B
349 #define KSZ9896_PORT3_INT_MASK 0x301F
350 #define KSZ9896_PORT3_OP_CTRL0 0x3020
351 #define KSZ9896_PORT3_STATUS 0x3030
352 #define KSZ9896_PORT3_MAC_CTRL0 0x3400
353 #define KSZ9896_PORT3_MAC_CTRL1 0x3401
354 #define KSZ9896_PORT3_IG_RATE_LIMIT_CTRL 0x3403
355 #define KSZ9896_PORT3_PRIO0_IG_LIMIT_CTRL 0x3410
356 #define KSZ9896_PORT3_PRIO1_IG_LIMIT_CTRL 0x3411
357 #define KSZ9896_PORT3_PRIO2_IG_LIMIT_CTRL 0x3412
358 #define KSZ9896_PORT3_PRIO3_IG_LIMIT_CTRL 0x3413
359 #define KSZ9896_PORT3_PRIO4_IG_LIMIT_CTRL 0x3414
360 #define KSZ9896_PORT3_PRIO5_IG_LIMIT_CTRL 0x3415
361 #define KSZ9896_PORT3_PRIO6_IG_LIMIT_CTRL 0x3416
362 #define KSZ9896_PORT3_PRIO7_IG_LIMIT_CTRL 0x3417
363 #define KSZ9896_PORT3_QUEUE0_EG_LIMIT_CTRL 0x3420
364 #define KSZ9896_PORT3_QUEUE1_EG_LIMIT_CTRL 0x3421
365 #define KSZ9896_PORT3_QUEUE2_EG_LIMIT_CTRL 0x3422
366 #define KSZ9896_PORT3_QUEUE3_EG_LIMIT_CTRL 0x3423
367 #define KSZ9896_PORT3_MIB_CTRL_STAT 0x3500
368 #define KSZ9896_PORT3_MIB_DATA 0x3504
369 #define KSZ9896_PORT3_ACL_ACCESS0 0x3600
370 #define KSZ9896_PORT3_ACL_ACCESS1 0x3601
371 #define KSZ9896_PORT3_ACL_ACCESS2 0x3602
372 #define KSZ9896_PORT3_ACL_ACCESS3 0x3603
373 #define KSZ9896_PORT3_ACL_ACCESS4 0x3604
374 #define KSZ9896_PORT3_ACL_ACCESS5 0x3605
375 #define KSZ9896_PORT3_ACL_ACCESS6 0x3606
376 #define KSZ9896_PORT3_ACL_ACCESS7 0x3607
377 #define KSZ9896_PORT3_ACL_ACCESS8 0x3608
378 #define KSZ9896_PORT3_ACL_ACCESS9 0x3609
379 #define KSZ9896_PORT3_ACL_ACCESS10 0x360A
380 #define KSZ9896_PORT3_ACL_ACCESS11 0x360B
381 #define KSZ9896_PORT3_ACL_ACCESS12 0x360C
382 #define KSZ9896_PORT3_ACL_ACCESS13 0x360D
383 #define KSZ9896_PORT3_ACL_ACCESS14 0x360E
384 #define KSZ9896_PORT3_ACL_ACCESS15 0x360F
385 #define KSZ9896_PORT3_ACL_BYTE_EN_MSB 0x3610
386 #define KSZ9896_PORT3_ACL_BYTE_EN_LSB 0x3611
387 #define KSZ9896_PORT3_ACL_ACCESS_CTRL0 0x3612
388 #define KSZ9896_PORT3_MIRRORING_CTRL 0x3800
389 #define KSZ9896_PORT3_PRIO_CTRL 0x3801
390 #define KSZ9896_PORT3_IG_MAC_CTRL 0x3802
391 #define KSZ9896_PORT3_AUTH_CTRL 0x3803
392 #define KSZ9896_PORT3_PTR 0x3804
393 #define KSZ9896_PORT3_PRIO_TO_QUEUE_MAPPING 0x3808
394 #define KSZ9896_PORT3_POLICE_CTRL 0x380C
395 #define KSZ9896_PORT3_POLICE_QUEUE_RATE 0x3820
396 #define KSZ9896_PORT3_POLICE_QUEUE_BURST_SIZE 0x3824
397 #define KSZ9896_PORT3_WRED_PKT_MEM_CTRL0 0x3830
398 #define KSZ9896_PORT3_WRED_PKT_MEM_CTRL1 0x3834
399 #define KSZ9896_PORT3_WRED_QUEUE_CTRL0 0x3840
400 #define KSZ9896_PORT3_WRED_QUEUE_CTRL1 0x3844
401 #define KSZ9896_PORT3_WRED_QUEUE_PERF_MON_CTRL 0x3848
402 #define KSZ9896_PORT3_TX_QUEUE_INDEX 0x3900
403 #define KSZ9896_PORT3_TX_QUEUE_PVID 0x3904
404 #define KSZ9896_PORT3_TX_QUEUE_CTRL0 0x3914
405 #define KSZ9896_PORT3_TX_QUEUE_CTRL1 0x3915
406 #define KSZ9896_PORT3_CTRL0 0x3A00
407 #define KSZ9896_PORT3_CTRL1 0x3A04
408 #define KSZ9896_PORT3_CTRL2 0x3B00
409 #define KSZ9896_PORT3_MSTP_PTR 0x3B01
410 #define KSZ9896_PORT3_MSTP_STATE 0x3B04
411 #define KSZ9896_PORT4_DEFAULT_TAG0 0x4000
412 #define KSZ9896_PORT4_DEFAULT_TAG1 0x4001
413 #define KSZ9896_PORT4_PME_WOL_EVENT 0x4013
414 #define KSZ9896_PORT4_PME_WOL_EN 0x4017
415 #define KSZ9896_PORT4_INT_STATUS 0x401B
416 #define KSZ9896_PORT4_INT_MASK 0x401F
417 #define KSZ9896_PORT4_OP_CTRL0 0x4020
418 #define KSZ9896_PORT4_STATUS 0x4030
419 #define KSZ9896_PORT4_MAC_CTRL0 0x4400
420 #define KSZ9896_PORT4_MAC_CTRL1 0x4401
421 #define KSZ9896_PORT4_IG_RATE_LIMIT_CTRL 0x4403
422 #define KSZ9896_PORT4_PRIO0_IG_LIMIT_CTRL 0x4410
423 #define KSZ9896_PORT4_PRIO1_IG_LIMIT_CTRL 0x4411
424 #define KSZ9896_PORT4_PRIO2_IG_LIMIT_CTRL 0x4412
425 #define KSZ9896_PORT4_PRIO3_IG_LIMIT_CTRL 0x4413
426 #define KSZ9896_PORT4_PRIO4_IG_LIMIT_CTRL 0x4414
427 #define KSZ9896_PORT4_PRIO5_IG_LIMIT_CTRL 0x4415
428 #define KSZ9896_PORT4_PRIO6_IG_LIMIT_CTRL 0x4416
429 #define KSZ9896_PORT4_PRIO7_IG_LIMIT_CTRL 0x4417
430 #define KSZ9896_PORT4_QUEUE0_EG_LIMIT_CTRL 0x4420
431 #define KSZ9896_PORT4_QUEUE1_EG_LIMIT_CTRL 0x4421
432 #define KSZ9896_PORT4_QUEUE2_EG_LIMIT_CTRL 0x4422
433 #define KSZ9896_PORT4_QUEUE3_EG_LIMIT_CTRL 0x4423
434 #define KSZ9896_PORT4_MIB_CTRL_STAT 0x4500
435 #define KSZ9896_PORT4_MIB_DATA 0x4504
436 #define KSZ9896_PORT4_ACL_ACCESS0 0x4600
437 #define KSZ9896_PORT4_ACL_ACCESS1 0x4601
438 #define KSZ9896_PORT4_ACL_ACCESS2 0x4602
439 #define KSZ9896_PORT4_ACL_ACCESS3 0x4603
440 #define KSZ9896_PORT4_ACL_ACCESS4 0x4604
441 #define KSZ9896_PORT4_ACL_ACCESS5 0x4605
442 #define KSZ9896_PORT4_ACL_ACCESS6 0x4606
443 #define KSZ9896_PORT4_ACL_ACCESS7 0x4607
444 #define KSZ9896_PORT4_ACL_ACCESS8 0x4608
445 #define KSZ9896_PORT4_ACL_ACCESS9 0x4609
446 #define KSZ9896_PORT4_ACL_ACCESS10 0x460A
447 #define KSZ9896_PORT4_ACL_ACCESS11 0x460B
448 #define KSZ9896_PORT4_ACL_ACCESS12 0x460C
449 #define KSZ9896_PORT4_ACL_ACCESS13 0x460D
450 #define KSZ9896_PORT4_ACL_ACCESS14 0x460E
451 #define KSZ9896_PORT4_ACL_ACCESS15 0x460F
452 #define KSZ9896_PORT4_ACL_BYTE_EN_MSB 0x4610
453 #define KSZ9896_PORT4_ACL_BYTE_EN_LSB 0x4611
454 #define KSZ9896_PORT4_ACL_ACCESS_CTRL0 0x4612
455 #define KSZ9896_PORT4_MIRRORING_CTRL 0x4800
456 #define KSZ9896_PORT4_PRIO_CTRL 0x4801
457 #define KSZ9896_PORT4_IG_MAC_CTRL 0x4802
458 #define KSZ9896_PORT4_AUTH_CTRL 0x4803
459 #define KSZ9896_PORT4_PTR 0x4804
460 #define KSZ9896_PORT4_PRIO_TO_QUEUE_MAPPING 0x4808
461 #define KSZ9896_PORT4_POLICE_CTRL 0x480C
462 #define KSZ9896_PORT4_POLICE_QUEUE_RATE 0x4820
463 #define KSZ9896_PORT4_POLICE_QUEUE_BURST_SIZE 0x4824
464 #define KSZ9896_PORT4_WRED_PKT_MEM_CTRL0 0x4830
465 #define KSZ9896_PORT4_WRED_PKT_MEM_CTRL1 0x4834
466 #define KSZ9896_PORT4_WRED_QUEUE_CTRL0 0x4840
467 #define KSZ9896_PORT4_WRED_QUEUE_CTRL1 0x4844
468 #define KSZ9896_PORT4_WRED_QUEUE_PERF_MON_CTRL 0x4848
469 #define KSZ9896_PORT4_TX_QUEUE_INDEX 0x4900
470 #define KSZ9896_PORT4_TX_QUEUE_PVID 0x4904
471 #define KSZ9896_PORT4_TX_QUEUE_CTRL0 0x4914
472 #define KSZ9896_PORT4_TX_QUEUE_CTRL1 0x4915
473 #define KSZ9896_PORT4_CTRL0 0x4A00
474 #define KSZ9896_PORT4_CTRL1 0x4A04
475 #define KSZ9896_PORT4_CTRL2 0x4B00
476 #define KSZ9896_PORT4_MSTP_PTR 0x4B01
477 #define KSZ9896_PORT4_MSTP_STATE 0x4B04
478 #define KSZ9896_PORT5_DEFAULT_TAG0 0x5000
479 #define KSZ9896_PORT5_DEFAULT_TAG1 0x5001
480 #define KSZ9896_PORT5_PME_WOL_EVENT 0x5013
481 #define KSZ9896_PORT5_PME_WOL_EN 0x5017
482 #define KSZ9896_PORT5_INT_STATUS 0x501B
483 #define KSZ9896_PORT5_INT_MASK 0x501F
484 #define KSZ9896_PORT5_OP_CTRL0 0x5020
485 #define KSZ9896_PORT5_STATUS 0x5030
486 #define KSZ9896_PORT5_MAC_CTRL0 0x5400
487 #define KSZ9896_PORT5_MAC_CTRL1 0x5401
488 #define KSZ9896_PORT5_IG_RATE_LIMIT_CTRL 0x5403
489 #define KSZ9896_PORT5_PRIO0_IG_LIMIT_CTRL 0x5410
490 #define KSZ9896_PORT5_PRIO1_IG_LIMIT_CTRL 0x5411
491 #define KSZ9896_PORT5_PRIO2_IG_LIMIT_CTRL 0x5412
492 #define KSZ9896_PORT5_PRIO3_IG_LIMIT_CTRL 0x5413
493 #define KSZ9896_PORT5_PRIO4_IG_LIMIT_CTRL 0x5414
494 #define KSZ9896_PORT5_PRIO5_IG_LIMIT_CTRL 0x5415
495 #define KSZ9896_PORT5_PRIO6_IG_LIMIT_CTRL 0x5416
496 #define KSZ9896_PORT5_PRIO7_IG_LIMIT_CTRL 0x5417
497 #define KSZ9896_PORT5_QUEUE0_EG_LIMIT_CTRL 0x5420
498 #define KSZ9896_PORT5_QUEUE1_EG_LIMIT_CTRL 0x5421
499 #define KSZ9896_PORT5_QUEUE2_EG_LIMIT_CTRL 0x5422
500 #define KSZ9896_PORT5_QUEUE3_EG_LIMIT_CTRL 0x5423
501 #define KSZ9896_PORT5_MIB_CTRL_STAT 0x5500
502 #define KSZ9896_PORT5_MIB_DATA 0x5504
503 #define KSZ9896_PORT5_ACL_ACCESS0 0x5600
504 #define KSZ9896_PORT5_ACL_ACCESS1 0x5601
505 #define KSZ9896_PORT5_ACL_ACCESS2 0x5602
506 #define KSZ9896_PORT5_ACL_ACCESS3 0x5603
507 #define KSZ9896_PORT5_ACL_ACCESS4 0x5604
508 #define KSZ9896_PORT5_ACL_ACCESS5 0x5605
509 #define KSZ9896_PORT5_ACL_ACCESS6 0x5606
510 #define KSZ9896_PORT5_ACL_ACCESS7 0x5607
511 #define KSZ9896_PORT5_ACL_ACCESS8 0x5608
512 #define KSZ9896_PORT5_ACL_ACCESS9 0x5609
513 #define KSZ9896_PORT5_ACL_ACCESS10 0x560A
514 #define KSZ9896_PORT5_ACL_ACCESS11 0x560B
515 #define KSZ9896_PORT5_ACL_ACCESS12 0x560C
516 #define KSZ9896_PORT5_ACL_ACCESS13 0x560D
517 #define KSZ9896_PORT5_ACL_ACCESS14 0x560E
518 #define KSZ9896_PORT5_ACL_ACCESS15 0x560F
519 #define KSZ9896_PORT5_ACL_BYTE_EN_MSB 0x5610
520 #define KSZ9896_PORT5_ACL_BYTE_EN_LSB 0x5611
521 #define KSZ9896_PORT5_ACL_ACCESS_CTRL0 0x5612
522 #define KSZ9896_PORT5_MIRRORING_CTRL 0x5800
523 #define KSZ9896_PORT5_PRIO_CTRL 0x5801
524 #define KSZ9896_PORT5_IG_MAC_CTRL 0x5802
525 #define KSZ9896_PORT5_AUTH_CTRL 0x5803
526 #define KSZ9896_PORT5_PTR 0x5804
527 #define KSZ9896_PORT5_PRIO_TO_QUEUE_MAPPING 0x5808
528 #define KSZ9896_PORT5_POLICE_CTRL 0x580C
529 #define KSZ9896_PORT5_POLICE_QUEUE_RATE 0x5820
530 #define KSZ9896_PORT5_POLICE_QUEUE_BURST_SIZE 0x5824
531 #define KSZ9896_PORT5_WRED_PKT_MEM_CTRL0 0x5830
532 #define KSZ9896_PORT5_WRED_PKT_MEM_CTRL1 0x5834
533 #define KSZ9896_PORT5_WRED_QUEUE_CTRL0 0x5840
534 #define KSZ9896_PORT5_WRED_QUEUE_CTRL1 0x5844
535 #define KSZ9896_PORT5_WRED_QUEUE_PERF_MON_CTRL 0x5848
536 #define KSZ9896_PORT5_TX_QUEUE_INDEX 0x5900
537 #define KSZ9896_PORT5_TX_QUEUE_PVID 0x5904
538 #define KSZ9896_PORT5_TX_QUEUE_CTRL0 0x5914
539 #define KSZ9896_PORT5_TX_QUEUE_CTRL1 0x5915
540 #define KSZ9896_PORT5_CTRL0 0x5A00
541 #define KSZ9896_PORT5_CTRL1 0x5A04
542 #define KSZ9896_PORT5_CTRL2 0x5B00
543 #define KSZ9896_PORT5_MSTP_PTR 0x5B01
544 #define KSZ9896_PORT5_MSTP_STATE 0x5B04
545 #define KSZ9896_PORT6_DEFAULT_TAG0 0x6000
546 #define KSZ9896_PORT6_DEFAULT_TAG1 0x6001
547 #define KSZ9896_PORT6_PME_WOL_EVENT 0x6013
548 #define KSZ9896_PORT6_PME_WOL_EN 0x6017
549 #define KSZ9896_PORT6_INT_STATUS 0x601B
550 #define KSZ9896_PORT6_INT_MASK 0x601F
551 #define KSZ9896_PORT6_OP_CTRL0 0x6020
552 #define KSZ9896_PORT6_STATUS 0x6030
553 #define KSZ9896_PORT6_XMII_CTRL0 0x6300
554 #define KSZ9896_PORT6_XMII_CTRL1 0x6301
555 #define KSZ9896_PORT6_MAC_CTRL0 0x6400
556 #define KSZ9896_PORT6_MAC_CTRL1 0x6401
557 #define KSZ9896_PORT6_IG_RATE_LIMIT_CTRL 0x6403
558 #define KSZ9896_PORT6_PRIO0_IG_LIMIT_CTRL 0x6410
559 #define KSZ9896_PORT6_PRIO1_IG_LIMIT_CTRL 0x6411
560 #define KSZ9896_PORT6_PRIO2_IG_LIMIT_CTRL 0x6412
561 #define KSZ9896_PORT6_PRIO3_IG_LIMIT_CTRL 0x6413
562 #define KSZ9896_PORT6_PRIO4_IG_LIMIT_CTRL 0x6414
563 #define KSZ9896_PORT6_PRIO5_IG_LIMIT_CTRL 0x6415
564 #define KSZ9896_PORT6_PRIO6_IG_LIMIT_CTRL 0x6416
565 #define KSZ9896_PORT6_PRIO7_IG_LIMIT_CTRL 0x6417
566 #define KSZ9896_PORT6_QUEUE0_EG_LIMIT_CTRL 0x6420
567 #define KSZ9896_PORT6_QUEUE1_EG_LIMIT_CTRL 0x6421
568 #define KSZ9896_PORT6_QUEUE2_EG_LIMIT_CTRL 0x6422
569 #define KSZ9896_PORT6_QUEUE3_EG_LIMIT_CTRL 0x6423
570 #define KSZ9896_PORT6_MIB_CTRL_STAT 0x6500
571 #define KSZ9896_PORT6_MIB_DATA 0x6504
572 #define KSZ9896_PORT6_ACL_ACCESS0 0x6600
573 #define KSZ9896_PORT6_ACL_ACCESS1 0x6601
574 #define KSZ9896_PORT6_ACL_ACCESS2 0x6602
575 #define KSZ9896_PORT6_ACL_ACCESS3 0x6603
576 #define KSZ9896_PORT6_ACL_ACCESS4 0x6604
577 #define KSZ9896_PORT6_ACL_ACCESS5 0x6605
578 #define KSZ9896_PORT6_ACL_ACCESS6 0x6606
579 #define KSZ9896_PORT6_ACL_ACCESS7 0x6607
580 #define KSZ9896_PORT6_ACL_ACCESS8 0x6608
581 #define KSZ9896_PORT6_ACL_ACCESS9 0x6609
582 #define KSZ9896_PORT6_ACL_ACCESS10 0x660A
583 #define KSZ9896_PORT6_ACL_ACCESS11 0x660B
584 #define KSZ9896_PORT6_ACL_ACCESS12 0x660C
585 #define KSZ9896_PORT6_ACL_ACCESS13 0x660D
586 #define KSZ9896_PORT6_ACL_ACCESS14 0x660E
587 #define KSZ9896_PORT6_ACL_ACCESS15 0x660F
588 #define KSZ9896_PORT6_ACL_BYTE_EN_MSB 0x6610
589 #define KSZ9896_PORT6_ACL_BYTE_EN_LSB 0x6611
590 #define KSZ9896_PORT6_ACL_ACCESS_CTRL0 0x6612
591 #define KSZ9896_PORT6_MIRRORING_CTRL 0x6800
592 #define KSZ9896_PORT6_PRIO_CTRL 0x6801
593 #define KSZ9896_PORT6_IG_MAC_CTRL 0x6802
594 #define KSZ9896_PORT6_AUTH_CTRL 0x6803
595 #define KSZ9896_PORT6_PTR 0x6804
596 #define KSZ9896_PORT6_PRIO_TO_QUEUE_MAPPING 0x6808
597 #define KSZ9896_PORT6_POLICE_CTRL 0x680C
598 #define KSZ9896_PORT6_POLICE_QUEUE_RATE 0x6820
599 #define KSZ9896_PORT6_POLICE_QUEUE_BURST_SIZE 0x6824
600 #define KSZ9896_PORT6_WRED_PKT_MEM_CTRL0 0x6830
601 #define KSZ9896_PORT6_WRED_PKT_MEM_CTRL1 0x6834
602 #define KSZ9896_PORT6_WRED_QUEUE_CTRL0 0x6840
603 #define KSZ9896_PORT6_WRED_QUEUE_CTRL1 0x6844
604 #define KSZ9896_PORT6_WRED_QUEUE_PERF_MON_CTRL 0x6848
605 #define KSZ9896_PORT6_TX_QUEUE_INDEX 0x6900
606 #define KSZ9896_PORT6_TX_QUEUE_PVID 0x6904
607 #define KSZ9896_PORT6_TX_QUEUE_CTRL0 0x6914
608 #define KSZ9896_PORT6_TX_QUEUE_CTRL1 0x6915
609 #define KSZ9896_PORT6_CTRL0 0x6A00
610 #define KSZ9896_PORT6_CTRL1 0x6A04
611 #define KSZ9896_PORT6_CTRL2 0x6B00
612 #define KSZ9896_PORT6_MSTP_PTR 0x6B01
613 #define KSZ9896_PORT6_MSTP_STATE 0x6B04
614 
615 //KSZ9896 Switch register access macros
616 #define KSZ9896_PORTn_DEFAULT_TAG0(port) (0x0000 + ((port) * 0x1000))
617 #define KSZ9896_PORTn_DEFAULT_TAG1(port) (0x0001 + ((port) * 0x1000))
618 #define KSZ9896_PORTn_PME_WOL_EVENT(port) (0x0013 + ((port) * 0x1000))
619 #define KSZ9896_PORTn_PME_WOL_EN(port) (0x0017 + ((port) * 0x1000))
620 #define KSZ9896_PORTn_INT_STATUS(port) (0x001B + ((port) * 0x1000))
621 #define KSZ9896_PORTn_INT_MASK(port) (0x001F + ((port) * 0x1000))
622 #define KSZ9896_PORTn_OP_CTRL0(port) (0x0020 + ((port) * 0x1000))
623 #define KSZ9896_PORTn_STATUS(port) (0x0030 + ((port) * 0x1000))
624 #define KSZ9896_PORTn_MAC_CTRL0(port) (0x0400 + ((port) * 0x1000))
625 #define KSZ9896_PORTn_MAC_CTRL1(port) (0x0401 + ((port) * 0x1000))
626 #define KSZ9896_PORTn_IG_RATE_LIMIT_CTRL(port) (0x0403 + ((port) * 0x1000))
627 #define KSZ9896_PORTn_PRIO0_IG_LIMIT_CTRL(port) (0x0410 + ((port) * 0x1000))
628 #define KSZ9896_PORTn_PRIO1_IG_LIMIT_CTRL(port) (0x0411 + ((port) * 0x1000))
629 #define KSZ9896_PORTn_PRIO2_IG_LIMIT_CTRL(port) (0x0412 + ((port) * 0x1000))
630 #define KSZ9896_PORTn_PRIO3_IG_LIMIT_CTRL(port) (0x0413 + ((port) * 0x1000))
631 #define KSZ9896_PORTn_PRIO4_IG_LIMIT_CTRL(port) (0x0414 + ((port) * 0x1000))
632 #define KSZ9896_PORTn_PRIO5_IG_LIMIT_CTRL(port) (0x0415 + ((port) * 0x1000))
633 #define KSZ9896_PORTn_PRIO6_IG_LIMIT_CTRL(port) (0x0416 + ((port) * 0x1000))
634 #define KSZ9896_PORTn_PRIO7_IG_LIMIT_CTRL(port) (0x0417 + ((port) * 0x1000))
635 #define KSZ9896_PORTn_QUEUE0_EG_LIMIT_CTRL(port) (0x0420 + ((port) * 0x1000))
636 #define KSZ9896_PORTn_QUEUE1_EG_LIMIT_CTRL(port) (0x0421 + ((port) * 0x1000))
637 #define KSZ9896_PORTn_QUEUE2_EG_LIMIT_CTRL(port) (0x0422 + ((port) * 0x1000))
638 #define KSZ9896_PORTn_QUEUE3_EG_LIMIT_CTRL(port) (0x0423 + ((port) * 0x1000))
639 #define KSZ9896_PORTn_MIB_CTRL_STAT(port) (0x0500 + ((port) * 0x1000))
640 #define KSZ9896_PORTn_MIB_DATA(port) (0x0504 + ((port) * 0x1000))
641 #define KSZ9896_PORTn_ACL_ACCESS0(port) (0x0600 + ((port) * 0x1000))
642 #define KSZ9896_PORTn_ACL_ACCESS1(port) (0x0601 + ((port) * 0x1000))
643 #define KSZ9896_PORTn_ACL_ACCESS2(port) (0x0602 + ((port) * 0x1000))
644 #define KSZ9896_PORTn_ACL_ACCESS3(port) (0x0603 + ((port) * 0x1000))
645 #define KSZ9896_PORTn_ACL_ACCESS4(port) (0x0604 + ((port) * 0x1000))
646 #define KSZ9896_PORTn_ACL_ACCESS5(port) (0x0605 + ((port) * 0x1000))
647 #define KSZ9896_PORTn_ACL_ACCESS6(port) (0x0606 + ((port) * 0x1000))
648 #define KSZ9896_PORTn_ACL_ACCESS7(port) (0x0607 + ((port) * 0x1000))
649 #define KSZ9896_PORTn_ACL_ACCESS8(port) (0x0608 + ((port) * 0x1000))
650 #define KSZ9896_PORTn_ACL_ACCESS9(port) (0x0609 + ((port) * 0x1000))
651 #define KSZ9896_PORTn_ACL_ACCESS10(port) (0x060A + ((port) * 0x1000))
652 #define KSZ9896_PORTn_ACL_ACCESS11(port) (0x060B + ((port) * 0x1000))
653 #define KSZ9896_PORTn_ACL_ACCESS12(port) (0x060C + ((port) * 0x1000))
654 #define KSZ9896_PORTn_ACL_ACCESS13(port) (0x060D + ((port) * 0x1000))
655 #define KSZ9896_PORTn_ACL_ACCESS14(port) (0x060E + ((port) * 0x1000))
656 #define KSZ9896_PORTn_ACL_ACCESS15(port) (0x060F + ((port) * 0x1000))
657 #define KSZ9896_PORTn_ACL_BYTE_EN_MSB(port) (0x0610 + ((port) * 0x1000))
658 #define KSZ9896_PORTn_ACL_BYTE_EN_LSB(port) (0x0611 + ((port) * 0x1000))
659 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0(port) (0x0612 + ((port) * 0x1000))
660 #define KSZ9896_PORTn_MIRRORING_CTRL(port) (0x0800 + ((port) * 0x1000))
661 #define KSZ9896_PORTn_PRIO_CTRL(port) (0x0801 + ((port) * 0x1000))
662 #define KSZ9896_PORTn_IG_MAC_CTRL(port) (0x0802 + ((port) * 0x1000))
663 #define KSZ9896_PORTn_AUTH_CTRL(port) (0x0803 + ((port) * 0x1000))
664 #define KSZ9896_PORTn_PTR(port) (0x0804 + ((port) * 0x1000))
665 #define KSZ9896_PORTn_PRIO_TO_QUEUE_MAPPING(port) (0x0808 + ((port) * 0x1000))
666 #define KSZ9896_PORTn_POLICE_CTRL(port) (0x080C + ((port) * 0x1000))
667 #define KSZ9896_PORTn_POLICE_QUEUE_RATE(port) (0x0820 + ((port) * 0x1000))
668 #define KSZ9896_PORTn_POLICE_QUEUE_BURST_SIZE(port) (0x0824 + ((port) * 0x1000))
669 #define KSZ9896_PORTn_WRED_PKT_MEM_CTRL0(port) (0x0830 + ((port) * 0x1000))
670 #define KSZ9896_PORTn_WRED_PKT_MEM_CTRL1(port) (0x0834 + ((port) * 0x1000))
671 #define KSZ9896_PORTn_WRED_QUEUE_CTRL0(port) (0x0840 + ((port) * 0x1000))
672 #define KSZ9896_PORTn_WRED_QUEUE_CTRL1(port) (0x0844 + ((port) * 0x1000))
673 #define KSZ9896_PORTn_WRED_QUEUE_PERF_MON_CTRL(port) (0x0848 + ((port) * 0x1000))
674 #define KSZ9896_PORTn_TX_QUEUE_INDEX(port) (0x0900 + ((port) * 0x1000))
675 #define KSZ9896_PORTn_TX_QUEUE_PVID(port) (0x0904 + ((port) * 0x1000))
676 #define KSZ9896_PORTn_TX_QUEUE_CTRL0(port) (0x0914 + ((port) * 0x1000))
677 #define KSZ9896_PORTn_TX_QUEUE_CTRL1(port) (0x0915 + ((port) * 0x1000))
678 #define KSZ9896_PORTn_CTRL0(port) (0x0A00 + ((port) * 0x1000))
679 #define KSZ9896_PORTn_CTRL1(port) (0x0A04 + ((port) * 0x1000))
680 #define KSZ9896_PORTn_CTRL2(port) (0x0B00 + ((port) * 0x1000))
681 #define KSZ9896_PORTn_MSTP_PTR(port) (0x0B01 + ((port) * 0x1000))
682 #define KSZ9896_PORTn_MSTP_STATE(port) (0x0B04 + ((port) * 0x1000))
683 #define KSZ9896_PORTn_ETH_PHY_REG(port, addr) (0x0100 + ((port) * 0x1000) + ((addr) * 2))
684 
685 //PHY Basic Control register
686 #define KSZ9896_BMCR_RESET 0x8000
687 #define KSZ9896_BMCR_LOOPBACK 0x4000
688 #define KSZ9896_BMCR_SPEED_SEL_LSB 0x2000
689 #define KSZ9896_BMCR_AN_EN 0x1000
690 #define KSZ9896_BMCR_POWER_DOWN 0x0800
691 #define KSZ9896_BMCR_ISOLATE 0x0400
692 #define KSZ9896_BMCR_RESTART_AN 0x0200
693 #define KSZ9896_BMCR_DUPLEX_MODE 0x0100
694 #define KSZ9896_BMCR_COL_TEST 0x0080
695 #define KSZ9896_BMCR_SPEED_SEL_MSB 0x0040
696 
697 //PHY Basic Status register
698 #define KSZ9896_BMSR_100BT4 0x8000
699 #define KSZ9896_BMSR_100BTX_FD 0x4000
700 #define KSZ9896_BMSR_100BTX_HD 0x2000
701 #define KSZ9896_BMSR_10BT_FD 0x1000
702 #define KSZ9896_BMSR_10BT_HD 0x0800
703 #define KSZ9896_BMSR_EXTENDED_STATUS 0x0100
704 #define KSZ9896_BMSR_MF_PREAMBLE_SUPPR 0x0040
705 #define KSZ9896_BMSR_AN_COMPLETE 0x0020
706 #define KSZ9896_BMSR_REMOTE_FAULT 0x0010
707 #define KSZ9896_BMSR_AN_CAPABLE 0x0008
708 #define KSZ9896_BMSR_LINK_STATUS 0x0004
709 #define KSZ9896_BMSR_JABBER_DETECT 0x0002
710 #define KSZ9896_BMSR_EXTENDED_CAPABLE 0x0001
711 
712 //PHY ID High register
713 #define KSZ9896_PHYID1_DEFAULT 0x0022
714 
715 //PHY ID Low register
716 #define KSZ9896_PHYID2_DEFAULT 0x1631
717 
718 //PHY Auto-Negotiation Advertisement register
719 #define KSZ9896_ANAR_NEXT_PAGE 0x8000
720 #define KSZ9896_ANAR_REMOTE_FAULT 0x2000
721 #define KSZ9896_ANAR_PAUSE 0x0C00
722 #define KSZ9896_ANAR_100BT4 0x0200
723 #define KSZ9896_ANAR_100BTX_FD 0x0100
724 #define KSZ9896_ANAR_100BTX_HD 0x0080
725 #define KSZ9896_ANAR_10BT_FD 0x0040
726 #define KSZ9896_ANAR_10BT_HD 0x0020
727 #define KSZ9896_ANAR_SELECTOR 0x001F
728 #define KSZ9896_ANAR_SELECTOR_DEFAULT 0x0001
729 
730 //PHY Auto-Negotiation Link Partner Ability register
731 #define KSZ9896_ANLPAR_NEXT_PAGE 0x8000
732 #define KSZ9896_ANLPAR_ACK 0x4000
733 #define KSZ9896_ANLPAR_REMOTE_FAULT 0x2000
734 #define KSZ9896_ANLPAR_PAUSE 0x0C00
735 #define KSZ9896_ANLPAR_100BT4 0x0200
736 #define KSZ9896_ANLPAR_100BTX_FD 0x0100
737 #define KSZ9896_ANLPAR_100BTX_HD 0x0080
738 #define KSZ9896_ANLPAR_10BT_FD 0x0040
739 #define KSZ9896_ANLPAR_10BT_HD 0x0020
740 #define KSZ9896_ANLPAR_SELECTOR 0x001F
741 #define KSZ9896_ANLPAR_SELECTOR_DEFAULT 0x0001
742 
743 //PHY Auto-Negotiation Expansion Status register
744 #define KSZ9896_ANER_PAR_DETECT_FAULT 0x0010
745 #define KSZ9896_ANER_LP_NEXT_PAGE_ABLE 0x0008
746 #define KSZ9896_ANER_NEXT_PAGE_ABLE 0x0004
747 #define KSZ9896_ANER_PAGE_RECEIVED 0x0002
748 #define KSZ9896_ANER_LP_AN_ABLE 0x0001
749 
750 //PHY Auto-Negotiation Next Page register
751 #define KSZ9896_ANNPR_NEXT_PAGE 0x8000
752 #define KSZ9896_ANNPR_MSG_PAGE 0x2000
753 #define KSZ9896_ANNPR_ACK2 0x1000
754 #define KSZ9896_ANNPR_TOGGLE 0x0800
755 #define KSZ9896_ANNPR_MESSAGE 0x07FF
756 
757 //PHY Auto-Negotiation Link Partner Next Page Ability register
758 #define KSZ9896_ANLPNPR_NEXT_PAGE 0x8000
759 #define KSZ9896_ANLPNPR_ACK 0x4000
760 #define KSZ9896_ANLPNPR_MSG_PAGE 0x2000
761 #define KSZ9896_ANLPNPR_ACK2 0x1000
762 #define KSZ9896_ANLPNPR_TOGGLE 0x0800
763 #define KSZ9896_ANLPNPR_MESSAGE 0x07FF
764 
765 //PHY 1000BASE-T Control register
766 #define KSZ9896_GBCR_TEST_MODE 0xE000
767 #define KSZ9896_GBCR_MS_MAN_CONF_EN 0x1000
768 #define KSZ9896_GBCR_MS_MAN_CONF_VAL 0x0800
769 #define KSZ9896_GBCR_PORT_TYPE 0x0400
770 #define KSZ9896_GBCR_1000BT_FD 0x0200
771 #define KSZ9896_GBCR_1000BT_HD 0x0100
772 
773 //PHY 1000BASE-T Status register
774 #define KSZ9896_GBSR_MS_CONF_FAULT 0x8000
775 #define KSZ9896_GBSR_MS_CONF_RES 0x4000
776 #define KSZ9896_GBSR_LOCAL_RECEIVER_STATUS 0x2000
777 #define KSZ9896_GBSR_REMOTE_RECEIVER_STATUS 0x1000
778 #define KSZ9896_GBSR_LP_1000BT_FD 0x0800
779 #define KSZ9896_GBSR_LP_1000BT_HD 0x0400
780 #define KSZ9896_GBSR_IDLE_ERR_COUNT 0x00FF
781 
782 //PHY MMD Setup register
783 #define KSZ9896_MMDACR_FUNC 0xC000
784 #define KSZ9896_MMDACR_FUNC_ADDR 0x0000
785 #define KSZ9896_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
786 #define KSZ9896_MMDACR_FUNC_DATA_POST_INC_RW 0x8000
787 #define KSZ9896_MMDACR_FUNC_DATA_POST_INC_W 0xC000
788 #define KSZ9896_MMDACR_DEVAD 0x001F
789 
790 //PHY Extended Status register
791 #define KSZ9896_GBESR_1000BX_FD 0x8000
792 #define KSZ9896_GBESR_1000BX_HD 0x4000
793 #define KSZ9896_GBESR_1000BT_FD 0x2000
794 #define KSZ9896_GBESR_1000BT_HD 0x1000
795 
796 //PHY Remote Loopback register
797 #define KSZ9896_RLB_REMOTE_LOOPBACK 0x0100
798 
799 //PHY LinkMD register
800 #define KSZ9896_LINKMD_TEST_EN 0x8000
801 #define KSZ9896_LINKMD_PAIR 0x3000
802 #define KSZ9896_LINKMD_PAIR_A 0x0000
803 #define KSZ9896_LINKMD_PAIR_B 0x1000
804 #define KSZ9896_LINKMD_PAIR_C 0x2000
805 #define KSZ9896_LINKMD_PAIR_D 0x3000
806 #define KSZ9896_LINKMD_STATUS 0x0300
807 #define KSZ9896_LINKMD_STATUS_NORMAL 0x0000
808 #define KSZ9896_LINKMD_STATUS_OPEN 0x0100
809 #define KSZ9896_LINKMD_STATUS_SHORT 0x0200
810 #define KSZ9896_LINKMD_RESULT 0x00FF
811 
812 //PHY Digital PMA/PCS Status register
813 #define KSZ9896_DPMAPCSS_1000BT_LINK_STATUS 0x0002
814 #define KSZ9896_DPMAPCSS_100BTX_LINK_STATUS 0x0001
815 
816 //Port Interrupt Control/Status register
817 #define KSZ9896_ICSR_JABBER_IE 0x8000
818 #define KSZ9896_ICSR_RECEIVE_ERROR_IE 0x4000
819 #define KSZ9896_ICSR_PAGE_RECEIVED_IE 0x2000
820 #define KSZ9896_ICSR_PAR_DETECT_FAULT_IE 0x1000
821 #define KSZ9896_ICSR_LP_ACK_IE 0x0800
822 #define KSZ9896_ICSR_LINK_DOWN_IE 0x0400
823 #define KSZ9896_ICSR_REMOTE_FAULT_IE 0x0200
824 #define KSZ9896_ICSR_LINK_UP_IE 0x0100
825 #define KSZ9896_ICSR_JABBER_IF 0x0080
826 #define KSZ9896_ICSR_RECEIVE_ERROR_IF 0x0040
827 #define KSZ9896_ICSR_PAGE_RECEIVED_IF 0x0020
828 #define KSZ9896_ICSR_PAR_DETECT_FAULT_IF 0x0010
829 #define KSZ9896_ICSR_LP_ACK_IF 0x0008
830 #define KSZ9896_ICSR_LINK_DOWN_IF 0x0004
831 #define KSZ9896_ICSR_REMOTE_FAULT_IF 0x0002
832 #define KSZ9896_ICSR_LINK_UP_IF 0x0001
833 
834 //PHY Auto MDI/MDI-X register
835 #define KSZ9896_AUTOMDI_MDI_SET 0x0080
836 #define KSZ9896_AUTOMDI_SWAP_OFF 0x0040
837 
838 //PHY Control register
839 #define KSZ9896_PHYCON_JABBER_EN 0x0200
840 #define KSZ9896_PHYCON_SPEED_1000BT 0x0040
841 #define KSZ9896_PHYCON_SPEED_100BTX 0x0020
842 #define KSZ9896_PHYCON_SPEED_10BT 0x0010
843 #define KSZ9896_PHYCON_DUPLEX_STATUS 0x0008
844 #define KSZ9896_PHYCON_1000BT_MS_STATUS 0x0004
845 
846 //MMD LED Mode register
847 #define KSZ9896_MMD_LED_MODE_LED_MODE 0x0010
848 #define KSZ9896_MMD_LED_MODE_LED_MODE_TRI_COLOR_DUAL 0x0000
849 #define KSZ9896_MMD_LED_MODE_LED_MODE_SINGLE 0x0010
850 #define KSZ9896_MMD_LED_MODE_RESERVED 0x000F
851 #define KSZ9896_MMD_LED_MODE_RESERVED_DEFAULT 0x0001
852 
853 //MMD EEE Advertisement register
854 #define KSZ9896_MMD_EEE_ADV_1000BT_EEE_EN 0x0004
855 #define KSZ9896_MMD_EEE_ADV_100BT_EEE_EN 0x0002
856 
857 //Global Chip ID 0 register
858 #define KSZ9896_CHIP_ID0_DEFAULT 0x00
859 
860 //Global Chip ID 1 register
861 #define KSZ9896_CHIP_ID1_DEFAULT 0x98
862 
863 //Global Chip ID 2 register
864 #define KSZ9896_CHIP_ID2_DEFAULT 0x96
865 
866 //Global Chip ID 3 register
867 #define KSZ9896_CHIP_ID3_REVISION_ID 0xF0
868 #define KSZ9896_CHIP_ID3_GLOBAL_SOFT_RESET 0x01
869 
870 //PME Pin Control register
871 #define KSZ9896_PME_PIN_CTRL_PME_PIN_OUT_EN 0x02
872 #define KSZ9896_PME_PIN_CTRL_PME_PIN_OUT_POL 0x01
873 
874 //Global Interrupt Status register
875 #define KSZ9896_GLOBAL_INT_STAT_LUE 0x80000000
876 
877 //Global Interrupt Mask register
878 #define KSZ9896_GLOBAL_INT_MASK_LUE 0x80000000
879 
880 //Global Port Interrupt Status register
881 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT6 0x00000020
882 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT5 0x00000010
883 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT4 0x00000008
884 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT3 0x00000004
885 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT2 0x00000002
886 #define KSZ9896_GLOBAL_PORT_INT_STAT_PORT1 0x00000001
887 
888 //Global Port Interrupt Mask register
889 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT6 0x00000020
890 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT5 0x00000010
891 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT4 0x00000008
892 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT3 0x00000004
893 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT2 0x00000002
894 #define KSZ9896_GLOBAL_PORT_INT_MASK_PORT1 0x00000001
895 
896 //Serial I/O Control register
897 #define KSZ9896_SERIAL_IO_CTRL_MIIM_PREAMBLE_SUPPR 0x04
898 #define KSZ9896_SERIAL_IO_CTRL_AUTO_SPI_DATA_OUT_EDGE_SEL 0x02
899 #define KSZ9896_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL 0x01
900 #define KSZ9896_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL_FALLING 0x00
901 #define KSZ9896_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL_RISING 0x01
902 
903 //Output Clock Control register
904 #define KSZ9896_OUT_CLK_CTRL_CLKO_25_125_EN 0x02
905 #define KSZ9896_OUT_CLK_CTRL_CLKO_25_125_FREQ 0x01
906 #define KSZ9896_OUT_CLK_CTRL_CLKO_25_125_FREQ_25MHZ 0x00
907 #define KSZ9896_OUT_CLK_CTRL_CLKO_25_125_FREQ_125MHZ 0x01
908 
909 //In-Band Management Control register
910 #define KSZ9896_IBA_CTRL_IBA_EN 0x80000000
911 #define KSZ9896_IBA_CTRL_DEST_MAC_ADDR_MATCH_EN 0x40000000
912 #define KSZ9896_IBA_CTRL_IBA_RESET 0x20000000
913 #define KSZ9896_IBA_CTRL_RESP_PRIO_QUEUE 0x00C00000
914 #define KSZ9896_IBA_CTRL_RESP_PRIO_QUEUE_DEFAULT 0x00400000
915 #define KSZ9896_IBA_CTRL_IBA_COMM 0x00070000
916 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT1 0x00000000
917 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT2 0x00010000
918 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT3 0x00020000
919 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT4 0x00030000
920 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT5 0x00040000
921 #define KSZ9896_IBA_CTRL_IBA_COMM_PORT6 0x00050000
922 #define KSZ9896_IBA_CTRL_TPID 0x0000FFFF
923 #define KSZ9896_IBA_CTRL_TPID_DEFAULT 0x000040FE
924 
925 //I/O Drive Strength register
926 #define KSZ9896_IO_DRIVE_STRENGTH_HIGH_SPEED_DRIVE_STRENGTH 0x70
927 #define KSZ9896_IO_DRIVE_STRENGTH_LOW_SPEED_DRIVE_STRENGTH 0x07
928 
929 //In-Band Management Operation Status 1 register
930 #define KSZ9896_IBA_OP_STAT1_GOOD_PKT_DETECT 0x80000000
931 #define KSZ9896_IBA_OP_STAT1_RESP_PKT_TX_DONE 0x40000000
932 #define KSZ9896_IBA_OP_STAT1_EXEC_DONE 0x20000000
933 #define KSZ9896_IBA_OP_STAT1_MAC_ADDR_MISMATCH_ERR 0x00004000
934 #define KSZ9896_IBA_OP_STAT1_ACCESS_FORMAT_ERR 0x00002000
935 #define KSZ9896_IBA_OP_STAT1_ACCESS_CODE_ERR 0x00001000
936 #define KSZ9896_IBA_OP_STAT1_ACCESS_CMD_ERR 0x00000800
937 #define KSZ9896_IBA_OP_STAT1_OVERSIZE_PKT_ERR 0x00000400
938 #define KSZ9896_IBA_OP_STAT1_ACCESS_CODE_ERR_LOC 0x0000007F
939 
940 //LED Override register
941 #define KSZ9896_LED_OVERRIDE_OVERRIDE 0x000003FF
942 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED1_0 0x00000001
943 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED1_1 0x00000002
944 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED2_0 0x00000004
945 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED2_1 0x00000008
946 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED3_0 0x00000010
947 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED3_1 0x00000020
948 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED4_0 0x00000040
949 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED4_1 0x00000080
950 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED5_0 0x00000100
951 #define KSZ9896_LED_OVERRIDE_OVERRIDE_LED5_1 0x00000200
952 
953 //LED Output register
954 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL 0x000003FF
955 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED1_0 0x00000001
956 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED1_1 0x00000002
957 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED2_0 0x00000004
958 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED2_1 0x00000008
959 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED3_0 0x00000010
960 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED3_1 0x00000020
961 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED4_0 0x00000040
962 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED4_1 0x00000080
963 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED5_0 0x00000100
964 #define KSZ9896_LED_OUTPUT_GPIO_OUT_CTRL_LED5_1 0x00000200
965 
966 //Power Down Control 0 register
967 #define KSZ9896_PWR_DOWN_CTRL0_PLL_PWR_DOWN 0x20
968 #define KSZ9896_PWR_DOWN_CTRL0_PWR_MGMT_MODE 0x18
969 #define KSZ9896_PWR_DOWN_CTRL0_PWR_MGMT_MODE_NORMAL 0x00
970 #define KSZ9896_PWR_DOWN_CTRL0_PWR_MGMT_MODE_EDPD 0x08
971 #define KSZ9896_PWR_DOWN_CTRL0_PWR_MGMT_MODE_SOFT_PWR_DOWN 0x10
972 
973 //LED Strap-In register
974 #define KSZ9896_LED_STRAP_IN_STRAP_IN 0x000003FF
975 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED1_0 0x00000001
976 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED1_1 0x00000002
977 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED2_0 0x00000004
978 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED2_1 0x00000008
979 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED3_0 0x00000010
980 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED3_1 0x00000020
981 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED4_0 0x00000040
982 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED4_1 0x00000080
983 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED5_0 0x00000100
984 #define KSZ9896_LED_STRAP_IN_STRAP_IN_LED5_1 0x00000200
985 
986 //Switch Operation register
987 #define KSZ9896_SWITCH_OP_DOUBLE_TAG_EN 0x80
988 #define KSZ9896_SWITCH_OP_SOFT_HARD_RESET 0x02
989 #define KSZ9896_SWITCH_OP_START_SWITCH 0x01
990 
991 //Switch Maximum Transmit Unit register
992 #define KSZ9896_SWITCH_MTU_MTU 0x3FFF
993 #define KSZ9896_SWITCH_MTU_MTU_DEFAULT 0x07D0
994 
995 //Switch Lookup Engine Control 0 register
996 #define KSZ9896_SWITCH_LUE_CTRL0_VLAN_EN 0x80
997 #define KSZ9896_SWITCH_LUE_CTRL0_DROP_INVALID_VID 0x40
998 #define KSZ9896_SWITCH_LUE_CTRL0_AGE_COUNT 0x38
999 #define KSZ9896_SWITCH_LUE_CTRL0_AGE_COUNT_DEFAULT 0x20
1000 #define KSZ9896_SWITCH_LUE_CTRL0_RESERVED_MCAST_LOOKUP_EN 0x04
1001 #define KSZ9896_SWITCH_LUE_CTRL0_HASH_OPTION 0x03
1002 #define KSZ9896_SWITCH_LUE_CTRL0_HASH_OPTION_NONE 0x00
1003 #define KSZ9896_SWITCH_LUE_CTRL0_HASH_OPTION_CRC 0x01
1004 #define KSZ9896_SWITCH_LUE_CTRL0_HASH_OPTION_XOR 0x02
1005 
1006 //Switch Lookup Engine Control 1 register
1007 #define KSZ9896_SWITCH_LUE_CTRL1_UNICAST_LEARNING_DIS 0x80
1008 #define KSZ9896_SWITCH_LUE_CTRL1_SELF_ADDR_FILT 0x40
1009 #define KSZ9896_SWITCH_LUE_CTRL1_FLUSH_ALU_TABLE 0x20
1010 #define KSZ9896_SWITCH_LUE_CTRL1_FLUSH_MSTP_ENTRIES 0x10
1011 #define KSZ9896_SWITCH_LUE_CTRL1_MCAST_SRC_ADDR_FILT 0x08
1012 #define KSZ9896_SWITCH_LUE_CTRL1_AGING_EN 0x04
1013 #define KSZ9896_SWITCH_LUE_CTRL1_FAST_AGING 0x02
1014 #define KSZ9896_SWITCH_LUE_CTRL1_LINK_DOWN_FLUSH 0x01
1015 
1016 //Switch Lookup Engine Control 2 register
1017 #define KSZ9896_SWITCH_LUE_CTRL2_DOUBLE_TAG_MCAST_TRAP 0x40
1018 #define KSZ9896_SWITCH_LUE_CTRL2_DYNAMIC_ENTRY_EG_VLAN_FILT 0x20
1019 #define KSZ9896_SWITCH_LUE_CTRL2_STATIC_ENTRY_EG_VLAN_FILT 0x10
1020 #define KSZ9896_SWITCH_LUE_CTRL2_FLUSH_OPTION 0x0C
1021 #define KSZ9896_SWITCH_LUE_CTRL2_FLUSH_OPTION_NONE 0x00
1022 #define KSZ9896_SWITCH_LUE_CTRL2_FLUSH_OPTION_DYNAMIC 0x04
1023 #define KSZ9896_SWITCH_LUE_CTRL2_FLUSH_OPTION_STATIC 0x08
1024 #define KSZ9896_SWITCH_LUE_CTRL2_FLUSH_OPTION_BOTH 0x0C
1025 #define KSZ9896_SWITCH_LUE_CTRL2_MAC_ADDR_PRIORITY 0x03
1026 
1027 //Switch Lookup Engine Control 3 register
1028 #define KSZ9896_SWITCH_LUE_CTRL3_AGE_PERIOD 0xFF
1029 #define KSZ9896_SWITCH_LUE_CTRL3_AGE_PERIOD_DEFAULT 0x4B
1030 
1031 //Address Lookup Table Interrupt register
1032 #define KSZ9896_ALU_TABLE_INT_LEARN_FAIL 0x04
1033 #define KSZ9896_ALU_TABLE_INT_ALMOST_FULL 0x02
1034 #define KSZ9896_ALU_TABLE_INT_WRITE_FAIL 0x01
1035 
1036 //Address Lookup Table Mask register
1037 #define KSZ9896_ALU_TABLE_MASK_LEARN_FAIL 0x04
1038 #define KSZ9896_ALU_TABLE_MASK_ALMOST_FULL 0x02
1039 #define KSZ9896_ALU_TABLE_MASK_WRITE_FAIL 0x01
1040 
1041 //Address Lookup Table Entry Index 0 register
1042 #define KSZ9896_ALU_TABLE_ENTRY_INDEX0_ALMOST_FULL_ENTRY_INDEX 0x0FFF
1043 #define KSZ9896_ALU_TABLE_ENTRY_INDEX0_FAIL_WRITE_INDEX 0x03FF
1044 
1045 //Address Lookup Table Entry Index 1 register
1046 #define KSZ9896_ALU_TABLE_ENTRY_INDEX1_FAIL_LEARN_INDEX 0x03FF
1047 
1048 //Address Lookup Table Entry Index 2 register
1049 #define KSZ9896_ALU_TABLE_ENTRY_INDEX2_CPU_ACCESS_INDEX 0x03FF
1050 
1051 //Unknown Unicast Control register
1052 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD 0x80000000
1053 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP 0x0000003F
1054 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT1 0x00000001
1055 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT2 0x00000002
1056 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT3 0x00000004
1057 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT4 0x00000008
1058 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT5 0x00000010
1059 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT6 0x00000020
1060 #define KSZ9896_UNKNOWN_UNICAST_CTRL_FWD_MAP_ALL 0x0000003F
1061 
1062 //Unknown Multicast Control register
1063 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD 0x80000000
1064 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP 0x0000003F
1065 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT1 0x00000001
1066 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT2 0x00000002
1067 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT3 0x00000004
1068 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT4 0x00000008
1069 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT5 0x00000010
1070 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT6 0x00000020
1071 #define KSZ9896_UNKONWN_MULTICAST_CTRL_FWD_MAP_ALL 0x0000003F
1072 
1073 //Unknown VLAN ID Control register
1074 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD 0x80000000
1075 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP 0x0000003F
1076 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT1 0x00000001
1077 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT2 0x00000002
1078 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT3 0x00000004
1079 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT4 0x00000008
1080 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT5 0x00000010
1081 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT6 0x00000020
1082 #define KSZ9896_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_ALL 0x0000003F
1083 
1084 //Switch MAC Control 0 register
1085 #define KSZ9896_SWITCH_MAC_CTRL0_ALT_BACK_OFF_MODE 0x80
1086 #define KSZ9896_SWITCH_MAC_CTRL0_FRAME_LEN_CHECK_EN 0x08
1087 #define KSZ9896_SWITCH_MAC_CTRL0_FLOW_CTRL_PKT_DROP_MODE 0x02
1088 #define KSZ9896_SWITCH_MAC_CTRL0_AGGRESSIVE_BACK_OFF_EN 0x01
1089 
1090 //Switch MAC Control 1 register
1091 #define KSZ9896_SWITCH_MAC_CTRL1_MCAST_STORM_PROTECT_DIS 0x40
1092 #define KSZ9896_SWITCH_MAC_CTRL1_BACK_PRESSURE_MODE 0x20
1093 #define KSZ9896_SWITCH_MAC_CTRL1_FLOW_CTRL_FAIR_MODE 0x10
1094 #define KSZ9896_SWITCH_MAC_CTRL1_NO_EXCESSIVE_COL_DROP 0x08
1095 #define KSZ9896_SWITCH_MAC_CTRL1_JUMBO_PKT_SUPPORT 0x04
1096 #define KSZ9896_SWITCH_MAC_CTRL1_MAX_PKT_SIZE_CHECK_DIS 0x02
1097 #define KSZ9896_SWITCH_MAC_CTRL1_PASS_SHORT_PKT 0x01
1098 
1099 //Switch MAC Control 2 register
1100 #define KSZ9896_SWITCH_MAC_CTRL2_NULL_VID_REPLACEMENT 0x08
1101 #define KSZ9896_SWITCH_MAC_CTRL2_BCAST_STORM_PROTECT_RATE_MSB 0x07
1102 
1103 //Switch MAC Control 3 register
1104 #define KSZ9896_SWITCH_MAC_CTRL3_BCAST_STORM_PROTECT_RATE_LSB 0xFF
1105 
1106 //Switch MAC Control 4 register
1107 #define KSZ9896_SWITCH_MAC_CTRL4_PASS_FLOW_CTRL_PKT 0x01
1108 
1109 //Switch MAC Control 5 register
1110 #define KSZ9896_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD 0x30
1111 #define KSZ9896_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_16MS 0x00
1112 #define KSZ9896_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_64MS 0x10
1113 #define KSZ9896_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_256MS 0x20
1114 #define KSZ9896_SWITCH_MAC_CTRL5_QUEUE_BASED_EG_RATE_LIMITE_EN 0x08
1115 
1116 //Switch MIB Control register
1117 #define KSZ9896_SWITCH_MIB_CTRL_FLUSH 0x80
1118 #define KSZ9896_SWITCH_MIB_CTRL_FREEZE 0x40
1119 
1120 //Global Port Mirroring and Snooping Control register
1121 #define KSZ9896_GLOBAL_PORT_MIRROR_SNOOP_CTRL_IGMP_SNOOP_EN 0x40
1122 #define KSZ9896_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_OPT 0x08
1123 #define KSZ9896_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_EN 0x04
1124 #define KSZ9896_GLOBAL_PORT_MIRROR_SNOOP_CTRL_SNIFF_MODE_SEL 0x01
1125 
1126 //WRED DiffServ Color Mapping register
1127 #define KSZ9896_WRED_DIFFSERV_COLOR_MAPPING_RED 0x30
1128 #define KSZ9896_WRED_DIFFSERV_COLOR_MAPPING_YELLOW 0x0C
1129 #define KSZ9896_WRED_DIFFSERV_COLOR_MAPPING_GREEN 0x03
1130 
1131 //Queue Management Control 0 register
1132 #define KSZ9896_QUEUE_MGMT_CTRL0_PRIORITY_2Q 0x000000C0
1133 #define KSZ9896_QUEUE_MGMT_CTRL0_UNICAST_PORT_VLAN_DISCARD 0x00000002
1134 
1135 //VLAN Table Entry 0 register
1136 #define KSZ9896_VLAN_TABLE_ENTRY0_VALID 0x80000000
1137 #define KSZ9896_VLAN_TABLE_ENTRY0_FORWARD_OPTION 0x08000000
1138 #define KSZ9896_VLAN_TABLE_ENTRY0_PRIORITY 0x07000000
1139 #define KSZ9896_VLAN_TABLE_ENTRY0_MSTP_INDEX 0x00007000
1140 #define KSZ9896_VLAN_TABLE_ENTRY0_FID 0x0000007F
1141 
1142 //VLAN Table Entry 1 register
1143 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT_UNTAG 0x0000003F
1144 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT6_UNTAG 0x00000020
1145 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT5_UNTAG 0x00000010
1146 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT4_UNTAG 0x00000008
1147 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT3_UNTAG 0x00000004
1148 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT2_UNTAG 0x00000002
1149 #define KSZ9896_VLAN_TABLE_ENTRY1_PORT1_UNTAG 0x00000001
1150 
1151 //VLAN Table Entry 2 register
1152 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT_FORWARD 0x0000003F
1153 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT6_FORWARD 0x00000020
1154 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
1155 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
1156 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1157 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1158 #define KSZ9896_VLAN_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1159 
1160 //VLAN Table Index register
1161 #define KSZ9896_VLAN_TABLE_INDEX_VLAN_INDEX 0x0FFF
1162 
1163 //VLAN Table Access Control register
1164 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_START_FINISH 0x80
1165 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_ACTION 0x03
1166 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_ACTION_NOP 0x00
1167 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_ACTION_WRITE 0x01
1168 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_ACTION_READ 0x02
1169 #define KSZ9896_VLAN_TABLE_ACCESS_CTRL_ACTION_CLEAR 0x03
1170 
1171 //ALU Table Index 0 register
1172 #define KSZ9896_ALU_TABLE_INDEX0_FID_INDEX 0x007F0000
1173 #define KSZ9896_ALU_TABLE_INDEX0_MAC_INDEX_MSB 0x0000FFFF
1174 
1175 //ALU Table Index 1 register
1176 #define KSZ9896_ALU_TABLE_INDEX1_MAC_INDEX_LSB 0xFFFFFFFF
1177 
1178 //ALU Table Access Control register
1179 #define KSZ9896_ALU_TABLE_CTRL_VALID_COUNT 0x3FFF0000
1180 #define KSZ9896_ALU_TABLE_CTRL_START_FINISH 0x00000080
1181 #define KSZ9896_ALU_TABLE_CTRL_VALID 0x00000040
1182 #define KSZ9896_ALU_TABLE_CTRL_VALID_ENTRY_OR_SEARCH_END 0x00000020
1183 #define KSZ9896_ALU_TABLE_CTRL_DIRECT 0x00000004
1184 #define KSZ9896_ALU_TABLE_CTRL_ACTION 0x00000003
1185 #define KSZ9896_ALU_TABLE_CTRL_ACTION_NOP 0x00000000
1186 #define KSZ9896_ALU_TABLE_CTRL_ACTION_WRITE 0x00000001
1187 #define KSZ9896_ALU_TABLE_CTRL_ACTION_READ 0x00000002
1188 #define KSZ9896_ALU_TABLE_CTRL_ACTION_SEARCH 0x00000003
1189 
1190 //Static Address and Reserved Multicast Table Control register
1191 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_TABLE_INDEX 0x003F0000
1192 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_START_FINISH 0x00000080
1193 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_TABLE_SELECT 0x00000002
1194 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_ACTION 0x00000001
1195 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_ACTION_READ 0x00000000
1196 #define KSZ9896_STATIC_MCAST_TABLE_CTRL_ACTION_WRITE 0x00000001
1197 
1198 //ALU Table Entry 1 register
1199 #define KSZ9896_ALU_TABLE_ENTRY1_STATIC 0x80000000
1200 #define KSZ9896_ALU_TABLE_ENTRY1_SRC_FILTER 0x40000000
1201 #define KSZ9896_ALU_TABLE_ENTRY1_DES_FILTER 0x20000000
1202 #define KSZ9896_ALU_TABLE_ENTRY1_PRIORITY 0x1C000000
1203 #define KSZ9896_ALU_TABLE_ENTRY1_AGE_COUNT 0x1C000000
1204 #define KSZ9896_ALU_TABLE_ENTRY1_MSTP 0x00000007
1205 
1206 //ALU Table Entry 2 register
1207 #define KSZ9896_ALU_TABLE_ENTRY2_OVERRIDE 0x80000000
1208 #define KSZ9896_ALU_TABLE_ENTRY2_PORT_FORWARD 0x0000003F
1209 #define KSZ9896_ALU_TABLE_ENTRY2_PORT6_FORWARD 0x00000020
1210 #define KSZ9896_ALU_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
1211 #define KSZ9896_ALU_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
1212 #define KSZ9896_ALU_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1213 #define KSZ9896_ALU_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1214 #define KSZ9896_ALU_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1215 
1216 //ALU Table Entry 3 register
1217 #define KSZ9896_ALU_TABLE_ENTRY3_FID 0x007F0000
1218 #define KSZ9896_ALU_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
1219 
1220 //ALU Table Entry 4 register
1221 #define KSZ9896_ALU_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
1222 
1223 //Static Address Table Entry 1 register
1224 #define KSZ9896_STATIC_TABLE_ENTRY1_VALID 0x80000000
1225 #define KSZ9896_STATIC_TABLE_ENTRY1_SRC_FILTER 0x40000000
1226 #define KSZ9896_STATIC_TABLE_ENTRY1_DES_FILTER 0x20000000
1227 #define KSZ9896_STATIC_TABLE_ENTRY1_PRIORITY 0x1C000000
1228 #define KSZ9896_STATIC_TABLE_ENTRY1_MSTP 0x00000007
1229 
1230 //Static Address Table Entry 2 register
1231 #define KSZ9896_STATIC_TABLE_ENTRY2_OVERRIDE 0x80000000
1232 #define KSZ9896_STATIC_TABLE_ENTRY2_USE_FID 0x40000000
1233 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT_FORWARD 0x0000003F
1234 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT6_FORWARD 0x00000020
1235 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
1236 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
1237 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1238 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1239 #define KSZ9896_STATIC_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1240 
1241 //Static Address Table Entry 3 register
1242 #define KSZ9896_STATIC_TABLE_ENTRY3_FID 0x007F0000
1243 #define KSZ9896_STATIC_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
1244 
1245 //Static Address Table Entry 4 register
1246 #define KSZ9896_STATIC_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
1247 
1248 //Reserved Multicast Table Entry 2 register
1249 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT_FORWARD 0x0000003F
1250 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT6_FORWARD 0x00000020
1251 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
1252 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
1253 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1254 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1255 #define KSZ9896_RES_MCAST_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1256 
1257 //Port N Default Tag 0 register
1258 #define KSZ9896_PORTn_DEFAULT_TAG0_PCP 0xE0
1259 #define KSZ9896_PORTn_DEFAULT_TAG0_DEI 0x10
1260 #define KSZ9896_PORTn_DEFAULT_TAG0_VID_MSB 0x0F
1261 
1262 //Port N Default Tag 1 register
1263 #define KSZ9896_PORTn_DEFAULT_TAG1_VID_LSB 0xFF
1264 
1265 //Port N Interrupt Status register
1266 #define KSZ9896_PORTn_INT_STATUS_PHY 0x02
1267 #define KSZ9896_PORTn_INT_STATUS_ACL 0x01
1268 
1269 //Port N Interrupt Mask register
1270 #define KSZ9896_PORTn_INT_MASK_PHY 0x02
1271 #define KSZ9896_PORTn_INT_MASK_ACL 0x01
1272 
1273 //Port N Operation Control 0 register
1274 #define KSZ9896_PORTn_OP_CTRL0_LOCAL_LOOPBACK 0x80
1275 #define KSZ9896_PORTn_OP_CTRL0_REMOTE_LOOPBACK 0x40
1276 #define KSZ9896_PORTn_OP_CTRL0_TAIL_TAG_EN 0x04
1277 #define KSZ9896_PORTn_OP_CTRL0_TX_QUEUE_SPLIT_EN 0x03
1278 
1279 //Port N Status register
1280 #define KSZ9896_PORTn_STATUS_SPEED 0x18
1281 #define KSZ9896_PORTn_STATUS_SPEED_10MBPS 0x00
1282 #define KSZ9896_PORTn_STATUS_SPEED_100MBPS 0x08
1283 #define KSZ9896_PORTn_STATUS_SPEED_1000MBPS 0x10
1284 #define KSZ9896_PORTn_STATUS_DUPLEX 0x04
1285 #define KSZ9896_PORTn_STATUS_TX_FLOW_CTRL_EN 0x02
1286 #define KSZ9896_PORTn_STATUS_RX_FLOW_CTRL_EN 0x01
1287 
1288 //XMII Port 6 Control 0 register
1289 #define KSZ9896_PORT6_XMII_CTRL0_DUPLEX 0x40
1290 #define KSZ9896_PORT6_XMII_CTRL0_TX_FLOW_CTRL_EN 0x20
1291 #define KSZ9896_PORT6_XMII_CTRL0_SPEED_10_100 0x10
1292 #define KSZ9896_PORT6_XMII_CTRL0_RX_FLOW_CTRL_EN 0x08
1293 
1294 //XMII Port 6 Control 1 register
1295 #define KSZ9896_PORT6_XMII_CTRL1_SPEED_1000 0x40
1296 #define KSZ9896_PORT6_XMII_CTRL1_RGMII_ID_IG 0x10
1297 #define KSZ9896_PORT6_XMII_CTRL1_RGMII_ID_EG 0x08
1298 #define KSZ9896_PORT6_XMII_CTRL1_MII_RMII_MODE 0x04
1299 #define KSZ9896_PORT6_XMII_CTRL1_IF_TYPE 0x03
1300 #define KSZ9896_PORT6_XMII_CTRL1_IF_TYPE_RGMII 0x00
1301 #define KSZ9896_PORT6_XMII_CTRL1_IF_TYPE_RMII 0x01
1302 #define KSZ9896_PORT6_XMII_CTRL1_IF_TYPE_GMII 0x02
1303 #define KSZ9896_PORT6_XMII_CTRL1_IF_TYPE_MII 0x03
1304 
1305 //Port N MAC Control 0 register
1306 #define KSZ9896_PORTn_MAC_CTRL0_BCAST_STORM_PROTECT_EN 0x02
1307 
1308 //Port N MAC Control 1 register
1309 #define KSZ9896_PORTn_MAC_CTRL1_BACK_PRESSURE_EN 0x08
1310 #define KSZ9896_PORTn_MAC_CTRL1_PASS_ALL_FRAMES 0x01
1311 
1312 //Port N MIB Control and Status register
1313 #define KSZ9896_PORTn_MIB_CTRL_STAT_MIB_COUNTER_OVERFLOW 0x80000000
1314 #define KSZ9896_PORTn_MIB_CTRL_STAT_MIB_READ 0x02000000
1315 #define KSZ9896_PORTn_MIB_CTRL_STAT_MIB_FLUSH_FREEZE 0x01000000
1316 #define KSZ9896_PORTn_MIB_CTRL_STAT_MIB_INDEX 0x00FF0000
1317 #define KSZ9896_PORTn_MIB_CTRL_STAT_MIB_COUNTER_VALUE_35_32 0x0000000F
1318 
1319 //Port N MIB Data register
1320 #define KSZ9896_PORTn_MIB_DATA_MIB_COUNTER_VALUE_31_0 0xFFFFFFFF
1321 
1322 //Port N ACL Access Control 0 register
1323 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0_WRITE_STATUS 0x40
1324 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0_READ_STATUS 0x20
1325 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0_READ 0x00
1326 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0_WRITE 0x10
1327 #define KSZ9896_PORTn_ACL_ACCESS_CTRL0_ACL_INDEX 0x0F
1328 
1329 //Port N Port Mirroring Control register
1330 #define KSZ9896_PORTn_MIRRORING_CTRL_RECEIVE_SNIFF 0x40
1331 #define KSZ9896_PORTn_MIRRORING_CTRL_TRANSMIT_SNIFF 0x20
1332 #define KSZ9896_PORTn_MIRRORING_CTRL_SNIFFER_PORT 0x02
1333 
1334 //Port N Authentication Control register
1335 #define KSZ9896_PORTn_AUTH_CTRL_ACL_EN 0x04
1336 #define KSZ9896_PORTn_AUTH_CTRL_AUTH_MODE 0x03
1337 #define KSZ9896_PORTn_AUTH_CTRL_AUTH_MODE_PASS 0x00
1338 #define KSZ9896_PORTn_AUTH_CTRL_AUTH_MODE_BLOCK 0x01
1339 #define KSZ9896_PORTn_AUTH_CTRL_AUTH_MODE_TRAP 0x02
1340 
1341 //Port N Pointer register
1342 #define KSZ9896_PORTn_PTR_PORT_INDEX 0x00070000
1343 #define KSZ9896_PORTn_PTR_QUEUE_PTR 0x00000003
1344 
1345 //Port N Control 1 register
1346 #define KSZ9896_PORTn_CTRL1_PORT_VLAN_MEMBERSHIP 0x0000003F
1347 #define KSZ9896_PORTn_CTRL1_PORT6_VLAN_MEMBERSHIP 0x00000020
1348 #define KSZ9896_PORTn_CTRL1_PORT5_VLAN_MEMBERSHIP 0x00000010
1349 #define KSZ9896_PORTn_CTRL1_PORT4_VLAN_MEMBERSHIP 0x00000008
1350 #define KSZ9896_PORTn_CTRL1_PORT3_VLAN_MEMBERSHIP 0x00000004
1351 #define KSZ9896_PORTn_CTRL1_PORT2_VLAN_MEMBERSHIP 0x00000002
1352 #define KSZ9896_PORTn_CTRL1_PORT1_VLAN_MEMBERSHIP 0x00000001
1353 
1354 //Port N Control 2 register
1355 #define KSZ9896_PORTn_CTRL2_NULL_VID_LOOKUP_EN 0x80
1356 #define KSZ9896_PORTn_CTRL2_INGRESS_VLAN_FILT 0x40
1357 #define KSZ9896_PORTn_CTRL2_DISCARD_NON_PVID_PKT 0x20
1358 #define KSZ9896_PORTn_CTRL2_802_1X_EN 0x10
1359 #define KSZ9896_PORTn_CTRL2_SELF_ADDR_FILT 0x08
1360 
1361 //Port N MSTP Pointer register
1362 #define KSZ9896_PORTn_MSTP_PTR_MSTP_PTR 0x07
1363 
1364 //Port N MSTP State register
1365 #define KSZ9896_PORTn_MSTP_STATE_TRANSMIT_EN 0x04
1366 #define KSZ9896_PORTn_MSTP_STATE_RECEIVE_EN 0x02
1367 #define KSZ9896_PORTn_MSTP_STATE_LEARNING_DIS 0x01
1368 
1369 //C++ guard
1370 #ifdef __cplusplus
1371 extern "C" {
1372 #endif
1373 
1374 //KSZ9896 Ethernet switch driver
1375 extern const SwitchDriver ksz9896SwitchDriver;
1376 
1377 //KSZ9896 related functions
1378 error_t ksz9896Init(NetInterface *interface);
1379 void ksz9896InitHook(NetInterface *interface);
1380 
1381 void ksz9896Tick(NetInterface *interface);
1382 
1383 void ksz9896EnableIrq(NetInterface *interface);
1384 void ksz9896DisableIrq(NetInterface *interface);
1385 
1386 void ksz9896EventHandler(NetInterface *interface);
1387 
1388 error_t ksz9896TagFrame(NetInterface *interface, NetBuffer *buffer,
1389  size_t *offset, NetTxAncillary *ancillary);
1390 
1391 error_t ksz9896UntagFrame(NetInterface *interface, uint8_t **frame,
1392  size_t *length, NetRxAncillary *ancillary);
1393 
1394 bool_t ksz9896GetLinkState(NetInterface *interface, uint8_t port);
1395 uint32_t ksz9896GetLinkSpeed(NetInterface *interface, uint8_t port);
1397 
1398 void ksz9896SetPortState(NetInterface *interface, uint8_t port,
1399  SwitchPortState state);
1400 
1402 
1403 void ksz9896SetAgingTime(NetInterface *interface, uint32_t agingTime);
1404 
1405 void ksz9896EnableIgmpSnooping(NetInterface *interface, bool_t enable);
1406 void ksz9896EnableMldSnooping(NetInterface *interface, bool_t enable);
1407 void ksz9896EnableRsvdMcastTable(NetInterface *interface, bool_t enable);
1408 
1410  const SwitchFdbEntry *entry);
1411 
1413  const SwitchFdbEntry *entry);
1414 
1416  SwitchFdbEntry *entry);
1417 
1418 void ksz9896FlushStaticFdbTable(NetInterface *interface);
1419 
1421  SwitchFdbEntry *entry);
1422 
1423 void ksz9896FlushDynamicFdbTable(NetInterface *interface, uint8_t port);
1424 
1426  bool_t enable, uint32_t forwardPorts);
1427 
1428 void ksz9896WritePhyReg(NetInterface *interface, uint8_t port,
1429  uint8_t address, uint16_t data);
1430 
1431 uint16_t ksz9896ReadPhyReg(NetInterface *interface, uint8_t port,
1432  uint8_t address);
1433 
1434 void ksz9896DumpPhyReg(NetInterface *interface, uint8_t port);
1435 
1436 void ksz9896WriteMmdReg(NetInterface *interface, uint8_t port,
1437  uint8_t devAddr, uint16_t regAddr, uint16_t data);
1438 
1439 uint16_t ksz9896ReadMmdReg(NetInterface *interface, uint8_t port,
1440  uint8_t devAddr, uint16_t regAddr);
1441 
1442 void ksz9896WriteSwitchReg8(NetInterface *interface, uint16_t address,
1443  uint8_t data);
1444 
1445 uint8_t ksz9896ReadSwitchReg8(NetInterface *interface, uint16_t address);
1446 
1447 void ksz9896WriteSwitchReg16(NetInterface *interface, uint16_t address,
1448  uint16_t data);
1449 
1450 uint16_t ksz9896ReadSwitchReg16(NetInterface *interface, uint16_t address);
1451 
1452 void ksz9896WriteSwitchReg32(NetInterface *interface, uint16_t address,
1453  uint32_t data);
1454 
1455 uint32_t ksz9896ReadSwitchReg32(NetInterface *interface, uint16_t address);
1456 
1457 //C++ guard
1458 #ifdef __cplusplus
1459 }
1460 #endif
1461 
1462 #endif
void ksz9896SetUnknownMcastFwdPorts(NetInterface *interface, bool_t enable, uint32_t forwardPorts)
Set forward ports for unknown multicast packets.
bool_t ksz9896GetLinkState(NetInterface *interface, uint8_t port)
Get link state.
int bool_t
Definition: compiler_port.h:53
void ksz9896WriteSwitchReg16(NetInterface *interface, uint16_t address, uint16_t data)
Write switch register (16 bits)
void ksz9896WriteSwitchReg32(NetInterface *interface, uint16_t address, uint32_t data)
Write switch register (32 bits)
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
void ksz9896EventHandler(NetInterface *interface)
KSZ9896 event handler.
uint8_t data[]
Definition: ethernet.h:222
SwitchPortState ksz9896GetPortState(NetInterface *interface, uint8_t port)
Get port state.
error_t ksz9896TagFrame(NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary)
Add tail tag to Ethernet frame.
uint16_t ksz9896ReadMmdReg(NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
error_t ksz9896GetStaticFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the static MAC table.
void ksz9896EnableIgmpSnooping(NetInterface *interface, bool_t enable)
Enable IGMP snooping.
void ksz9896Tick(NetInterface *interface)
KSZ9896 timer handler.
NicDuplexMode ksz9896GetDuplexMode(NetInterface *interface, uint8_t port)
Get duplex mode.
void ksz9896WriteSwitchReg8(NetInterface *interface, uint16_t address, uint8_t data)
Write switch register (8 bits)
error_t
Error codes.
Definition: error.h:43
void ksz9896WriteMmdReg(NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
void ksz9896EnableMldSnooping(NetInterface *interface, bool_t enable)
Enable MLD snooping.
error_t ksz9896GetDynamicFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the dynamic MAC table.
#define NetTxAncillary
Definition: net_misc.h:36
SwitchPortState
Switch port state.
Definition: nic.h:134
uint8_t length
Definition: tcp.h:368
void ksz9896FlushDynamicFdbTable(NetInterface *interface, uint8_t port)
Flush dynamic MAC table.
uint32_t ksz9896GetLinkSpeed(NetInterface *interface, uint8_t port)
Get link speed.
uint16_t port
Definition: dns_common.h:267
uint16_t regAddr
uint16_t ksz9896ReadSwitchReg16(NetInterface *interface, uint16_t address)
Read switch register (16 bits)
Ethernet switch driver.
Definition: nic.h:325
Ipv6Addr address[]
Definition: ipv6.h:325
void ksz9896EnableIrq(NetInterface *interface)
Enable interrupts.
NicDuplexMode
Duplex mode.
Definition: nic.h:122
error_t ksz9896AddStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Add a new entry to the static MAC table.
error_t ksz9896UntagFrame(NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary)
Decode tail tag from incoming Ethernet frame.
Network interface controller abstraction layer.
uint32_t ksz9896ReadSwitchReg32(NetInterface *interface, uint16_t address)
Read switch register (32 bits)
const SwitchDriver ksz9896SwitchDriver
KSZ9896 Ethernet switch driver.
void ksz9896SetPortState(NetInterface *interface, uint8_t port, SwitchPortState state)
Set port state.
uint8_t ksz9896ReadSwitchReg8(NetInterface *interface, uint16_t address)
Read switch register (8 bits)
void ksz9896WritePhyReg(NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
Write PHY register.
void ksz9896DumpPhyReg(NetInterface *interface, uint8_t port)
Dump PHY registers for debugging purpose.
uint16_t ksz9896ReadPhyReg(NetInterface *interface, uint8_t port, uint8_t address)
Read PHY register.
void ksz9896FlushStaticFdbTable(NetInterface *interface)
Flush static MAC table.
error_t ksz9896DeleteStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Remove an entry from the static MAC table.
unsigned int uint_t
Definition: compiler_port.h:50
void ksz9896InitHook(NetInterface *interface)
KSZ9896 custom configuration.
void ksz9896EnableRsvdMcastTable(NetInterface *interface, bool_t enable)
Enable reserved multicast table.
error_t ksz9896Init(NetInterface *interface)
KSZ9896 Ethernet switch initialization.
void ksz9896SetAgingTime(NetInterface *interface, uint32_t agingTime)
Set aging time for dynamic filtering entries.
Forwarding database entry.
Definition: nic.h:149
void ksz9896DisableIrq(NetInterface *interface)
Disable interrupts.