ksz8775_driver.h
Go to the documentation of this file.
1 /**
2  * @file ksz8775_driver.h
3  * @brief KSZ8775 5-port Ethernet switch driver
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.0
29  **/
30 
31 #ifndef _KSZ8775_DRIVER_H
32 #define _KSZ8775_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //Port identifiers
38 #define KSZ8775_PORT1 1
39 #define KSZ8775_PORT2 2
40 #define KSZ8775_PORT3 3
41 #define KSZ8775_PORT4 4
42 #define KSZ8775_PORT5 5
43 
44 //Port masks
45 #define KSZ8775_PORT_MASK 0x1F
46 #define KSZ8775_PORT1_MASK 0x01
47 #define KSZ8775_PORT2_MASK 0x02
48 #define KSZ8775_PORT3_MASK 0x04
49 #define KSZ8775_PORT4_MASK 0x08
50 #define KSZ8775_PORT5_MASK 0x10
51 
52 //SPI command byte
53 #define KSZ8775_SPI_CMD_WRITE 0x4000
54 #define KSZ8775_SPI_CMD_READ 0x6000
55 #define KSZ8775_SPI_CMD_ADDR 0x1FFE
56 
57 //Size of static and dynamic MAC tables
58 #define KSZ8775_STATIC_MAC_TABLE_SIZE 32
59 #define KSZ8775_DYNAMIC_MAC_TABLE_SIZE 1024
60 #define KSZ8775_VLAN_TABLE_SIZE 4096
61 
62 //Tail tag rules (host to KSZ8775)
63 #define KSZ8775_TAIL_TAG_NORMAL_ADDR_LOOKUP 0x80
64 #define KSZ8775_TAIL_TAG_PORT_SEL 0x40
65 #define KSZ8775_TAIL_TAG_DEST_QUEUE 0x30
66 #define KSZ8775_TAIL_TAG_DEST_PORT4 0x08
67 #define KSZ8775_TAIL_TAG_DEST_PORT3 0x04
68 #define KSZ8775_TAIL_TAG_DEST_PORT2 0x02
69 #define KSZ8775_TAIL_TAG_DEST_PORT1 0x01
70 
71 //Tail tag rules (KSZ8775 to host)
72 #define KSZ8775_TAIL_TAG_SRC_PORT 0x03
73 
74 //KSZ8775 PHY registers
75 #define KSZ8775_BMCR 0x00
76 #define KSZ8775_BMSR 0x01
77 #define KSZ8775_PHYID1 0x02
78 #define KSZ8775_PHYID2 0x03
79 #define KSZ8775_ANAR 0x04
80 #define KSZ8775_ANLPAR 0x05
81 #define KSZ8775_LINKMD 0x1D
82 #define KSZ8775_PHYSCS 0x1F
83 
84 //KSZ8775 Switch registers
85 #define KSZ8775_CHIP_ID0 0x00
86 #define KSZ8775_CHIP_ID1 0x01
87 #define KSZ8775_GLOBAL_CTRL0 0x02
88 #define KSZ8775_GLOBAL_CTRL1 0x03
89 #define KSZ8775_GLOBAL_CTRL2 0x04
90 #define KSZ8775_GLOBAL_CTRL3 0x05
91 #define KSZ8775_GLOBAL_CTRL4 0x06
92 #define KSZ8775_GLOBAL_CTRL5 0x07
93 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL 0x08
94 #define KSZ8775_GLOBAL_CTRL7 0x09
95 #define KSZ8775_GLOBAL_CTRL8 0x0A
96 #define KSZ8775_GLOBAL_CTRL9 0x0B
97 #define KSZ8775_GLOBAL_CTRL10 0x0C
98 #define KSZ8775_GLOBAL_CTRL11 0x0D
99 #define KSZ8775_PD_MGMT_CTRL1 0x0E
100 #define KSZ8775_PD_MGMT_CTRL2 0x0F
101 #define KSZ8775_PORT1_CTRL0 0x10
102 #define KSZ8775_PORT1_CTRL1 0x11
103 #define KSZ8775_PORT1_CTRL2 0x12
104 #define KSZ8775_PORT1_CTRL3 0x13
105 #define KSZ8775_PORT1_CTRL4 0x14
106 #define KSZ8775_PORT1_CTRL5 0x15
107 #define KSZ8775_PORT1_CTRL7 0x17
108 #define KSZ8775_PORT1_STAT0 0x18
109 #define KSZ8775_PORT1_STAT1 0x19
110 #define KSZ8775_PORT1_PHY_CTRL8 0x1A
111 #define KSZ8775_PORT1_LINKMD 0x1B
112 #define KSZ8775_PORT1_CTRL9 0x1C
113 #define KSZ8775_PORT1_CTRL10 0x1D
114 #define KSZ8775_PORT1_STAT2 0x1E
115 #define KSZ8775_PORT1_CTRL11_STAT3 0x1F
116 #define KSZ8775_PORT2_CTRL0 0x20
117 #define KSZ8775_PORT2_CTRL1 0x21
118 #define KSZ8775_PORT2_CTRL2 0x22
119 #define KSZ8775_PORT2_CTRL3 0x23
120 #define KSZ8775_PORT2_CTRL4 0x24
121 #define KSZ8775_PORT2_CTRL5 0x25
122 #define KSZ8775_PORT2_CTRL7 0x27
123 #define KSZ8775_PORT2_STAT0 0x28
124 #define KSZ8775_PORT2_STAT1 0x29
125 #define KSZ8775_PORT2_PHY_CTRL8 0x2A
126 #define KSZ8775_PORT2_LINKMD 0x2B
127 #define KSZ8775_PORT2_CTRL9 0x2C
128 #define KSZ8775_PORT2_CTRL10 0x2D
129 #define KSZ8775_PORT2_STAT2 0x2E
130 #define KSZ8775_PORT2_CTRL11_STAT3 0x2F
131 #define KSZ8775_PORT3_CTRL0 0x30
132 #define KSZ8775_PORT3_CTRL1 0x31
133 #define KSZ8775_PORT3_CTRL2 0x32
134 #define KSZ8775_PORT3_CTRL3 0x33
135 #define KSZ8775_PORT3_CTRL4 0x34
136 #define KSZ8775_PORT3_CTRL5 0x35
137 #define KSZ8775_PORT3_CTRL7 0x37
138 #define KSZ8775_PORT3_STAT0 0x38
139 #define KSZ8775_PORT3_STAT1 0x39
140 #define KSZ8775_PORT3_PHY_CTRL8 0x3A
141 #define KSZ8775_PORT3_LINKMD 0x3B
142 #define KSZ8775_PORT3_CTRL9 0x3C
143 #define KSZ8775_PORT3_CTRL10 0x3D
144 #define KSZ8775_PORT3_STAT2 0x3E
145 #define KSZ8775_PORT3_CTRL11_STAT3 0x3F
146 #define KSZ8775_PORT4_CTRL0 0x40
147 #define KSZ8775_PORT4_CTRL1 0x41
148 #define KSZ8775_PORT4_CTRL2 0x42
149 #define KSZ8775_PORT4_CTRL3 0x43
150 #define KSZ8775_PORT4_CTRL4 0x44
151 #define KSZ8775_PORT4_CTRL5 0x45
152 #define KSZ8775_PORT4_IF_CTRL6 0x46
153 #define KSZ8775_PORT4_CTRL9 0x4C
154 #define KSZ8775_PORT5_CTRL0 0x50
155 #define KSZ8775_PORT5_CTRL1 0x51
156 #define KSZ8775_PORT5_CTRL2 0x52
157 #define KSZ8775_PORT5_CTRL3 0x53
158 #define KSZ8775_PORT5_CTRL4 0x54
159 #define KSZ8775_PORT5_CTRL5 0x55
160 #define KSZ8775_PORT5_IF_CTRL6 0x56
161 #define KSZ8775_MAC_ADDR0 0x68
162 #define KSZ8775_MAC_ADDR1 0x69
163 #define KSZ8775_MAC_ADDR2 0x6A
164 #define KSZ8775_MAC_ADDR3 0x6B
165 #define KSZ8775_MAC_ADDR4 0x6C
166 #define KSZ8775_MAC_ADDR5 0x6D
167 #define KSZ8775_INDIRECT_CTRL0 0x6E
168 #define KSZ8775_INDIRECT_CTRL1 0x6F
169 #define KSZ8775_INDIRECT_DATA8 0x70
170 #define KSZ8775_INDIRECT_DATA7 0x71
171 #define KSZ8775_INDIRECT_DATA6 0x72
172 #define KSZ8775_INDIRECT_DATA5 0x73
173 #define KSZ8775_INDIRECT_DATA4 0x74
174 #define KSZ8775_INDIRECT_DATA3 0x75
175 #define KSZ8775_INDIRECT_DATA2 0x76
176 #define KSZ8775_INDIRECT_DATA1 0x77
177 #define KSZ8775_INDIRECT_DATA0 0x78
178 #define KSZ8775_INT_STAT 0x7C
179 #define KSZ8775_INT_MASK 0x7D
180 #define KSZ8775_ACL_INT_STAT 0x7E
181 #define KSZ8775_ACL_INT_CTRL 0x7F
182 #define KSZ8775_GLOBAL_CTRL12 0x80
183 #define KSZ8775_GLOBAL_CTRL13 0x81
184 #define KSZ8775_GLOBAL_CTRL14 0x82
185 #define KSZ8775_GLOBAL_CTRL15 0x83
186 #define KSZ8775_GLOBAL_CTRL16 0x84
187 #define KSZ8775_GLOBAL_CTRL17 0x85
188 #define KSZ8775_GLOBAL_CTRL18 0x86
189 #define KSZ8775_GLOBAL_CTRL19 0x87
190 #define KSZ8775_TOS_PRIO_CTRL0 0x90
191 #define KSZ8775_TOS_PRIO_CTRL1 0x91
192 #define KSZ8775_TOS_PRIO_CTRL2 0x92
193 #define KSZ8775_TOS_PRIO_CTRL3 0x93
194 #define KSZ8775_TOS_PRIO_CTRL4 0x94
195 #define KSZ8775_TOS_PRIO_CTRL5 0x95
196 #define KSZ8775_TOS_PRIO_CTRL6 0x96
197 #define KSZ8775_TOS_PRIO_CTRL7 0x97
198 #define KSZ8775_TOS_PRIO_CTRL8 0x98
199 #define KSZ8775_TOS_PRIO_CTRL9 0x99
200 #define KSZ8775_TOS_PRIO_CTRL10 0x9A
201 #define KSZ8775_TOS_PRIO_CTRL11 0x9B
202 #define KSZ8775_TOS_PRIO_CTRL12 0x9C
203 #define KSZ8775_TOS_PRIO_CTRL13 0x9D
204 #define KSZ8775_TOS_PRIO_CTRL14 0x9E
205 #define KSZ8775_TOS_PRIO_CTRL15 0x9F
206 #define KSZ8775_INDIRECT_BYTE 0xA0
207 #define KSZ8775_GLOBAL_CTRL20 0xA3
208 #define KSZ8775_GLOBAL_CTRL21 0xA4
209 #define KSZ8775_PORT1_CTRL12 0xB0
210 #define KSZ8775_PORT1_CTRL13 0xB1
211 #define KSZ8775_PORT1_CTRL14 0xB2
212 #define KSZ8775_PORT1_CTRL15 0xB3
213 #define KSZ8775_PORT1_CTRL16 0xB4
214 #define KSZ8775_PORT1_CTRL17 0xB5
215 #define KSZ8775_PORT1_RATE_LIMIT_CTRL 0xB6
216 #define KSZ8775_PORT1_PRIO0_IG_LIMIT_CTRL1 0xB7
217 #define KSZ8775_PORT1_PRIO1_IG_LIMIT_CTRL2 0xB8
218 #define KSZ8775_PORT1_PRIO2_IG_LIMIT_CTRL3 0xB9
219 #define KSZ8775_PORT1_PRIO3_IG_LIMIT_CTRL4 0xBA
220 #define KSZ8775_PORT1_QUEUE0_EG_LIMIT_CTRL1 0xBB
221 #define KSZ8775_PORT1_QUEUE1_EG_LIMIT_CTRL2 0xBC
222 #define KSZ8775_PORT1_QUEUE2_EG_LIMIT_CTRL3 0xBD
223 #define KSZ8775_PORT1_QUEUE3_EG_LIMIT_CTRL4 0xBE
224 #define KSZ8775_TEST 0xBF
225 #define KSZ8775_PORT2_CTRL12 0xC0
226 #define KSZ8775_PORT2_CTRL13 0xC1
227 #define KSZ8775_PORT2_CTRL14 0xC2
228 #define KSZ8775_PORT2_CTRL15 0xC3
229 #define KSZ8775_PORT2_CTRL16 0xC4
230 #define KSZ8775_PORT2_CTRL17 0xC5
231 #define KSZ8775_PORT2_RATE_LIMIT_CTRL 0xC6
232 #define KSZ8775_PORT2_PRIO0_IG_LIMIT_CTRL1 0xC7
233 #define KSZ8775_PORT2_PRIO1_IG_LIMIT_CTRL2 0xC8
234 #define KSZ8775_PORT2_PRIO2_IG_LIMIT_CTRL3 0xC9
235 #define KSZ8775_PORT2_PRIO3_IG_LIMIT_CTRL4 0xCA
236 #define KSZ8775_PORT2_QUEUE0_EG_LIMIT_CTRL1 0xCB
237 #define KSZ8775_PORT2_QUEUE1_EG_LIMIT_CTRL2 0xCC
238 #define KSZ8775_PORT2_QUEUE2_EG_LIMIT_CTRL3 0xCD
239 #define KSZ8775_PORT2_QUEUE3_EG_LIMIT_CTRL4 0xCE
240 #define KSZ8775_PORT3_CTRL12 0xD0
241 #define KSZ8775_PORT3_CTRL13 0xD1
242 #define KSZ8775_PORT3_CTRL14 0xD2
243 #define KSZ8775_PORT3_CTRL15 0xD3
244 #define KSZ8775_PORT3_CTRL16 0xD4
245 #define KSZ8775_PORT3_CTRL17 0xD5
246 #define KSZ8775_PORT3_RATE_LIMIT_CTRL 0xD6
247 #define KSZ8775_PORT3_PRIO0_IG_LIMIT_CTRL1 0xD7
248 #define KSZ8775_PORT3_PRIO1_IG_LIMIT_CTRL2 0xD8
249 #define KSZ8775_PORT3_PRIO2_IG_LIMIT_CTRL3 0xD9
250 #define KSZ8775_PORT3_PRIO3_IG_LIMIT_CTRL4 0xDA
251 #define KSZ8775_PORT3_QUEUE0_EG_LIMIT_CTRL1 0xDB
252 #define KSZ8775_PORT3_QUEUE1_EG_LIMIT_CTRL2 0xDC
253 #define KSZ8775_PORT3_QUEUE2_EG_LIMIT_CTRL3 0xDD
254 #define KSZ8775_PORT3_QUEUE3_EG_LIMIT_CTRL4 0xDE
255 #define KSZ8775_TEST2 0xDF
256 #define KSZ8775_PORT4_CTRL12 0xE0
257 #define KSZ8775_PORT4_CTRL13 0xE1
258 #define KSZ8775_PORT4_CTRL14 0xE2
259 #define KSZ8775_PORT4_CTRL15 0xE3
260 #define KSZ8775_PORT4_CTRL16 0xE4
261 #define KSZ8775_PORT4_CTRL17 0xE5
262 #define KSZ8775_PORT4_RATE_LIMIT_CTRL 0xE6
263 #define KSZ8775_PORT4_PRIO0_IG_LIMIT_CTRL1 0xE7
264 #define KSZ8775_PORT4_PRIO1_IG_LIMIT_CTRL2 0xE8
265 #define KSZ8775_PORT4_PRIO2_IG_LIMIT_CTRL3 0xE9
266 #define KSZ8775_PORT4_PRIO3_IG_LIMIT_CTRL4 0xEA
267 #define KSZ8775_PORT4_QUEUE0_EG_LIMIT_CTRL1 0xEB
268 #define KSZ8775_PORT4_QUEUE1_EG_LIMIT_CTRL2 0xEC
269 #define KSZ8775_PORT4_QUEUE2_EG_LIMIT_CTRL3 0xED
270 #define KSZ8775_PORT4_QUEUE3_EG_LIMIT_CTRL4 0xEE
271 #define KSZ8775_TEST3 0xEF
272 #define KSZ8775_PORT5_CTRL13 0xF1
273 #define KSZ8775_PORT5_CTRL14 0xF2
274 #define KSZ8775_PORT5_CTRL15 0xF3
275 #define KSZ8775_PORT5_CTRL16 0xF4
276 #define KSZ8775_PORT5_CTRL17 0xF5
277 #define KSZ8775_PORT5_RATE_LIMIT_CTRL 0xF6
278 #define KSZ8775_PORT5_PRIO0_IG_LIMIT_CTRL1 0xF7
279 #define KSZ8775_PORT5_PRIO1_IG_LIMIT_CTRL2 0xF8
280 #define KSZ8775_PORT5_PRIO2_IG_LIMIT_CTRL3 0xF9
281 #define KSZ8775_PORT5_PRIO3_IG_LIMIT_CTRL4 0xFA
282 #define KSZ8775_PORT5_QUEUE0_EG_LIMIT_CTRL1 0xFB
283 #define KSZ8775_PORT5_QUEUE1_EG_LIMIT_CTRL2 0xFC
284 #define KSZ8775_PORT5_QUEUE2_EG_LIMIT_CTRL3 0xFD
285 #define KSZ8775_PORT5_QUEUE3_EG_LIMIT_CTRL4 0xFE
286 #define KSZ8775_TEST4 0xFF
287 
288 //KSZ8775 Switch register access macros
289 #define KSZ8775_PORTn_CTRL0(port) (0x00 + ((port) * 0x10))
290 #define KSZ8775_PORTn_CTRL1(port) (0x01 + ((port) * 0x10))
291 #define KSZ8775_PORTn_CTRL2(port) (0x02 + ((port) * 0x10))
292 #define KSZ8775_PORTn_CTRL3(port) (0x03 + ((port) * 0x10))
293 #define KSZ8775_PORTn_CTRL4(port) (0x04 + ((port) * 0x10))
294 #define KSZ8775_PORTn_CTRL5(port) (0x05 + ((port) * 0x10))
295 #define KSZ8775_PORTn_IF_CTRL6(port) (0x06 + ((port) * 0x10))
296 #define KSZ8775_PORTn_CTRL7(port) (0x07 + ((port) * 0x10))
297 #define KSZ8775_PORTn_STAT0(port) (0x08 + ((port) * 0x10))
298 #define KSZ8775_PORTn_STAT1(port) (0x09 + ((port) * 0x10))
299 #define KSZ8775_PORTn_PHY_CTRL8(port) (0x0A + ((port) * 0x10))
300 #define KSZ8775_PORTn_LINKMD(port) (0x0B + ((port) * 0x10))
301 #define KSZ8775_PORTn_CTRL9(port) (0x0C + ((port) * 0x10))
302 #define KSZ8775_PORTn_CTRL10(port) (0x0D + ((port) * 0x10))
303 #define KSZ8775_PORTn_STAT2(port) (0x0E + ((port) * 0x10))
304 #define KSZ8775_PORTn_CTRL11_STAT3(port) (0x0F + ((port) * 0x10))
305 #define KSZ8775_PORTn_CTRL12(port) (0xA0 + ((port) * 0x10))
306 #define KSZ8775_PORTn_CTRL13(port) (0xA1 + ((port) * 0x10))
307 #define KSZ8775_PORTn_CTRL14(port) (0xA2 + ((port) * 0x10))
308 #define KSZ8775_PORTn_CTRL15(port) (0xA3 + ((port) * 0x10))
309 #define KSZ8775_PORTn_CTRL16(port) (0xA4 + ((port) * 0x10))
310 #define KSZ8775_PORTn_CTRL17(port) (0xA5 + ((port) * 0x10))
311 #define KSZ8775_PORTn_RATE_LIMIT_CTRL(port) (0xA6 + ((port) * 0x10))
312 #define KSZ8775_PORTn_PRIO0_IG_LIMIT_CTRL1(port) (0xA7 + ((port) * 0x10))
313 #define KSZ8775_PORTn_PRIO1_IG_LIMIT_CTRL2(port) (0xA8 + ((port) * 0x10))
314 #define KSZ8775_PORTn_PRIO2_IG_LIMIT_CTRL3(port) (0xA9 + ((port) * 0x10))
315 #define KSZ8775_PORTn_PRIO3_IG_LIMIT_CTRL4(port) (0xAA + ((port) * 0x10))
316 #define KSZ8775_PORTn_QUEUE0_EG_LIMIT_CTRL1(port) (0xAB + ((port) * 0x10))
317 #define KSZ8775_PORTn_QUEUE1_EG_LIMIT_CTRL2(port) (0xAC + ((port) * 0x10))
318 #define KSZ8775_PORTn_QUEUE2_EG_LIMIT_CTRL3(port) (0xAD + ((port) * 0x10))
319 #define KSZ8775_PORTn_QUEUE3_EG_LIMIT_CTRL4(port) (0xAE + ((port) * 0x10))
320 
321 //Basic Control register
322 #define KSZ8775_BMCR_RESET 0x8000
323 #define KSZ8775_BMCR_LOOPBACK 0x4000
324 #define KSZ8775_BMCR_FORCE_100 0x2000
325 #define KSZ8775_BMCR_AN_EN 0x1000
326 #define KSZ8775_BMCR_POWER_DOWN 0x0800
327 #define KSZ8775_BMCR_ISOLATE 0x0400
328 #define KSZ8775_BMCR_RESTART_AN 0x0200
329 #define KSZ8775_BMCR_FORCE_FULL_DUPLEX 0x0100
330 #define KSZ8775_BMCR_HP_MDIX 0x0020
331 #define KSZ8775_BMCR_FORCE_MDI 0x0010
332 #define KSZ8775_BMCR_AUTO_MDIX_DIS 0x0008
333 #define KSZ8775_BMCR_FAR_END_FAULT_DIS 0x0004
334 #define KSZ8775_BMCR_TRANSMIT_DIS 0x0002
335 #define KSZ8775_BMCR_LED_DIS 0x0001
336 
337 //Basic Status register
338 #define KSZ8775_BMSR_100BT4 0x8000
339 #define KSZ8775_BMSR_100BTX_FD 0x4000
340 #define KSZ8775_BMSR_100BTX_HD 0x2000
341 #define KSZ8775_BMSR_10BT_FD 0x1000
342 #define KSZ8775_BMSR_10BT_HD 0x0800
343 #define KSZ8775_BMSR_AN_COMPLETE 0x0020
344 #define KSZ8775_BMSR_FAR_END_FAULT 0x0010
345 #define KSZ8775_BMSR_AN_CAPABLE 0x0008
346 #define KSZ8775_BMSR_LINK_STATUS 0x0004
347 #define KSZ8775_BMSR_EXTENDED_CAPABLE 0x0001
348 
349 //PHYID High register
350 #define KSZ8775_PHYID1_DEFAULT 0x0022
351 
352 //PHYID Low register
353 #define KSZ8775_PHYID2_DEFAULT 0x1550
354 
355 //Advertisement Ability register
356 #define KSZ8775_ANAR_PAUSE 0x0400
357 #define KSZ8775_ANAR_100BTX_FD 0x0100
358 #define KSZ8775_ANAR_100BTX_HD 0x0080
359 #define KSZ8775_ANAR_10BT_FD 0x0040
360 #define KSZ8775_ANAR_10BT_HD 0x0020
361 #define KSZ8775_ANAR_SELECTOR 0x001F
362 #define KSZ8775_ANAR_SELECTOR_DEFAULT 0x0001
363 
364 //Link Partner Ability register
365 #define KSZ8775_ANLPAR_PAUSE 0x0400
366 #define KSZ8775_ANLPAR_100BTX_FD 0x0100
367 #define KSZ8775_ANLPAR_100BTX_HD 0x0080
368 #define KSZ8775_ANLPAR_10BT_FD 0x0040
369 #define KSZ8775_ANLPAR_10BT_HD 0x0020
370 
371 //LinkMD Control/Status register
372 #define KSZ8775_LINKMD_TEST_EN 0x8000
373 #define KSZ8775_LINKMD_RESULT 0x6000
374 #define KSZ8775_LINKMD_RESULT_NORMAL 0x0000
375 #define KSZ8775_LINKMD_RESULT_OPEN 0x2000
376 #define KSZ8775_LINKMD_RESULT_SHORT 0x4000
377 #define KSZ8775_LINKMD_RESULT_FAIL 0x6000
378 #define KSZ8775_LINKMD_SHORT 0x1000
379 #define KSZ8775_LINKMD_FAULT_COUNT 0x01FF
380 
381 //PHY Special Control/Status register
382 #define KSZ8775_PHYSCS_OP_MODE 0x0700
383 #define KSZ8775_PHYSCS_OP_MODE_AN 0x0100
384 #define KSZ8775_PHYSCS_OP_MODE_10BT_HD 0x0200
385 #define KSZ8775_PHYSCS_OP_MODE_100BTX_HD 0x0300
386 #define KSZ8775_PHYSCS_OP_MODE_10BT_FD 0x0500
387 #define KSZ8775_PHYSCS_OP_MODE_100BTX_FD 0x0600
388 #define KSZ8775_PHYSCS_OP_MODE_ISOLATE 0x0700
389 #define KSZ8775_PHYSCS_POLRVS 0x0020
390 #define KSZ8775_PHYSCS_MDIX_STATUS 0x0010
391 #define KSZ8775_PHYSCS_FORCE_LINK 0x0008
392 #define KSZ8775_PHYSCS_PWRSAVE 0x0004
393 #define KSZ8775_PHYSCS_REMOTE_LOOPBACK 0x0002
394 
395 //Chip ID0 register
396 #define KSZ8775_CHIP_ID0_FAMILY_ID 0xFF
397 #define KSZ8775_CHIP_ID0_FAMILY_ID_DEFAULT 0x87
398 
399 //Chip ID1 / Start Switch register
400 #define KSZ8775_CHIP_ID1_CHIP_ID 0xF0
401 #define KSZ8775_CHIP_ID1_CHIP_ID_DEFAULT 0x70
402 #define KSZ8775_CHIP_ID1_REVISION_ID 0x0E
403 #define KSZ8775_CHIP_ID1_START_SWITCH 0x01
404 
405 //Global Control 0 register
406 #define KSZ8775_GLOBAL_CTRL0_NEW_BACK_OFF_EN 0x80
407 #define KSZ8775_GLOBAL_CTRL0_GLOBAL_SOFT_RESET_EN 0x40
408 #define KSZ8775_GLOBAL_CTRL0_FLUSH_DYNAMIC_MAC_TABLE 0x20
409 #define KSZ8775_GLOBAL_CTRL0_FLUSH_STATIC_MAC_TABLE 0x10
410 #define KSZ8775_GLOBAL_CTRL0_UNH_MODE 0x02
411 #define KSZ8775_GLOBAL_CTRL0_LINK_CHANGE_AGE 0x01
412 
413 //Global Control 1 register
414 #define KSZ8775_GLOBAL_CTRL1_2KB_PKT_SUPPORT 0x40
415 #define KSZ8775_GLOBAL_CTRL1_TX_FLOW_CTRL_DIS 0x20
416 #define KSZ8775_GLOBAL_CTRL1_RX_FLOW_CTRL_DIS 0x10
417 #define KSZ8775_GLOBAL_CTRL1_FRAME_LEN_CHECK_EN 0x08
418 #define KSZ8775_GLOBAL_CTRL1_AGING_EN 0x04
419 #define KSZ8775_GLOBAL_CTRL1_FAST_AGE_EN 0x02
420 #define KSZ8775_GLOBAL_CTRL1_AGGRESSIVE_BACK_OFF_EN 0x01
421 
422 //Global Control 2 register
423 #define KSZ8775_GLOBAL_CTRL2_UNI_VLAN_MISMATCH_DISCARD 0x80
424 #define KSZ8775_GLOBAL_CTRL2_MCAST_STORM_PROTECT_DIS 0x40
425 #define KSZ8775_GLOBAL_CTRL2_BACK_PRESSURE_MODE 0x20
426 #define KSZ8775_GLOBAL_CTRL2_FLOW_CTRL_FAIR_MODE 0x10
427 #define KSZ8775_GLOBAL_CTRL2_NO_EXCESSIVE_COL_DROP 0x08
428 #define KSZ8775_GLOBAL_CTRL2_MAX_PKT_SIZE_CHECK_DIS 0x02
429 
430 //Global Control 3 register
431 #define KSZ8775_GLOBAL_CTRL3_VLAN_EN 0x80
432 #define KSZ8775_GLOBAL_CTRL3_SW5_IGMP_SNOOP_EN 0x40
433 #define KSZ8775_GLOBAL_CTRL3_SNIFF_MODE_SEL 0x01
434 
435 //Global Control 4 register
436 #define KSZ8775_GLOBAL_CTRL4_SW5_BACK_PRESSURE_EN 0x80
437 #define KSZ8775_GLOBAL_CTRL4_SW5_HALF_DUPLEX_MODE 0x40
438 #define KSZ8775_GLOBAL_CTRL4_SW5_FLOW_CTRL_EN 0x20
439 #define KSZ8775_GLOBAL_CTRL4_SW5_SPEED 0x10
440 #define KSZ8775_GLOBAL_CTRL4_NULL_VID_REPLACEMENT 0x08
441 #define KSZ8775_GLOBAL_CTRL4_BCAST_STORM_PROTECT_RATE_MSB 0x07
442 
443 //Global Control 5 register
444 #define KSZ8775_GLOBAL_CTRL5_BCAST_STORM_PROTECT_RATE_LSB 0xFF
445 
446 //Global Control 6 MIB Control register
447 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_FLUSH_COUNTER 0x80
448 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_FREEZE_COUNTER 0x40
449 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN 0x1F
450 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN_PORT1 0x01
451 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN_PORT2 0x02
452 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN_PORT3 0x04
453 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN_PORT4 0x08
454 #define KSZ8775_GLOBAL_CTRL6_MIB_CTRL_CONTROL_EN_PORT5 0x10
455 
456 //Global Control 7 register
457 #define KSZ8775_GLOBAL_CTRL7_FACTORY_TESTING 0xFF
458 
459 //Global Control 8 register
460 #define KSZ8775_GLOBAL_CTRL8_FACTORY_TESTING 0xFF
461 
462 //Global Control 9 register
463 #define KSZ8775_GLOBAL_CTRL9_SW5_REFCLK_EDGE_SEL 0x40
464 #define KSZ8775_GLOBAL_CTRL9_SW5_REFCLK_EDGE_SEL_RISING 0x00
465 #define KSZ8775_GLOBAL_CTRL9_SW5_REFCLK_EDGE_SEL_FALLING 0x40
466 #define KSZ8775_GLOBAL_CTRL9_LED_MODE 0x30
467 #define KSZ8775_GLOBAL_CTRL9_LED_MODE_LED0_LNK_ACT_LED1_SPD 0x00
468 #define KSZ8775_GLOBAL_CTRL9_LED_MODE_LED0_LNK_LED1_ACT 0x10
469 #define KSZ8775_GLOBAL_CTRL9_LED_MODE_LED0_LNK_ACT_LED1_DPLX 0x20
470 #define KSZ8775_GLOBAL_CTRL9_LED_MODE_LED0_LNK_LED1_ACT_DPLX 0x30
471 #define KSZ8775_GLOBAL_CTRL9_REFCLKO_ENABLE 0x02
472 #define KSZ8775_GLOBAL_CTRL9_SPI_READ_CLK_EDGE_SEL 0x01
473 #define KSZ8775_GLOBAL_CTRL9_SPI_READ_CLK_EDGE_SEL_FALLING 0x00
474 #define KSZ8775_GLOBAL_CTRL9_SPI_READ_CLK_EDGE_SEL_RISING 0x01
475 
476 //Global Control 10 register
477 #define KSZ8775_GLOBAL_CTRL10_TAIL_TAG_EN 0x02
478 
479 //Global Control 11 register
480 #define KSZ8775_GLOBAL_CTRL11_FACTORY_TESTING 0xFF
481 
482 //Power-Down Management Control 1 register
483 #define KSZ8775_PD_MGMT_CTRL1_PLL_PWR_DOWN 0x20
484 #define KSZ8775_PD_MGMT_CTRL1_PWR_MGMT_MODE 0x18
485 #define KSZ8775_PD_MGMT_CTRL1_PWR_MGMT_MODE_NORMAL 0x00
486 #define KSZ8775_PD_MGMT_CTRL1_PWR_MGMT_MODE_ENERGY_DETECT 0x08
487 #define KSZ8775_PD_MGMT_CTRL1_PWR_MGMT_MODE_SOFT_PWR_DOWN 0x10
488 
489 //Power-Down Management Control 2 register
490 #define KSZ8775_PD_MGMT_CTRL2_GO_SLEEP_TIME 0xFF
491 
492 //Port N Control 0 register
493 #define KSZ8775_PORTn_CTRL0_BCAST_STORM_PROTECT_EN 0x80
494 #define KSZ8775_PORTn_CTRL0_DIFFSERV_PRIO_CLASS_EN 0x40
495 #define KSZ8775_PORTn_CTRL0_802_1P_PRIO_CLASS_EN 0x20
496 #define KSZ8775_PORTn_CTRL0_PORT_PRIO_CLASS_EN 0x18
497 #define KSZ8775_PORTn_CTRL0_TAG_INSERTION 0x04
498 #define KSZ8775_PORTn_CTRL0_TAG_REMOVAL 0x02
499 #define KSZ8775_PORTn_CTRL0_TWO_QUEUE_SPLIT_EN 0x01
500 
501 //Port N Control 1 register
502 #define KSZ8775_PORTn_CTRL1_SNIFFER_PORT 0x80
503 #define KSZ8775_PORTn_CTRL1_RECEIVE_SNIFF 0x40
504 #define KSZ8775_PORTn_CTRL1_TRANSMIT_SNIFF 0x20
505 #define KSZ8775_PORTn_CTRL1_PORT_VLAN_MEMBERSHIP 0x1F
506 
507 //Port N Control 2 register
508 #define KSZ8775_PORTn_CTRL2_USER_PRIO_CEILING 0x80
509 #define KSZ8775_PORTn_CTRL2_INGRESS_VLAN_FILT 0x40
510 #define KSZ8775_PORTn_CTRL2_DISCARD_NON_PVID_PKT 0x20
511 #define KSZ8775_PORTn_CTRL2_FORCE_FLOW_CTRL 0x10
512 #define KSZ8775_PORTn_CTRL2_BACK_PRESSURE_EN 0x08
513 #define KSZ8775_PORTn_CTRL2_TRANSMIT_EN 0x04
514 #define KSZ8775_PORTn_CTRL2_RECEIVE_EN 0x02
515 #define KSZ8775_PORTn_CTRL2_LEARNING_DIS 0x01
516 
517 //Port N Control 3 register
518 #define KSZ8775_PORTn_CTRL3_DEFAULT_USER_PRIO 0xE0
519 #define KSZ8775_PORTn_CTRL3_DEFAULT_CFI 0x10
520 #define KSZ8775_PORTn_CTRL3_DEFAULT_VID_MSB 0x0F
521 
522 //Port N Control 4 register
523 #define KSZ8775_PORTn_CTRL4_DEFAULT_VID_LSB 0xFF
524 
525 //Port N Control 5 register
526 #define KSZ8775_PORTn_CTRL5_ACL_EN 0x04
527 #define KSZ8775_PORTn_CTRL5_AUTH_MODE 0x03
528 
529 //Port N Interface Control 6 register
530 #define KSZ8775_PORTn_IF_CTRL6_RMII_CLK_SEL 0x80
531 #define KSZ8775_PORTn_IF_CTRL6_IS_1GBPS 0x40
532 #define KSZ8775_PORTn_IF_CTRL6_RGMII_ID_IG_EN 0x10
533 #define KSZ8775_PORTn_IF_CTRL6_RGMII_ID_EG_EN 0x08
534 #define KSZ8775_PORTn_IF_CTRL6_MII_MODE_SEL 0x04
535 #define KSZ8775_PORTn_IF_CTRL6_MII_MODE_SEL_PHY 0x00
536 #define KSZ8775_PORTn_IF_CTRL6_MII_MODE_SEL_MAC 0x04
537 #define KSZ8775_PORTn_IF_CTRL6_IF_MODE_SEL 0x03
538 #define KSZ8775_PORTn_IF_CTRL6_IF_MODE_SEL_MII 0x00
539 #define KSZ8775_PORTn_IF_CTRL6_IF_MODE_SEL_RMII 0x01
540 #define KSZ8775_PORTn_IF_CTRL6_IF_MODE_SEL_RGMII 0x03
541 
542 //Port N Control 7 register
543 #define KSZ8775_PORTn_CTRL7_ADV_FLOW_CTRL_CAP 0x30
544 #define KSZ8775_PORTn_CTRL7_ADV_FLOW_CTRL_CAP_NO 0x00
545 #define KSZ8775_PORTn_CTRL7_ADV_FLOW_CTRL_CAP_SYMMETRIC 0x10
546 #define KSZ8775_PORTn_CTRL7_ADV_FLOW_CTRL_CAP_ASYMMETRIC 0x20
547 #define KSZ8775_PORTn_CTRL7_ADV_FLOW_CTRL_CAP_BOTH 0x30
548 #define KSZ8775_PORTn_CTRL7_ADV_100BT_FD 0x08
549 #define KSZ8775_PORTn_CTRL7_ADV_100BT_HD 0x04
550 #define KSZ8775_PORTn_CTRL7_ADV_10BT_FD 0x02
551 #define KSZ8775_PORTn_CTRL7_ADV_10BT_HD 0x01
552 
553 //Port N Status 0 register
554 #define KSZ8775_PORTn_STAT0_LP_FLOW_CTRL_CAPABLE 0x30
555 #define KSZ8775_PORTn_STAT0_LP_100BTX_FD_CAPABLE 0x08
556 #define KSZ8775_PORTn_STAT0_LP_100BTX_HF_CAPABLE 0x04
557 #define KSZ8775_PORTn_STAT0_LP_10BT_FD_CAPABLE 0x02
558 #define KSZ8775_PORTn_STAT0_LP_10BT_HD_CAPABLE 0x01
559 
560 //Port N Status 1 register
561 #define KSZ8775_PORTn_STAT1_HP_MDIX 0x80
562 #define KSZ8775_PORTn_STAT1_FACTORY_TESTING 0x40
563 #define KSZ8775_PORTn_STAT1_POLRVS 0x20
564 #define KSZ8775_PORTn_STAT1_TX_FLOW_CTRL_EN 0x10
565 #define KSZ8775_PORTn_STAT1_RX_FLOW_CTRL_EN 0x08
566 #define KSZ8775_PORTn_STAT1_OP_SPEED 0x04
567 #define KSZ8775_PORTn_STAT1_OP_DUPLEX 0x02
568 
569 //Port N PHY Control 8 register
570 #define KSZ8775_PORTn_PHY_CTRL8_CDT_10M_SHORT 0x80
571 #define KSZ8775_PORTn_PHY_CTRL8_CDT_RESULT 0x60
572 #define KSZ8775_PORTn_PHY_CTRL8_CDT_EN 0x10
573 #define KSZ8775_PORTn_PHY_CTRL8_FORCE_LINK 0x08
574 #define KSZ8775_PORTn_PHY_CTRL8_PWRSAVE 0x04
575 #define KSZ8775_PORTn_PHY_CTRL8_REMOTE_LOOPBACK 0x02
576 #define KSZ8775_PORTn_PHY_CTRL8_VCT_FAULT_COUNT_MSB 0x01
577 
578 //Port N LinkMD Result register
579 #define KSZ8775_PORTn_LINKMD_VCT_FAULT_COUNT_LSB 0xFF
580 
581 //Port N Control 9 register
582 #define KSZ8775_PORTn_CTRL9_AN_DIS 0x80
583 #define KSZ8775_PORTn_CTRL9_FORCED_SPEED 0x40
584 #define KSZ8775_PORTn_CTRL9_FORCED_DUPLEX 0x20
585 
586 //Port N Control 10 register
587 #define KSZ8775_PORTn_CTRL10_LED_OFF 0x80
588 #define KSZ8775_PORTn_CTRL10_TX_DIS 0x40
589 #define KSZ8775_PORTn_CTRL10_RESTART_AN 0x20
590 #define KSZ8775_PORTn_CTRL10_POWER_DOWN 0x08
591 #define KSZ8775_PORTn_CTRL10_AUTO_MDIX_DIS 0x04
592 #define KSZ8775_PORTn_CTRL10_FORCED_MDI 0x02
593 #define KSZ8775_PORTn_CTRL10_MAC_LOOPBACK 0x01
594 
595 //Port N Status 2 register
596 #define KSZ8775_PORTn_STAT2_MDIX_STATUS 0x80
597 #define KSZ8775_PORTn_STAT2_AN_DONE 0x40
598 #define KSZ8775_PORTn_STAT2_LINK_GOOD 0x20
599 
600 //Port N Control 11 / Status 3 register
601 #define KSZ8775_PORTn_CTRL11_STAT3_PHY_LOOPBACK 0x80
602 #define KSZ8775_PORTn_CTRL11_STAT3_PHY_ISOLATE 0x20
603 #define KSZ8775_PORTn_CTRL11_STAT3_SOFT_RESET 0x10
604 #define KSZ8775_PORTn_CTRL11_STAT3_FORCE_LINK 0x08
605 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE 0x07
606 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE_AN 0x01
607 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE_10BT_HD 0x02
608 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE_100BTX_HD 0x03
609 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE_10BT_FD 0x05
610 #define KSZ8775_PORTn_CTRL11_STAT3_OP_MODE_100BTX_FD 0x06
611 
612 //MAC Address 0 register
613 #define KSZ8775_MAC_ADDR0_MACA_47_40 0xFF
614 
615 //MAC Address 1 register
616 #define KSZ8775_MAC_ADDR1_MACA_39_32 0xFF
617 
618 //MAC Address 2 register
619 #define KSZ8775_MAC_ADDR2_MACA_31_24 0xFF
620 
621 //MAC Address 3 register
622 #define KSZ8775_MAC_ADDR3_MACA_23_16 0xFF
623 
624 //MAC Address 4 register
625 #define KSZ8775_MAC_ADDR4_MACA_15_8 0xFF
626 
627 //MAC Address 5 register
628 #define KSZ8775_MAC_ADDR5_MACA_7_0 0xFF
629 
630 //Indirect Access Control 0 register
631 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL 0xE0
632 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL_INDIRECT_MODE 0x00
633 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL_EEE 0x20
634 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL_ACL 0x40
635 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL_PME 0x80
636 #define KSZ8775_INDIRECT_CTRL0_FUNC_SEL_LINKMD 0xA0
637 #define KSZ8775_INDIRECT_CTRL0_WRITE 0x00
638 #define KSZ8775_INDIRECT_CTRL0_READ 0x10
639 #define KSZ8775_INDIRECT_CTRL0_TABLE_SEL 0x0C
640 #define KSZ8775_INDIRECT_CTRL0_TABLE_SEL_STATIC_MAC 0x00
641 #define KSZ8775_INDIRECT_CTRL0_TABLE_SEL_VLAN 0x04
642 #define KSZ8775_INDIRECT_CTRL0_TABLE_SEL_DYNAMIC_MAC 0x08
643 #define KSZ8775_INDIRECT_CTRL0_TABLE_SEL_MIB_COUNTER 0x0C
644 #define KSZ8775_INDIRECT_CTRL0_ADDR_11_8 0x0F
645 #define KSZ8775_INDIRECT_CTRL0_ADDR_9_8 0x03
646 
647 //Indirect Access Control 1 register
648 #define KSZ8775_INDIRECT_CTRL1_ADDR_7_0 0xFF
649 
650 //Interrupt Status register
651 #define KSZ8775_INT_STAT_PME 0x10
652 #define KSZ8775_INT_STAT_PORT4 0x08
653 #define KSZ8775_INT_STAT_PORT3 0x04
654 #define KSZ8775_INT_STAT_PORT2 0x02
655 #define KSZ8775_INT_STAT_PORT1 0x01
656 
657 //Interrupt Mask register
658 #define KSZ8775_INT_MASK_PME 0x10
659 #define KSZ8775_INT_MASK_PORT4 0x08
660 #define KSZ8775_INT_MASK_PORT3 0x04
661 #define KSZ8775_INT_MASK_PORT2 0x02
662 #define KSZ8775_INT_MASK_PORT1 0x01
663 
664 //ACL Interrupt Status register
665 #define KSZ8775_ACL_INT_STAT_PORT5 0x10
666 #define KSZ8775_ACL_INT_STAT_PORT4 0x08
667 #define KSZ8775_ACL_INT_STAT_PORT3 0x04
668 #define KSZ8775_ACL_INT_STAT_PORT2 0x02
669 #define KSZ8775_ACL_INT_STAT_PORT1 0x01
670 
671 //ACL Interrupt Control register
672 #define KSZ8775_ACL_INT_CTRL_PORT5 0x10
673 #define KSZ8775_ACL_INT_CTRL_PORT4 0x08
674 #define KSZ8775_ACL_INT_CTRL_PORT3 0x04
675 #define KSZ8775_ACL_INT_CTRL_PORT2 0x02
676 #define KSZ8775_ACL_INT_CTRL_PORT1 0x01
677 
678 //Global Control 12 register
679 #define KSZ8775_GLOBAL_CTRL12_TAG3 0xC0
680 #define KSZ8775_GLOBAL_CTRL12_TAG2 0x30
681 #define KSZ8775_GLOBAL_CTRL12_TAG1 0x0C
682 #define KSZ8775_GLOBAL_CTRL12_TAG0 0x03
683 
684 //Global Control 13 register
685 #define KSZ8775_GLOBAL_CTRL13_TAG7 0xC0
686 #define KSZ8775_GLOBAL_CTRL13_TAG6 0x30
687 #define KSZ8775_GLOBAL_CTRL13_TAG5 0x0C
688 #define KSZ8775_GLOBAL_CTRL13_TAG4 0x03
689 
690 //Global Control 14 register
691 #define KSZ8775_GLOBAL_CTRL14_PRI_2Q 0xC0
692 
693 //Global Control 15 register
694 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD 0x20
695 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP 0x1F
696 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_FILT 0x00
697 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_PORT1 0x01
698 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_PORT2 0x02
699 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_PORT3 0x04
700 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_PORT4 0x08
701 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_PORT5 0x10
702 #define KSZ8775_GLOBAL_CTRL15_UNKNOWN_UNICAST_FWD_MAP_ALL 0x1F
703 
704 //Global Control 16 register
705 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD 0x20
706 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP 0x1F
707 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_FILT 0x00
708 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_PORT1 0x01
709 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_PORT2 0x02
710 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_PORT3 0x04
711 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_PORT4 0x08
712 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_PORT5 0x10
713 #define KSZ8775_GLOBAL_CTRL16_UNKNOWN_MCAST_FWD_MAP_ALL 0x1F
714 
715 //Global Control 17 register
716 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD 0x20
717 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP 0x1F
718 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_FILT 0x00
719 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_PORT1 0x01
720 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_PORT2 0x02
721 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_PORT3 0x04
722 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_PORT4 0x08
723 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_PORT5 0x10
724 #define KSZ8775_GLOBAL_CTRL17_UNKNOWN_VID_FWD_MAP_ALL 0x1F
725 
726 //Global Control 18 register
727 #define KSZ8775_GLOBAL_CTRL18_SELF_ADDR_FILTER_EN 0x40
728 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD 0x20
729 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP 0x1F
730 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_FILT 0x00
731 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_PORT1 0x01
732 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_PORT2 0x02
733 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_PORT3 0x04
734 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_PORT4 0x08
735 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_PORT5 0x10
736 #define KSZ8775_GLOBAL_CTRL18_UNKNOWN_IP_MCAST_FWD_MAP_ALL 0x1F
737 
738 //Global Control 19 register
739 #define KSZ8775_GLOBAL_CTRL19_IG_RATE_LIMIT_PERIOD 0x30
740 #define KSZ8775_GLOBAL_CTRL19_IG_RATE_LIMIT_PERIOD_16MS 0x00
741 #define KSZ8775_GLOBAL_CTRL19_IG_RATE_LIMIT_PERIOD_64MS 0x10
742 #define KSZ8775_GLOBAL_CTRL19_IG_RATE_LIMIT_PERIOD_256MS 0x20
743 #define KSZ8775_GLOBAL_CTRL19_QUEUE_BASED_EG_RATE_LIMITE_EN 0x08
744 #define KSZ8775_GLOBAL_CTRL19_INSERT_SRC_PORT_PVID_TAG_EN 0x04
745 
746 //TOS Priority Control 0 register
747 #define KSZ8775_TOS_PRIO_CTRL0_DSCP_7_6 0xC0
748 #define KSZ8775_TOS_PRIO_CTRL0_DSCP_5_4 0x30
749 #define KSZ8775_TOS_PRIO_CTRL0_DSCP_3_2 0x0C
750 #define KSZ8775_TOS_PRIO_CTRL0_DSCP_1_0 0x03
751 
752 //TOS Priority Control 1 register
753 #define KSZ8775_TOS_PRIO_CTRL1_DSCP_15_14 0xC0
754 #define KSZ8775_TOS_PRIO_CTRL1_DSCP_13_12 0x30
755 #define KSZ8775_TOS_PRIO_CTRL1_DSCP_11_10 0x0C
756 #define KSZ8775_TOS_PRIO_CTRL1_DSCP_9_8 0x03
757 
758 //TOS Priority Control 2 register
759 #define KSZ8775_TOS_PRIO_CTRL2_DSCP_23_22 0xC0
760 #define KSZ8775_TOS_PRIO_CTRL2_DSCP_21_20 0x30
761 #define KSZ8775_TOS_PRIO_CTRL2_DSCP_19_18 0x0C
762 #define KSZ8775_TOS_PRIO_CTRL2_DSCP_17_16 0x03
763 
764 //TOS Priority Control 3 register
765 #define KSZ8775_TOS_PRIO_CTRL3_DSCP_31_30 0xC0
766 #define KSZ8775_TOS_PRIO_CTRL3_DSCP_29_28 0x30
767 #define KSZ8775_TOS_PRIO_CTRL3_DSCP_27_26 0x0C
768 #define KSZ8775_TOS_PRIO_CTRL3_DSCP_25_24 0x03
769 
770 //TOS Priority Control 4 register
771 #define KSZ8775_TOS_PRIO_CTRL4_DSCP_39_38 0xC0
772 #define KSZ8775_TOS_PRIO_CTRL4_DSCP_37_36 0x30
773 #define KSZ8775_TOS_PRIO_CTRL4_DSCP_35_34 0x0C
774 #define KSZ8775_TOS_PRIO_CTRL4_DSCP_33_32 0x03
775 
776 //TOS Priority Control 5 register
777 #define KSZ8775_TOS_PRIO_CTRL5_DSCP_47_46 0xC0
778 #define KSZ8775_TOS_PRIO_CTRL5_DSCP_45_44 0x30
779 #define KSZ8775_TOS_PRIO_CTRL5_DSCP_43_42 0x0C
780 #define KSZ8775_TOS_PRIO_CTRL5_DSCP_41_40 0x03
781 
782 //TOS Priority Control 6 register
783 #define KSZ8775_TOS_PRIO_CTRL6_DSCP_55_54 0xC0
784 #define KSZ8775_TOS_PRIO_CTRL6_DSCP_53_52 0x30
785 #define KSZ8775_TOS_PRIO_CTRL6_DSCP_51_50 0x0C
786 #define KSZ8775_TOS_PRIO_CTRL6_DSCP_49_48 0x03
787 
788 //TOS Priority Control 7 register
789 #define KSZ8775_TOS_PRIO_CTRL7_DSCP_63_62 0xC0
790 #define KSZ8775_TOS_PRIO_CTRL7_DSCP_61_60 0x30
791 #define KSZ8775_TOS_PRIO_CTRL7_DSCP_59_58 0x0C
792 #define KSZ8775_TOS_PRIO_CTRL7_DSCP_57_56 0x03
793 
794 //TOS Priority Control 8 register
795 #define KSZ8775_TOS_PRIO_CTRL8_DSCP_71_70 0xC0
796 #define KSZ8775_TOS_PRIO_CTRL8_DSCP_69_68 0x30
797 #define KSZ8775_TOS_PRIO_CTRL8_DSCP_67_66 0x0C
798 #define KSZ8775_TOS_PRIO_CTRL8_DSCP_65_64 0x03
799 
800 //TOS Priority Control 9 register
801 #define KSZ8775_TOS_PRIO_CTRL9_DSCP_79_78 0xC0
802 #define KSZ8775_TOS_PRIO_CTRL9_DSCP_77_76 0x30
803 #define KSZ8775_TOS_PRIO_CTRL9_DSCP_75_74 0x0C
804 #define KSZ8775_TOS_PRIO_CTRL9_DSCP_73_72 0x03
805 
806 //TOS Priority Control 10 register
807 #define KSZ8775_TOS_PRIO_CTRL10_DSCP_87_86 0xC0
808 #define KSZ8775_TOS_PRIO_CTRL10_DSCP_85_84 0x30
809 #define KSZ8775_TOS_PRIO_CTRL10_DSCP_83_82 0x0C
810 #define KSZ8775_TOS_PRIO_CTRL10_DSCP_81_80 0x03
811 
812 //TOS Priority Control 11 register
813 #define KSZ8775_TOS_PRIO_CTRL11_DSCP_95_94 0xC0
814 #define KSZ8775_TOS_PRIO_CTRL11_DSCP_93_92 0x30
815 #define KSZ8775_TOS_PRIO_CTRL11_DSCP_91_90 0x0C
816 #define KSZ8775_TOS_PRIO_CTRL11_DSCP_89_88 0x03
817 
818 //TOS Priority Control 12 register
819 #define KSZ8775_TOS_PRIO_CTRL12_DSCP_103_102 0xC0
820 #define KSZ8775_TOS_PRIO_CTRL12_DSCP_101_100 0x30
821 #define KSZ8775_TOS_PRIO_CTRL12_DSCP_99_98 0x0C
822 #define KSZ8775_TOS_PRIO_CTRL12_DSCP_97_96 0x03
823 
824 //TOS Priority Control 13 register
825 #define KSZ8775_TOS_PRIO_CTRL13_DSCP_111_110 0xC0
826 #define KSZ8775_TOS_PRIO_CTRL13_DSCP_109_108 0x30
827 #define KSZ8775_TOS_PRIO_CTRL13_DSCP_107_106 0x0C
828 #define KSZ8775_TOS_PRIO_CTRL13_DSCP_105_104 0x03
829 
830 //TOS Priority Control 14 register
831 #define KSZ8775_TOS_PRIO_CTRL14_DSCP_119_118 0xC0
832 #define KSZ8775_TOS_PRIO_CTRL14_DSCP_117_116 0x30
833 #define KSZ8775_TOS_PRIO_CTRL14_DSCP_115_114 0x0C
834 #define KSZ8775_TOS_PRIO_CTRL14_DSCP_113_112 0x03
835 
836 //TOS Priority Control 15 register
837 #define KSZ8775_TOS_PRIO_CTRL15_DSCP_127_126 0xC0
838 #define KSZ8775_TOS_PRIO_CTRL15_DSCP_125_124 0x30
839 #define KSZ8775_TOS_PRIO_CTRL15_DSCP_123_122 0x0C
840 #define KSZ8775_TOS_PRIO_CTRL15_DSCP_121_120 0x03
841 
842 //Global Control 20 register
843 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH 0x70
844 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_2MA 0x00
845 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_4MA 0x10
846 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_8MA 0x20
847 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_12MA 0x30
848 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_16MA 0x40
849 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_20MA 0x50
850 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_24MA 0x60
851 #define KSZ8775_GLOBAL_CTRL20_HIGH_SPEED_DRIVE_STRENGTH_28MA 0x70
852 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH 0x07
853 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_2MA 0x00
854 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_4MA 0x01
855 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_8MA 0x02
856 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_12MA 0x03
857 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_16MA 0x04
858 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_20MA 0x05
859 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_24MA 0x06
860 #define KSZ8775_GLOBAL_CTRL20_LOW_SPEED_DRIVE_STRENGTH_28MA 0x07
861 
862 //Global Control 21 register
863 #define KSZ8775_GLOBAL_CTRL21_MLD_SNOOP_OPT 0x08
864 #define KSZ8775_GLOBAL_CTRL21_MLD_SNOOP_EN 0x04
865 
866 //Port N Control 12 register
867 #define KSZ8775_PORTn_CTRL12_PASS_ALL_FRAMES 0x40
868 #define KSZ8775_PORTn_CTRL12_INSERT_SRC_PORT_PVID_H 0x08
869 #define KSZ8775_PORTn_CTRL12_INSERT_SRC_PORT_PVID_H2 0x04
870 #define KSZ8775_PORTn_CTRL12_INSERT_SRC_PORT_PVID_L2 0x02
871 #define KSZ8775_PORTn_CTRL12_INSERT_SRC_PORT_PVID_L 0x01
872 
873 //Port N Control 13 register
874 #define KSZ8775_PORTn_CTRL13_4_QUEUE_SPLIT_EN 0x02
875 #define KSZ8775_PORTn_CTRL13_DROPPING_TAG_EN 0x01
876 
877 //Port N Control 14 register
878 #define KSZ8775_PORTn_CTRL14_PORT_TX_QUEUE3_RATIO_EN 0x80
879 #define KSZ8775_PORTn_CTRL14_PORT_TX_QUEUE3_RATIO 0x7F
880 
881 //Port N Control 15 register
882 #define KSZ8775_PORTn_CTRL15_PORT_TX_QUEUE2_RATIO_EN 0x80
883 #define KSZ8775_PORTn_CTRL15_PORT_TX_QUEUE2_RATIO 0x7F
884 
885 //Port N Control 16 register
886 #define KSZ8775_PORTn_CTRL16_PORT_TX_QUEUE1_RATIO_EN 0x80
887 #define KSZ8775_PORTn_CTRL16_PORT_TX_QUEUE1_RATIO 0x7F
888 
889 //Port N Control 17 register
890 #define KSZ8775_PORTn_CTRL17_PORT_TX_QUEUE0_RATIO_EN 0x80
891 #define KSZ8775_PORTn_CTRL17_PORT_TX_QUEUE0_RATIO 0x7F
892 
893 //Port N Rate Limit Control register
894 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_IG_LIMIT_PORT_PRIO_SEL 0x40
895 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_IG_LIMIT_BIT_PKT_MODE_SEL 0x20
896 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_IG_RATE_LIMIT_FLOW_CTRL_EN 0x10
897 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_LIMIT_MODE 0x0C
898 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_COUNT_IFG 0x02
899 #define KSZ8775_PORTn_RATE_LIMIT_CTRL_COUNT_PRE 0x01
900 
901 //C++ guard
902 #ifdef __cplusplus
903 extern "C" {
904 #endif
905 
906 //CC-RX, CodeWarrior or Win32 compiler?
907 #if defined(__CCRX__)
908  #pragma pack
909 #elif defined(__CWCC__) || defined(_WIN32)
910  #pragma pack(push, 1)
911 #endif
912 
913 
914 /**
915  * @brief Static MAC table entry (read operation)
916  **/
917 
918 typedef struct
919 {
920 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
921  uint8_t fid : 7; //0
922  uint8_t useFid : 1;
923  uint8_t reserved : 1; //1
924  uint8_t override : 1;
925  uint8_t valid : 1;
926  uint8_t forwardPorts : 5;
927 #else
928  uint8_t useFid : 1; //0
929  uint8_t fid : 7;
930  uint8_t forwardPorts : 5; //1
931  uint8_t valid : 1;
932  uint8_t override : 1;
933  uint8_t reserved : 1;
934 #endif
937 
938 
939 /**
940  * @brief Static MAC table entry (write operation)
941  **/
942 
943 typedef struct
944 {
945  uint8_t fid; //0
946 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
947  uint8_t useFid : 1; //1
948  uint8_t override : 1;
949  uint8_t valid : 1;
950  uint8_t forwardPorts : 5;
951 #else
952  uint8_t forwardPorts : 5; //1
953  uint8_t valid : 1;
954  uint8_t override : 1;
955  uint8_t useFid : 1;
956 #endif
959 
960 
961 /**
962  * @brief Dynamic MAC table entry
963  **/
964 
965 typedef struct
966 {
967 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
968  uint8_t macEmpty : 1; //0
969  uint8_t numValidEntriesH : 7;
970  uint8_t numValidEntriesL : 3; //1
971  uint8_t timestamp : 2;
972  uint8_t sourcePort : 3;
973  uint8_t dataNotReady : 1; //2
974  uint8_t fid : 7;
975 #else
976  uint8_t numValidEntriesH : 7; //0
977  uint8_t macEmpty : 1;
978  uint8_t sourcePort : 3; //1
979  uint8_t timestamp : 2;
980  uint8_t numValidEntriesL : 3;
981  uint8_t fid : 7; //2
982  uint8_t dataNotReady : 1;
983 #endif
986 
987 
988 /**
989  * @brief Set of VLAN entries
990  **/
991 
992 typedef struct
993 {
994 #if defined(_CPU_BIG_ENDIAN) && !defined(__IAR_SYSTEMS_ICC__)
995  uint8_t reserved3 : 3; //0
996  uint8_t entry3Valid : 1;
997  uint8_t entry3MembershipH : 4;
998  uint8_t entry3MembershipL : 1; //1
999  uint8_t entry3Fid : 7;
1000  uint8_t reserved2 : 3; //2
1001  uint8_t entry2Valid : 1;
1002  uint8_t entry2MembershipH : 4;
1003  uint8_t entry2MembershipL : 1; //3
1004  uint8_t entry2Fid : 7;
1005  uint8_t reserved1 : 3; //4
1006  uint8_t entry1Valid : 1;
1007  uint8_t entry1MembershipH : 4;
1008  uint8_t entry1MembershipL : 1; //5
1009  uint8_t entry1Fid : 7;
1010  uint8_t reserved0 : 3; //6
1011  uint8_t entry0Valid : 1;
1012  uint8_t entry0MembershipH : 4;
1013  uint8_t entry0MembershipL : 1; //7
1014  uint8_t entry0Fid : 7;
1015 #else
1016  uint8_t entry3MembershipH : 4; //0
1017  uint8_t entry3Valid : 1;
1018  uint8_t reserved3 : 3;
1019  uint8_t entry3Fid : 7; //1
1020  uint8_t entry3MembershipL : 1;
1021  uint8_t entry2MembershipH : 4; //2
1022  uint8_t entry2Valid : 1;
1023  uint8_t reserved2 : 3;
1024  uint8_t entry2Fid : 7; //3
1025  uint8_t entry2MembershipL : 1;
1026  uint8_t entry1MembershipH : 4; //4
1027  uint8_t entry1Valid : 1;
1028  uint8_t reserved1 : 3;
1029  uint8_t entry1Fid : 7; //5
1030  uint8_t entry1MembershipL : 1;
1031  uint8_t entry0MembershipH : 4; //6
1032  uint8_t entry0Valid : 1;
1033  uint8_t reserved0 : 3;
1034  uint8_t entry0Fid : 7; //7
1035  uint8_t entry0MembershipL : 1;
1036 #endif
1038 
1039 
1040 //CC-RX, CodeWarrior or Win32 compiler?
1041 #if defined(__CCRX__)
1042  #pragma unpack
1043 #elif defined(__CWCC__) || defined(_WIN32)
1044  #pragma pack(pop)
1045 #endif
1046 
1047 //KSZ8775 Ethernet switch driver
1048 extern const SwitchDriver ksz8775SwitchDriver;
1049 
1050 //KSZ8775 related functions
1051 error_t ksz8775Init(NetInterface *interface);
1052 void ksz8775InitHook(NetInterface *interface);
1053 
1054 void ksz8775Tick(NetInterface *interface);
1055 
1056 void ksz8775EnableIrq(NetInterface *interface);
1057 void ksz8775DisableIrq(NetInterface *interface);
1058 
1059 void ksz8775EventHandler(NetInterface *interface);
1060 
1061 error_t ksz8775TagFrame(NetInterface *interface, NetBuffer *buffer,
1062  size_t *offset, NetTxAncillary *ancillary);
1063 
1064 error_t ksz8775UntagFrame(NetInterface *interface, uint8_t **frame,
1065  size_t *length, NetRxAncillary *ancillary);
1066 
1067 bool_t ksz8775GetLinkState(NetInterface *interface, uint8_t port);
1068 uint32_t ksz8775GetLinkSpeed(NetInterface *interface, uint8_t port);
1070 
1071 void ksz8775SetPortState(NetInterface *interface, uint8_t port,
1072  SwitchPortState state);
1073 
1075 
1076 void ksz8775SetAgingTime(NetInterface *interface, uint32_t agingTime);
1077 
1078 void ksz8775EnableIgmpSnooping(NetInterface *interface, bool_t enable);
1079 void ksz8775EnableMldSnooping(NetInterface *interface, bool_t enable);
1080 void ksz8775EnableRsvdMcastTable(NetInterface *interface, bool_t enable);
1081 
1083  const SwitchFdbEntry *entry);
1084 
1086  const SwitchFdbEntry *entry);
1087 
1089  SwitchFdbEntry *entry);
1090 
1091 void ksz8775FlushStaticFdbTable(NetInterface *interface);
1092 
1094  SwitchFdbEntry *entry);
1095 
1096 void ksz8775FlushDynamicFdbTable(NetInterface *interface, uint8_t port);
1097 
1099  bool_t enable, uint32_t forwardPorts);
1100 
1102  const SwitchVlanEntry *entry);
1103 
1104 void ksz8775WritePhyReg(NetInterface *interface, uint8_t port,
1105  uint8_t address, uint16_t data);
1106 
1107 uint16_t ksz8775ReadPhyReg(NetInterface *interface, uint8_t port,
1108  uint8_t address);
1109 
1110 void ksz8775DumpPhyReg(NetInterface *interface, uint8_t port);
1111 
1112 void ksz8775WriteSwitchReg(NetInterface *interface, uint16_t address,
1113  uint8_t data);
1114 
1115 uint8_t ksz8775ReadSwitchReg(NetInterface *interface, uint16_t address);
1116 
1117 void ksz8775DumpSwitchReg(NetInterface *interface);
1118 
1119 //C++ guard
1120 #ifdef __cplusplus
1121 }
1122 #endif
1123 
1124 #endif
uint8_t entry0Fid
int bool_t
Definition: compiler_port.h:63
MacAddr macAddr
uint8_t entry3MembershipH
uint8_t reserved1
uint8_t valid
uint8_t useFid
uint8_t entry3Valid
uint8_t reserved3
void ksz8775EnableIgmpSnooping(NetInterface *interface, bool_t enable)
Enable IGMP snooping.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t data[]
Definition: ethernet.h:224
uint8_t entry3MembershipL
uint8_t forwardPorts
void ksz8775EnableIrq(NetInterface *interface)
Enable interrupts.
uint8_t override
NicDuplexMode ksz8775GetDuplexMode(NetInterface *interface, uint8_t port)
Get duplex mode.
uint8_t entry2MembershipL
void ksz8775FlushStaticFdbTable(NetInterface *interface)
Flush static MAC table.
uint8_t reserved
Definition: igmp_common.h:250
const SwitchDriver ksz8775SwitchDriver
KSZ8775 Ethernet switch driver.
uint8_t numValidEntriesL
void ksz8775WriteSwitchReg(NetInterface *interface, uint16_t address, uint8_t data)
Write switch register.
void ksz8775FlushDynamicFdbTable(NetInterface *interface, uint8_t port)
Flush dynamic MAC table.
uint8_t dataNotReady
uint8_t fid
uint8_t entry0Valid
VLAN entry.
Definition: nic.h:162
error_t
Error codes.
Definition: error.h:43
uint8_t entry1Valid
error_t ksz8775UntagFrame(NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary)
Decode tail tag from incoming Ethernet frame.
void ksz8775EnableMldSnooping(NetInterface *interface, bool_t enable)
Enable MLD snooping.
uint16_t ksz8775ReadPhyReg(NetInterface *interface, uint8_t port, uint8_t address)
Read PHY register.
uint8_t reserved1
Definition: tcp.h:356
MacAddr macAddr
void ksz8775InitHook(NetInterface *interface)
KSZ8775 custom configuration.
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:40
uint8_t sourcePort
uint8_t macEmpty
Set of VLAN entries.
error_t ksz8775GetDynamicFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the dynamic MAC table.
uint8_t fid
uint8_t entry3Fid
error_t ksz8775WriteVlanEntry(NetInterface *interface, const SwitchVlanEntry *entry)
Write VLAN entry.
#define NetTxAncillary
Definition: net_misc.h:36
void ksz8775SetPortState(NetInterface *interface, uint8_t port, SwitchPortState state)
Set port state.
SwitchPortState
Switch port state.
Definition: nic.h:134
uint8_t forwardPorts
uint8_t length
Definition: tcp.h:375
bool_t ksz8775GetLinkState(NetInterface *interface, uint8_t port)
Get link state.
uint8_t entry0MembershipL
uint8_t entry1MembershipL
void ksz8775SetUnknownMcastFwdPorts(NetInterface *interface, bool_t enable, uint32_t forwardPorts)
Set forward ports for unknown multicast packets.
void ksz8775SetAgingTime(NetInterface *interface, uint32_t agingTime)
Set aging time for dynamic filtering entries.
MacAddr macAddr
MacAddr
Definition: ethernet.h:197
error_t ksz8775GetStaticFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the static MAC table.
uint16_t port
Definition: dns_common.h:270
void ksz8775DumpPhyReg(NetInterface *interface, uint8_t port)
Dump PHY registers for debugging purpose.
uint8_t reserved2
Definition: tcp.h:359
error_t ksz8775Init(NetInterface *interface)
KSZ8775 Ethernet switch initialization.
uint8_t entry2Valid
void ksz8775EventHandler(NetInterface *interface)
KSZ8775 event handler.
uint8_t reserved2
Ethernet switch driver.
Definition: nic.h:325
uint8_t entry2Fid
uint8_t entry2MembershipH
Static MAC table entry (read operation)
uint8_t ksz8775ReadSwitchReg(NetInterface *interface, uint16_t address)
Read switch register.
Ipv6Addr address[]
Definition: ipv6.h:345
uint8_t timestamp
NicDuplexMode
Duplex mode.
Definition: nic.h:122
Network interface controller abstraction layer.
uint8_t valid
Static MAC table entry (write operation)
void ksz8775Tick(NetInterface *interface)
KSZ8775 timer handler.
uint8_t reserved0
void ksz8775DumpSwitchReg(NetInterface *interface)
Dump switch registers for debugging purpose.
error_t ksz8775TagFrame(NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary)
Add tail tag to Ethernet frame.
uint8_t entry1MembershipH
uint8_t fid
Dynamic MAC table entry.
void ksz8775WritePhyReg(NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
Write PHY register.
uint8_t entry1Fid
uint8_t numValidEntriesH
void ksz8775EnableRsvdMcastTable(NetInterface *interface, bool_t enable)
Enable reserved multicast table.
unsigned int uint_t
Definition: compiler_port.h:57
void ksz8775DisableIrq(NetInterface *interface)
Disable interrupts.
uint32_t ksz8775GetLinkSpeed(NetInterface *interface, uint8_t port)
Get link speed.
SwitchPortState ksz8775GetPortState(NetInterface *interface, uint8_t port)
Get port state.
uint8_t useFid
uint8_t override
uint8_t reserved
Forwarding database entry.
Definition: nic.h:149
uint8_t entry0MembershipH
error_t ksz8775DeleteStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Remove an entry from the static MAC table.
error_t ksz8775AddStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Add a new entry to the static MAC table.