31#ifndef _LAN9303_DRIVER_H
32#define _LAN9303_DRIVER_H
38#define LAN9303_PORT0 3
39#define LAN9303_PORT1 1
40#define LAN9303_PORT2 2
43#define LAN9303_PORT_MASK 0x07
44#define LAN9303_PORT0_MASK 0x04
45#define LAN9303_PORT1_MASK 0x01
46#define LAN9303_PORT2_MASK 0x02
47#define LAN9303_PORT0_1_MASK 0x05
48#define LAN9303_PORT0_2_MASK 0x06
49#define LAN9303_PORT1_2_MASK 0x03
50#define LAN9303_PORT0_1_2_MASK 0x07
53#define LAN9303_ALR_TABLE_SIZE 512
56#define LAN9303_VID_VLAN_RULES 0x0040
57#define LAN9303_VID_CALC_PRIORITY 0x0020
58#define LAN9303_VID_STP_OVERRIDE 0x0010
59#define LAN9303_VID_ALR_LOOKUP 0x0008
60#define LAN9303_VID_BROADCAST 0x0003
61#define LAN9303_VID_DEST_PORT2 0x0002
62#define LAN9303_VID_DEST_PORT1 0x0001
63#define LAN9303_VID_DEST_PORT0 0x0000
66#define LAN9303_VID_PRIORITY 0x0380
67#define LAN9303_VID_PRIORITY_EN 0x0040
68#define LAN9303_VID_STATIC 0x0020
69#define LAN9303_VID_STP_OVERRIDE 0x0010
70#define LAN9303_VID_IGMP_PACKET 0x0008
71#define LAN9303_VID_SRC_PORT 0x0003
74#define LAN9303_BMCR 0x00
75#define LAN9303_BMSR 0x01
76#define LAN9303_PHYID1 0x02
77#define LAN9303_PHYID2 0x03
78#define LAN9303_ANAR 0x04
79#define LAN9303_ANLPAR 0x05
80#define LAN9303_ANER 0x06
81#define LAN9303_PMCSR 0x11
82#define LAN9303_PSMR 0x12
83#define LAN9303_PSCSIR 0x1B
84#define LAN9303_PISR 0x1D
85#define LAN9303_PIMR 0x1E
86#define LAN9303_PSCSR 0x1F
89#define LAN9303_ID_REV 0x0050
90#define LAN9303_IRQ_CFG 0x0054
91#define LAN9303_INT_STS 0x0058
92#define LAN9303_INT_EN 0x005C
93#define LAN9303_BYTE_TEST 0x0064
94#define LAN9303_HW_CFG 0x0074
95#define LAN9303_GPT_CFG 0x008C
96#define LAN9303_GPT_CNT 0x0090
97#define LAN9303_FREE_RUN 0x009C
98#define LAN9303_PMI_DATA 0x00A4
99#define LAN9303_PMI_ACCESS 0x00A8
100#define LAN9303_MANUAL_FC_1 0x01A0
101#define LAN9303_MANUAL_FC_2 0x01A4
102#define LAN9303_MANUAL_FC_0 0x01A8
103#define LAN9303_SWITCH_CSR_DATA 0x01AC
104#define LAN9303_SWITCH_CSR_CMD 0x01B0
105#define LAN9303_E2P_CMD 0x01B4
106#define LAN9303_E2P_DATA 0x01B8
107#define LAN9303_LED_CFG 0x01BC
108#define LAN9303_VPHY_BASIC_CTRL 0x01C0
109#define LAN9303_VPHY_BASIC_STATUS 0x01C4
110#define LAN9303_VPHY_ID_MSB 0x01C8
111#define LAN9303_VPHY_ID_LSB 0x01CC
112#define LAN9303_VPHY_AN_ADV 0x01D0
113#define LAN9303_VPHY_AN_LP_BASE_ABILITY 0x01D4
114#define LAN9303_VPHY_AN_EXP 0x01D8
115#define LAN9303_VPHY_SPECIAL_CTRL_STATUS 0x01DC
116#define LAN9303_GPIO_CFG 0x01E0
117#define LAN9303_GPIO_DATA_DIR 0x01E4
118#define LAN9303_GPIO_INT_STS_EN 0x01E8
119#define LAN9303_SWITCH_MAC_ADDRH 0x01F0
120#define LAN9303_SWITCH_MAC_ADDRL 0x01F4
121#define LAN9303_RESET_CTL 0x01F8
122#define LAN9303_SWITCH_CSR_DIRECT_DATA 0x0200
125#define LAN9303_SW_DEV_ID 0x0000
126#define LAN9303_SW_RESET 0x0001
127#define LAN9303_SW_IMR 0x0004
128#define LAN9303_SW_IPR 0x0005
129#define LAN9303_MAC_VER_ID_0 0x0400
130#define LAN9303_MAC_RX_CFG_0 0x0401
131#define LAN9303_MAC_RX_UNDSZE_CNT_0 0x0410
132#define LAN9303_MAC_RX_64_CNT_0 0x0411
133#define LAN9303_MAC_RX_65_TO_127_CNT_0 0x0412
134#define LAN9303_MAC_RX_128_TO_255_CNT_0 0x0413
135#define LAN9303_MAC_RX_256_TO_511_CNT_0 0x0414
136#define LAN9303_MAC_RX_512_TO_1023_CNT_0 0x0415
137#define LAN9303_MAC_RX_1024_TO_MAX_CNT_0 0x0416
138#define LAN9303_MAC_RX_OVRSZE_CNT_0 0x0417
139#define LAN9303_MAC_RX_PKTOK_CNT_0 0x0418
140#define LAN9303_MAC_RX_CRCERR_CNT_0 0x0419
141#define LAN9303_MAC_RX_MULCST_CNT_0 0x041A
142#define LAN9303_MAC_RX_BRDCST_CNT_0 0x041B
143#define LAN9303_MAC_RX_PAUSE_CNT_0 0x041C
144#define LAN9303_MAC_RX_FRAG_CNT_0 0x041D
145#define LAN9303_MAC_RX_JABB_CNT_0 0x041E
146#define LAN9303_MAC_RX_ALIGN_CNT_0 0x041F
147#define LAN9303_MAC_RX_PKTLEN_CNT_0 0x0420
148#define LAN9303_MAC_RX_GOODPKTLEN_CNT_0 0x0421
149#define LAN9303_MAC_RX_SYMBOL_CNT_0 0x0422
150#define LAN9303_MAC_RX_CTLFRM_CNT_0 0x0423
151#define LAN9303_MAC_TX_CFG_0 0x0440
152#define LAN9303_MAC_TX_FC_SETTINGS_0 0x0441
153#define LAN9303_MAC_TX_DEFER_CNT_0 0x0451
154#define LAN9303_MAC_TX_PAUSE_CNT_0 0x0452
155#define LAN9303_MAC_TX_PKTOK_CNT_0 0x0453
156#define LAN9303_MAC_TX_64_CNT_0 0x0454
157#define LAN9303_MAC_TX_65_TO_127_CNT_0 0x0455
158#define LAN9303_MAC_TX_128_TO_255_CNT_0 0x0456
159#define LAN9303_MAC_TX_256_TO_511_CNT_0 0x0457
160#define LAN9303_MAC_TX_512_TO_1023_CNT_0 0x0458
161#define LAN9303_MAC_TX_1024_TO_MAX_CNT_0 0x0459
162#define LAN9303_MAC_TX_UNDSZE_CNT_0 0x045A
163#define LAN9303_MAC_TX_PKTLEN_CNT_0 0x045C
164#define LAN9303_MAC_TX_BRDCST_CNT_0 0x045D
165#define LAN9303_MAC_TX_MULCST_CNT_0 0x045E
166#define LAN9303_MAC_TX_LATECOL_CNT_0 0x045F
167#define LAN9303_MAC_TX_EXCCOL_CNT_0 0x0460
168#define LAN9303_MAC_TX_SNGLECOL_CNT_0 0x0461
169#define LAN9303_MAC_TX_MULTICOL_CNT_0 0x0462
170#define LAN9303_MAC_TX_TOTALCOL_CNT_0 0x0463
171#define LAN9303_MAC_IMR_0 0x0480
172#define LAN9303_MAC_IPR_0 0x0481
173#define LAN9303_MAC_VER_ID_1 0x0800
174#define LAN9303_MAC_RX_CFG_1 0x0801
175#define LAN9303_MAC_RX_UNDSZE_CNT_1 0x0810
176#define LAN9303_MAC_RX_64_CNT_1 0x0811
177#define LAN9303_MAC_RX_65_TO_127_CNT_1 0x0812
178#define LAN9303_MAC_RX_128_TO_255_CNT_1 0x0813
179#define LAN9303_MAC_RX_256_TO_511_CNT_1 0x0814
180#define LAN9303_MAC_RX_512_TO_1023_CNT_1 0x0815
181#define LAN9303_MAC_RX_1024_TO_MAX_CNT_1 0x0816
182#define LAN9303_MAC_RX_OVRSZE_CNT_1 0x0817
183#define LAN9303_MAC_RX_PKTOK_CNT_1 0x0818
184#define LAN9303_MAC_RX_CRCERR_CNT_1 0x0819
185#define LAN9303_MAC_RX_MULCST_CNT_1 0x081A
186#define LAN9303_MAC_RX_BRDCST_CNT_1 0x081B
187#define LAN9303_MAC_RX_PAUSE_CNT_1 0x081C
188#define LAN9303_MAC_RX_FRAG_CNT_1 0x081D
189#define LAN9303_MAC_RX_JABB_CNT_1 0x081E
190#define LAN9303_MAC_RX_ALIGN_CNT_1 0x081F
191#define LAN9303_MAC_RX_PKTLEN_CNT_1 0x0820
192#define LAN9303_MAC_RX_GOODPKTLEN_CNT_1 0x0821
193#define LAN9303_MAC_RX_SYMBOL_CNT_1 0x0822
194#define LAN9303_MAC_RX_CTLFRM_CNT_1 0x0823
195#define LAN9303_MAC_TX_CFG_1 0x0840
196#define LAN9303_MAC_TX_FC_SETTINGS_1 0x0841
197#define LAN9303_MAC_TX_DEFER_CNT_1 0x0851
198#define LAN9303_MAC_TX_PAUSE_CNT_1 0x0852
199#define LAN9303_MAC_TX_PKTOK_CNT_1 0x0853
200#define LAN9303_MAC_TX_64_CNT_1 0x0854
201#define LAN9303_MAC_TX_65_TO_127_CNT_1 0x0855
202#define LAN9303_MAC_TX_128_TO_255_CNT_1 0x0856
203#define LAN9303_MAC_TX_256_TO_511_CNT_1 0x0857
204#define LAN9303_MAC_TX_512_TO_1023_CNT_1 0x0858
205#define LAN9303_MAC_TX_1024_TO_MAX_CNT_1 0x0859
206#define LAN9303_MAC_TX_UNDSZE_CNT_1 0x085A
207#define LAN9303_MAC_TX_PKTLEN_CNT_1 0x085C
208#define LAN9303_MAC_TX_BRDCST_CNT_1 0x085D
209#define LAN9303_MAC_TX_MULCST_CNT_1 0x085E
210#define LAN9303_MAC_TX_LATECOL_CNT_1 0x085F
211#define LAN9303_MAC_TX_EXCCOL_CNT_1 0x0860
212#define LAN9303_MAC_TX_SNGLECOL_CNT_1 0x0861
213#define LAN9303_MAC_TX_MULTICOL_CNT_1 0x0862
214#define LAN9303_MAC_TX_TOTALCOL_CNT_1 0x0863
215#define LAN9303_MAC_IMR_1 0x0880
216#define LAN9303_MAC_IPR_1 0x0881
217#define LAN9303_MAC_VER_ID_2 0x0C00
218#define LAN9303_MAC_RX_CFG_2 0x0C01
219#define LAN9303_MAC_RX_UNDSZE_CNT_2 0x0C10
220#define LAN9303_MAC_RX_64_CNT_2 0x0C11
221#define LAN9303_MAC_RX_65_TO_127_CNT_2 0x0C12
222#define LAN9303_MAC_RX_128_TO_255_CNT_2 0x0C13
223#define LAN9303_MAC_RX_256_TO_511_CNT_2 0x0C14
224#define LAN9303_MAC_RX_512_TO_1023_CNT_2 0x0C15
225#define LAN9303_MAC_RX_1024_TO_MAX_CNT_2 0x0C16
226#define LAN9303_MAC_RX_OVRSZE_CNT_2 0x0C17
227#define LAN9303_MAC_RX_PKTOK_CNT_2 0x0C18
228#define LAN9303_MAC_RX_CRCERR_CNT_2 0x0C19
229#define LAN9303_MAC_RX_MULCST_CNT_2 0x0C1A
230#define LAN9303_MAC_RX_BRDCST_CNT_2 0x0C1B
231#define LAN9303_MAC_RX_PAUSE_CNT_2 0x0C1C
232#define LAN9303_MAC_RX_FRAG_CNT_2 0x0C1D
233#define LAN9303_MAC_RX_JABB_CNT_2 0x0C1E
234#define LAN9303_MAC_RX_ALIGN_CNT_2 0x0C1F
235#define LAN9303_MAC_RX_PKTLEN_CNT_2 0x0C20
236#define LAN9303_MAC_RX_GOODPKTLEN_CNT_2 0x0C21
237#define LAN9303_MAC_RX_SYMBOL_CNT_2 0x0C22
238#define LAN9303_MAC_RX_CTLFRM_CNT_2 0x0C23
239#define LAN9303_MAC_TX_CFG_2 0x0C40
240#define LAN9303_MAC_TX_FC_SETTINGS_2 0x0C41
241#define LAN9303_MAC_TX_DEFER_CNT_2 0x0C51
242#define LAN9303_MAC_TX_PAUSE_CNT_2 0x0C52
243#define LAN9303_MAC_TX_PKTOK_CNT_2 0x0C53
244#define LAN9303_MAC_TX_64_CNT_2 0x0C54
245#define LAN9303_MAC_TX_65_TO_127_CNT_2 0x0C55
246#define LAN9303_MAC_TX_128_TO_255_CNT_2 0x0C56
247#define LAN9303_MAC_TX_256_TO_511_CNT_2 0x0C57
248#define LAN9303_MAC_TX_512_TO_1023_CNT_2 0x0C58
249#define LAN9303_MAC_TX_1024_TO_MAX_CNT_2 0x0C59
250#define LAN9303_MAC_TX_UNDSZE_CNT_2 0x0C5A
251#define LAN9303_MAC_TX_PKTLEN_CNT_2 0x0C5C
252#define LAN9303_MAC_TX_BRDCST_CNT_2 0x0C5D
253#define LAN9303_MAC_TX_MULCST_CNT_2 0x0C5E
254#define LAN9303_MAC_TX_LATECOL_CNT_2 0x0C5F
255#define LAN9303_MAC_TX_EXCCOL_CNT_2 0x0C60
256#define LAN9303_MAC_TX_SNGLECOL_CNT_2 0x0C61
257#define LAN9303_MAC_TX_MULTICOL_CNT_2 0x0C62
258#define LAN9303_MAC_TX_TOTALCOL_CNT_2 0x0C63
259#define LAN9303_MAC_IMR_2 0x0C80
260#define LAN9303_MAC_IPR_2 0x0C81
261#define LAN9303_SWE_ALR_CMD 0x1800
262#define LAN9303_SWE_ALR_WR_DAT_0 0x1801
263#define LAN9303_SWE_ALR_WR_DAT_1 0x1802
264#define LAN9303_SWE_ALR_RD_DAT_0 0x1805
265#define LAN9303_SWE_ALR_RD_DAT_1 0x1806
266#define LAN9303_SWE_ALR_CMD_STS 0x1808
267#define LAN9303_SWE_ALR_CFG 0x1809
268#define LAN9303_SWE_VLAN_CMD 0x180B
269#define LAN9303_SWE_VLAN_WR_DATA 0x180C
270#define LAN9303_SWE_VLAN_RD_DATA 0x180E
271#define LAN9303_SWE_VLAN_CMD_STS 0x1810
272#define LAN9303_SWE_DIFFSERV_TBL_CFG 0x1811
273#define LAN9303_SWE_DIFFSERV_TBL_WR_DATA 0x1812
274#define LAN9303_SWE_DIFFSERV_TBL_RD_DATA 0x1813
275#define LAN9303_SWE_DIFFSERV_TBL_CMD_STS 0x1814
276#define LAN9303_SWE_GLOBAL_INGRSS_CFG 0x1840
277#define LAN9303_SWE_PORT_INGRSS_CFG 0x1841
278#define LAN9303_SWE_ADMT_ONLY_VLAN 0x1842
279#define LAN9303_SWE_PORT_STATE 0x1843
280#define LAN9303_SWE_PRI_TO_QUE 0x1845
281#define LAN9303_SWE_PORT_MIRROR 0x1846
282#define LAN9303_SWE_INGRSS_PORT_TYP 0x1847
283#define LAN9303_SWE_BCST_THROT 0x1848
284#define LAN9303_SWE_ADMT_N_MEMBER 0x1849
285#define LAN9303_SWE_INGRSS_RATE_CFG 0x184A
286#define LAN9303_SWE_INGRSS_RATE_CMD 0x184B
287#define LAN9303_SWE_INGRSS_RATE_CMD_STS 0x184C
288#define LAN9303_SWE_INGRSS_RATE_WR_DATA 0x184D
289#define LAN9303_SWE_INGRSS_RATE_RD_DATA 0x184E
290#define LAN9303_SWE_FILTERED_CNT_0 0x1850
291#define LAN9303_SWE_FILTERED_CNT_1 0x1851
292#define LAN9303_SWE_FILTERED_CNT_2 0x1852
293#define LAN9303_SWE_INGRSS_REGEN_TBL_0 0x1855
294#define LAN9303_SWE_INGRSS_REGEN_TBL_1 0x1856
295#define LAN9303_SWE_INGRSS_REGEN_TBL_2 0x1857
296#define LAN9303_SWE_LRN_DISCRD_CNT_0 0x1858
297#define LAN9303_SWE_LRN_DISCRD_CNT_1 0x1859
298#define LAN9303_SWE_LRN_DISCRD_CNT_2 0x185A
299#define LAN9303_SWE_IMR 0x1880
300#define LAN9303_SWE_IPR 0x1881
301#define LAN9303_BM_CFG 0x1C00
302#define LAN9303_BM_DROP_LVL 0x1C01
303#define LAN9303_BM_FC_PAUSE_LVL 0x1C02
304#define LAN9303_BM_FC_RESUME_LVL 0x1C03
305#define LAN9303_BM_BCST_LVL 0x1C04
306#define LAN9303_BM_DRP_CNT_SRC_0 0x1C05
307#define LAN9303_BM_DRP_CNT_SRC_1 0x1C06
308#define LAN9303_BM_DRP_CNT_SRC_2 0x1C07
309#define LAN9303_BM_RST_STS 0x1C08
310#define LAN9303_BM_RNDM_DSCRD_TBL_CMD 0x1C09
311#define LAN9303_BM_RNDM_DSCRD_TBL_WDATA 0x1C0A
312#define LAN9303_BM_RNDM_DSCRD_TBL_RDATA 0x1C0B
313#define LAN9303_BM_EGRSS_PORT_TYPE 0x1C0C
314#define LAN9303_BM_EGRSS_RATE_00_01 0x1C0D
315#define LAN9303_BM_EGRSS_RATE_02_03 0x1C0E
316#define LAN9303_BM_EGRSS_RATE_10_11 0x1C0F
317#define LAN9303_BM_EGRSS_RATE_12_13 0x1C10
318#define LAN9303_BM_EGRSS_RATE_20_21 0x1C11
319#define LAN9303_BM_EGRSS_RATE_22_23 0x1C12
320#define LAN9303_BM_VLAN_0 0x1C13
321#define LAN9303_BM_VLAN_1 0x1C14
322#define LAN9303_BM_VLAN_2 0x1C15
323#define LAN9303_BM_RATE_DRP_CNT_SRC_0 0x1C16
324#define LAN9303_BM_RATE_DRP_CNT_SRC_1 0x1C17
325#define LAN9303_BM_RATE_DRP_CNT_SRC_2 0x1C18
326#define LAN9303_BM_IMR 0x1C20
327#define LAN9303_BM_IPR 0x1C21
330#define LAN9303_MAC_VER_ID(port) (0x0400 + ((port) * 0x0400))
331#define LAN9303_MAC_RX_CFG(port) (0x0401 + ((port) * 0x0400))
332#define LAN9303_MAC_RX_UNDSZE_CNT(port) (0x0410 + ((port) * 0x0400))
333#define LAN9303_MAC_RX_64_CNT(port) (0x0411 + ((port) * 0x0400))
334#define LAN9303_MAC_RX_65_TO_127_CNT(port) (0x0412 + ((port) * 0x0400))
335#define LAN9303_MAC_RX_128_TO_255_CNT(port) (0x0413 + ((port) * 0x0400))
336#define LAN9303_MAC_RX_256_TO_511_CNT(port) (0x0414 + ((port) * 0x0400))
337#define LAN9303_MAC_RX_512_TO_1023_CNT(port) (0x0415 + ((port) * 0x0400))
338#define LAN9303_MAC_RX_1024_TO_MAX_CNT(port) (0x0416 + ((port) * 0x0400))
339#define LAN9303_MAC_RX_OVRSZE_CNT(port) (0x0417 + ((port) * 0x0400))
340#define LAN9303_MAC_RX_PKTOK_CNT(port) (0x0418 + ((port) * 0x0400))
341#define LAN9303_MAC_RX_CRCERR_CNT(port) (0x0419 + ((port) * 0x0400))
342#define LAN9303_MAC_RX_MULCST_CNT(port) (0x041A + ((port) * 0x0400))
343#define LAN9303_MAC_RX_BRDCST_CNT(port) (0x041B + ((port) * 0x0400))
344#define LAN9303_MAC_RX_PAUSE_CNT(port) (0x041C + ((port) * 0x0400))
345#define LAN9303_MAC_RX_FRAG_CNT(port) (0x041D + ((port) * 0x0400))
346#define LAN9303_MAC_RX_JABB_CNT(port) (0x041E + ((port) * 0x0400))
347#define LAN9303_MAC_RX_ALIGN_CNT(port) (0x041F + ((port) * 0x0400))
348#define LAN9303_MAC_RX_PKTLEN_CNT(port) (0x0420 + ((port) * 0x0400))
349#define LAN9303_MAC_RX_GOODPKTLEN_CNT(port) (0x0421 + ((port) * 0x0400))
350#define LAN9303_MAC_RX_SYMBOL_CNT(port) (0x0422 + ((port) * 0x0400))
351#define LAN9303_MAC_RX_CTLFRM_CNT(port) (0x0423 + ((port) * 0x0400))
352#define LAN9303_MAC_TX_CFG(port) (0x0440 + ((port) * 0x0400))
353#define LAN9303_MAC_TX_FC_SETTINGS(port) (0x0441 + ((port) * 0x0400))
354#define LAN9303_MAC_TX_DEFER_CNT(port) (0x0451 + ((port) * 0x0400))
355#define LAN9303_MAC_TX_PAUSE_CNT(port) (0x0452 + ((port) * 0x0400))
356#define LAN9303_MAC_TX_PKTOK_CNT(port) (0x0453 + ((port) * 0x0400))
357#define LAN9303_MAC_TX_64_CNT(port) (0x0454 + ((port) * 0x0400))
358#define LAN9303_MAC_TX_65_TO_127_CNT(port) (0x0455 + ((port) * 0x0400))
359#define LAN9303_MAC_TX_128_TO_255_CNT(port) (0x0456 + ((port) * 0x0400))
360#define LAN9303_MAC_TX_256_TO_511_CNT(port) (0x0457 + ((port) * 0x0400))
361#define LAN9303_MAC_TX_512_TO_1023_CNT(port) (0x0458 + ((port) * 0x0400))
362#define LAN9303_MAC_TX_1024_TO_MAX_CNT(port) (0x0459 + ((port) * 0x0400))
363#define LAN9303_MAC_TX_UNDSZE_CNT(port) (0x045A + ((port) * 0x0400))
364#define LAN9303_MAC_TX_PKTLEN_CNT(port) (0x045C + ((port) * 0x0400))
365#define LAN9303_MAC_TX_BRDCST_CNT(port) (0x045D + ((port) * 0x0400))
366#define LAN9303_MAC_TX_MULCST_CNT(port) (0x045E + ((port) * 0x0400))
367#define LAN9303_MAC_TX_LATECOL_CNT(port) (0x045F + ((port) * 0x0400))
368#define LAN9303_MAC_TX_EXCCOL_CNT(port) (0x0460 + ((port) * 0x0400))
369#define LAN9303_MAC_TX_SNGLECOL_CNT(port) (0x0461 + ((port) * 0x0400))
370#define LAN9303_MAC_TX_MULTICOL_CNT(port) (0x0462 + ((port) * 0x0400))
371#define LAN9303_MAC_TX_TOTALCOL_CNT(port) (0x0463 + ((port) * 0x0400))
372#define LAN9303_MAC_IMR(port) (0x0480 + ((port) * 0x0400))
373#define LAN9303_MAC_IPR(port) (0x0481 + ((port) * 0x0400))
376#define LAN9303_BMCR_RESET 0x8000
377#define LAN9303_BMCR_LOOPBACK 0x4000
378#define LAN9303_BMCR_SPEED_SEL 0x2000
379#define LAN9303_BMCR_AN_EN 0x1000
380#define LAN9303_BMCR_POWER_DOWN 0x0800
381#define LAN9303_BMCR_RESTART_AN 0x0200
382#define LAN9303_BMCR_DUPLEX_MODE 0x0100
383#define LAN9303_BMCR_COL_TEST 0x0080
386#define LAN9303_BMSR_100BT4 0x8000
387#define LAN9303_BMSR_100BTX_FD 0x4000
388#define LAN9303_BMSR_100BTX_HD 0x2000
389#define LAN9303_BMSR_10BT_FD 0x1000
390#define LAN9303_BMSR_10BT_HD 0x0800
391#define LAN9303_BMSR_100BT2_FD 0x0400
392#define LAN9303_BMSR_100BT2_HD 0x0200
393#define LAN9303_BMSR_AN_COMPLETE 0x0020
394#define LAN9303_BMSR_REMOTE_FAULT 0x0010
395#define LAN9303_BMSR_AN_CAPABLE 0x0008
396#define LAN9303_BMSR_LINK_STATUS 0x0004
397#define LAN9303_BMSR_JABBER_DETECT 0x0002
398#define LAN9303_BMSR_EXTENDED_CAPABLE 0x0001
401#define LAN9303_PHYID1_PHY_ID_MSB 0xFFFF
402#define LAN9303_PHYID1_PHY_ID_MSB_DEFAULT 0x0007
405#define LAN9303_PHYID2_PHY_ID_LSB 0xFC00
406#define LAN9303_PHYID2_PHY_ID_LSB_DEFAULT 0xC000
407#define LAN9303_PHYID2_MODEL_NUM 0x03F0
408#define LAN9303_PHYID2_MODEL_NUM_DEFAULT 0x00D0
409#define LAN9303_PHYID2_REVISION_NUM 0x000F
412#define LAN9303_ANAR_REMOTE_FAULT 0x2000
413#define LAN9303_ANAR_ASYM_PAUSE 0x0800
414#define LAN9303_ANAR_SYM_PAUSE 0x0400
415#define LAN9303_ANAR_100BTX_FD 0x0100
416#define LAN9303_ANAR_100BTX_HD 0x0080
417#define LAN9303_ANAR_10BT_FD 0x0040
418#define LAN9303_ANAR_10BT_HD 0x0020
419#define LAN9303_ANAR_SELECTOR 0x001F
420#define LAN9303_ANAR_SELECTOR_DEFAULT 0x0001
423#define LAN9303_ANLPAR_NEXT_PAGE 0x8000
424#define LAN9303_ANLPAR_ACK 0x4000
425#define LAN9303_ANLPAR_REMOTE_FAULT 0x2000
426#define LAN9303_ANLPAR_ASYM_PAUSE 0x0800
427#define LAN9303_ANLPAR_SYM_PAUSE 0x0400
428#define LAN9303_ANLPAR_100BT4 0x0200
429#define LAN9303_ANLPAR_100BTX_FD 0x0100
430#define LAN9303_ANLPAR_100BTX_HD 0x0080
431#define LAN9303_ANLPAR_10BT_FD 0x0040
432#define LAN9303_ANLPAR_10BT_HD 0x0020
433#define LAN9303_ANLPAR_SELECTOR 0x001F
434#define LAN9303_ANLPAR_SELECTOR_DEFAULT 0x0001
437#define LAN9303_ANER_PAR_DETECT_FAULT 0x0010
438#define LAN9303_ANER_LP_NEXT_PAGE_ABLE 0x0008
439#define LAN9303_ANER_NEXT_PAGE_ABLE 0x0004
440#define LAN9303_ANER_PAGE_RECEIVED 0x0002
441#define LAN9303_ANER_LP_AN_ABLE 0x0001
444#define LAN9303_PMCSR_EDPWRDOWN 0x2000
445#define LAN9303_PMCSR_ENERGYON 0x0002
448#define LAN9303_PSMR_MODE 0x00E0
449#define LAN9303_PSMR_MODE_10BT_HD 0x0000
450#define LAN9303_PSMR_MODE_10BT_FD 0x0020
451#define LAN9303_PSMR_MODE_100BTX_HD 0x0040
452#define LAN9303_PSMR_MODE_100BTX_FD 0x0060
453#define LAN9303_PSMR_MODE_POWER_DOWN 0x00C0
454#define LAN9303_PSMR_MODE_AN 0x00E0
455#define LAN9303_PSMR_PHYAD 0x001F
458#define LAN9303_PSCSIR_AMDIXCTRL 0x8000
459#define LAN9303_PSCSIR_AMDIXEN 0x4000
460#define LAN9303_PSCSIR_AMDIXSTATE 0x2000
461#define LAN9303_PSCSIR_SQEOFF 0x0800
462#define LAN9303_PSCSIR_VCOOFF_LP 0x0400
463#define LAN9303_PSCSIR_XPOL 0x0010
466#define LAN9303_PISR_ENERGYON 0x0080
467#define LAN9303_PISR_AN_COMPLETE 0x0040
468#define LAN9303_PISR_REMOTE_FAULT 0x0020
469#define LAN9303_PISR_LINK_DOWN 0x0010
470#define LAN9303_PISR_AN_LP_ACK 0x0008
471#define LAN9303_PISR_PAR_DETECT_FAULT 0x0004
472#define LAN9303_PISR_AN_PAGE_RECEIVED 0x0002
475#define LAN9303_PIMR_ENERGYON 0x0080
476#define LAN9303_PIMR_AN_COMPLETE 0x0040
477#define LAN9303_PIMR_REMOTE_FAULT 0x0020
478#define LAN9303_PIMR_LINK_DOWN 0x0010
479#define LAN9303_PIMR_AN_LP_ACK 0x0008
480#define LAN9303_PIMR_PAR_DETECT_FAULT 0x0004
481#define LAN9303_PIMR_AN_PAGE_RECEIVED 0x0002
484#define LAN9303_PSCSR_AUTODONE 0x1000
485#define LAN9303_PSCSR_SPEED 0x001C
486#define LAN9303_PSCSR_SPEED_10BT_HD 0x0004
487#define LAN9303_PSCSR_SPEED_100BTX_HD 0x0008
488#define LAN9303_PSCSR_SPEED_10BT_FD 0x0014
489#define LAN9303_PSCSR_SPEED_100BTX_FD 0x0018
492#define LAN9303_ID_REV_CHIP_ID 0xFFFF0000
493#define LAN9303_ID_REV_CHIP_ID_DEFAULT 0x93030000
494#define LAN9303_ID_REV_CHIP_REV 0x0000FFFF
497#define LAN9303_IRQ_CFG_INT_DEAS 0xFF000000
498#define LAN9303_IRQ_CFG_INT_DEAS_CLR 0x00004000
499#define LAN9303_IRQ_CFG_INT_DEAS_STS 0x00002000
500#define LAN9303_IRQ_CFG_IRQ_INT 0x00001000
501#define LAN9303_IRQ_CFG_IRQ_EN 0x00000100
502#define LAN9303_IRQ_CFG_IRQ_POL 0x00000010
503#define LAN9303_IRQ_CFG_IRQ_TYPE 0x00000001
506#define LAN9303_INT_STS_SW_INT 0x80000000
507#define LAN9303_INT_STS_READY 0x40000000
508#define LAN9303_INT_STS_SWITCH_INT 0x10000000
509#define LAN9303_INT_STS_PHY_INT2 0x08000000
510#define LAN9303_INT_STS_PHY_INT1 0x04000000
511#define LAN9303_INT_STS_GPT_INT 0x00080000
512#define LAN9303_INT_STS_GPIO 0x00001000
515#define LAN9303_INT_EN_SW_INT_EN 0x80000000
516#define LAN9303_INT_EN_READY_EN 0x40000000
517#define LAN9303_INT_EN_SWITCH_INT_EN 0x10000000
518#define LAN9303_INT_EN_PHY_INT2_EN 0x08000000
519#define LAN9303_INT_EN_PHY_INT1_EN 0x04000000
520#define LAN9303_INT_EN_GPT_INT_EN 0x00080000
521#define LAN9303_INT_EN_GPIO_EN 0x00001000
524#define LAN9303_BYTE_TEST_DEFAULT 0x87654321
527#define LAN9303_HW_CFG_DEVICE_READY 0x08000000
528#define LAN9303_HW_CFG_AMDIX_EN_STRAP_STATE_PORT2 0x04000000
529#define LAN9303_HW_CFG_AMDIX_EN_STRAP_STATE_PORT1 0x02000000
532#define LAN9303_GPT_CFG_TIMER_EN 0x20000000
533#define LAN9303_GPT_CFG_GPT_LOAD 0x0000FFFF
536#define LAN9303_GPT_CNT_GPT_CNT 0x0000FFFF
539#define LAN9303_FREE_RUN_FR_CNT 0xFFFFFFFF
542#define LAN9303_PMI_DATA_MII_DATA 0x0000FFFF
545#define LAN9303_PMI_ACCESS_PHY_ADDR 0x0000F800
546#define LAN9303_PMI_ACCESS_MIIRINDA 0x000007C0
547#define LAN9303_PMI_ACCESS_MIIW_R 0x00000002
548#define LAN9303_PMI_ACCESS_MIIBZY 0x00000001
551#define LAN9303_MANUAL_FC_1_BP_EN_1 0x00000040
552#define LAN9303_MANUAL_FC_1_CUR_DUP_1 0x00000020
553#define LAN9303_MANUAL_FC_1_CUR_RX_FC_1 0x00000010
554#define LAN9303_MANUAL_FC_1_CUR_TX_FC_1 0x00000008
555#define LAN9303_MANUAL_FC_1_RX_FC_1 0x00000004
556#define LAN9303_MANUAL_FC_1_TX_FC_1 0x00000002
557#define LAN9303_MANUAL_FC_1_MANUAL_FC_1 0x00000001
560#define LAN9303_MANUAL_FC_2_BP_EN_2 0x00000040
561#define LAN9303_MANUAL_FC_2_CUR_DUP_2 0x00000020
562#define LAN9303_MANUAL_FC_2_CUR_RX_FC_2 0x00000010
563#define LAN9303_MANUAL_FC_2_CUR_TX_FC_2 0x00000008
564#define LAN9303_MANUAL_FC_2_RX_FC_2 0x00000004
565#define LAN9303_MANUAL_FC_2_TX_FC_2 0x00000002
566#define LAN9303_MANUAL_FC_2_MANUAL_FC_2 0x00000001
569#define LAN9303_MANUAL_FC_0_BP_EN_0 0x00000040
570#define LAN9303_MANUAL_FC_0_CUR_DUP_0 0x00000020
571#define LAN9303_MANUAL_FC_0_CUR_RX_FC_0 0x00000010
572#define LAN9303_MANUAL_FC_0_CUR_TX_FC_0 0x00000008
573#define LAN9303_MANUAL_FC_0_RX_FC_0 0x00000004
574#define LAN9303_MANUAL_FC_0_TX_FC_0 0x00000002
575#define LAN9303_MANUAL_FC_0_MANUAL_FC_0 0x00000001
578#define LAN9303_SWITCH_CSR_CMD_BUSY 0x80000000
579#define LAN9303_SWITCH_CSR_CMD_WRITE 0x00000000
580#define LAN9303_SWITCH_CSR_CMD_READ 0x40000000
581#define LAN9303_SWITCH_CSR_CMD_AUTO_INC 0x20000000
582#define LAN9303_SWITCH_CSR_CMD_AUTO_DEC 0x10000000
583#define LAN9303_SWITCH_CSR_CMD_BE 0x000F0000
584#define LAN9303_SWITCH_CSR_CMD_BE_0 0x00010000
585#define LAN9303_SWITCH_CSR_CMD_BE_1 0x00020000
586#define LAN9303_SWITCH_CSR_CMD_BE_2 0x00040000
587#define LAN9303_SWITCH_CSR_CMD_BE_3 0x00080000
588#define LAN9303_SWITCH_CSR_CMD_ADDR 0x0000FFFF
591#define LAN9303_E2P_CMD_EPC_BUSY 0x80000000
592#define LAN9303_E2P_CMD_EPC_COMMAND 0x70000000
593#define LAN9303_E2P_CMD_EPC_COMMAND_READ 0x00000000
594#define LAN9303_E2P_CMD_EPC_COMMAND_WRITE 0x30000000
595#define LAN9303_E2P_CMD_EPC_COMMAND_RELOAD 0x70000000
596#define LAN9303_E2P_CMD_LOADER_OVERFLOW 0x00040000
597#define LAN9303_E2P_CMD_EPC_TIMEOUT 0x00020000
598#define LAN9303_E2P_CMD_CFG_LOADED 0x00010000
599#define LAN9303_E2P_CMD_EPC_ADDR 0x0000FFFF
602#define LAN9303_E2P_DATA_EEPROM_DATA 0x000000FF
605#define LAN9303_LED_CFG_LED_FUN 0x00000300
606#define LAN9303_LED_CFG_LED_FUN_0 0x00000000
607#define LAN9303_LED_CFG_LED_FUN_1 0x00000100
608#define LAN9303_LED_CFG_LED_FUN_2 0x00000200
609#define LAN9303_LED_CFG_LED_FUN_3 0x00000300
610#define LAN9303_LED_CFG_LED_EN 0x0000003F
611#define LAN9303_LED_CFG_LED_EN_0 0x00000001
612#define LAN9303_LED_CFG_LED_EN_1 0x00000002
613#define LAN9303_LED_CFG_LED_EN_2 0x00000004
614#define LAN9303_LED_CFG_LED_EN_3 0x00000008
615#define LAN9303_LED_CFG_LED_EN_4 0x00000010
616#define LAN9303_LED_CFG_LED_EN_5 0x00000020
619#define LAN9303_VPHY_BASIC_CTRL_VPHY_RST 0x00008000
620#define LAN9303_VPHY_BASIC_CTRL_VPHY_LOOPBACK 0x00004000
621#define LAN9303_VPHY_BASIC_CTRL_VPHY_SPEED_SEL_LSB 0x00002000
622#define LAN9303_VPHY_BASIC_CTRL_VPHY_AN 0x00001000
623#define LAN9303_VPHY_BASIC_CTRL_VPHY_PWR_DWN 0x00000800
624#define LAN9303_VPHY_BASIC_CTRL_VPHY_ISO 0x00000400
625#define LAN9303_VPHY_BASIC_CTRL_VPHY_RST_AN 0x00000200
626#define LAN9303_VPHY_BASIC_CTRL_VPHY_DUPLEX 0x00000100
627#define LAN9303_VPHY_BASIC_CTRL_VPHY_COL_TEST 0x00000080
628#define LAN9303_VPHY_BASIC_CTRL_VPHY_SPEED_SEL_MSB 0x00000040
631#define LAN9303_VPHY_BASIC_STATUS_100BT4 0x00008000
632#define LAN9303_VPHY_BASIC_STATUS_100BTX_FD 0x00004000
633#define LAN9303_VPHY_BASIC_STATUS_100BTX_HD 0x00002000
634#define LAN9303_VPHY_BASIC_STATUS_10BT_FD 0x00001000
635#define LAN9303_VPHY_BASIC_STATUS_10BT_HD 0x00000800
636#define LAN9303_VPHY_BASIC_STATUS_100BT2_FD 0x00000400
637#define LAN9303_VPHY_BASIC_STATUS_100BT2_HD 0x00000200
638#define LAN9303_VPHY_BASIC_STATUS_EXTENDED_STATUS 0x00000100
639#define LAN9303_VPHY_BASIC_STATUS_MF_PREAMBLE_SUPPR 0x00000040
640#define LAN9303_VPHY_BASIC_STATUS_AN_COMPLETE 0x00000020
641#define LAN9303_VPHY_BASIC_STATUS_REMOTE_FAULT 0x00000010
642#define LAN9303_VPHY_BASIC_STATUS_AN_CAPABLE 0x00000008
643#define LAN9303_VPHY_BASIC_STATUS_LINK_STATUS 0x00000004
644#define LAN9303_VPHY_BASIC_STATUS_JABBER_DETECT 0x00000002
645#define LAN9303_VPHY_BASIC_STATUS_EXTENDED_CAPABLE 0x00000001
648#define LAN9303_VPHY_ID_MSB_PHY_ID_MSB 0x0000FFFF
651#define LAN9303_VPHY_ID_LSB_PHY_ID_LSB 0x0000FC00
652#define LAN9303_VPHY_ID_LSB_MODEL_NUM 0x000003F0
653#define LAN9303_VPHY_ID_LSB_REVISION_NUM 0x0000000F
656#define LAN9303_VPHY_AN_ADV_NEXT_PAGE 0x00008000
657#define LAN9303_VPHY_AN_ADV_REMOTE_FAULT 0x00002000
658#define LAN9303_VPHY_AN_ADV_ASYM_PAUSE 0x00000800
659#define LAN9303_VPHY_AN_ADV_SYM_PAUSE 0x00000400
660#define LAN9303_VPHY_AN_ADV_100BTX_FD 0x00000100
661#define LAN9303_VPHY_AN_ADV_100BTX_HD 0x00000080
662#define LAN9303_VPHY_AN_ADV_10BT_FD 0x00000040
663#define LAN9303_VPHY_AN_ADV_10BT_HD 0x00000020
664#define LAN9303_VPHY_AN_ADV_SELECTOR 0x0000001F
665#define LAN9303_VPHY_AN_ADV_SELECTOR_DEFAULT 0x00000001
668#define LAN9303_VPHY_AN_LP_BASE_ABILITY_NEXT_PAGE 0x00008000
669#define LAN9303_VPHY_AN_LP_BASE_ABILITY_ACK 0x00004000
670#define LAN9303_VPHY_AN_LP_BASE_ABILITY_REMOTE_FAULT 0x00002000
671#define LAN9303_VPHY_AN_LP_BASE_ABILITY_ASYM_PAUSE 0x00000800
672#define LAN9303_VPHY_AN_LP_BASE_ABILITY_SYM_PAUSE 0x00000400
673#define LAN9303_VPHY_AN_LP_BASE_ABILITY_100BT4 0x00000200
674#define LAN9303_VPHY_AN_LP_BASE_ABILITY_100BTX_FD 0x00000100
675#define LAN9303_VPHY_AN_LP_BASE_ABILITY_100BTX_HD 0x00000080
676#define LAN9303_VPHY_AN_LP_BASE_ABILITY_10BT_FD 0x00000040
677#define LAN9303_VPHY_AN_LP_BASE_ABILITY_10BT_HD 0x00000020
678#define LAN9303_VPHY_AN_LP_BASE_ABILITY_SELECTOR 0x0000001F
679#define LAN9303_VPHY_AN_LP_BASE_ABILITY_SELECTOR_DEFAULT 0x00000001
682#define LAN9303_VPHY_AN_EXP_PAR_DETECT_FAULT 0x00000010
683#define LAN9303_VPHY_AN_EXP_LP_NEXT_PAGE_ABLE 0x00000008
684#define LAN9303_VPHY_AN_EXP_NEXT_PAGE_ABLE 0x00000004
685#define LAN9303_VPHY_AN_EXP_PAGE_RECEIVED 0x00000002
686#define LAN9303_VPHY_AN_EXP_LP_AN_ABLE 0x00000001
689#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_SW_LOOPBACK_PORT0 0x00004000
690#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_TURBO_MII_EN 0x00000400
691#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_MODE 0x00000300
692#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_MODE_MII_MAC 0x00000000
693#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_MODE_MII_PHY 0x00000100
694#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_MODE_RMII_PHY 0x00000200
695#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_SW_COL_TEST_PORT0 0x00000080
696#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_RMII_CLK_DIR 0x00000040
697#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_RMII_CLK_DIR_IN 0x00000000
698#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_RMII_CLK_DIR_OUT 0x00000040
699#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_RMII_CLK_STRENGTH 0x00000020
700#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_IND 0x0000001C
701#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_IND_10_HD 0x00000004
702#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_IND_100_200_HD 0x00000008
703#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_IND_10_FD 0x00000014
704#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_IND_100_200_FD 0x00000018
705#define LAN9303_VPHY_SPECIAL_CTRL_STATUS_SQEOFF 0x00000001
708#define LAN9303_GPIO_CFG_GPIO_INT_POL 0x003F0000
709#define LAN9303_GPIO_CFG_GPIO_INT_POL_0 0x00010000
710#define LAN9303_GPIO_CFG_GPIO_INT_POL_1 0x00020000
711#define LAN9303_GPIO_CFG_GPIO_INT_POL_2 0x00040000
712#define LAN9303_GPIO_CFG_GPIO_INT_POL_3 0x00080000
713#define LAN9303_GPIO_CFG_GPIO_INT_POL_4 0x00100000
714#define LAN9303_GPIO_CFG_GPIO_INT_POL_5 0x00200000
715#define LAN9303_GPIO_CFG_GPIOBUF 0x0000003F
716#define LAN9303_GPIO_CFG_GPIOBUF_0 0x00000001
717#define LAN9303_GPIO_CFG_GPIOBUF_1 0x00000002
718#define LAN9303_GPIO_CFG_GPIOBUF_2 0x00000004
719#define LAN9303_GPIO_CFG_GPIOBUF_3 0x00000008
720#define LAN9303_GPIO_CFG_GPIOBUF_4 0x00000010
721#define LAN9303_GPIO_CFG_GPIOBUF_5 0x00000020
724#define LAN9303_GPIO_DATA_DIR_GPDIR 0x003F0000
725#define LAN9303_GPIO_DATA_DIR_GPDIR_0 0x00010000
726#define LAN9303_GPIO_DATA_DIR_GPDIR_1 0x00020000
727#define LAN9303_GPIO_DATA_DIR_GPDIR_2 0x00040000
728#define LAN9303_GPIO_DATA_DIR_GPDIR_3 0x00080000
729#define LAN9303_GPIO_DATA_DIR_GPDIR_4 0x00100000
730#define LAN9303_GPIO_DATA_DIR_GPDIR_5 0x00200000
731#define LAN9303_GPIO_DATA_DIR_GPIOD 0x0000003F
732#define LAN9303_GPIO_DATA_DIR_GPIOD_0 0x00000001
733#define LAN9303_GPIO_DATA_DIR_GPIOD_1 0x00000002
734#define LAN9303_GPIO_DATA_DIR_GPIOD_2 0x00000004
735#define LAN9303_GPIO_DATA_DIR_GPIOD_3 0x00000008
736#define LAN9303_GPIO_DATA_DIR_GPIOD_4 0x00000010
737#define LAN9303_GPIO_DATA_DIR_GPIOD_5 0x00000020
740#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN 0x003F0000
741#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_0 0x00010000
742#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_1 0x00020000
743#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_2 0x00040000
744#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_3 0x00080000
745#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_4 0x00100000
746#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_EN_5 0x00200000
747#define LAN9303_GPIO_INT_STS_EN_GPIO_INT 0x0000003F
748#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_0 0x00000001
749#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_1 0x00000002
750#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_2 0x00000004
751#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_3 0x00000008
752#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_4 0x00000010
753#define LAN9303_GPIO_INT_STS_EN_GPIO_INT_5 0x00000020
756#define LAN9303_SWITCH_MAC_ADDRH_DIFF_PAUSE_ADDR 0x00400000
757#define LAN9303_SWITCH_MAC_ADDRH_PORT2_PHY_ADDR_41_40 0x00300000
758#define LAN9303_SWITCH_MAC_ADDRH_PORT1_PHY_ADDR_41_40 0x000C0000
759#define LAN9303_SWITCH_MAC_ADDRH_PORT0_PHY_ADDR_41_40 0x00030000
760#define LAN9303_SWITCH_MAC_ADDRH_PHY_ADDR_47_32 0x0000FFFF
763#define LAN9303_SWITCH_MAC_ADDRL_PHY_ADDR_31_0 0xFFFFFFFF
766#define LAN9303_RESET_CTL_VPHY_RST 0x00000008
767#define LAN9303_RESET_CTL_PHY2_RST 0x00000004
768#define LAN9303_RESET_CTL_PHY1_RST 0x00000002
769#define LAN9303_RESET_CTL_DIGITAL_RST 0x00000001
772#define LAN9303_SW_DEV_ID_DEVICE_TYPE 0x00FF0000
773#define LAN9303_SW_DEV_ID_DEVICE_TYPE_DEFAULT 0x00030000
774#define LAN9303_SW_DEV_ID_CHIP_VERSION 0x0000FF00
775#define LAN9303_SW_DEV_ID_CHIP_VERSION_DEFAULT 0x00000400
776#define LAN9303_SW_DEV_ID_REVISION 0x000000FF
777#define LAN9303_SW_DEV_ID_REVISION_DEFAULT 0x00000007
780#define LAN9303_SW_RESET_SW_RESET 0x00000001
783#define LAN9303_SW_IMR_BM 0x00000040
784#define LAN9303_SW_IMR_SWE 0x00000020
785#define LAN9303_SW_IMR_MAC2 0x00000004
786#define LAN9303_SW_IMR_MAC1 0x00000002
787#define LAN9303_SW_IMR_MAC0 0x00000001
790#define LAN9303_SW_IPR_BM 0x00000040
791#define LAN9303_SW_IPR_SWE 0x00000020
792#define LAN9303_SW_IPR_MAC2 0x00000004
793#define LAN9303_SW_IPR_MAC1 0x00000002
794#define LAN9303_SW_IPR_MAC0 0x00000001
797#define LAN9303_MAC_VER_ID_DEVICE_TYPE 0x00000F00
798#define LAN9303_MAC_VER_ID_DEVICE_TYPE_DEFAULT 0x00000500
799#define LAN9303_MAC_VER_ID_CHIP_VERSION 0x000000F0
800#define LAN9303_MAC_VER_ID_CHIP_VERSION_DEFAULT 0x00000080
801#define LAN9303_MAC_VER_ID_REVISION 0x0000000F
802#define LAN9303_MAC_VER_ID_REVISION_DEFAULT 0x00000003
805#define LAN9303_MAC_RX_CFG_RECEIVE_OWN_TRANSMIT_EN 0x00000020
806#define LAN9303_MAC_RX_CFG_JUMBO_2K 0x00000008
807#define LAN9303_MAC_RX_CFG_REJECT_MAC_TYPES 0x00000002
808#define LAN9303_MAC_RX_CFG_RX_EN 0x00000001
811#define LAN9303_MAC_TX_CFG_MAC_COUNTER_TEST 0x00000080
812#define LAN9303_MAC_TX_CFG_IFG_CONFIG 0x0000007C
813#define LAN9303_MAC_TX_CFG_IFG_CONFIG_DEFAULT 0x00000054
814#define LAN9303_MAC_TX_CFG_TX_PAD_EN 0x00000002
815#define LAN9303_MAC_TX_CFG_TX_EN 0x00000001
818#define LAN9303_SWE_ALR_CMD_MAKE_ENTRY 0x00000004
819#define LAN9303_SWE_ALR_CMD_GET_FIRST_ENTRY 0x00000002
820#define LAN9303_SWE_ALR_CMD_GET_NEXT_ENTRY 0x00000001
823#define LAN9303_SWE_ALR_WR_DAT_0_MAC_ADDR 0xFFFFFFFF
826#define LAN9303_SWE_ALR_WR_DAT_1_VALID 0x04000000
827#define LAN9303_SWE_ALR_WR_DAT_1_AGE_OVERRIDE 0x02000000
828#define LAN9303_SWE_ALR_WR_DAT_1_STATIC 0x01000000
829#define LAN9303_SWE_ALR_WR_DAT_1_FILTER 0x00800000
830#define LAN9303_SWE_ALR_WR_DAT_1_PRIORITY_EN 0x00400000
831#define LAN9303_SWE_ALR_WR_DAT_1_PRIORITY 0x00380000
832#define LAN9303_SWE_ALR_WR_DAT_1_PORT 0x00070000
833#define LAN9303_SWE_ALR_WR_DAT_1_PORT_0 0x00000000
834#define LAN9303_SWE_ALR_WR_DAT_1_PORT_1 0x00010000
835#define LAN9303_SWE_ALR_WR_DAT_1_PORT_2 0x00020000
836#define LAN9303_SWE_ALR_WR_DAT_1_PORT_RESERVED 0x00030000
837#define LAN9303_SWE_ALR_WR_DAT_1_PORT_0_1 0x00040000
838#define LAN9303_SWE_ALR_WR_DAT_1_PORT_0_2 0x00050000
839#define LAN9303_SWE_ALR_WR_DAT_1_PORT_1_2 0x00060000
840#define LAN9303_SWE_ALR_WR_DAT_1_PORT_0_1_2 0x00070000
841#define LAN9303_SWE_ALR_WR_DAT_1_MAC_ADDR 0x0000FFFF
844#define LAN9303_SWE_ALR_RD_DAT_0_MAC_ADDR 0xFFFFFFFF
847#define LAN9303_SWE_ALR_RD_DAT_1_VALID 0x04000000
848#define LAN9303_SWE_ALR_RD_DAT_1_END_OF_TABLE 0x02000000
849#define LAN9303_SWE_ALR_RD_DAT_1_STATIC 0x01000000
850#define LAN9303_SWE_ALR_RD_DAT_1_FILTER 0x00800000
851#define LAN9303_SWE_ALR_RD_DAT_1_PRIORITY_EN 0x00400000
852#define LAN9303_SWE_ALR_RD_DAT_1_PRIORITY 0x00380000
853#define LAN9303_SWE_ALR_RD_DAT_1_PORT 0x00070000
854#define LAN9303_SWE_ALR_RD_DAT_1_PORT_0 0x00000000
855#define LAN9303_SWE_ALR_RD_DAT_1_PORT_1 0x00010000
856#define LAN9303_SWE_ALR_RD_DAT_1_PORT_2 0x00020000
857#define LAN9303_SWE_ALR_RD_DAT_1_PORT_RESERVED 0x00030000
858#define LAN9303_SWE_ALR_RD_DAT_1_PORT_0_1 0x00040000
859#define LAN9303_SWE_ALR_RD_DAT_1_PORT_0_2 0x00050000
860#define LAN9303_SWE_ALR_RD_DAT_1_PORT_1_2 0x00060000
861#define LAN9303_SWE_ALR_RD_DAT_1_PORT_0_1_2 0x00070000
862#define LAN9303_SWE_ALR_RD_DAT_1_MAC_ADDR 0x0000FFFF
865#define LAN9303_SWE_ALR_CMD_STS_ALR_INIT_DONE 0x00000002
866#define LAN9303_SWE_ALR_CMD_STS_MAKE_PENDING 0x00000001
869#define LAN9303_SWE_ALR_CFG_ALR_AGE_TEST 0x00000001
872#define LAN9303_SWE_VLAN_CMD_WRITE 0x00000000
873#define LAN9303_SWE_VLAN_CMD_READ 0x00000020
874#define LAN9303_SWE_VLAN_CMD_VLAN 0x00000000
875#define LAN9303_SWE_VLAN_CMD_PVID 0x00000010
876#define LAN9303_SWE_VLAN_CMD_VLAN_PORT 0x0000000F
879#define LAN9303_SWE_GLOBAL_INGRSS_CFG_802_1Q_VLAN_DIS 0x00008000
880#define LAN9303_SWE_GLOBAL_INGRSS_CFG_USE_TAG 0x00004000
881#define LAN9303_SWE_GLOBAL_INGRSS_CFG_ALLOW_MONITOR_ECHO 0x00002000
882#define LAN9303_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITOR_PORT 0x00001C00
883#define LAN9303_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITOR_PORT_0 0x00000400
884#define LAN9303_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITOR_PORT_1 0x00000800
885#define LAN9303_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITOR_PORT_2 0x00001000
886#define LAN9303_SWE_GLOBAL_INGRSS_CFG_USE_IP 0x00000200
887#define LAN9303_SWE_GLOBAL_INGRSS_CFG_IGMP_MONITORING_EN 0x00000080
888#define LAN9303_SWE_GLOBAL_INGRSS_CFG_SWE_COUNTER_TEST 0x00000040
889#define LAN9303_SWE_GLOBAL_INGRSS_CFG_DA_HIGHEST_PRIORITY 0x00000020
890#define LAN9303_SWE_GLOBAL_INGRSS_CFG_FILTER_MULTICAST 0x00000010
891#define LAN9303_SWE_GLOBAL_INGRSS_CFG_DROP_UNKNOWN 0x00000008
892#define LAN9303_SWE_GLOBAL_INGRSS_CFG_USE_PRECEDENCE 0x00000004
893#define LAN9303_SWE_GLOBAL_INGRSS_CFG_VL_HIGHER_PRIORITY 0x00000002
894#define LAN9303_SWE_GLOBAL_INGRSS_CFG_VLAN_EN 0x00000001
897#define LAN9303_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS 0x00000038
898#define LAN9303_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT0 0x00000000
899#define LAN9303_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT1 0x00000008
900#define LAN9303_SWE_PORT_INGRSS_CFG_LEARN_ON_INGRESS_PORT2 0x00000010
901#define LAN9303_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK 0x00000007
902#define LAN9303_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT0 0x00000000
903#define LAN9303_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT1 0x00000001
904#define LAN9303_SWE_PORT_INGRSS_CFG_MEMBERSHIP_CHECK_PORT2 0x00000002
907#define LAN9303_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN 0x00000007
908#define LAN9303_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT0 0x00000001
909#define LAN9303_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT1 0x00000002
910#define LAN9303_SWE_ADMT_ONLY_VLAN_ADMIT_ONLY_VLAN_PORT2 0x00000004
913#define LAN9303_SWE_PORT_STATE_PORT2 0x00000030
914#define LAN9303_SWE_PORT_STATE_PORT2_FORWARDING 0x00000000
915#define LAN9303_SWE_PORT_STATE_PORT2_LISTENING 0x00000010
916#define LAN9303_SWE_PORT_STATE_PORT2_LEARNING 0x00000020
917#define LAN9303_SWE_PORT_STATE_PORT2_DISABLED 0x00000030
918#define LAN9303_SWE_PORT_STATE_PORT1 0x0000000C
919#define LAN9303_SWE_PORT_STATE_PORT1_FORWARDING 0x00000000
920#define LAN9303_SWE_PORT_STATE_PORT1_LISTENING 0x00000004
921#define LAN9303_SWE_PORT_STATE_PORT1_LEARNING 0x00000008
922#define LAN9303_SWE_PORT_STATE_PORT1_DISABLED 0x0000000C
923#define LAN9303_SWE_PORT_STATE_PORT0 0x00000003
924#define LAN9303_SWE_PORT_STATE_PORT0_FORWARDING 0x00000000
925#define LAN9303_SWE_PORT_STATE_PORT0_LISTENING 0x00000001
926#define LAN9303_SWE_PORT_STATE_PORT0_LEARNING 0x00000002
927#define LAN9303_SWE_PORT_STATE_PORT0_DISABLED 0x00000003
930#define LAN9303_SWE_PRI_TO_QUE_PRIO_7_TRAFFIC_CLASS 0x0000C000
931#define LAN9303_SWE_PRI_TO_QUE_PRIO_6_TRAFFIC_CLASS 0x00003000
932#define LAN9303_SWE_PRI_TO_QUE_PRIO_5_TRAFFIC_CLASS 0x00000C00
933#define LAN9303_SWE_PRI_TO_QUE_PRIO_4_TRAFFIC_CLASS 0x00000300
934#define LAN9303_SWE_PRI_TO_QUE_PRIO_3_TRAFFIC_CLASS 0x000000C0
935#define LAN9303_SWE_PRI_TO_QUE_PRIO_2_TRAFFIC_CLASS 0x00000030
936#define LAN9303_SWE_PRI_TO_QUE_PRIO_1_TRAFFIC_CLASS 0x0000000C
937#define LAN9303_SWE_PRI_TO_QUE_PRIO_0_TRAFFIC_CLASS 0x00000003
940#define LAN9303_SWE_PORT_MIRROR_RX_MIRRORING_FILT_EN 0x00000100
941#define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT 0x000000E0
942#define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT_0 0x00000020
943#define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT_1 0x00000040
944#define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT_2 0x00000080
945#define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT 0x0000001C
946#define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT_0 0x00000004
947#define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT_1 0x00000008
948#define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT_2 0x00000010
949#define LAN9303_SWE_PORT_MIRROR_RX_MIRRORING_EN 0x00000002
950#define LAN9303_SWE_PORT_MIRROR_TX_MIRRORING_EN 0x00000001
953#define LAN9303_SWE_INGRSS_PORT_TYP_PORT2 0x00000030
954#define LAN9303_SWE_INGRSS_PORT_TYP_PORT2_DIS 0x00000000
955#define LAN9303_SWE_INGRSS_PORT_TYP_PORT2_EN 0x00000030
956#define LAN9303_SWE_INGRSS_PORT_TYP_PORT1 0x0000000C
957#define LAN9303_SWE_INGRSS_PORT_TYP_PORT1_DIS 0x00000000
958#define LAN9303_SWE_INGRSS_PORT_TYP_PORT1_EN 0x0000000C
959#define LAN9303_SWE_INGRSS_PORT_TYP_PORT0 0x00000003
960#define LAN9303_SWE_INGRSS_PORT_TYP_PORT0_DIS 0x00000000
961#define LAN9303_SWE_INGRSS_PORT_TYP_PORT0_EN 0x00000003
964#define LAN9303_BM_EGRSS_PORT_TYPE_VID_SEL_PORT2 0x00400000
965#define LAN9303_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT2 0x00200000
966#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT2 0x00100000
967#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT2 0x00080000
968#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT2 0x00040000
969#define LAN9303_BM_EGRSS_PORT_TYPE_PORT2_TYPE 0x00030000
970#define LAN9303_BM_EGRSS_PORT_TYPE_PORT2_TYPE_DUMB 0x00000000
971#define LAN9303_BM_EGRSS_PORT_TYPE_PORT2_TYPE_ACCESS 0x00010000
972#define LAN9303_BM_EGRSS_PORT_TYPE_PORT2_TYPE_HYBRID 0x00020000
973#define LAN9303_BM_EGRSS_PORT_TYPE_PORT2_TYPE_CPU 0x00030000
974#define LAN9303_BM_EGRSS_PORT_TYPE_VID_SEL_PORT1 0x00004000
975#define LAN9303_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT1 0x00002000
976#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT1 0x00001000
977#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT1 0x00000800
978#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT1 0x00000400
979#define LAN9303_BM_EGRSS_PORT_TYPE_PORT1_TYPE 0x00000300
980#define LAN9303_BM_EGRSS_PORT_TYPE_PORT1_TYPE_DUMB 0x00000000
981#define LAN9303_BM_EGRSS_PORT_TYPE_PORT1_TYPE_ACCESS 0x00000100
982#define LAN9303_BM_EGRSS_PORT_TYPE_PORT1_TYPE_HYBRID 0x00000200
983#define LAN9303_BM_EGRSS_PORT_TYPE_PORT1_TYPE_CPU 0x00000300
984#define LAN9303_BM_EGRSS_PORT_TYPE_VID_SEL_PORT0 0x00000040
985#define LAN9303_BM_EGRSS_PORT_TYPE_INSERT_TAG_PORT0 0x00000020
986#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_VID_PORT0 0x00000010
987#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_PRIO_PORT0 0x00000008
988#define LAN9303_BM_EGRSS_PORT_TYPE_CHANGE_TAG_PORT0 0x00000004
989#define LAN9303_BM_EGRSS_PORT_TYPE_PORT0_TYPE 0x00000003
990#define LAN9303_BM_EGRSS_PORT_TYPE_PORT0_TYPE_DUMB 0x00000000
991#define LAN9303_BM_EGRSS_PORT_TYPE_PORT0_TYPE_ACCESS 0x00000001
992#define LAN9303_BM_EGRSS_PORT_TYPE_PORT0_TYPE_HYBRID 0x00000002
993#define LAN9303_BM_EGRSS_PORT_TYPE_PORT0_TYPE_CPU 0x00000003
1004error_t lan9303Init(NetInterface *interface);
1005void lan9303InitHook(NetInterface *interface);
1007void lan9303Tick(NetInterface *interface);
1009void lan9303EnableIrq(NetInterface *interface);
1010void lan9303DisableIrq(NetInterface *interface);
1012void lan9303EventHandler(NetInterface *interface);
1015 size_t *offset, NetTxAncillary *ancillary);
1017error_t lan9303UntagFrame(NetInterface *interface, uint8_t **frame,
1018 size_t *length, NetRxAncillary *ancillary);
1020bool_t lan9303GetLinkState(NetInterface *interface, uint8_t port);
1021uint32_t lan9303GetLinkSpeed(NetInterface *interface, uint8_t port);
1022NicDuplexMode lan9303GetDuplexMode(NetInterface *interface, uint8_t port);
1024void lan9303SetPortState(NetInterface *interface, uint8_t port,
1027SwitchPortState lan9303GetPortState(NetInterface *interface, uint8_t port);
1029void lan9303SetAgingTime(NetInterface *interface, uint32_t agingTime);
1031void lan9303EnableIgmpSnooping(NetInterface *interface, bool_t enable);
1032void lan9303EnableMldSnooping(NetInterface *interface, bool_t enable);
1033void lan9303EnableRsvdMcastTable(NetInterface *interface, bool_t enable);
1035error_t lan9303AddStaticFdbEntry(NetInterface *interface,
1038error_t lan9303DeleteStaticFdbEntry(NetInterface *interface,
1041error_t lan9303GetStaticFdbEntry(NetInterface *interface, uint_t index,
1044void lan9303FlushStaticFdbTable(NetInterface *interface);
1046error_t lan9303GetDynamicFdbEntry(NetInterface *interface, uint_t index,
1049void lan9303FlushDynamicFdbTable(NetInterface *interface, uint8_t port);
1051void lan9303SetUnknownMcastFwdPorts(NetInterface *interface,
1052 bool_t enable, uint32_t forwardPorts);
1054void lan9303WritePhyReg(NetInterface *interface, uint8_t port,
1055 uint8_t address, uint16_t data);
1057uint16_t lan9303ReadPhyReg(NetInterface *interface, uint8_t port,
1060void lan9303DumpPhyReg(NetInterface *interface, uint8_t port);
1062void lan9303WriteSysReg(NetInterface *interface, uint16_t address,
1065uint32_t lan9303ReadSysReg(NetInterface *interface, uint16_t address);
1067void lan9303DumpSysReg(NetInterface *interface);
1069void lan9303WriteSwitchReg(NetInterface *interface, uint16_t address,
1072uint32_t lan9303ReadSwitchReg(NetInterface *interface, uint16_t address);
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
NicDuplexMode
Duplex mode.
Definition nic.h:122
SwitchPortState
Switch port state.
Definition nic.h:134
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
Ethernet switch driver.
Definition nic.h:322
Forwarding database entry.
Definition nic.h:149