lan9353_driver.h
Go to the documentation of this file.
1 /**
2  * @file lan9353_driver.h
3  * @brief LAN9353 3-port 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 _LAN9353_DRIVER_H
32 #define _LAN9353_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //Port identifiers
38 #define LAN9353_PORT0 3
39 #define LAN9353_PORT1 1
40 #define LAN9353_PORT2 2
41 
42 //Port masks
43 #define LAN9353_PORT_MASK 0x07
44 #define LAN9353_PORT0_MASK 0x04
45 #define LAN9353_PORT1_MASK 0x01
46 #define LAN9353_PORT2_MASK 0x02
47 #define LAN9353_PORT0_1_MASK 0x05
48 #define LAN9353_PORT0_2_MASK 0x06
49 #define LAN9353_PORT1_2_MASK 0x03
50 #define LAN9353_PORT0_1_2_MASK 0x07
51 
52 //Size of of the MAC address lookup table
53 #define LAN9353_ALR_TABLE_SIZE 512
54 
55 //Special VLAN tag (host to LAN9353)
56 #define LAN9353_VID_VLAN_RULES 0x0040
57 #define LAN9353_VID_CALC_PRIORITY 0x0020
58 #define LAN9353_VID_STP_OVERRIDE 0x0010
59 #define LAN9353_VID_ALR_LOOKUP 0x0008
60 #define LAN9353_VID_BROADCAST 0x0003
61 #define LAN9353_VID_DEST_PORT2 0x0002
62 #define LAN9353_VID_DEST_PORT1 0x0001
63 #define LAN9353_VID_DEST_PORT0 0x0000
64 
65 //Special VLAN tag (LAN9353 to host)
66 #define LAN9353_VID_PRIORITY 0x0380
67 #define LAN9353_VID_PRIORITY_EN 0x0040
68 #define LAN9353_VID_STATIC 0x0020
69 #define LAN9353_VID_STP_OVERRIDE 0x0010
70 #define LAN9353_VID_IGMP_PACKET 0x0008
71 #define LAN9353_VID_SRC_PORT 0x0003
72 
73 //LAN9353 PHY registers
74 #define LAN9353_BMCR 0x00
75 #define LAN9353_BMSR 0x01
76 #define LAN9353_PHYID1 0x02
77 #define LAN9353_PHYID2 0x03
78 #define LAN9353_ANAR 0x04
79 #define LAN9353_ANLPAR 0x05
80 #define LAN9353_ANER 0x06
81 #define LAN9353_PMCSR 0x11
82 #define LAN9353_PSMR 0x12
83 #define LAN9353_PSCSIR 0x1B
84 #define LAN9353_PISR 0x1D
85 #define LAN9353_PIMR 0x1E
86 #define LAN9353_PSCSR 0x1F
87 
88 //LAN9353 System registers
89 #define LAN9353_ID_REV 0x0050
90 #define LAN9353_IRQ_CFG 0x0054
91 #define LAN9353_INT_STS 0x0058
92 #define LAN9353_INT_EN 0x005C
93 #define LAN9353_BYTE_TEST 0x0064
94 #define LAN9353_HW_CFG 0x0074
95 #define LAN9353_PMT_CTRL 0x0084
96 #define LAN9353_GPT_CFG 0x008C
97 #define LAN9353_GPT_CNT 0x0090
98 #define LAN9353_FREE_RUN 0x009C
99 #define LAN9353_PMI_DATA 0x00A4
100 #define LAN9353_PMI_ACCESS 0x00A8
101 #define LAN9353_VPHY_BASIC_CTRL_1 0x00C0
102 #define LAN9353_VPHY_BASIC_STATUS_1 0x00C4
103 #define LAN9353_VPHY_ID_MSB_1 0x00C8
104 #define LAN9353_VPHY_ID_LSB_1 0x00CC
105 #define LAN9353_VPHY_AN_ADV_1 0x00D0
106 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1 0x00D4
107 #define LAN9353_VPHY_AN_EXP_1 0x00D8
108 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1 0x00DC
109 #define LAN9353_1588_CMD_CTL 0x0100
110 #define LAN9353_1588_GENERAL_CONFIG 0x0104
111 #define LAN9353_1588_INT_STS 0x0108
112 #define LAN9353_1588_INT_EN 0x010C
113 #define LAN9353_1588_CLOCK_SEC 0x0110
114 #define LAN9353_1588_CLOCK_NS 0x0114
115 #define LAN9353_1588_CLOCK_SUBNS 0x0118
116 #define LAN9353_1588_CLOCK_RATE_ADJ 0x011C
117 #define LAN9353_1588_CLOCK_TEMP_RATE_ADJ 0x0120
118 #define LAN9353_1588_CLOCK_TEMP_RATE_DURATION 0x0124
119 #define LAN9353_1588_CLOCK_STEP_ADJ 0x0128
120 #define LAN9353_1588_CLOCK_TARGET_SEC_A 0x012C
121 #define LAN9353_1588_CLOCK_TARGET_NS_A 0x0130
122 #define LAN9353_1588_CLOCK_TARGET_RELOAD_SEC_A 0x0134
123 #define LAN9353_1588_CLOCK_TARGET_RELOAD_NS_A 0x0138
124 #define LAN9353_1588_CLOCK_TARGET_SEC_B 0x013C
125 #define LAN9353_1588_CLOCK_TARGET_NS_B 0x0140
126 #define LAN9353_1588_CLOCK_TARGET_RELOAD_SEC_B 0x0144
127 #define LAN9353_1588_CLOCK_TARGET_RELOAD_NS_B 0x0148
128 #define LAN9353_1588_USER_MAC_HI 0x014C
129 #define LAN9353_1588_USER_MAC_LO 0x0150
130 #define LAN9353_1588_BANK_PORT_GPIO_SEL 0x0154
131 #define LAN9353_1588_LATENCY 0x0158
132 #define LAN9353_1588_RX_PARSE_CONFIG 0x0158
133 #define LAN9353_1588_TX_PARSE_CONFIG 0x0158
134 #define LAN9353_1588_ASYM_PEERDLY 0x015C
135 #define LAN9353_1588_RX_TIMESTAMP_CONFIG 0x015C
136 #define LAN9353_1588_TX_TIMESTAMP_CONFIG 0x015C
137 #define LAN9353_1588_GPIO_CAP_CONFIG 0x015C
138 #define LAN9353_1588_CAP_INFO 0x0160
139 #define LAN9353_1588_RX_TS_INSERT_CONFIG 0x0160
140 #define LAN9353_1588_RX_CF_MOD 0x0164
141 #define LAN9353_1588_TX_MOD 0x0164
142 #define LAN9353_1588_RX_FILTER_CONFIG 0x0168
143 #define LAN9353_1588_TX_MOD2 0x0168
144 #define LAN9353_1588_RX_INGRESS_SEC 0x016C
145 #define LAN9353_1588_TX_EGRESS_SEC 0x016C
146 #define LAN9353_1588_GPIO_RE_CLOCK_SEC_CAP 0x016C
147 #define LAN9353_1588_RX_INGRESS_NS 0x0170
148 #define LAN9353_1588_TX_EGRESS_NS 0x0170
149 #define LAN9353_1588_GPIO_RE_CLOCK_NS_CAP 0x0170
150 #define LAN9353_1588_RX_MSG_HEADER 0x0174
151 #define LAN9353_1588_TX_MSG_HEADER 0x0174
152 #define LAN9353_1588_RX_PDREQ_SEC 0x0178
153 #define LAN9353_1588_TX_DREQ_SEC 0x0178
154 #define LAN9353_1588_GPIO_FE_CLOCK_SEC_CAP 0x0178
155 #define LAN9353_1588_RX_PDREQ_NS 0x017C
156 #define LAN9353_1588_TX_DREQ_NS 0x017C
157 #define LAN9353_1588_GPIO_FE_CLOCK_NS_CAP 0x017C
158 #define LAN9353_1588_RX_PDREQ_CF_HI 0x0180
159 #define LAN9353_1588_TX_ONE_STEP_SYNC_SEC 0x0180
160 #define LAN9353_1588_RX_PDREQ_CF_LOW 0x0184
161 #define LAN9353_1588_RX_CHKSUM_DROPPED_CNT 0x0188
162 #define LAN9353_1588_RX_FILTERED_CNT 0x018C
163 #define LAN9353_MANUAL_FC_1 0x01A0
164 #define LAN9353_MANUAL_FC_2 0x01A4
165 #define LAN9353_MANUAL_FC_0 0x01A8
166 #define LAN9353_SWITCH_CSR_DATA 0x01AC
167 #define LAN9353_SWITCH_CSR_CMD 0x01B0
168 #define LAN9353_E2P_CMD 0x01B4
169 #define LAN9353_E2P_DATA 0x01B8
170 #define LAN9353_LED_CFG 0x01BC
171 #define LAN9353_VPHY_BASIC_CTRL_0 0x01C0
172 #define LAN9353_VPHY_BASIC_STATUS_0 0x01C4
173 #define LAN9353_VPHY_ID_MSB_0 0x01C8
174 #define LAN9353_VPHY_ID_LSB_0 0x01CC
175 #define LAN9353_VPHY_AN_ADV_0 0x01D0
176 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0 0x01D4
177 #define LAN9353_VPHY_AN_EXP_0 0x01D8
178 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0 0x01DC
179 #define LAN9353_GPIO_CFG 0x01E0
180 #define LAN9353_GPIO_DATA_DIR 0x01E4
181 #define LAN9353_GPIO_INT_STS_EN 0x01E8
182 #define LAN9353_SWITCH_MAC_ADDRH 0x01F0
183 #define LAN9353_SWITCH_MAC_ADDRL 0x01F4
184 #define LAN9353_RESET_CTL 0x01F8
185 #define LAN9353_SWITCH_CSR_DIRECT_DATA 0x0200
186 
187 //LAN9353 Switch Fabric registers
188 #define LAN9353_SW_DEV_ID 0x0000
189 #define LAN9353_SW_RESET 0x0001
190 #define LAN9353_SW_IMR 0x0004
191 #define LAN9353_SW_IPR 0x0005
192 #define LAN9353_MAC_VER_ID_0 0x0400
193 #define LAN9353_MAC_RX_CFG_0 0x0401
194 #define LAN9353_MAC_RX_UNDSZE_CNT_0 0x0410
195 #define LAN9353_MAC_RX_64_CNT_0 0x0411
196 #define LAN9353_MAC_RX_65_TO_127_CNT_0 0x0412
197 #define LAN9353_MAC_RX_128_TO_255_CNT_0 0x0413
198 #define LAN9353_MAC_RX_256_TO_511_CNT_0 0x0414
199 #define LAN9353_MAC_RX_512_TO_1023_CNT_0 0x0415
200 #define LAN9353_MAC_RX_1024_TO_MAX_CNT_0 0x0416
201 #define LAN9353_MAC_RX_OVRSZE_CNT_0 0x0417
202 #define LAN9353_MAC_RX_PKTOK_CNT_0 0x0418
203 #define LAN9353_MAC_RX_CRCERR_CNT_0 0x0419
204 #define LAN9353_MAC_RX_MULCST_CNT_0 0x041A
205 #define LAN9353_MAC_RX_BRDCST_CNT_0 0x041B
206 #define LAN9353_MAC_RX_PAUSE_CNT_0 0x041C
207 #define LAN9353_MAC_RX_FRAG_CNT_0 0x041D
208 #define LAN9353_MAC_RX_JABB_CNT_0 0x041E
209 #define LAN9353_MAC_RX_ALIGN_CNT_0 0x041F
210 #define LAN9353_MAC_RX_PKTLEN_CNT_0 0x0420
211 #define LAN9353_MAC_RX_GOODPKTLEN_CNT_0 0x0421
212 #define LAN9353_MAC_RX_SYMBOL_CNT_0 0x0422
213 #define LAN9353_MAC_RX_CTLFRM_CNT_0 0x0423
214 #define LAN9353_MAC_TX_CFG_0 0x0440
215 #define LAN9353_MAC_TX_FC_SETTINGS_0 0x0441
216 #define LAN9353_MAC_TX_DEFER_CNT_0 0x0451
217 #define LAN9353_MAC_TX_PAUSE_CNT_0 0x0452
218 #define LAN9353_MAC_TX_PKTOK_CNT_0 0x0453
219 #define LAN9353_MAC_TX_64_CNT_0 0x0454
220 #define LAN9353_MAC_TX_65_TO_127_CNT_0 0x0455
221 #define LAN9353_MAC_TX_128_TO_255_CNT_0 0x0456
222 #define LAN9353_MAC_TX_256_TO_511_CNT_0 0x0457
223 #define LAN9353_MAC_TX_512_TO_1023_CNT_0 0x0458
224 #define LAN9353_MAC_TX_1024_TO_MAX_CNT_0 0x0459
225 #define LAN9353_MAC_TX_UNDSZE_CNT_0 0x045A
226 #define LAN9353_MAC_TX_PKTLEN_CNT_0 0x045C
227 #define LAN9353_MAC_TX_BRDCST_CNT_0 0x045D
228 #define LAN9353_MAC_TX_MULCST_CNT_0 0x045E
229 #define LAN9353_MAC_TX_LATECOL_CNT_0 0x045F
230 #define LAN9353_MAC_TX_EXCCOL_CNT_0 0x0460
231 #define LAN9353_MAC_TX_SNGLECOL_CNT_0 0x0461
232 #define LAN9353_MAC_TX_MULTICOL_CNT_0 0x0462
233 #define LAN9353_MAC_TX_TOTALCOL_CNT_0 0x0463
234 #define LAN9353_MAC_IMR_0 0x0480
235 #define LAN9353_MAC_IPR_0 0x0481
236 #define LAN9353_MAC_VER_ID_1 0x0800
237 #define LAN9353_MAC_RX_CFG_1 0x0801
238 #define LAN9353_MAC_RX_UNDSZE_CNT_1 0x0810
239 #define LAN9353_MAC_RX_64_CNT_1 0x0811
240 #define LAN9353_MAC_RX_65_TO_127_CNT_1 0x0812
241 #define LAN9353_MAC_RX_128_TO_255_CNT_1 0x0813
242 #define LAN9353_MAC_RX_256_TO_511_CNT_1 0x0814
243 #define LAN9353_MAC_RX_512_TO_1023_CNT_1 0x0815
244 #define LAN9353_MAC_RX_1024_TO_MAX_CNT_1 0x0816
245 #define LAN9353_MAC_RX_OVRSZE_CNT_1 0x0817
246 #define LAN9353_MAC_RX_PKTOK_CNT_1 0x0818
247 #define LAN9353_MAC_RX_CRCERR_CNT_1 0x0819
248 #define LAN9353_MAC_RX_MULCST_CNT_1 0x081A
249 #define LAN9353_MAC_RX_BRDCST_CNT_1 0x081B
250 #define LAN9353_MAC_RX_PAUSE_CNT_1 0x081C
251 #define LAN9353_MAC_RX_FRAG_CNT_1 0x081D
252 #define LAN9353_MAC_RX_JABB_CNT_1 0x081E
253 #define LAN9353_MAC_RX_ALIGN_CNT_1 0x081F
254 #define LAN9353_MAC_RX_PKTLEN_CNT_1 0x0820
255 #define LAN9353_MAC_RX_GOODPKTLEN_CNT_1 0x0821
256 #define LAN9353_MAC_RX_SYMBOL_CNT_1 0x0822
257 #define LAN9353_MAC_RX_CTLFRM_CNT_1 0x0823
258 #define LAN9353_RX_LPI_TRANSITION_1 0x0824
259 #define LAN9353_RX_LPI_TIME_1 0x0825
260 #define LAN9353_MAC_TX_CFG_1 0x0840
261 #define LAN9353_MAC_TX_FC_SETTINGS_1 0x0841
262 #define LAN9353_EEE_TW_TX_SYS_1 0x0842
263 #define LAN9353_EEE_TX_LPI_REQ_DELAY_1 0x0843
264 #define LAN9353_MAC_TX_DEFER_CNT_1 0x0851
265 #define LAN9353_MAC_TX_PAUSE_CNT_1 0x0852
266 #define LAN9353_MAC_TX_PKTOK_CNT_1 0x0853
267 #define LAN9353_MAC_TX_64_CNT_1 0x0854
268 #define LAN9353_MAC_TX_65_TO_127_CNT_1 0x0855
269 #define LAN9353_MAC_TX_128_TO_255_CNT_1 0x0856
270 #define LAN9353_MAC_TX_256_TO_511_CNT_1 0x0857
271 #define LAN9353_MAC_TX_512_TO_1023_CNT_1 0x0858
272 #define LAN9353_MAC_TX_1024_TO_MAX_CNT_1 0x0859
273 #define LAN9353_MAC_TX_UNDSZE_CNT_1 0x085A
274 #define LAN9353_MAC_TX_PKTLEN_CNT_1 0x085C
275 #define LAN9353_MAC_TX_BRDCST_CNT_1 0x085D
276 #define LAN9353_MAC_TX_MULCST_CNT_1 0x085E
277 #define LAN9353_MAC_TX_LATECOL_CNT_1 0x085F
278 #define LAN9353_MAC_TX_EXCCOL_CNT_1 0x0860
279 #define LAN9353_MAC_TX_SNGLECOL_CNT_1 0x0861
280 #define LAN9353_MAC_TX_MULTICOL_CNT_1 0x0862
281 #define LAN9353_MAC_TX_TOTALCOL_CNT_1 0x0863
282 #define LAN9353_TX_LPI_TRANSITION_1 0x0864
283 #define LAN9353_TX_LPI_TIME_1 0x0865
284 #define LAN9353_MAC_IMR_1 0x0880
285 #define LAN9353_MAC_IPR_1 0x0881
286 #define LAN9353_MAC_VER_ID_2 0x0C00
287 #define LAN9353_MAC_RX_CFG_2 0x0C01
288 #define LAN9353_MAC_RX_UNDSZE_CNT_2 0x0C10
289 #define LAN9353_MAC_RX_64_CNT_2 0x0C11
290 #define LAN9353_MAC_RX_65_TO_127_CNT_2 0x0C12
291 #define LAN9353_MAC_RX_128_TO_255_CNT_2 0x0C13
292 #define LAN9353_MAC_RX_256_TO_511_CNT_2 0x0C14
293 #define LAN9353_MAC_RX_512_TO_1023_CNT_2 0x0C15
294 #define LAN9353_MAC_RX_1024_TO_MAX_CNT_2 0x0C16
295 #define LAN9353_MAC_RX_OVRSZE_CNT_2 0x0C17
296 #define LAN9353_MAC_RX_PKTOK_CNT_2 0x0C18
297 #define LAN9353_MAC_RX_CRCERR_CNT_2 0x0C19
298 #define LAN9353_MAC_RX_MULCST_CNT_2 0x0C1A
299 #define LAN9353_MAC_RX_BRDCST_CNT_2 0x0C1B
300 #define LAN9353_MAC_RX_PAUSE_CNT_2 0x0C1C
301 #define LAN9353_MAC_RX_FRAG_CNT_2 0x0C1D
302 #define LAN9353_MAC_RX_JABB_CNT_2 0x0C1E
303 #define LAN9353_MAC_RX_ALIGN_CNT_2 0x0C1F
304 #define LAN9353_MAC_RX_PKTLEN_CNT_2 0x0C20
305 #define LAN9353_MAC_RX_GOODPKTLEN_CNT_2 0x0C21
306 #define LAN9353_MAC_RX_SYMBOL_CNT_2 0x0C22
307 #define LAN9353_MAC_RX_CTLFRM_CNT_2 0x0C23
308 #define LAN9353_RX_LPI_TRANSITION_2 0x0C24
309 #define LAN9353_RX_LPI_TIME_2 0x0C25
310 #define LAN9353_MAC_TX_CFG_2 0x0C40
311 #define LAN9353_MAC_TX_FC_SETTINGS_2 0x0C41
312 #define LAN9353_EEE_TW_TX_SYS_2 0x0C42
313 #define LAN9353_EEE_TX_LPI_REQ_DELAY_2 0x0C43
314 #define LAN9353_MAC_TX_DEFER_CNT_2 0x0C51
315 #define LAN9353_MAC_TX_PAUSE_CNT_2 0x0C52
316 #define LAN9353_MAC_TX_PKTOK_CNT_2 0x0C53
317 #define LAN9353_MAC_TX_64_CNT_2 0x0C54
318 #define LAN9353_MAC_TX_65_TO_127_CNT_2 0x0C55
319 #define LAN9353_MAC_TX_128_TO_255_CNT_2 0x0C56
320 #define LAN9353_MAC_TX_256_TO_511_CNT_2 0x0C57
321 #define LAN9353_MAC_TX_512_TO_1023_CNT_2 0x0C58
322 #define LAN9353_MAC_TX_1024_TO_MAX_CNT_2 0x0C59
323 #define LAN9353_MAC_TX_UNDSZE_CNT_2 0x0C5A
324 #define LAN9353_MAC_TX_PKTLEN_CNT_2 0x0C5C
325 #define LAN9353_MAC_TX_BRDCST_CNT_2 0x0C5D
326 #define LAN9353_MAC_TX_MULCST_CNT_2 0x0C5E
327 #define LAN9353_MAC_TX_LATECOL_CNT_2 0x0C5F
328 #define LAN9353_MAC_TX_EXCCOL_CNT_2 0x0C60
329 #define LAN9353_MAC_TX_SNGLECOL_CNT_2 0x0C61
330 #define LAN9353_MAC_TX_MULTICOL_CNT_2 0x0C62
331 #define LAN9353_MAC_TX_TOTALCOL_CNT_2 0x0C63
332 #define LAN9353_TX_LPI_TRANSITION_2 0x0C64
333 #define LAN9353_TX_LPI_TIME_2 0x0C65
334 #define LAN9353_MAC_IMR_2 0x0C80
335 #define LAN9353_MAC_IPR_2 0x0C81
336 #define LAN9353_SWE_ALR_CMD 0x1800
337 #define LAN9353_SWE_ALR_WR_DAT_0 0x1801
338 #define LAN9353_SWE_ALR_WR_DAT_1 0x1802
339 #define LAN9353_SWE_ALR_RD_DAT_0 0x1805
340 #define LAN9353_SWE_ALR_RD_DAT_1 0x1806
341 #define LAN9353_SWE_ALR_CMD_STS 0x1808
342 #define LAN9353_SWE_ALR_CFG 0x1809
343 #define LAN9353_SWE_ALR_OVERRIDE 0x180A
344 #define LAN9353_SWE_VLAN_CMD 0x180B
345 #define LAN9353_SWE_VLAN_WR_DATA 0x180C
346 #define LAN9353_SWE_VLAN_RD_DATA 0x180E
347 #define LAN9353_SWE_VLAN_CMD_STS 0x1810
348 #define LAN9353_SWE_DIFFSERV_TBL_CFG 0x1811
349 #define LAN9353_SWE_DIFFSERV_TBL_WR_DATA 0x1812
350 #define LAN9353_SWE_DIFFSERV_TBL_RD_DATA 0x1813
351 #define LAN9353_SWE_DIFFSERV_TBL_CMD_STS 0x1814
352 #define LAN9353_SWE_GLOBAL_INGRSS_CFG 0x1840
353 #define LAN9353_SWE_PORT_INGRSS_CFG 0x1841
354 #define LAN9353_SWE_ADMT_ONLY_VLAN 0x1842
355 #define LAN9353_SWE_PORT_STATE 0x1843
356 #define LAN9353_SWE_PRI_TO_QUE 0x1845
357 #define LAN9353_SWE_PORT_MIRROR 0x1846
358 #define LAN9353_SWE_INGRSS_PORT_TYP 0x1847
359 #define LAN9353_SWE_BCST_THROT 0x1848
360 #define LAN9353_SWE_ADMT_N_MEMBER 0x1849
361 #define LAN9353_SWE_INGRSS_RATE_CFG 0x184A
362 #define LAN9353_SWE_INGRSS_RATE_CMD 0x184B
363 #define LAN9353_SWE_INGRSS_RATE_CMD_STS 0x184C
364 #define LAN9353_SWE_INGRSS_RATE_WR_DATA 0x184D
365 #define LAN9353_SWE_INGRSS_RATE_RD_DATA 0x184E
366 #define LAN9353_SWE_FILTERED_CNT_0 0x1850
367 #define LAN9353_SWE_FILTERED_CNT_1 0x1851
368 #define LAN9353_SWE_FILTERED_CNT_2 0x1852
369 #define LAN9353_SWE_INGRSS_REGEN_TBL_0 0x1855
370 #define LAN9353_SWE_INGRSS_REGEN_TBL_1 0x1856
371 #define LAN9353_SWE_INGRSS_REGEN_TBL_2 0x1857
372 #define LAN9353_SWE_LRN_DISCRD_CNT_0 0x1858
373 #define LAN9353_SWE_LRN_DISCRD_CNT_1 0x1859
374 #define LAN9353_SWE_LRN_DISCRD_CNT_2 0x185A
375 #define LAN9353_SWE_IMR 0x1880
376 #define LAN9353_SWE_IPR 0x1881
377 #define LAN9353_BM_CFG 0x1C00
378 #define LAN9353_BM_DROP_LVL 0x1C01
379 #define LAN9353_BM_FC_PAUSE_LVL 0x1C02
380 #define LAN9353_BM_FC_RESUME_LVL 0x1C03
381 #define LAN9353_BM_BCST_LVL 0x1C04
382 #define LAN9353_BM_DRP_CNT_SRC_0 0x1C05
383 #define LAN9353_BM_DRP_CNT_SRC_1 0x1C06
384 #define LAN9353_BM_DRP_CNT_SRC_2 0x1C07
385 #define LAN9353_BM_RST_STS 0x1C08
386 #define LAN9353_BM_RNDM_DSCRD_TBL_CMD 0x1C09
387 #define LAN9353_BM_RNDM_DSCRD_TBL_WDATA 0x1C0A
388 #define LAN9353_BM_RNDM_DSCRD_TBL_RDATA 0x1C0B
389 #define LAN9353_BM_EGRSS_PORT_TYPE 0x1C0C
390 #define LAN9353_BM_EGRSS_RATE_00_01 0x1C0D
391 #define LAN9353_BM_EGRSS_RATE_02_03 0x1C0E
392 #define LAN9353_BM_EGRSS_RATE_10_11 0x1C0F
393 #define LAN9353_BM_EGRSS_RATE_12_13 0x1C10
394 #define LAN9353_BM_EGRSS_RATE_20_21 0x1C11
395 #define LAN9353_BM_EGRSS_RATE_22_23 0x1C12
396 #define LAN9353_BM_VLAN_0 0x1C13
397 #define LAN9353_BM_VLAN_1 0x1C14
398 #define LAN9353_BM_VLAN_2 0x1C15
399 #define LAN9353_BM_RATE_DRP_CNT_SRC_0 0x1C16
400 #define LAN9353_BM_RATE_DRP_CNT_SRC_1 0x1C17
401 #define LAN9353_BM_RATE_DRP_CNT_SRC_2 0x1C18
402 #define LAN9353_BM_IMR 0x1C20
403 #define LAN9353_BM_IPR 0x1C21
404 
405 //LAN9353 Switch Fabric register access macros
406 #define LAN9353_MAC_VER_ID(port) (0x0400 + ((port) * 0x0400))
407 #define LAN9353_MAC_RX_CFG(port) (0x0401 + ((port) * 0x0400))
408 #define LAN9353_MAC_RX_UNDSZE_CNT(port) (0x0410 + ((port) * 0x0400))
409 #define LAN9353_MAC_RX_64_CNT(port) (0x0411 + ((port) * 0x0400))
410 #define LAN9353_MAC_RX_65_TO_127_CNT(port) (0x0412 + ((port) * 0x0400))
411 #define LAN9353_MAC_RX_128_TO_255_CNT(port) (0x0413 + ((port) * 0x0400))
412 #define LAN9353_MAC_RX_256_TO_511_CNT(port) (0x0414 + ((port) * 0x0400))
413 #define LAN9353_MAC_RX_512_TO_1023_CNT(port) (0x0415 + ((port) * 0x0400))
414 #define LAN9353_MAC_RX_1024_TO_MAX_CNT(port) (0x0416 + ((port) * 0x0400))
415 #define LAN9353_MAC_RX_OVRSZE_CNT(port) (0x0417 + ((port) * 0x0400))
416 #define LAN9353_MAC_RX_PKTOK_CNT(port) (0x0418 + ((port) * 0x0400))
417 #define LAN9353_MAC_RX_CRCERR_CNT(port) (0x0419 + ((port) * 0x0400))
418 #define LAN9353_MAC_RX_MULCST_CNT(port) (0x041A + ((port) * 0x0400))
419 #define LAN9353_MAC_RX_BRDCST_CNT(port) (0x041B + ((port) * 0x0400))
420 #define LAN9353_MAC_RX_PAUSE_CNT(port) (0x041C + ((port) * 0x0400))
421 #define LAN9353_MAC_RX_FRAG_CNT(port) (0x041D + ((port) * 0x0400))
422 #define LAN9353_MAC_RX_JABB_CNT(port) (0x041E + ((port) * 0x0400))
423 #define LAN9353_MAC_RX_ALIGN_CNT(port) (0x041F + ((port) * 0x0400))
424 #define LAN9353_MAC_RX_PKTLEN_CNT(port) (0x0420 + ((port) * 0x0400))
425 #define LAN9353_MAC_RX_GOODPKTLEN_CNT(port) (0x0421 + ((port) * 0x0400))
426 #define LAN9353_MAC_RX_SYMBOL_CNT(port) (0x0422 + ((port) * 0x0400))
427 #define LAN9353_MAC_RX_CTLFRM_CNT(port) (0x0423 + ((port) * 0x0400))
428 #define LAN9353_RX_LPI_TRANSITION(port) (0x0424 + ((port) * 0x0400))
429 #define LAN9353_RX_LPI_TIME(port) (0x0425 + ((port) * 0x0400))
430 #define LAN9353_MAC_TX_CFG(port) (0x0440 + ((port) * 0x0400))
431 #define LAN9353_MAC_TX_FC_SETTINGS(port) (0x0441 + ((port) * 0x0400))
432 #define LAN9353_EEE_TW_TX_SYS(port) (0x0442 + ((port) * 0x0400))
433 #define LAN9353_EEE_TX_LPI_REQ_DELAY(port) (0x0443 + ((port) * 0x0400))
434 #define LAN9353_MAC_TX_DEFER_CNT(port) (0x0451 + ((port) * 0x0400))
435 #define LAN9353_MAC_TX_PAUSE_CNT(port) (0x0452 + ((port) * 0x0400))
436 #define LAN9353_MAC_TX_PKTOK_CNT(port) (0x0453 + ((port) * 0x0400))
437 #define LAN9353_MAC_TX_64_CNT(port) (0x0454 + ((port) * 0x0400))
438 #define LAN9353_MAC_TX_65_TO_127_CNT(port) (0x0455 + ((port) * 0x0400))
439 #define LAN9353_MAC_TX_128_TO_255_CNT(port) (0x0456 + ((port) * 0x0400))
440 #define LAN9353_MAC_TX_256_TO_511_CNT(port) (0x0457 + ((port) * 0x0400))
441 #define LAN9353_MAC_TX_512_TO_1023_CNT(port) (0x0458 + ((port) * 0x0400))
442 #define LAN9353_MAC_TX_1024_TO_MAX_CNT(port) (0x0459 + ((port) * 0x0400))
443 #define LAN9353_MAC_TX_UNDSZE_CNT(port) (0x045A + ((port) * 0x0400))
444 #define LAN9353_MAC_TX_PKTLEN_CNT(port) (0x045C + ((port) * 0x0400))
445 #define LAN9353_MAC_TX_BRDCST_CNT(port) (0x045D + ((port) * 0x0400))
446 #define LAN9353_MAC_TX_MULCST_CNT(port) (0x045E + ((port) * 0x0400))
447 #define LAN9353_MAC_TX_LATECOL_CNT(port) (0x045F + ((port) * 0x0400))
448 #define LAN9353_MAC_TX_EXCCOL_CNT(port) (0x0460 + ((port) * 0x0400))
449 #define LAN9353_MAC_TX_SNGLECOL_CNT(port) (0x0461 + ((port) * 0x0400))
450 #define LAN9353_MAC_TX_MULTICOL_CNT(port) (0x0462 + ((port) * 0x0400))
451 #define LAN9353_MAC_TX_TOTALCOL_CNT(port) (0x0463 + ((port) * 0x0400))
452 #define LAN9353_TX_LPI_TRANSITION(port) (0x0464 + ((port) * 0x0400))
453 #define LAN9353_TX_LPI_TIME(port) (0x0465 + ((port) * 0x0400))
454 #define LAN9353_MAC_IMR(port) (0x0480 + ((port) * 0x0400))
455 #define LAN9353_MAC_IPR(port) (0x0481 + ((port) * 0x0400))
456 
457 //PHY Basic Control register
458 #define LAN9353_BMCR_RESET 0x8000
459 #define LAN9353_BMCR_LOOPBACK 0x4000
460 #define LAN9353_BMCR_SPEED_SEL 0x2000
461 #define LAN9353_BMCR_AN_EN 0x1000
462 #define LAN9353_BMCR_POWER_DOWN 0x0800
463 #define LAN9353_BMCR_RESTART_AN 0x0200
464 #define LAN9353_BMCR_DUPLEX_MODE 0x0100
465 #define LAN9353_BMCR_COL_TEST 0x0080
466 
467 //PHY Basic Status register
468 #define LAN9353_BMSR_100BT4 0x8000
469 #define LAN9353_BMSR_100BTX_FD 0x4000
470 #define LAN9353_BMSR_100BTX_HD 0x2000
471 #define LAN9353_BMSR_10BT_FD 0x1000
472 #define LAN9353_BMSR_10BT_HD 0x0800
473 #define LAN9353_BMSR_100BT2_FD 0x0400
474 #define LAN9353_BMSR_100BT2_HD 0x0200
475 #define LAN9353_BMSR_EXTENDED_STATUS 0x0100
476 #define LAN9353_BMSR_UNIDIRECTIONAL_ABLE 0x0080
477 #define LAN9353_BMSR_MF_PREAMBLE_SUPPR 0x0040
478 #define LAN9353_BMSR_AN_COMPLETE 0x0020
479 #define LAN9353_BMSR_REMOTE_FAULT 0x0010
480 #define LAN9353_BMSR_AN_CAPABLE 0x0008
481 #define LAN9353_BMSR_LINK_STATUS 0x0004
482 #define LAN9353_BMSR_JABBER_DETECT 0x0002
483 #define LAN9353_BMSR_EXTENDED_CAPABLE 0x0001
484 
485 //PHY Identification MSB register
486 #define LAN9353_PHYID1_PHY_ID_MSB 0xFFFF
487 #define LAN9353_PHYID1_PHY_ID_MSB_DEFAULT 0x0007
488 
489 //PHY Identification LSB register
490 #define LAN9353_PHYID2_PHY_ID_LSB 0xFC00
491 #define LAN9353_PHYID2_PHY_ID_LSB_DEFAULT 0xC000
492 #define LAN9353_PHYID2_MODEL_NUM 0x03F0
493 #define LAN9353_PHYID2_MODEL_NUM_DEFAULT 0x0140
494 #define LAN9353_PHYID2_REVISION_NUM 0x000F
495 
496 //PHY Auto-Negotiation Advertisement register
497 #define LAN9353_ANAR_REMOTE_FAULT 0x2000
498 #define LAN9353_ANAR_ASYM_PAUSE 0x0800
499 #define LAN9353_ANAR_SYM_PAUSE 0x0400
500 #define LAN9353_ANAR_100BTX_FD 0x0100
501 #define LAN9353_ANAR_100BTX_HD 0x0080
502 #define LAN9353_ANAR_10BT_FD 0x0040
503 #define LAN9353_ANAR_10BT_HD 0x0020
504 #define LAN9353_ANAR_SELECTOR 0x001F
505 #define LAN9353_ANAR_SELECTOR_DEFAULT 0x0001
506 
507 //PHY Auto-Negotiation Link Partner Base Page Ability register
508 #define LAN9353_ANLPAR_NEXT_PAGE 0x8000
509 #define LAN9353_ANLPAR_ACK 0x4000
510 #define LAN9353_ANLPAR_REMOTE_FAULT 0x2000
511 #define LAN9353_ANLPAR_ASYM_PAUSE 0x0800
512 #define LAN9353_ANLPAR_SYM_PAUSE 0x0400
513 #define LAN9353_ANLPAR_100BT4 0x0200
514 #define LAN9353_ANLPAR_100BTX_FD 0x0100
515 #define LAN9353_ANLPAR_100BTX_HD 0x0080
516 #define LAN9353_ANLPAR_10BT_FD 0x0040
517 #define LAN9353_ANLPAR_10BT_HD 0x0020
518 #define LAN9353_ANLPAR_SELECTOR 0x001F
519 #define LAN9353_ANLPAR_SELECTOR_DEFAULT 0x0001
520 
521 //PHY Auto-Negotiation Expansion register
522 #define LAN9353_ANER_PAR_DETECT_FAULT 0x0010
523 #define LAN9353_ANER_LP_NEXT_PAGE_ABLE 0x0008
524 #define LAN9353_ANER_NEXT_PAGE_ABLE 0x0004
525 #define LAN9353_ANER_PAGE_RECEIVED 0x0002
526 #define LAN9353_ANER_LP_AN_ABLE 0x0001
527 
528 //PHY Mode Control/Status register
529 #define LAN9353_PMCSR_EDPWRDOWN 0x2000
530 #define LAN9353_PMCSR_ENERGYON 0x0002
531 
532 //PHY Special Modes register
533 #define LAN9353_PSMR_MODE 0x00E0
534 #define LAN9353_PSMR_MODE_10BT_HD 0x0000
535 #define LAN9353_PSMR_MODE_10BT_FD 0x0020
536 #define LAN9353_PSMR_MODE_100BTX_HD 0x0040
537 #define LAN9353_PSMR_MODE_100BTX_FD 0x0060
538 #define LAN9353_PSMR_MODE_POWER_DOWN 0x00C0
539 #define LAN9353_PSMR_MODE_AN 0x00E0
540 #define LAN9353_PSMR_PHYAD 0x001F
541 
542 //PHY Special Control/Status Indication register
543 #define LAN9353_PSCSIR_AMDIXCTRL 0x8000
544 #define LAN9353_PSCSIR_AMDIXEN 0x4000
545 #define LAN9353_PSCSIR_AMDIXSTATE 0x2000
546 #define LAN9353_PSCSIR_SQEOFF 0x0800
547 #define LAN9353_PSCSIR_VCOOFF_LP 0x0400
548 #define LAN9353_PSCSIR_XPOL 0x0010
549 
550 //PHY Interrupt Source Flags register
551 #define LAN9353_PISR_ENERGYON 0x0080
552 #define LAN9353_PISR_AN_COMPLETE 0x0040
553 #define LAN9353_PISR_REMOTE_FAULT 0x0020
554 #define LAN9353_PISR_LINK_DOWN 0x0010
555 #define LAN9353_PISR_AN_LP_ACK 0x0008
556 #define LAN9353_PISR_PAR_DETECT_FAULT 0x0004
557 #define LAN9353_PISR_AN_PAGE_RECEIVED 0x0002
558 
559 //PHY Interrupt Mask register
560 #define LAN9353_PIMR_ENERGYON 0x0080
561 #define LAN9353_PIMR_AN_COMPLETE 0x0040
562 #define LAN9353_PIMR_REMOTE_FAULT 0x0020
563 #define LAN9353_PIMR_LINK_DOWN 0x0010
564 #define LAN9353_PIMR_AN_LP_ACK 0x0008
565 #define LAN9353_PIMR_PAR_DETECT_FAULT 0x0004
566 #define LAN9353_PIMR_AN_PAGE_RECEIVED 0x0002
567 
568 //PHY Special Control/Status register
569 #define LAN9353_PSCSR_AUTODONE 0x1000
570 #define LAN9353_PSCSR_SPEED 0x001C
571 #define LAN9353_PSCSR_SPEED_10BT_HD 0x0004
572 #define LAN9353_PSCSR_SPEED_100BTX_HD 0x0008
573 #define LAN9353_PSCSR_SPEED_10BT_FD 0x0014
574 #define LAN9353_PSCSR_SPEED_100BTX_FD 0x0018
575 
576 //Chip ID and Revision register
577 #define LAN9353_ID_REV_CHIP_ID 0xFFFF0000
578 #define LAN9353_ID_REV_CHIP_ID_DEFAULT 0x93530000
579 #define LAN9353_ID_REV_CHIP_REV 0x0000FFFF
580 
581 //Interrupt Configuration register
582 #define LAN9353_IRQ_CFG_INT_DEAS 0xFF000000
583 #define LAN9353_IRQ_CFG_INT_DEAS_CLR 0x00004000
584 #define LAN9353_IRQ_CFG_INT_DEAS_STS 0x00002000
585 #define LAN9353_IRQ_CFG_IRQ_INT 0x00001000
586 #define LAN9353_IRQ_CFG_IRQ_EN 0x00000100
587 #define LAN9353_IRQ_CFG_IRQ_POL 0x00000010
588 #define LAN9353_IRQ_CFG_IRQ_CLK_SELECT 0x00000002
589 #define LAN9353_IRQ_CFG_IRQ_TYPE 0x00000001
590 
591 //Interrupt Status register
592 #define LAN9353_INT_STS_SW_INT 0x80000000
593 #define LAN9353_INT_STS_READY 0x40000000
594 #define LAN9353_INT_STS_1588_EVNT 0x20000000
595 #define LAN9353_INT_STS_SWITCH_INT 0x10000000
596 #define LAN9353_INT_STS_PHY_INT_B 0x08000000
597 #define LAN9353_INT_STS_PHY_INT_A 0x04000000
598 #define LAN9353_INT_STS_GPT_INT 0x00080000
599 #define LAN9353_INT_STS_PME_INT 0x00020000
600 #define LAN9353_INT_STS_GPIO 0x00001000
601 
602 //Interrupt Enable register
603 #define LAN9353_INT_EN_SW_INT_EN 0x80000000
604 #define LAN9353_INT_EN_READY_EN 0x40000000
605 #define LAN9353_INT_EN_1588_EVNT_EN 0x20000000
606 #define LAN9353_INT_EN_SWITCH_INT_EN 0x10000000
607 #define LAN9353_INT_EN_PHY_INT_B_EN 0x08000000
608 #define LAN9353_INT_EN_PHY_INT_A_EN 0x04000000
609 #define LAN9353_INT_EN_GPT_INT_EN 0x00080000
610 #define LAN9353_INT_EN_GPIO_EN 0x00001000
611 
612 //Byte Order Test register
613 #define LAN9353_BYTE_TEST_DEFAULT 0x87654321
614 
615 //Hardware Configuration register
616 #define LAN9353_HW_CFG_DEVICE_READY 0x08000000
617 #define LAN9353_HW_CFG_AMDIX_EN_STRAP_STATE_PORT_B 0x04000000
618 #define LAN9353_HW_CFG_AMDIX_EN_STRAP_STATE_PORT_A 0x02000000
619 
620 //General Purpose Timer Configuration register
621 #define LAN9353_GPT_CFG_TIMER_EN 0x20000000
622 #define LAN9353_GPT_CFG_GPT_LOAD 0x0000FFFF
623 
624 //General Purpose Timer Count register
625 #define LAN9353_GPT_CNT_GPT_CNT 0x0000FFFF
626 
627 //Free Running 25MHz Counter register
628 #define LAN9353_FREE_RUN_FR_CNT 0xFFFFFFFF
629 
630 //PHY Management Interface Data register
631 #define LAN9353_PMI_DATA_MII_DATA 0x0000FFFF
632 
633 //PHY Management Interface Access register
634 #define LAN9353_PMI_ACCESS_PHY_ADDR 0x0000F800
635 #define LAN9353_PMI_ACCESS_MIIRINDA 0x000007C0
636 #define LAN9353_PMI_ACCESS_MIIW_R 0x00000002
637 #define LAN9353_PMI_ACCESS_MIIBZY 0x00000001
638 
639 //Port 1 Virtual PHY Basic Control register
640 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_RST 0x00008000
641 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_LOOPBACK 0x00004000
642 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_SPEED_SEL_LSB 0x00002000
643 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_AN 0x00001000
644 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_PWR_DWN 0x00000800
645 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_ISO 0x00000400
646 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_RST_AN 0x00000200
647 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_DUPLEX 0x00000100
648 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_COL_TEST 0x00000080
649 #define LAN9353_VPHY_BASIC_CTRL_1_VPHY_SPEED_SEL_MSB 0x00000040
650 
651 //Port 1 Virtual PHY Basic Status register
652 #define LAN9353_VPHY_BASIC_STATUS_1_100BT4 0x00008000
653 #define LAN9353_VPHY_BASIC_STATUS_1_100BTX_FD 0x00004000
654 #define LAN9353_VPHY_BASIC_STATUS_1_100BTX_HD 0x00002000
655 #define LAN9353_VPHY_BASIC_STATUS_1_10BT_FD 0x00001000
656 #define LAN9353_VPHY_BASIC_STATUS_1_10BT_HD 0x00000800
657 #define LAN9353_VPHY_BASIC_STATUS_1_100BT2_FD 0x00000400
658 #define LAN9353_VPHY_BASIC_STATUS_1_100BT2_HD 0x00000200
659 #define LAN9353_VPHY_BASIC_STATUS_1_EXTENDED_STATUS 0x00000100
660 #define LAN9353_VPHY_BASIC_STATUS_1_MF_PREAMBLE_SUPPR 0x00000040
661 #define LAN9353_VPHY_BASIC_STATUS_1_AN_COMPLETE 0x00000020
662 #define LAN9353_VPHY_BASIC_STATUS_1_REMOTE_FAULT 0x00000010
663 #define LAN9353_VPHY_BASIC_STATUS_1_AN_CAPABLE 0x00000008
664 #define LAN9353_VPHY_BASIC_STATUS_1_LINK_STATUS 0x00000004
665 #define LAN9353_VPHY_BASIC_STATUS_1_JABBER_DETECT 0x00000002
666 #define LAN9353_VPHY_BASIC_STATUS_1_EXTENDED_CAPABLE 0x00000001
667 
668 //Port 1 Virtual PHY Identification MSB register
669 #define LAN9353_VPHY_ID_MSB_1_PHY_ID_MSB 0x0000FFFF
670 
671 //Port 1 Virtual PHY Identification LSB register
672 #define LAN9353_VPHY_ID_LSB_1_PHY_ID_LSB 0x0000FC00
673 #define LAN9353_VPHY_ID_LSB_1_MODEL_NUM 0x000003F0
674 #define LAN9353_VPHY_ID_LSB_1_REVISION_NUM 0x0000000F
675 
676 //Port 1 Virtual PHY Auto-Negotiation Advertisement register
677 #define LAN9353_VPHY_AN_ADV_1_NEXT_PAGE 0x00008000
678 #define LAN9353_VPHY_AN_ADV_1_REMOTE_FAULT 0x00002000
679 #define LAN9353_VPHY_AN_ADV_1_ASYM_PAUSE 0x00000800
680 #define LAN9353_VPHY_AN_ADV_1_SYM_PAUSE 0x00000400
681 #define LAN9353_VPHY_AN_ADV_1_100BTX_FD 0x00000100
682 #define LAN9353_VPHY_AN_ADV_1_100BTX_HD 0x00000080
683 #define LAN9353_VPHY_AN_ADV_1_10BT_FD 0x00000040
684 #define LAN9353_VPHY_AN_ADV_1_10BT_HD 0x00000020
685 #define LAN9353_VPHY_AN_ADV_1_SELECTOR 0x0000001F
686 #define LAN9353_VPHY_AN_ADV_1_SELECTOR_DEFAULT 0x00000001
687 
688 //Port 1 Virtual PHY Auto-Negotiation Link Partner Base Page Ability register
689 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_NEXT_PAGE 0x00008000
690 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_ACK 0x00004000
691 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_REMOTE_FAULT 0x00002000
692 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_ASYM_PAUSE 0x00000800
693 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_SYM_PAUSE 0x00000400
694 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_100BT4 0x00000200
695 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_100BTX_FD 0x00000100
696 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_100BTX_HD 0x00000080
697 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_10BT_FD 0x00000040
698 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_10BT_HD 0x00000020
699 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_SELECTOR 0x0000001F
700 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_1_SELECTOR_DEFAULT 0x00000001
701 
702 //Port 1 Virtual PHY Auto-Negotiation Expansion register
703 #define LAN9353_VPHY_AN_EXP_1_PAR_DETECT_FAULT 0x00000010
704 #define LAN9353_VPHY_AN_EXP_1_LP_NEXT_PAGE_ABLE 0x00000008
705 #define LAN9353_VPHY_AN_EXP_1_NEXT_PAGE_ABLE 0x00000004
706 #define LAN9353_VPHY_AN_EXP_1_PAGE_RECEIVED 0x00000002
707 #define LAN9353_VPHY_AN_EXP_1_LP_AN_ABLE 0x00000001
708 
709 //Port 1 Virtual PHY Special Control/Status register
710 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE2 0x00008000
711 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_SW_LOOPBACK 0x00004000
712 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_TURBO_MODE_EN 0x00000400
713 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE 0x00000300
714 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE_MII_MAC 0x00000000
715 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE_MII_PHY 0x00000100
716 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE_RMII_MAC 0x00000200
717 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_MODE_RMII_PHY 0x00000300
718 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_SW_COL_TEST 0x00000080
719 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_RMII_CLK_DIR 0x00000040
720 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_RMII_CLK_DIR_IN 0x00000000
721 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_RMII_CLK_DIR_OUT 0x00000040
722 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_RMII_CLK_STRENGTH 0x00000020
723 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_IND 0x0000001C
724 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_IND_10_HD 0x00000004
725 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_IND_100_200_HD 0x00000008
726 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_IND_10_FD 0x00000014
727 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_IND_100_200_FD 0x00000018
728 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_1_SQEOFF 0x00000001
729 
730 //Port 1 Manual Flow Control register
731 #define LAN9353_MANUAL_FC_1_BP_EN_1 0x00000040
732 #define LAN9353_MANUAL_FC_1_CUR_DUP_1 0x00000020
733 #define LAN9353_MANUAL_FC_1_CUR_RX_FC_1 0x00000010
734 #define LAN9353_MANUAL_FC_1_CUR_TX_FC_1 0x00000008
735 #define LAN9353_MANUAL_FC_1_RX_FC_1 0x00000004
736 #define LAN9353_MANUAL_FC_1_TX_FC_1 0x00000002
737 #define LAN9353_MANUAL_FC_1_MANUAL_FC_1 0x00000001
738 
739 //Port 2 Manual Flow Control register
740 #define LAN9353_MANUAL_FC_2_BP_EN_2 0x00000040
741 #define LAN9353_MANUAL_FC_2_CUR_DUP_2 0x00000020
742 #define LAN9353_MANUAL_FC_2_CUR_RX_FC_2 0x00000010
743 #define LAN9353_MANUAL_FC_2_CUR_TX_FC_2 0x00000008
744 #define LAN9353_MANUAL_FC_2_RX_FC_2 0x00000004
745 #define LAN9353_MANUAL_FC_2_TX_FC_2 0x00000002
746 #define LAN9353_MANUAL_FC_2_MANUAL_FC_2 0x00000001
747 
748 //Port 0 Manual Flow Control register
749 #define LAN9353_MANUAL_FC_0_BP_EN_0 0x00000040
750 #define LAN9353_MANUAL_FC_0_CUR_DUP_0 0x00000020
751 #define LAN9353_MANUAL_FC_0_CUR_RX_FC_0 0x00000010
752 #define LAN9353_MANUAL_FC_0_CUR_TX_FC_0 0x00000008
753 #define LAN9353_MANUAL_FC_0_RX_FC_0 0x00000004
754 #define LAN9353_MANUAL_FC_0_TX_FC_0 0x00000002
755 #define LAN9353_MANUAL_FC_0_MANUAL_FC_0 0x00000001
756 
757 //Switch Fabric CSR Interface Command register
758 #define LAN9353_SWITCH_CSR_CMD_BUSY 0x80000000
759 #define LAN9353_SWITCH_CSR_CMD_WRITE 0x00000000
760 #define LAN9353_SWITCH_CSR_CMD_READ 0x40000000
761 #define LAN9353_SWITCH_CSR_CMD_AUTO_INC 0x20000000
762 #define LAN9353_SWITCH_CSR_CMD_AUTO_DEC 0x10000000
763 #define LAN9353_SWITCH_CSR_CMD_BE 0x000F0000
764 #define LAN9353_SWITCH_CSR_CMD_BE_0 0x00010000
765 #define LAN9353_SWITCH_CSR_CMD_BE_1 0x00020000
766 #define LAN9353_SWITCH_CSR_CMD_BE_2 0x00040000
767 #define LAN9353_SWITCH_CSR_CMD_BE_3 0x00080000
768 #define LAN9353_SWITCH_CSR_CMD_ADDR 0x0000FFFF
769 
770 //EEPROM Command register
771 #define LAN9353_E2P_CMD_EPC_BUSY 0x80000000
772 #define LAN9353_E2P_CMD_EPC_COMMAND 0x70000000
773 #define LAN9353_E2P_CMD_EPC_COMMAND_READ 0x00000000
774 #define LAN9353_E2P_CMD_EPC_COMMAND_WRITE 0x30000000
775 #define LAN9353_E2P_CMD_EPC_COMMAND_RELOAD 0x70000000
776 #define LAN9353_E2P_CMD_LOADER_OVERFLOW 0x00040000
777 #define LAN9353_E2P_CMD_EPC_TIMEOUT 0x00020000
778 #define LAN9353_E2P_CMD_CFG_LOADED 0x00010000
779 #define LAN9353_E2P_CMD_EPC_ADDR 0x0000FFFF
780 
781 //EEPROM Data register
782 #define LAN9353_E2P_DATA_EEPROM_DATA 0x000000FF
783 
784 //LED Configuration register
785 #define LAN9353_LED_CFG_LED_FUN 0x00000700
786 #define LAN9353_LED_CFG_LED_FUN_0 0x00000000
787 #define LAN9353_LED_CFG_LED_FUN_1 0x00000100
788 #define LAN9353_LED_CFG_LED_FUN_2 0x00000200
789 #define LAN9353_LED_CFG_LED_FUN_3 0x00000300
790 #define LAN9353_LED_CFG_LED_FUN_4 0x00000400
791 #define LAN9353_LED_CFG_LED_FUN_5 0x00000500
792 #define LAN9353_LED_CFG_LED_FUN_RESERVED 0x00000600
793 #define LAN9353_LED_CFG_LED_FUN_7 0x00000700
794 #define LAN9353_LED_CFG_LED_EN 0x0000003F
795 #define LAN9353_LED_CFG_LED_EN_0 0x00000001
796 #define LAN9353_LED_CFG_LED_EN_1 0x00000002
797 #define LAN9353_LED_CFG_LED_EN_2 0x00000004
798 #define LAN9353_LED_CFG_LED_EN_3 0x00000008
799 #define LAN9353_LED_CFG_LED_EN_4 0x00000010
800 #define LAN9353_LED_CFG_LED_EN_5 0x00000020
801 
802 //Port 0 Virtual PHY Basic Control register
803 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_RST 0x00008000
804 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_LOOPBACK 0x00004000
805 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_SPEED_SEL_LSB 0x00002000
806 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_AN 0x00001000
807 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_PWR_DWN 0x00000800
808 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_ISO 0x00000400
809 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_RST_AN 0x00000200
810 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_DUPLEX 0x00000100
811 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_COL_TEST 0x00000080
812 #define LAN9353_VPHY_BASIC_CTRL_0_VPHY_SPEED_SEL_MSB 0x00000040
813 
814 //Port 0 Virtual PHY Basic Status register
815 #define LAN9353_VPHY_BASIC_STATUS_0_100BT4 0x00008000
816 #define LAN9353_VPHY_BASIC_STATUS_0_100BTX_FD 0x00004000
817 #define LAN9353_VPHY_BASIC_STATUS_0_100BTX_HD 0x00002000
818 #define LAN9353_VPHY_BASIC_STATUS_0_10BT_FD 0x00001000
819 #define LAN9353_VPHY_BASIC_STATUS_0_10BT_HD 0x00000800
820 #define LAN9353_VPHY_BASIC_STATUS_0_100BT2_FD 0x00000400
821 #define LAN9353_VPHY_BASIC_STATUS_0_100BT2_HD 0x00000200
822 #define LAN9353_VPHY_BASIC_STATUS_0_EXTENDED_STATUS 0x00000100
823 #define LAN9353_VPHY_BASIC_STATUS_0_MF_PREAMBLE_SUPPR 0x00000040
824 #define LAN9353_VPHY_BASIC_STATUS_0_AN_COMPLETE 0x00000020
825 #define LAN9353_VPHY_BASIC_STATUS_0_REMOTE_FAULT 0x00000010
826 #define LAN9353_VPHY_BASIC_STATUS_0_AN_CAPABLE 0x00000008
827 #define LAN9353_VPHY_BASIC_STATUS_0_LINK_STATUS 0x00000004
828 #define LAN9353_VPHY_BASIC_STATUS_0_JABBER_DETECT 0x00000002
829 #define LAN9353_VPHY_BASIC_STATUS_0_EXTENDED_CAPABLE 0x00000001
830 
831 //Port 0 Virtual PHY Identification MSB register
832 #define LAN9353_VPHY_ID_MSB_0_PHY_ID_MSB 0x0000FFFF
833 
834 //Port 0 Virtual PHY Identification LSB register
835 #define LAN9353_VPHY_ID_LSB_0_PHY_ID_LSB 0x0000FC00
836 #define LAN9353_VPHY_ID_LSB_0_MODEL_NUM 0x000003F0
837 #define LAN9353_VPHY_ID_LSB_0_REVISION_NUM 0x0000000F
838 
839 //Port 0 Virtual PHY Auto-Negotiation Advertisement register
840 #define LAN9353_VPHY_AN_ADV_0_NEXT_PAGE 0x00008000
841 #define LAN9353_VPHY_AN_ADV_0_REMOTE_FAULT 0x00002000
842 #define LAN9353_VPHY_AN_ADV_0_ASYM_PAUSE 0x00000800
843 #define LAN9353_VPHY_AN_ADV_0_SYM_PAUSE 0x00000400
844 #define LAN9353_VPHY_AN_ADV_0_100BTX_FD 0x00000100
845 #define LAN9353_VPHY_AN_ADV_0_100BTX_HD 0x00000080
846 #define LAN9353_VPHY_AN_ADV_0_10BT_FD 0x00000040
847 #define LAN9353_VPHY_AN_ADV_0_10BT_HD 0x00000020
848 #define LAN9353_VPHY_AN_ADV_0_SELECTOR 0x0000001F
849 #define LAN9353_VPHY_AN_ADV_0_SELECTOR_DEFAULT 0x00000001
850 
851 //Port 0 Virtual PHY Auto-Negotiation Link Partner Base Page Ability register
852 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_NEXT_PAGE 0x00008000
853 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_ACK 0x00004000
854 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_REMOTE_FAULT 0x00002000
855 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_ASYM_PAUSE 0x00000800
856 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_SYM_PAUSE 0x00000400
857 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_100BT4 0x00000200
858 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_100BTX_FD 0x00000100
859 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_100BTX_HD 0x00000080
860 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_10BT_FD 0x00000040
861 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_10BT_HD 0x00000020
862 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_SELECTOR 0x0000001F
863 #define LAN9353_VPHY_AN_LP_BASE_ABILITY_0_SELECTOR_DEFAULT 0x00000001
864 
865 //Port 0 Virtual PHY Auto-Negotiation Expansion register
866 #define LAN9353_VPHY_AN_EXP_0_PAR_DETECT_FAULT 0x00000010
867 #define LAN9353_VPHY_AN_EXP_0_LP_NEXT_PAGE_ABLE 0x00000008
868 #define LAN9353_VPHY_AN_EXP_0_NEXT_PAGE_ABLE 0x00000004
869 #define LAN9353_VPHY_AN_EXP_0_PAGE_RECEIVED 0x00000002
870 #define LAN9353_VPHY_AN_EXP_0_LP_AN_ABLE 0x00000001
871 
872 //Port 0 Virtual PHY Special Control/Status register
873 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE2 0x00008000
874 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_SW_LOOPBACK 0x00004000
875 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_TURBO_MODE_EN 0x00000400
876 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE 0x00000300
877 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE_MII_MAC 0x00000000
878 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE_MII_PHY 0x00000100
879 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE_RMII_MAC 0x00000200
880 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_MODE_RMII_PHY 0x00000300
881 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_SW_COL_TEST 0x00000080
882 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_RMII_CLK_DIR 0x00000040
883 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_RMII_CLK_DIR_IN 0x00000000
884 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_RMII_CLK_DIR_OUT 0x00000040
885 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_RMII_CLK_STRENGTH 0x00000020
886 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_IND 0x0000001C
887 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_IND_10_HD 0x00000004
888 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_IND_100_200_HD 0x00000008
889 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_IND_10_FD 0x00000014
890 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_IND_100_200_FD 0x00000018
891 #define LAN9353_VPHY_SPECIAL_CTRL_STATUS_0_SQEOFF 0x00000001
892 
893 //General Purpose I/O Configuration register
894 #define LAN9353_GPIO_CFG_GPIO_CH_SEL 0xFF000000
895 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_0 0x01000000
896 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_1 0x02000000
897 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_2 0x04000000
898 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_3 0x08000000
899 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_4 0x10000000
900 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_5 0x20000000
901 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_6 0x40000000
902 #define LAN9353_GPIO_CFG_GPIO_CH_SEL_7 0x80000000
903 #define LAN9353_GPIO_CFG_GPIO_INT_POL 0x00FF0000
904 #define LAN9353_GPIO_CFG_GPIO_INT_POL_0 0x00010000
905 #define LAN9353_GPIO_CFG_GPIO_INT_POL_1 0x00020000
906 #define LAN9353_GPIO_CFG_GPIO_INT_POL_2 0x00040000
907 #define LAN9353_GPIO_CFG_GPIO_INT_POL_3 0x00080000
908 #define LAN9353_GPIO_CFG_GPIO_INT_POL_4 0x00100000
909 #define LAN9353_GPIO_CFG_GPIO_INT_POL_5 0x00200000
910 #define LAN9353_GPIO_CFG_GPIO_INT_POL_6 0x00400000
911 #define LAN9353_GPIO_CFG_GPIO_INT_POL_7 0x00800000
912 #define LAN9353_GPIO_CFG_1588_GPIO_OE 0x0000FF00
913 #define LAN9353_GPIO_CFG_1588_GPIO_OE_0 0x00000100
914 #define LAN9353_GPIO_CFG_1588_GPIO_OE_1 0x00000200
915 #define LAN9353_GPIO_CFG_1588_GPIO_OE_2 0x00000400
916 #define LAN9353_GPIO_CFG_1588_GPIO_OE_3 0x00000800
917 #define LAN9353_GPIO_CFG_1588_GPIO_OE_4 0x00001000
918 #define LAN9353_GPIO_CFG_1588_GPIO_OE_5 0x00002000
919 #define LAN9353_GPIO_CFG_1588_GPIO_OE_6 0x00004000
920 #define LAN9353_GPIO_CFG_1588_GPIO_OE_7 0x00008000
921 #define LAN9353_GPIO_CFG_GPIOBUF 0x000000FF
922 #define LAN9353_GPIO_CFG_GPIOBUF_0 0x00000001
923 #define LAN9353_GPIO_CFG_GPIOBUF_1 0x00000002
924 #define LAN9353_GPIO_CFG_GPIOBUF_2 0x00000004
925 #define LAN9353_GPIO_CFG_GPIOBUF_3 0x00000008
926 #define LAN9353_GPIO_CFG_GPIOBUF_4 0x00000010
927 #define LAN9353_GPIO_CFG_GPIOBUF_5 0x00000020
928 #define LAN9353_GPIO_CFG_GPIOBUF_6 0x00000040
929 #define LAN9353_GPIO_CFG_GPIOBUF_7 0x00000080
930 
931 //General Purpose I/O Data and Direction register
932 #define LAN9353_GPIO_DATA_DIR_GPDIR 0x00FF0000
933 #define LAN9353_GPIO_DATA_DIR_GPDIR_0 0x00010000
934 #define LAN9353_GPIO_DATA_DIR_GPDIR_1 0x00020000
935 #define LAN9353_GPIO_DATA_DIR_GPDIR_2 0x00040000
936 #define LAN9353_GPIO_DATA_DIR_GPDIR_3 0x00080000
937 #define LAN9353_GPIO_DATA_DIR_GPDIR_4 0x00100000
938 #define LAN9353_GPIO_DATA_DIR_GPDIR_5 0x00200000
939 #define LAN9353_GPIO_DATA_DIR_GPDIR_6 0x00400000
940 #define LAN9353_GPIO_DATA_DIR_GPDIR_7 0x00800000
941 #define LAN9353_GPIO_DATA_DIR_GPIOD 0x000000FF
942 #define LAN9353_GPIO_DATA_DIR_GPIOD_0 0x00000001
943 #define LAN9353_GPIO_DATA_DIR_GPIOD_1 0x00000002
944 #define LAN9353_GPIO_DATA_DIR_GPIOD_2 0x00000004
945 #define LAN9353_GPIO_DATA_DIR_GPIOD_3 0x00000008
946 #define LAN9353_GPIO_DATA_DIR_GPIOD_4 0x00000010
947 #define LAN9353_GPIO_DATA_DIR_GPIOD_5 0x00000020
948 #define LAN9353_GPIO_DATA_DIR_GPIOD_6 0x00000040
949 #define LAN9353_GPIO_DATA_DIR_GPIOD_7 0x00000080
950 
951 //General Purpose I/O Interrupt Status and Enable register
952 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN 0x00FF0000
953 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_0 0x00010000
954 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_1 0x00020000
955 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_2 0x00040000
956 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_3 0x00080000
957 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_4 0x00100000
958 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_5 0x00200000
959 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_6 0x00400000
960 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_EN_7 0x00800000
961 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT 0x000000FF
962 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_0 0x00000001
963 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_1 0x00000002
964 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_2 0x00000004
965 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_3 0x00000008
966 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_4 0x00000010
967 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_5 0x00000020
968 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_6 0x00000040
969 #define LAN9353_GPIO_INT_STS_EN_GPIO_INT_7 0x00000080
970 
971 //Switch Fabric MAC Address High register
972 #define LAN9353_SWITCH_MAC_ADDRH_DIFF_PAUSE_ADDR 0x00400000
973 #define LAN9353_SWITCH_MAC_ADDRH_PORT2_PHY_ADDR_41_40 0x00300000
974 #define LAN9353_SWITCH_MAC_ADDRH_PORT1_PHY_ADDR_41_40 0x000C0000
975 #define LAN9353_SWITCH_MAC_ADDRH_PORT0_PHY_ADDR_41_40 0x00030000
976 #define LAN9353_SWITCH_MAC_ADDRH_PHY_ADDR_47_32 0x0000FFFF
977 
978 //Switch Fabric MAC Address Low register
979 #define LAN9353_SWITCH_MAC_ADDRL_PHY_ADDR_31_0 0xFFFFFFFF
980 
981 //Reset Control register
982 #define LAN9353_RESET_CTL_VPHY_1_RST 0x00000010
983 #define LAN9353_RESET_CTL_VPHY_0_RST 0x00000008
984 #define LAN9353_RESET_CTL_PHY_B_RST 0x00000004
985 #define LAN9353_RESET_CTL_PHY_A_RST 0x00000002
986 #define LAN9353_RESET_CTL_DIGITAL_RST 0x00000001
987 
988 //Switch Device ID register
989 #define LAN9353_SW_DEV_ID_DEVICE_TYPE 0x00FF0000
990 #define LAN9353_SW_DEV_ID_DEVICE_TYPE_DEFAULT 0x00030000
991 #define LAN9353_SW_DEV_ID_CHIP_VERSION 0x0000FF00
992 #define LAN9353_SW_DEV_ID_CHIP_VERSION_DEFAULT 0x00000600
993 #define LAN9353_SW_DEV_ID_REVISION 0x000000FF
994 #define LAN9353_SW_DEV_ID_REVISION_DEFAULT 0x00000007
995 
996 //Switch Reset register
997 #define LAN9353_SW_RESET_SW_RESET 0x00000001
998 
999 //Switch Global Interrupt Mask register
1000 #define LAN9353_SW_IMR_BM 0x00000040
1001 #define LAN9353_SW_IMR_SWE 0x00000020
1002 #define LAN9353_SW_IMR_MAC2 0x00000004
1003 #define LAN9353_SW_IMR_MAC1 0x00000002
1004 #define LAN9353_SW_IMR_MAC0 0x00000001
1005 
1006 //Switch Global Interrupt Pending register
1007 #define LAN9353_SW_IPR_BM 0x00000040
1008 #define LAN9353_SW_IPR_SWE 0x00000020
1009 #define LAN9353_SW_IPR_MAC2 0x00000004
1010 #define LAN9353_SW_IPR_MAC1 0x00000002
1011 #define LAN9353_SW_IPR_MAC0 0x00000001
1012 
1013 //Port x MAC Version ID register
1014 #define LAN9353_MAC_VER_ID_DEVICE_TYPE 0x00000F00
1015 #define LAN9353_MAC_VER_ID_DEVICE_TYPE_DEFAULT 0x00000500
1016 #define LAN9353_MAC_VER_ID_CHIP_VERSION 0x000000F0
1017 #define LAN9353_MAC_VER_ID_CHIP_VERSION_DEFAULT 0x00000090
1018 #define LAN9353_MAC_VER_ID_REVISION 0x0000000F
1019 #define LAN9353_MAC_VER_ID_REVISION_DEFAULT 0x00000003
1020 
1021 //Port x MAC Receive Configuration register
1022 #define LAN9353_MAC_RX_CFG_RECEIVE_OWN_TRANSMIT_EN 0x00000020
1023 #define LAN9353_MAC_RX_CFG_JUMBO_2K 0x00000008
1024 #define LAN9353_MAC_RX_CFG_REJECT_MAC_TYPES 0x00000002
1025 #define LAN9353_MAC_RX_CFG_RX_EN 0x00000001
1026 
1027 //Port x MAC Transmit Configuration register
1028 #define LAN9353_MAC_TX_CFG_EEE_EN 0x00000100
1029 #define LAN9353_MAC_TX_CFG_MAC_COUNTER_TEST 0x00000080
1030 #define LAN9353_MAC_TX_CFG_IFG_CONFIG 0x0000007C
1031 #define LAN9353_MAC_TX_CFG_IFG_CONFIG_DEFAULT 0x00000054
1032 #define LAN9353_MAC_TX_CFG_TX_PAD_EN 0x00000002
1033 #define LAN9353_MAC_TX_CFG_TX_EN 0x00000001
1034 
1035 //Switch Engine ALR Command register
1036 #define LAN9353_SWE_ALR_CMD_MAKE_ENTRY 0x00000004
1037 #define LAN9353_SWE_ALR_CMD_GET_FIRST_ENTRY 0x00000002
1038 #define LAN9353_SWE_ALR_CMD_GET_NEXT_ENTRY 0x00000001
1039 
1040 //Switch Engine ALR Write Data 0 register
1041 #define LAN9353_SWE_ALR_WR_DAT_0_MAC_ADDR 0xFFFFFFFF
1042 
1043 //Switch Engine ALR Write Data 1 register
1044 #define LAN9353_SWE_ALR_WR_DAT_1_VALID 0x04000000
1045 #define LAN9353_SWE_ALR_WR_DAT_1_AGE1_OVERRIDE 0x02000000
1046 #define LAN9353_SWE_ALR_WR_DAT_1_STATIC 0x01000000
1047 #define LAN9353_SWE_ALR_WR_DAT_1_AGE0_FILTER 0x00800000
1048 #define LAN9353_SWE_ALR_WR_DAT_1_PRIORITY_EN 0x00400000
1049 #define LAN9353_SWE_ALR_WR_DAT_1_PRIORITY 0x00380000
1050 #define LAN9353_SWE_ALR_WR_DAT_1_PORT 0x00070000
1051 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_0 0x00000000
1052 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_1 0x00010000
1053 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_2 0x00020000
1054 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_RESERVED 0x00030000
1055 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_0_1 0x00040000
1056 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_0_2 0x00050000
1057 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_1_2 0x00060000
1058 #define LAN9353_SWE_ALR_WR_DAT_1_PORT_0_1_2 0x00070000
1059 #define LAN9353_SWE_ALR_WR_DAT_1_MAC_ADDR 0x0000FFFF
1060 
1061 //Switch Engine ALR Read Data 0 register
1062 #define LAN9353_SWE_ALR_RD_DAT_0_MAC_ADDR 0xFFFFFFFF
1063 
1064 //Switch Engine ALR Read Data 1 register
1065 #define LAN9353_SWE_ALR_RD_DAT_1_END_OF_TABLE 0x08000000
1066 #define LAN9353_SWE_ALR_RD_DAT_1_VALID 0x04000000
1067 #define LAN9353_SWE_ALR_RD_DAT_1_AGE1_OVERRIDE 0x02000000
1068 #define LAN9353_SWE_ALR_RD_DAT_1_STATIC 0x01000000
1069 #define LAN9353_SWE_ALR_RD_DAT_1_AGE0_FILTER 0x00800000
1070 #define LAN9353_SWE_ALR_RD_DAT_1_PRIORITY_EN 0x00400000
1071 #define LAN9353_SWE_ALR_RD_DAT_1_PRIORITY 0x00380000
1072 #define LAN9353_SWE_ALR_RD_DAT_1_PORT 0x00070000
1073 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_0 0x00000000
1074 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_1 0x00010000
1075 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_2 0x00020000
1076 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_RESERVED 0x00030000
1077 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_0_1 0x00040000
1078 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_0_2 0x00050000
1079 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_1_2 0x00060000
1080 #define LAN9353_SWE_ALR_RD_DAT_1_PORT_0_1_2 0x00070000
1081 #define LAN9353_SWE_ALR_RD_DAT_1_MAC_ADDR 0x0000FFFF
1082 
1083 //Switch Engine ALR Command Status register
1084 #define LAN9353_SWE_ALR_CMD_STS_ALR_INIT_DONE 0x00000002
1085 #define LAN9353_SWE_ALR_CMD_STS_OPERATION_PENDING 0x00000001
1086 
1087 //Switch Engine ALR Configuration register
1088 #define LAN9353_SWE_ALR_CFG_AGING_TIME 0x0FFF0000
1089 #define LAN9353_SWE_ALR_CFG_AGING_TIME_DEFAULT 0x01290000
1090 #define LAN9353_SWE_ALR_CFG_ALLOW_BROADCAST 0x00000004
1091 #define LAN9353_SWE_ALR_CFG_ALR_AGE_EN 0x00000002
1092 #define LAN9353_SWE_ALR_CFG_ALR_AGE_TEST 0x00000001
1093 
1094 //Switch Engine ALR Override register
1095 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT2 0x00000600
1096 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT2_PORT0 0x00000000
1097 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT2_PORT1 0x00000200
1098 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT2_EN 0x00000100
1099 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT1 0x00000060
1100 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT1_PORT0 0x00000000
1101 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT1_PORT2 0x00000040
1102 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT1_EN 0x00000010
1103 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT0 0x00000006
1104 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT0_PORT1 0x00000002
1105 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT0_PORT2 0x00000004
1106 #define LAN9353_SWE_ALR_OVERRIDE_ALR_OVERRIDE_PORT0_EN 0x00000001
1107 
1108 //Switch Engine VLAN Command register
1109 #define LAN9353_SWE_VLAN_CMD_WRITE 0x00000000
1110 #define LAN9353_SWE_VLAN_CMD_READ 0x00000020
1111 #define LAN9353_SWE_VLAN_CMD_VLAN 0x00000000
1112 #define LAN9353_SWE_VLAN_CMD_PVID 0x00000010
1113 #define LAN9353_SWE_VLAN_CMD_VLAN_PORT 0x0000000F
1114 
1115 //Switch Engine Global Ingress Configuration register
1116 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_OTHER_MLD_NEXT_HDR_EN 0x00020000
1117 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_ANY_HOP_BY_HOP_NEXT_HDR 0x00010000
1118 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_802_1Q_VLAN_DIS 0x00008000
1119 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_USE_TAG 0x00004000
1120 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_ALLOW_MONITOR_ECHO 0x00002000
1121 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_MLD_IGMP_MONITOR_PORT 0x00001C00
1122 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_MLD_IGMP_MONITOR_PORT_0 0x00000400
1123 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_MLD_IGMP_MONITOR_PORT_1 0x00000800
1124 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_MLD_IGMP_MONITOR_PORT_2 0x00001000
1125 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_USE_IP 0x00000200
1126 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_MLD_MONITORING_EN 0x00000100
1127 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITORING_EN 0x00000080
1128 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_SWE_COUNTER_TEST 0x00000040
1129 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_DA_HIGHEST_PRIORITY 0x00000020
1130 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_FILTER_MULTICAST 0x00000010
1131 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_DROP_UNKNOWN 0x00000008
1132 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_USE_PRECEDENCE 0x00000004
1133 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_VL_HIGHER_PRIORITY 0x00000002
1134 #define LAN9353_SWE_GLOBAL_INGRSS_CFG_VLAN_EN 0x00000001
1135 
1136 //Switch Engine Port Ingress Configuration register
1137 #define LAN9353_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS 0x00000038
1138 #define LAN9353_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT0 0x00000000
1139 #define LAN9353_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT1 0x00000008
1140 #define LAN9353_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT2 0x00000010
1141 #define LAN9353_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK 0x00000007
1142 #define LAN9353_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT0 0x00000000
1143 #define LAN9353_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT1 0x00000001
1144 #define LAN9353_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT2 0x00000002
1145 
1146 //Switch Engine Admit Only VLAN register
1147 #define LAN9353_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN 0x00000007
1148 #define LAN9353_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT0 0x00000001
1149 #define LAN9353_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT1 0x00000002
1150 #define LAN9353_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT2 0x00000004
1151 
1152 //Switch Engine Port State register
1153 #define LAN9353_SWE_PORT_STATE_PORT2 0x00000030
1154 #define LAN9353_SWE_PORT_STATE_PORT2_FORWARDING 0x00000000
1155 #define LAN9353_SWE_PORT_STATE_PORT2_LISTENING 0x00000010
1156 #define LAN9353_SWE_PORT_STATE_PORT2_LEARNING 0x00000020
1157 #define LAN9353_SWE_PORT_STATE_PORT2_DISABLED 0x00000030
1158 #define LAN9353_SWE_PORT_STATE_PORT1 0x0000000C
1159 #define LAN9353_SWE_PORT_STATE_PORT1_FORWARDING 0x00000000
1160 #define LAN9353_SWE_PORT_STATE_PORT1_LISTENING 0x00000004
1161 #define LAN9353_SWE_PORT_STATE_PORT1_LEARNING 0x00000008
1162 #define LAN9353_SWE_PORT_STATE_PORT1_DISABLED 0x0000000C
1163 #define LAN9353_SWE_PORT_STATE_PORT0 0x00000003
1164 #define LAN9353_SWE_PORT_STATE_PORT0_FORWARDING 0x00000000
1165 #define LAN9353_SWE_PORT_STATE_PORT0_LISTENING 0x00000001
1166 #define LAN9353_SWE_PORT_STATE_PORT0_LEARNING 0x00000002
1167 #define LAN9353_SWE_PORT_STATE_PORT0_DISABLED 0x00000003
1168 
1169 //Switch Engine Priority to Queue register
1170 #define LAN9353_SWE_PRI_TO_QUE_PRIO_7_TRAFFIC_CLASS 0x0000C000
1171 #define LAN9353_SWE_PRI_TO_QUE_PRIO_6_TRAFFIC_CLASS 0x00003000
1172 #define LAN9353_SWE_PRI_TO_QUE_PRIO_5_TRAFFIC_CLASS 0x00000C00
1173 #define LAN9353_SWE_PRI_TO_QUE_PRIO_4_TRAFFIC_CLASS 0x00000300
1174 #define LAN9353_SWE_PRI_TO_QUE_PRIO_3_TRAFFIC_CLASS 0x000000C0
1175 #define LAN9353_SWE_PRI_TO_QUE_PRIO_2_TRAFFIC_CLASS 0x00000030
1176 #define LAN9353_SWE_PRI_TO_QUE_PRIO_1_TRAFFIC_CLASS 0x0000000C
1177 #define LAN9353_SWE_PRI_TO_QUE_PRIO_0_TRAFFIC_CLASS 0x00000003
1178 
1179 //Switch Engine Port Mirroring register
1180 #define LAN9353_SWE_PORT_MIRROR_RX_MIRRORING_FILT_EN 0x00000100
1181 #define LAN9353_SWE_PORT_MIRROR_SNIFFER_PORT 0x000000E0
1182 #define LAN9353_SWE_PORT_MIRROR_SNIFFER_PORT_0 0x00000020
1183 #define LAN9353_SWE_PORT_MIRROR_SNIFFER_PORT_1 0x00000040
1184 #define LAN9353_SWE_PORT_MIRROR_SNIFFER_PORT_2 0x00000080
1185 #define LAN9353_SWE_PORT_MIRROR_MIRRORED_PORT 0x0000001C
1186 #define LAN9353_SWE_PORT_MIRROR_MIRRORED_PORT_0 0x00000004
1187 #define LAN9353_SWE_PORT_MIRROR_MIRRORED_PORT_1 0x00000008
1188 #define LAN9353_SWE_PORT_MIRROR_MIRRORED_PORT_2 0x00000010
1189 #define LAN9353_SWE_PORT_MIRROR_RX_MIRRORING_EN 0x00000002
1190 #define LAN9353_SWE_PORT_MIRROR_TX_MIRRORING_EN 0x00000001
1191 
1192 //Switch Engine Ingress Port Type register
1193 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT2 0x00000030
1194 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT2_DIS 0x00000000
1195 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT2_EN 0x00000030
1196 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT1 0x0000000C
1197 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT1_DIS 0x00000000
1198 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT1_EN 0x0000000C
1199 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT0 0x00000003
1200 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT0_DIS 0x00000000
1201 #define LAN9353_SWE_INGRSS_PORT_TYP_PORT0_EN 0x00000003
1202 
1203 //Buffer Manager Egress Port Type register
1204 #define LAN9353_BM_EGRSS_PORT_TYPE_VID_SEL_PORT2 0x00400000
1205 #define LAN9353_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT2 0x00200000
1206 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT2 0x00100000
1207 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT2 0x00080000
1208 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT2 0x00040000
1209 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT2_TYPE 0x00030000
1210 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT2_TYPE_DUMB 0x00000000
1211 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT2_TYPE_ACCESS 0x00010000
1212 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT2_TYPE_HYBRID 0x00020000
1213 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT2_TYPE_CPU 0x00030000
1214 #define LAN9353_BM_EGRSS_PORT_TYPE_VID_SEL_PORT1 0x00004000
1215 #define LAN9353_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT1 0x00002000
1216 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT1 0x00001000
1217 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT1 0x00000800
1218 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT1 0x00000400
1219 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT1_TYPE 0x00000300
1220 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT1_TYPE_DUMB 0x00000000
1221 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT1_TYPE_ACCESS 0x00000100
1222 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT1_TYPE_HYBRID 0x00000200
1223 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT1_TYPE_CPU 0x00000300
1224 #define LAN9353_BM_EGRSS_PORT_TYPE_VID_SEL_PORT0 0x00000040
1225 #define LAN9353_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT0 0x00000020
1226 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT0 0x00000010
1227 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT0 0x00000008
1228 #define LAN9353_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT0 0x00000004
1229 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT0_TYPE 0x00000003
1230 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT0_TYPE_DUMB 0x00000000
1231 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT0_TYPE_ACCESS 0x00000001
1232 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT0_TYPE_HYBRID 0x00000002
1233 #define LAN9353_BM_EGRSS_PORT_TYPE_PORT0_TYPE_CPU 0x00000003
1234 
1235 //C++ guard
1236 #ifdef __cplusplus
1237 extern "C" {
1238 #endif
1239 
1240 //LAN9353 Ethernet switch driver
1241 extern const SwitchDriver lan9353SwitchDriver;
1242 
1243 //LAN9353 related functions
1244 error_t lan9353Init(NetInterface *interface);
1245 void lan9353InitHook(NetInterface *interface);
1246 
1247 void lan9353Tick(NetInterface *interface);
1248 
1249 void lan9353EnableIrq(NetInterface *interface);
1250 void lan9353DisableIrq(NetInterface *interface);
1251 
1252 void lan9353EventHandler(NetInterface *interface);
1253 
1254 error_t lan9353TagFrame(NetInterface *interface, NetBuffer *buffer,
1255  size_t *offset, NetTxAncillary *ancillary);
1256 
1257 error_t lan9353UntagFrame(NetInterface *interface, uint8_t **frame,
1258  size_t *length, NetRxAncillary *ancillary);
1259 
1260 bool_t lan9353GetLinkState(NetInterface *interface, uint8_t port);
1261 uint32_t lan9353GetLinkSpeed(NetInterface *interface, uint8_t port);
1263 
1264 void lan9353SetPortState(NetInterface *interface, uint8_t port,
1265  SwitchPortState state);
1266 
1268 
1269 void lan9353SetAgingTime(NetInterface *interface, uint32_t agingTime);
1270 
1271 void lan9353EnableIgmpSnooping(NetInterface *interface, bool_t enable);
1272 void lan9353EnableMldSnooping(NetInterface *interface, bool_t enable);
1273 void lan9353EnableRsvdMcastTable(NetInterface *interface, bool_t enable);
1274 
1276  const SwitchFdbEntry *entry);
1277 
1279  const SwitchFdbEntry *entry);
1280 
1282  SwitchFdbEntry *entry);
1283 
1284 void lan9353FlushStaticFdbTable(NetInterface *interface);
1285 
1287  SwitchFdbEntry *entry);
1288 
1289 void lan9353FlushDynamicFdbTable(NetInterface *interface, uint8_t port);
1290 
1292  bool_t enable, uint32_t forwardPorts);
1293 
1294 void lan9353WritePhyReg(NetInterface *interface, uint8_t port,
1295  uint8_t address, uint16_t data);
1296 
1297 uint16_t lan9353ReadPhyReg(NetInterface *interface, uint8_t port,
1298  uint8_t address);
1299 
1300 void lan9353DumpPhyReg(NetInterface *interface, uint8_t port);
1301 
1302 void lan9353WriteSysReg(NetInterface *interface, uint16_t address,
1303  uint32_t data);
1304 
1305 uint32_t lan9353ReadSysReg(NetInterface *interface, uint16_t address);
1306 
1307 void lan9353DumpSysReg(NetInterface *interface);
1308 
1309 void lan9353WriteSwitchReg(NetInterface *interface, uint16_t address,
1310  uint32_t data);
1311 
1312 uint32_t lan9353ReadSwitchReg(NetInterface *interface, uint16_t address);
1313 
1314 //C++ guard
1315 #ifdef __cplusplus
1316 }
1317 #endif
1318 
1319 #endif
void lan9353InitHook(NetInterface *interface)
LAN9353 custom configuration.
void lan9353WriteSwitchReg(NetInterface *interface, uint16_t address, uint32_t data)
Write switch fabric CSR register.
int bool_t
Definition: compiler_port.h:53
error_t lan9353GetDynamicFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the dynamic MAC table.
void lan9353EnableRsvdMcastTable(NetInterface *interface, bool_t enable)
Enable reserved multicast table.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t data[]
Definition: ethernet.h:222
void lan9353SetUnknownMcastFwdPorts(NetInterface *interface, bool_t enable, uint32_t forwardPorts)
Set forward ports for unknown multicast packets.
uint32_t lan9353ReadSwitchReg(NetInterface *interface, uint16_t address)
Read switch fabric CSR register.
error_t lan9353GetStaticFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the static MAC table.
void lan9353EventHandler(NetInterface *interface)
LAN9353 event handler.
void lan9353FlushStaticFdbTable(NetInterface *interface)
Flush static MAC table.
error_t lan9353AddStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Add a new entry to the static MAC table.
const SwitchDriver lan9353SwitchDriver
LAN9353 Ethernet switch driver.
void lan9353WritePhyReg(NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
Write PHY register.
error_t lan9353UntagFrame(NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary)
Decode special VLAN tag from incoming Ethernet frame.
uint32_t lan9353ReadSysReg(NetInterface *interface, uint16_t address)
Read system CSR register.
void lan9353DisableIrq(NetInterface *interface)
Disable interrupts.
error_t
Error codes.
Definition: error.h:43
error_t lan9353DeleteStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Remove an entry from the static MAC table.
void lan9353EnableIrq(NetInterface *interface)
Enable interrupts.
void lan9353DumpPhyReg(NetInterface *interface, uint8_t port)
Dump PHY registers for debugging purpose.
SwitchPortState lan9353GetPortState(NetInterface *interface, uint8_t port)
Get port state.
void lan9353EnableMldSnooping(NetInterface *interface, bool_t enable)
Enable MLD snooping.
error_t lan9353Init(NetInterface *interface)
LAN9353 Ethernet switch initialization.
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
void lan9353SetAgingTime(NetInterface *interface, uint32_t agingTime)
Set aging time for dynamic filtering entries.
#define NetTxAncillary
Definition: net_misc.h:36
error_t lan9353TagFrame(NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary)
Add special VLAN tag to Ethernet frame.
SwitchPortState
Switch port state.
Definition: nic.h:134
void lan9353Tick(NetInterface *interface)
LAN9353 timer handler.
uint8_t length
Definition: tcp.h:368
uint16_t port
Definition: dns_common.h:267
void lan9353SetPortState(NetInterface *interface, uint8_t port, SwitchPortState state)
Set port state.
Ethernet switch driver.
Definition: nic.h:325
void lan9353WriteSysReg(NetInterface *interface, uint16_t address, uint32_t data)
Write system CSR register.
Ipv6Addr address[]
Definition: ipv6.h:325
NicDuplexMode
Duplex mode.
Definition: nic.h:122
Network interface controller abstraction layer.
NicDuplexMode lan9353GetDuplexMode(NetInterface *interface, uint8_t port)
Get duplex mode.
uint16_t lan9353ReadPhyReg(NetInterface *interface, uint8_t port, uint8_t address)
Read PHY register.
void lan9353DumpSysReg(NetInterface *interface)
Dump system CSR registers for debugging purpose.
unsigned int uint_t
Definition: compiler_port.h:50
void lan9353FlushDynamicFdbTable(NetInterface *interface, uint8_t port)
Flush dynamic MAC table.
uint32_t lan9353GetLinkSpeed(NetInterface *interface, uint8_t port)
Get link speed.
void lan9353EnableIgmpSnooping(NetInterface *interface, bool_t enable)
Enable IGMP snooping.
bool_t lan9353GetLinkState(NetInterface *interface, uint8_t port)
Get link state.
Forwarding database entry.
Definition: nic.h:149