mikroSDK Reference Manual
ksz9563_driver.h
Go to the documentation of this file.
1
31#ifndef _KSZ9563_DRIVER_H
32#define _KSZ9563_DRIVER_H
33
34//Dependencies
35#include "core/nic.h"
36
37//Port identifiers
38#define KSZ9563_PORT1 1
39#define KSZ9563_PORT2 2
40#define KSZ9563_PORT3 3
41
42//Port masks
43#define KSZ9563_PORT_MASK 0x07
44#define KSZ9563_PORT1_MASK 0x01
45#define KSZ9563_PORT2_MASK 0x02
46#define KSZ9563_PORT3_MASK 0x04
47
48//SPI command byte
49#define KSZ9563_SPI_CMD_WRITE 0x40000000
50#define KSZ9563_SPI_CMD_READ 0x60000000
51#define KSZ9563_SPI_CMD_ADDR 0x001FFFE0
52
53//Size of static and dynamic MAC tables
54#define KSZ9563_STATIC_MAC_TABLE_SIZE 16
55#define KSZ9563_DYNAMIC_MAC_TABLE_SIZE 4096
56
57//Tail tag rules (host to KSZ9563)
58#define KSZ9563_TAIL_TAG_NORMAL_ADDR_LOOKUP 0x40
59#define KSZ9563_TAIL_TAG_PORT_BLOCKING_OVERRIDE 0x20
60#define KSZ9563_TAIL_TAG_PRIORITY 0x18
61#define KSZ9563_TAIL_TAG_DEST_PORT3 0x04
62#define KSZ9563_TAIL_TAG_DEST_PORT2 0x02
63#define KSZ9563_TAIL_TAG_DEST_PORT1 0x01
64
65//Tail tag rules (KSZ9563 to host)
66#define KSZ9563_TAIL_TAG_PTP_MSG 0x80
67#define KSZ9563_TAIL_TAG_SRC_PORT 0x03
68
69//KSZ9563 PHY registers
70#define KSZ9563_BMCR 0x00
71#define KSZ9563_BMSR 0x01
72#define KSZ9563_PHYID1 0x02
73#define KSZ9563_PHYID2 0x03
74#define KSZ9563_ANAR 0x04
75#define KSZ9563_ANLPAR 0x05
76#define KSZ9563_ANER 0x06
77#define KSZ9563_ANNPR 0x07
78#define KSZ9563_ANLPNPR 0x08
79#define KSZ9563_GBCR 0x09
80#define KSZ9563_GBSR 0x0A
81#define KSZ9563_MMDACR 0x0D
82#define KSZ9563_MMDAADR 0x0E
83#define KSZ9563_GBESR 0x0F
84#define KSZ9563_RLB 0x11
85#define KSZ9563_LINKMD 0x12
86#define KSZ9563_DPMAPCSS 0x13
87#define KSZ9563_RXERCTR 0x15
88#define KSZ9563_ICSR 0x1B
89#define KSZ9563_AUTOMDI 0x1C
90#define KSZ9563_PHYCON 0x1F
91
92//KSZ9563 MMD registers
93#define KSZ9563_MMD_LED_MODE 0x02, 0x00
94#define KSZ9563_MMD_1000BT_EEE_WAKE_TX_TIMER 0x03, 0x0E
95#define KSZ9563_MMD_EEE_ADV 0x07, 0x3C
96
97//KSZ9563 Switch registers
98#define KSZ9563_CHIP_ID0 0x0000
99#define KSZ9563_CHIP_ID1 0x0001
100#define KSZ9563_CHIP_ID2 0x0002
101#define KSZ9563_CHIP_ID3 0x0003
102#define KSZ9563_PME_PIN_CTRL 0x0006
103#define KSZ9563_CHIP_ID4 0x000F
104#define KSZ9563_GLOBAL_INT_STAT 0x0010
105#define KSZ9563_GLOBAL_INT_MASK 0x0014
106#define KSZ9563_GLOBAL_PORT_INT_STAT 0x0018
107#define KSZ9563_GLOBAL_PORT_INT_MASK 0x001C
108#define KSZ9563_SERIAL_IO_CTRL 0x0100
109#define KSZ9563_IBA_CTRL 0x0104
110#define KSZ9563_IO_DRIVE_STRENGTH 0x010D
111#define KSZ9563_IBA_OP_STAT1 0x0110
112#define KSZ9563_LED_OVERRIDE 0x0120
113#define KSZ9563_LED_OUTPUT 0x0124
114#define KSZ9563_LED2_0_LED2_1_SRC 0x0128
115#define KSZ9563_PWR_DOWN_CTRL0 0x0201
116#define KSZ9563_LED_STRAP_IN 0x0210
117#define KSZ9563_SWITCH_OP 0x0300
118#define KSZ9563_SWITCH_MAC_ADDR0 0x0302
119#define KSZ9563_SWITCH_MAC_ADDR1 0x0303
120#define KSZ9563_SWITCH_MAC_ADDR2 0x0304
121#define KSZ9563_SWITCH_MAC_ADDR3 0x0305
122#define KSZ9563_SWITCH_MAC_ADDR4 0x0306
123#define KSZ9563_SWITCH_MAC_ADDR5 0x0307
124#define KSZ9563_SWITCH_MTU 0x0308
125#define KSZ9563_SWITCH_ISP_TPID 0x030A
126#define KSZ9563_AVB_CBS_STRATEGY 0x030E
127#define KSZ9563_SWITCH_LUE_CTRL0 0x0310
128#define KSZ9563_SWITCH_LUE_CTRL1 0x0311
129#define KSZ9563_SWITCH_LUE_CTRL2 0x0312
130#define KSZ9563_SWITCH_LUE_CTRL3 0x0313
131#define KSZ9563_ALU_TABLE_INT 0x0314
132#define KSZ9563_ALU_TABLE_MASK 0x0315
133#define KSZ9563_ALU_TABLE_ENTRY_INDEX0 0x0316
134#define KSZ9563_ALU_TABLE_ENTRY_INDEX1 0x0318
135#define KSZ9563_ALU_TABLE_ENTRY_INDEX2 0x031A
136#define KSZ9563_UNKNOWN_UNICAST_CTRL 0x0320
137#define KSZ9563_UNKONWN_MULTICAST_CTRL 0x0324
138#define KSZ9563_UNKNOWN_VLAN_ID_CTRL 0x0328
139#define KSZ9563_SWITCH_MAC_CTRL0 0x0330
140#define KSZ9563_SWITCH_MAC_CTRL1 0x0331
141#define KSZ9563_SWITCH_MAC_CTRL2 0x0332
142#define KSZ9563_SWITCH_MAC_CTRL3 0x0333
143#define KSZ9563_SWITCH_MAC_CTRL4 0x0334
144#define KSZ9563_SWITCH_MAC_CTRL5 0x0335
145#define KSZ9563_SWITCH_MIB_CTRL 0x0336
146#define KSZ9563_802_1P_PRIO_MAPPING0 0x0338
147#define KSZ9563_802_1P_PRIO_MAPPING1 0x0339
148#define KSZ9563_802_1P_PRIO_MAPPING2 0x033A
149#define KSZ9563_802_1P_PRIO_MAPPING3 0x033B
150#define KSZ9563_IP_DIFFSERV_PRIO_EN 0x033E
151#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING0 0x0340
152#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING1 0x0341
153#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING2 0x0342
154#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING3 0x0343
155#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING4 0x0344
156#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING5 0x0345
157#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING6 0x0346
158#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING7 0x0347
159#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING8 0x0348
160#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING9 0x0349
161#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING10 0x034A
162#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING11 0x034B
163#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING12 0x034C
164#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING13 0x034D
165#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING14 0x034E
166#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING15 0x034F
167#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING16 0x0350
168#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING17 0x0351
169#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING18 0x0352
170#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING19 0x0353
171#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING20 0x0354
172#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING21 0x0355
173#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING22 0x0356
174#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING23 0x0357
175#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING24 0x0358
176#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING25 0x0359
177#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING26 0x035A
178#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING27 0x035B
179#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING28 0x035C
180#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING29 0x035D
181#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING30 0x035E
182#define KSZ9563_IP_DIFFSERV_PRIO_MAPPING31 0x035F
183#define KSZ9563_GLOBAL_PORT_MIRROR_SNOOP_CTRL 0x0370
184#define KSZ9563_WRED_DIFFSERV_COLOR_MAPPING 0x0378
185#define KSZ9563_PTP_EVENT_MSG_PRIO 0x037C
186#define KSZ9563_PTP_NON_EVENT_MSG_PRIO 0x037D
187#define KSZ9563_QUEUE_MGMT_CTRL0 0x0390
188#define KSZ9563_VLAN_TABLE_ENTRY0 0x0400
189#define KSZ9563_VLAN_TABLE_ENTRY1 0x0404
190#define KSZ9563_VLAN_TABLE_ENTRY2 0x0408
191#define KSZ9563_VLAN_TABLE_INDEX 0x040C
192#define KSZ9563_VLAN_TABLE_ACCESS_CTRL 0x040E
193#define KSZ9563_ALU_TABLE_INDEX0 0x0410
194#define KSZ9563_ALU_TABLE_INDEX1 0x0414
195#define KSZ9563_ALU_TABLE_CTRL 0x0418
196#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL 0x041C
197#define KSZ9563_ALU_TABLE_ENTRY1 0x0420
198#define KSZ9563_STATIC_TABLE_ENTRY1 0x0420
199#define KSZ9563_ALU_TABLE_ENTRY2 0x0424
200#define KSZ9563_STATIC_TABLE_ENTRY2 0x0424
201#define KSZ9563_RES_MCAST_TABLE_ENTRY2 0x0424
202#define KSZ9563_ALU_TABLE_ENTRY3 0x0428
203#define KSZ9563_STATIC_TABLE_ENTRY3 0x0428
204#define KSZ9563_ALU_TABLE_ENTRY4 0x042C
205#define KSZ9563_STATIC_TABLE_ENTRY4 0x042C
206#define KSZ9563_GLOBAL_PTP_CLK_CTRL 0x0500
207#define KSZ9563_GLOBAL_PTP_RTC_CLK_PHASE 0x0502
208#define KSZ9563_GLOBAL_PTP_RTC_CLK_NS_H 0x0504
209#define KSZ9563_GLOBAL_PTP_RTC_CLK_NS_L 0x0506
210#define KSZ9563_GLOBAL_PTP_RTC_CLK_S_H 0x0508
211#define KSZ9563_GLOBAL_PTP_RTC_CLK_S_L 0x050A
212#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_H 0x050C
213#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_L 0x050E
214#define KSZ9563_GLOBAL_PTP_CLK_TEMP_ADJ_DURATION_H 0x0510
215#define KSZ9563_GLOBAL_PTP_CLK_TEMP_ADJ_DURATION_L 0x0512
216#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1 0x0514
217#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2 0x0516
218#define KSZ9563_GLOBAL_PTP_DOMAIN_VERSION 0x0518
219#define KSZ9563_GLOBAL_PTP_UNIT_INDEX 0x0520
220#define KSZ9563_GPIO_STATUS_MONITOR0 0x0524
221#define KSZ9563_GPIO_STATUS_MONITOR1 0x0528
222#define KSZ9563_TS_CTRL_STAT 0x052C
223#define KSZ9563_TOU_TARGET_TIME_NS 0x0530
224#define KSZ9563_TOU_TARGET_TIME_S 0x0534
225#define KSZ9563_TOU_CTRL1 0x0538
226#define KSZ9563_TOU_CTRL2 0x053C
227#define KSZ9563_TOU_CTRL3 0x0540
228#define KSZ9563_TOU_CTRL4 0x0544
229#define KSZ9563_TOU_CTRL5 0x0548
230#define KSZ9563_TS_STAT_CTRL 0x0550
231#define KSZ9563_TS_SAMPLE1_TIME_NS 0x0554
232#define KSZ9563_TS_SAMPLE1_TIME_S 0x0558
233#define KSZ9563_TS_SAMPLE1_TIME_PHASE 0x055C
234#define KSZ9563_TS_SAMPLE2_TIME_NS 0x0560
235#define KSZ9563_TS_SAMPLE2_TIME_S 0x0564
236#define KSZ9563_TS_SAMPLE2_TIME_PHASE 0x0568
237#define KSZ9563_TS_SAMPLE3_TIME_NS 0x056C
238#define KSZ9563_TS_SAMPLE3_TIME_S 0x0570
239#define KSZ9563_TS_SAMPLE3_TIME_PHASE 0x0574
240#define KSZ9563_TS_SAMPLE4_TIME_NS 0x0578
241#define KSZ9563_TS_SAMPLE4_TIME_S 0x057C
242#define KSZ9563_TS_SAMPLE4_TIME_PHASE 0x0580
243#define KSZ9563_TS_SAMPLE5_TIME_NS 0x0584
244#define KSZ9563_TS_SAMPLE5_TIME_S 0x0588
245#define KSZ9563_TS_SAMPLE5_TIME_PHASE 0x058C
246#define KSZ9563_TS_SAMPLE6_TIME_NS 0x0590
247#define KSZ9563_TS_SAMPLE6_TIME_S 0x0594
248#define KSZ9563_TS_SAMPLE6_TIME_PHASE 0x0598
249#define KSZ9563_TS_SAMPLE7_TIME_NS 0x059C
250#define KSZ9563_TS_SAMPLE7_TIME_S 0x05A0
251#define KSZ9563_TS_SAMPLE7_TIME_PHASE 0x05A4
252#define KSZ9563_TS_SAMPLE8_TIME_NS 0x05A8
253#define KSZ9563_TS_SAMPLE8_TIME_S 0x05AC
254#define KSZ9563_TS_SAMPLE8_TIME_PHASE 0x05B0
255#define KSZ9563_PORT1_DEFAULT_TAG0 0x1000
256#define KSZ9563_PORT1_DEFAULT_TAG1 0x1001
257#define KSZ9563_PORT1_AVB_SR_CLASS1_TAG0 0x1004
258#define KSZ9563_PORT1_AVB_SR_CLASS1_TAG1 0x1005
259#define KSZ9563_PORT1_AVB_SR_CLASS2_TAG0 0x1006
260#define KSZ9563_PORT1_AVB_SR_CLASS2_TAG1 0x1007
261#define KSZ9563_PORT1_AVB_SR_CLASS1_TYPE 0x1008
262#define KSZ9563_PORT1_AVB_SR_CLASS2_TYPE 0x100A
263#define KSZ9563_PORT1_PME_WOL_EVENT 0x1013
264#define KSZ9563_PORT1_PME_WOL_EN 0x1017
265#define KSZ9563_PORT1_INT_STATUS 0x101B
266#define KSZ9563_PORT1_INT_MASK 0x101F
267#define KSZ9563_PORT1_OP_CTRL0 0x1020
268#define KSZ9563_PORT1_OP_CTRL1 0x1021
269#define KSZ9563_PORT1_STATUS 0x1030
270#define KSZ9563_PORT1_MAC_CTRL0 0x1400
271#define KSZ9563_PORT1_MAC_CTRL1 0x1401
272#define KSZ9563_PORT1_IG_RATE_LIMIT_CTRL 0x1403
273#define KSZ9563_PORT1_PRIO0_IG_LIMIT_CTRL 0x1410
274#define KSZ9563_PORT1_PRIO1_IG_LIMIT_CTRL 0x1411
275#define KSZ9563_PORT1_PRIO2_IG_LIMIT_CTRL 0x1412
276#define KSZ9563_PORT1_PRIO3_IG_LIMIT_CTRL 0x1413
277#define KSZ9563_PORT1_PRIO4_IG_LIMIT_CTRL 0x1414
278#define KSZ9563_PORT1_PRIO5_IG_LIMIT_CTRL 0x1415
279#define KSZ9563_PORT1_PRIO6_IG_LIMIT_CTRL 0x1416
280#define KSZ9563_PORT1_PRIO7_IG_LIMIT_CTRL 0x1417
281#define KSZ9563_PORT1_QUEUE0_EG_LIMIT_CTRL 0x1420
282#define KSZ9563_PORT1_QUEUE1_EG_LIMIT_CTRL 0x1421
283#define KSZ9563_PORT1_QUEUE2_EG_LIMIT_CTRL 0x1422
284#define KSZ9563_PORT1_QUEUE3_EG_LIMIT_CTRL 0x1423
285#define KSZ9563_PORT1_MIB_CTRL_STAT 0x1500
286#define KSZ9563_PORT1_MIB_DATA 0x1504
287#define KSZ9563_PORT1_ACL_ACCESS0 0x1600
288#define KSZ9563_PORT1_ACL_ACCESS1 0x1601
289#define KSZ9563_PORT1_ACL_ACCESS2 0x1602
290#define KSZ9563_PORT1_ACL_ACCESS3 0x1603
291#define KSZ9563_PORT1_ACL_ACCESS4 0x1604
292#define KSZ9563_PORT1_ACL_ACCESS5 0x1605
293#define KSZ9563_PORT1_ACL_ACCESS6 0x1606
294#define KSZ9563_PORT1_ACL_ACCESS7 0x1607
295#define KSZ9563_PORT1_ACL_ACCESS8 0x1608
296#define KSZ9563_PORT1_ACL_ACCESS9 0x1609
297#define KSZ9563_PORT1_ACL_ACCESS10 0x160A
298#define KSZ9563_PORT1_ACL_ACCESS11 0x160B
299#define KSZ9563_PORT1_ACL_ACCESS12 0x160C
300#define KSZ9563_PORT1_ACL_ACCESS13 0x160D
301#define KSZ9563_PORT1_ACL_ACCESS14 0x160E
302#define KSZ9563_PORT1_ACL_ACCESS15 0x160F
303#define KSZ9563_PORT1_ACL_BYTE_EN_MSB 0x1610
304#define KSZ9563_PORT1_ACL_BYTE_EN_LSB 0x1611
305#define KSZ9563_PORT1_ACL_ACCESS_CTRL0 0x1612
306#define KSZ9563_PORT1_MIRRORING_CTRL 0x1800
307#define KSZ9563_PORT1_PRIO_CTRL 0x1801
308#define KSZ9563_PORT1_IG_MAC_CTRL 0x1802
309#define KSZ9563_PORT1_AUTH_CTRL 0x1803
310#define KSZ9563_PORT1_PTR 0x1804
311#define KSZ9563_PORT1_PRIO_TO_QUEUE_MAPPING 0x1808
312#define KSZ9563_PORT1_POLICE_CTRL 0x180C
313#define KSZ9563_PORT1_TX_QUEUE_INDEX 0x1900
314#define KSZ9563_PORT1_TX_QUEUE_PVID 0x1904
315#define KSZ9563_PORT1_TX_QUEUE_CTRL0 0x1914
316#define KSZ9563_PORT1_TX_QUEUE_CTRL1 0x1915
317#define KSZ9563_PORT1_TX_CREDIT_SHAPER_CTRL0 0x1916
318#define KSZ9563_PORT1_TX_CREDIT_SHAPER_CTRL1 0x1918
319#define KSZ9563_PORT1_TX_CREDIT_SHAPER_CTRL2 0x191A
320#define KSZ9563_PORT1_CTRL0 0x1A00
321#define KSZ9563_PORT1_CTRL1 0x1A04
322#define KSZ9563_PORT1_CTRL2 0x1B00
323#define KSZ9563_PORT1_MSTP_PTR 0x1B01
324#define KSZ9563_PORT1_MSTP_STATE 0x1B04
325#define KSZ9563_PORT1_PTP_RX_LATENCY 0x1C00
326#define KSZ9563_PORT1_PTP_TX_LATENCY 0x1C02
327#define KSZ9563_PORT1_PTP_ASYM_CORRECTION 0x1C04
328#define KSZ9563_PORT1_PTP_XDLY_REQ_TSH 0x1C08
329#define KSZ9563_PORT1_PTP_XDLY_REQ_TSL 0x1C0A
330#define KSZ9563_PORT1_PTP_SYNC_TSH 0x1C0C
331#define KSZ9563_PORT1_PTP_SYNC_TSL 0x1C0E
332#define KSZ9563_PORT1_PTP_PDLY_RESP_TSH 0x1C10
333#define KSZ9563_PORT1_PTP_PDLY_RESP_TSL 0x1C12
334#define KSZ9563_PORT1_PTP_TS_INT_STAT 0x1C14
335#define KSZ9563_PORT1_PTP_TS_INT_EN 0x1C16
336#define KSZ9563_PORT1_PTP_LINK_DELAY 0x1C18
337#define KSZ9563_PORT2_DEFAULT_TAG0 0x2000
338#define KSZ9563_PORT2_DEFAULT_TAG1 0x2001
339#define KSZ9563_PORT2_AVB_SR_CLASS1_TAG0 0x2004
340#define KSZ9563_PORT2_AVB_SR_CLASS1_TAG1 0x2005
341#define KSZ9563_PORT2_AVB_SR_CLASS2_TAG0 0x2006
342#define KSZ9563_PORT2_AVB_SR_CLASS2_TAG1 0x2007
343#define KSZ9563_PORT2_AVB_SR_CLASS1_TYPE 0x2008
344#define KSZ9563_PORT2_AVB_SR_CLASS2_TYPE 0x200A
345#define KSZ9563_PORT2_PME_WOL_EVENT 0x2013
346#define KSZ9563_PORT2_PME_WOL_EN 0x2017
347#define KSZ9563_PORT2_INT_STATUS 0x201B
348#define KSZ9563_PORT2_INT_MASK 0x201F
349#define KSZ9563_PORT2_OP_CTRL0 0x2020
350#define KSZ9563_PORT2_OP_CTRL1 0x2021
351#define KSZ9563_PORT2_STATUS 0x2030
352#define KSZ9563_PORT2_MAC_CTRL0 0x2400
353#define KSZ9563_PORT2_MAC_CTRL1 0x2401
354#define KSZ9563_PORT2_IG_RATE_LIMIT_CTRL 0x2403
355#define KSZ9563_PORT2_PRIO0_IG_LIMIT_CTRL 0x2410
356#define KSZ9563_PORT2_PRIO1_IG_LIMIT_CTRL 0x2411
357#define KSZ9563_PORT2_PRIO2_IG_LIMIT_CTRL 0x2412
358#define KSZ9563_PORT2_PRIO3_IG_LIMIT_CTRL 0x2413
359#define KSZ9563_PORT2_PRIO4_IG_LIMIT_CTRL 0x2414
360#define KSZ9563_PORT2_PRIO5_IG_LIMIT_CTRL 0x2415
361#define KSZ9563_PORT2_PRIO6_IG_LIMIT_CTRL 0x2416
362#define KSZ9563_PORT2_PRIO7_IG_LIMIT_CTRL 0x2417
363#define KSZ9563_PORT2_QUEUE0_EG_LIMIT_CTRL 0x2420
364#define KSZ9563_PORT2_QUEUE1_EG_LIMIT_CTRL 0x2421
365#define KSZ9563_PORT2_QUEUE2_EG_LIMIT_CTRL 0x2422
366#define KSZ9563_PORT2_QUEUE3_EG_LIMIT_CTRL 0x2423
367#define KSZ9563_PORT2_MIB_CTRL_STAT 0x2500
368#define KSZ9563_PORT2_MIB_DATA 0x2504
369#define KSZ9563_PORT2_ACL_ACCESS0 0x2600
370#define KSZ9563_PORT2_ACL_ACCESS1 0x2601
371#define KSZ9563_PORT2_ACL_ACCESS2 0x2602
372#define KSZ9563_PORT2_ACL_ACCESS3 0x2603
373#define KSZ9563_PORT2_ACL_ACCESS4 0x2604
374#define KSZ9563_PORT2_ACL_ACCESS5 0x2605
375#define KSZ9563_PORT2_ACL_ACCESS6 0x2606
376#define KSZ9563_PORT2_ACL_ACCESS7 0x2607
377#define KSZ9563_PORT2_ACL_ACCESS8 0x2608
378#define KSZ9563_PORT2_ACL_ACCESS9 0x2609
379#define KSZ9563_PORT2_ACL_ACCESS10 0x260A
380#define KSZ9563_PORT2_ACL_ACCESS11 0x260B
381#define KSZ9563_PORT2_ACL_ACCESS12 0x260C
382#define KSZ9563_PORT2_ACL_ACCESS13 0x260D
383#define KSZ9563_PORT2_ACL_ACCESS14 0x260E
384#define KSZ9563_PORT2_ACL_ACCESS15 0x260F
385#define KSZ9563_PORT2_ACL_BYTE_EN_MSB 0x2610
386#define KSZ9563_PORT2_ACL_BYTE_EN_LSB 0x2611
387#define KSZ9563_PORT2_ACL_ACCESS_CTRL0 0x2612
388#define KSZ9563_PORT2_MIRRORING_CTRL 0x2800
389#define KSZ9563_PORT2_PRIO_CTRL 0x2801
390#define KSZ9563_PORT2_IG_MAC_CTRL 0x2802
391#define KSZ9563_PORT2_AUTH_CTRL 0x2803
392#define KSZ9563_PORT2_PTR 0x2804
393#define KSZ9563_PORT2_PRIO_TO_QUEUE_MAPPING 0x2808
394#define KSZ9563_PORT2_POLICE_CTRL 0x280C
395#define KSZ9563_PORT2_TX_QUEUE_INDEX 0x2900
396#define KSZ9563_PORT2_TX_QUEUE_PVID 0x2904
397#define KSZ9563_PORT2_TX_QUEUE_CTRL0 0x2914
398#define KSZ9563_PORT2_TX_QUEUE_CTRL1 0x2915
399#define KSZ9563_PORT2_TX_CREDIT_SHAPER_CTRL0 0x2916
400#define KSZ9563_PORT2_TX_CREDIT_SHAPER_CTRL1 0x2918
401#define KSZ9563_PORT2_TX_CREDIT_SHAPER_CTRL2 0x291A
402#define KSZ9563_PORT2_CTRL0 0x2A00
403#define KSZ9563_PORT2_CTRL1 0x2A04
404#define KSZ9563_PORT2_CTRL2 0x2B00
405#define KSZ9563_PORT2_MSTP_PTR 0x2B01
406#define KSZ9563_PORT2_MSTP_STATE 0x2B04
407#define KSZ9563_PORT2_PTP_RX_LATENCY 0x2C00
408#define KSZ9563_PORT2_PTP_TX_LATENCY 0x2C02
409#define KSZ9563_PORT2_PTP_ASYM_CORRECTION 0x2C04
410#define KSZ9563_PORT2_PTP_XDLY_REQ_TSH 0x2C08
411#define KSZ9563_PORT2_PTP_XDLY_REQ_TSL 0x2C0A
412#define KSZ9563_PORT2_PTP_SYNC_TSH 0x2C0C
413#define KSZ9563_PORT2_PTP_SYNC_TSL 0x2C0E
414#define KSZ9563_PORT2_PTP_PDLY_RESP_TSH 0x2C10
415#define KSZ9563_PORT2_PTP_PDLY_RESP_TSL 0x2C12
416#define KSZ9563_PORT2_PTP_TS_INT_STAT 0x2C14
417#define KSZ9563_PORT2_PTP_TS_INT_EN 0x2C16
418#define KSZ9563_PORT2_PTP_LINK_DELAY 0x2C18
419#define KSZ9563_PORT3_DEFAULT_TAG0 0x3000
420#define KSZ9563_PORT3_DEFAULT_TAG1 0x3001
421#define KSZ9563_PORT3_AVB_SR_CLASS1_TAG0 0x3004
422#define KSZ9563_PORT3_AVB_SR_CLASS1_TAG1 0x3005
423#define KSZ9563_PORT3_AVB_SR_CLASS2_TAG0 0x3006
424#define KSZ9563_PORT3_AVB_SR_CLASS2_TAG1 0x3007
425#define KSZ9563_PORT3_AVB_SR_CLASS1_TYPE 0x3008
426#define KSZ9563_PORT3_AVB_SR_CLASS2_TYPE 0x300A
427#define KSZ9563_PORT3_PME_WOL_EVENT 0x3013
428#define KSZ9563_PORT3_PME_WOL_EN 0x3017
429#define KSZ9563_PORT3_INT_STATUS 0x301B
430#define KSZ9563_PORT3_INT_MASK 0x301F
431#define KSZ9563_PORT3_OP_CTRL0 0x3020
432#define KSZ9563_PORT3_OP_CTRL1 0x3021
433#define KSZ9563_PORT3_STATUS 0x3030
434#define KSZ9563_PORT3_XMII_CTRL0 0x3300
435#define KSZ9563_PORT3_XMII_CTRL1 0x3301
436#define KSZ9563_PORT3_XMII_CTRL3 0x3303
437#define KSZ9563_PORT3_MAC_CTRL0 0x3400
438#define KSZ9563_PORT3_MAC_CTRL1 0x3401
439#define KSZ9563_PORT3_IG_RATE_LIMIT_CTRL 0x3403
440#define KSZ9563_PORT3_PRIO0_IG_LIMIT_CTRL 0x3410
441#define KSZ9563_PORT3_PRIO1_IG_LIMIT_CTRL 0x3411
442#define KSZ9563_PORT3_PRIO2_IG_LIMIT_CTRL 0x3412
443#define KSZ9563_PORT3_PRIO3_IG_LIMIT_CTRL 0x3413
444#define KSZ9563_PORT3_PRIO4_IG_LIMIT_CTRL 0x3414
445#define KSZ9563_PORT3_PRIO5_IG_LIMIT_CTRL 0x3415
446#define KSZ9563_PORT3_PRIO6_IG_LIMIT_CTRL 0x3416
447#define KSZ9563_PORT3_PRIO7_IG_LIMIT_CTRL 0x3417
448#define KSZ9563_PORT3_QUEUE0_EG_LIMIT_CTRL 0x3420
449#define KSZ9563_PORT3_QUEUE1_EG_LIMIT_CTRL 0x3421
450#define KSZ9563_PORT3_QUEUE2_EG_LIMIT_CTRL 0x3422
451#define KSZ9563_PORT3_QUEUE3_EG_LIMIT_CTRL 0x3423
452#define KSZ9563_PORT3_MIB_CTRL_STAT 0x3500
453#define KSZ9563_PORT3_MIB_DATA 0x3504
454#define KSZ9563_PORT3_ACL_ACCESS0 0x3600
455#define KSZ9563_PORT3_ACL_ACCESS1 0x3601
456#define KSZ9563_PORT3_ACL_ACCESS2 0x3602
457#define KSZ9563_PORT3_ACL_ACCESS3 0x3603
458#define KSZ9563_PORT3_ACL_ACCESS4 0x3604
459#define KSZ9563_PORT3_ACL_ACCESS5 0x3605
460#define KSZ9563_PORT3_ACL_ACCESS6 0x3606
461#define KSZ9563_PORT3_ACL_ACCESS7 0x3607
462#define KSZ9563_PORT3_ACL_ACCESS8 0x3608
463#define KSZ9563_PORT3_ACL_ACCESS9 0x3609
464#define KSZ9563_PORT3_ACL_ACCESS10 0x360A
465#define KSZ9563_PORT3_ACL_ACCESS11 0x360B
466#define KSZ9563_PORT3_ACL_ACCESS12 0x360C
467#define KSZ9563_PORT3_ACL_ACCESS13 0x360D
468#define KSZ9563_PORT3_ACL_ACCESS14 0x360E
469#define KSZ9563_PORT3_ACL_ACCESS15 0x360F
470#define KSZ9563_PORT3_ACL_BYTE_EN_MSB 0x3610
471#define KSZ9563_PORT3_ACL_BYTE_EN_LSB 0x3611
472#define KSZ9563_PORT3_ACL_ACCESS_CTRL0 0x3612
473#define KSZ9563_PORT3_MIRRORING_CTRL 0x3800
474#define KSZ9563_PORT3_PRIO_CTRL 0x3801
475#define KSZ9563_PORT3_IG_MAC_CTRL 0x3802
476#define KSZ9563_PORT3_AUTH_CTRL 0x3803
477#define KSZ9563_PORT3_PTR 0x3804
478#define KSZ9563_PORT3_PRIO_TO_QUEUE_MAPPING 0x3808
479#define KSZ9563_PORT3_POLICE_CTRL 0x380C
480#define KSZ9563_PORT3_TX_QUEUE_INDEX 0x3900
481#define KSZ9563_PORT3_TX_QUEUE_PVID 0x3904
482#define KSZ9563_PORT3_TX_QUEUE_CTRL0 0x3914
483#define KSZ9563_PORT3_TX_QUEUE_CTRL1 0x3915
484#define KSZ9563_PORT3_TX_CREDIT_SHAPER_CTRL0 0x3916
485#define KSZ9563_PORT3_TX_CREDIT_SHAPER_CTRL1 0x3918
486#define KSZ9563_PORT3_TX_CREDIT_SHAPER_CTRL2 0x391A
487#define KSZ9563_PORT3_CTRL0 0x3A00
488#define KSZ9563_PORT3_CTRL1 0x3A04
489#define KSZ9563_PORT3_CTRL2 0x3B00
490#define KSZ9563_PORT3_MSTP_PTR 0x3B01
491#define KSZ9563_PORT3_MSTP_STATE 0x3B04
492#define KSZ9563_PORT3_PTP_RX_LATENCY 0x3C00
493#define KSZ9563_PORT3_PTP_TX_LATENCY 0x3C02
494#define KSZ9563_PORT3_PTP_ASYM_CORRECTION 0x3C04
495#define KSZ9563_PORT3_PTP_XDLY_REQ_TSH 0x3C08
496#define KSZ9563_PORT3_PTP_XDLY_REQ_TSL 0x3C0A
497#define KSZ9563_PORT3_PTP_SYNC_TSH 0x3C0C
498#define KSZ9563_PORT3_PTP_SYNC_TSL 0x3C0E
499#define KSZ9563_PORT3_PTP_PDLY_RESP_TSH 0x3C10
500#define KSZ9563_PORT3_PTP_PDLY_RESP_TSL 0x3C12
501#define KSZ9563_PORT3_PTP_TS_INT_STAT 0x3C14
502#define KSZ9563_PORT3_PTP_TS_INT_EN 0x3C16
503#define KSZ9563_PORT3_PTP_LINK_DELAY 0x3C18
504
505//KSZ9563 Switch register access macros
506#define KSZ9563_PORTn_DEFAULT_TAG0(port) (0x0000 + ((port) * 0x1000))
507#define KSZ9563_PORTn_DEFAULT_TAG1(port) (0x0001 + ((port) * 0x1000))
508#define KSZ9563_PORTn_AVB_SR_CLASS1_TAG0(port) (0x0004 + ((port) * 0x1000))
509#define KSZ9563_PORTn_AVB_SR_CLASS1_TAG1(port) (0x0005 + ((port) * 0x1000))
510#define KSZ9563_PORTn_AVB_SR_CLASS2_TAG0(port) (0x0006 + ((port) * 0x1000))
511#define KSZ9563_PORTn_AVB_SR_CLASS2_TAG1(port) (0x0007 + ((port) * 0x1000))
512#define KSZ9563_PORTn_AVB_SR_CLASS1_TYPE(port) (0x0008 + ((port) * 0x1000))
513#define KSZ9563_PORTn_AVB_SR_CLASS2_TYPE(port) (0x000A + ((port) * 0x1000))
514#define KSZ9563_PORTn_PME_WOL_EVENT(port) (0x0013 + ((port) * 0x1000))
515#define KSZ9563_PORTn_PME_WOL_EN(port) (0x0017 + ((port) * 0x1000))
516#define KSZ9563_PORTn_INT_STATUS(port) (0x001B + ((port) * 0x1000))
517#define KSZ9563_PORTn_INT_MASK(port) (0x001F + ((port) * 0x1000))
518#define KSZ9563_PORTn_OP_CTRL0(port) (0x0020 + ((port) * 0x1000))
519#define KSZ9563_PORTn_OP_CTRL1(port) (0x0021 + ((port) * 0x1000))
520#define KSZ9563_PORTn_STATUS(port) (0x0030 + ((port) * 0x1000))
521#define KSZ9563_PORTn_XMII_CTRL0(port) (0x0300 + ((port) * 0x1000))
522#define KSZ9563_PORTn_XMII_CTRL1(port) (0x0301 + ((port) * 0x1000))
523#define KSZ9563_PORTn_XMII_CTRL3(port) (0x0303 + ((port) * 0x1000))
524#define KSZ9563_PORTn_MAC_CTRL0(port) (0x0400 + ((port) * 0x1000))
525#define KSZ9563_PORTn_MAC_CTRL1(port) (0x0401 + ((port) * 0x1000))
526#define KSZ9563_PORTn_IG_RATE_LIMIT_CTRL(port) (0x0403 + ((port) * 0x1000))
527#define KSZ9563_PORTn_PRIO0_IG_LIMIT_CTRL(port) (0x0410 + ((port) * 0x1000))
528#define KSZ9563_PORTn_PRIO1_IG_LIMIT_CTRL(port) (0x0411 + ((port) * 0x1000))
529#define KSZ9563_PORTn_PRIO2_IG_LIMIT_CTRL(port) (0x0412 + ((port) * 0x1000))
530#define KSZ9563_PORTn_PRIO3_IG_LIMIT_CTRL(port) (0x0413 + ((port) * 0x1000))
531#define KSZ9563_PORTn_PRIO4_IG_LIMIT_CTRL(port) (0x0414 + ((port) * 0x1000))
532#define KSZ9563_PORTn_PRIO5_IG_LIMIT_CTRL(port) (0x0415 + ((port) * 0x1000))
533#define KSZ9563_PORTn_PRIO6_IG_LIMIT_CTRL(port) (0x0416 + ((port) * 0x1000))
534#define KSZ9563_PORTn_PRIO7_IG_LIMIT_CTRL(port) (0x0417 + ((port) * 0x1000))
535#define KSZ9563_PORTn_QUEUE0_EG_LIMIT_CTRL(port) (0x0420 + ((port) * 0x1000))
536#define KSZ9563_PORTn_QUEUE1_EG_LIMIT_CTRL(port) (0x0421 + ((port) * 0x1000))
537#define KSZ9563_PORTn_QUEUE2_EG_LIMIT_CTRL(port) (0x0422 + ((port) * 0x1000))
538#define KSZ9563_PORTn_QUEUE3_EG_LIMIT_CTRL(port) (0x0423 + ((port) * 0x1000))
539#define KSZ9563_PORTn_MIB_CTRL_STAT(port) (0x0500 + ((port) * 0x1000))
540#define KSZ9563_PORTn_MIB_DATA(port) (0x0504 + ((port) * 0x1000))
541#define KSZ9563_PORTn_ACL_ACCESS0(port) (0x0600 + ((port) * 0x1000))
542#define KSZ9563_PORTn_ACL_ACCESS1(port) (0x0601 + ((port) * 0x1000))
543#define KSZ9563_PORTn_ACL_ACCESS2(port) (0x0602 + ((port) * 0x1000))
544#define KSZ9563_PORTn_ACL_ACCESS3(port) (0x0603 + ((port) * 0x1000))
545#define KSZ9563_PORTn_ACL_ACCESS4(port) (0x0604 + ((port) * 0x1000))
546#define KSZ9563_PORTn_ACL_ACCESS5(port) (0x0605 + ((port) * 0x1000))
547#define KSZ9563_PORTn_ACL_ACCESS6(port) (0x0606 + ((port) * 0x1000))
548#define KSZ9563_PORTn_ACL_ACCESS7(port) (0x0607 + ((port) * 0x1000))
549#define KSZ9563_PORTn_ACL_ACCESS8(port) (0x0608 + ((port) * 0x1000))
550#define KSZ9563_PORTn_ACL_ACCESS9(port) (0x0609 + ((port) * 0x1000))
551#define KSZ9563_PORTn_ACL_ACCESS10(port) (0x060A + ((port) * 0x1000))
552#define KSZ9563_PORTn_ACL_ACCESS11(port) (0x060B + ((port) * 0x1000))
553#define KSZ9563_PORTn_ACL_ACCESS12(port) (0x060C + ((port) * 0x1000))
554#define KSZ9563_PORTn_ACL_ACCESS13(port) (0x060D + ((port) * 0x1000))
555#define KSZ9563_PORTn_ACL_ACCESS14(port) (0x060E + ((port) * 0x1000))
556#define KSZ9563_PORTn_ACL_ACCESS15(port) (0x060F + ((port) * 0x1000))
557#define KSZ9563_PORTn_ACL_BYTE_EN_MSB(port) (0x0610 + ((port) * 0x1000))
558#define KSZ9563_PORTn_ACL_BYTE_EN_LSB(port) (0x0611 + ((port) * 0x1000))
559#define KSZ9563_PORTn_ACL_ACCESS_CTRL0(port) (0x0612 + ((port) * 0x1000))
560#define KSZ9563_PORTn_MIRRORING_CTRL(port) (0x0800 + ((port) * 0x1000))
561#define KSZ9563_PORTn_PRIO_CTRL(port) (0x0801 + ((port) * 0x1000))
562#define KSZ9563_PORTn_IG_MAC_CTRL(port) (0x0802 + ((port) * 0x1000))
563#define KSZ9563_PORTn_AUTH_CTRL(port) (0x0803 + ((port) * 0x1000))
564#define KSZ9563_PORTn_PTR(port) (0x0804 + ((port) * 0x1000))
565#define KSZ9563_PORTn_PRIO_TO_QUEUE_MAPPING(port) (0x0808 + ((port) * 0x1000))
566#define KSZ9563_PORTn_POLICE_CTRL(port) (0x080C + ((port) * 0x1000))
567#define KSZ9563_PORTn_TX_QUEUE_INDEX(port) (0x0900 + ((port) * 0x1000))
568#define KSZ9563_PORTn_TX_QUEUE_PVID(port) (0x0904 + ((port) * 0x1000))
569#define KSZ9563_PORTn_TX_QUEUE_CTRL0(port) (0x0914 + ((port) * 0x1000))
570#define KSZ9563_PORTn_TX_QUEUE_CTRL1(port) (0x0915 + ((port) * 0x1000))
571#define KSZ9563_PORTn_TX_CREDIT_SHAPER_CTRL0(port) (0x0916 + ((port) * 0x1000))
572#define KSZ9563_PORTn_TX_CREDIT_SHAPER_CTRL1(port) (0x0918 + ((port) * 0x1000))
573#define KSZ9563_PORTn_TX_CREDIT_SHAPER_CTRL2(port) (0x091A + ((port) * 0x1000))
574#define KSZ9563_PORTn_CTRL0(port) (0x0A00 + ((port) * 0x1000))
575#define KSZ9563_PORTn_CTRL1(port) (0x0A04 + ((port) * 0x1000))
576#define KSZ9563_PORTn_CTRL2(port) (0x0B00 + ((port) * 0x1000))
577#define KSZ9563_PORTn_MSTP_PTR(port) (0x0B01 + ((port) * 0x1000))
578#define KSZ9563_PORTn_MSTP_STATE(port) (0x0B04 + ((port) * 0x1000))
579#define KSZ9563_PORTn_PTP_RX_LATENCY(port) (0x0C00 + ((port) * 0x1000))
580#define KSZ9563_PORTn_PTP_TX_LATENCY(port) (0x0C02 + ((port) * 0x1000))
581#define KSZ9563_PORTn_PTP_ASYM_CORRECTION(port) (0x0C04 + ((port) * 0x1000))
582#define KSZ9563_PORTn_PTP_XDLY_REQ_TSH(port) (0x0C08 + ((port) * 0x1000))
583#define KSZ9563_PORTn_PTP_XDLY_REQ_TSL(port) (0x0C0A + ((port) * 0x1000))
584#define KSZ9563_PORTn_PTP_SYNC_TSH(port) (0x0C0C + ((port) * 0x1000))
585#define KSZ9563_PORTn_PTP_SYNC_TSL(port) (0x0C0E + ((port) * 0x1000))
586#define KSZ9563_PORTn_PTP_PDLY_RESP_TSH(port) (0x0C10 + ((port) * 0x1000))
587#define KSZ9563_PORTn_PTP_PDLY_RESP_TSL(port) (0x0C12 + ((port) * 0x1000))
588#define KSZ9563_PORTn_PTP_TS_INT_STAT(port) (0x0C14 + ((port) * 0x1000))
589#define KSZ9563_PORTn_PTP_TS_INT_EN(port) (0x0C16 + ((port) * 0x1000))
590#define KSZ9563_PORTn_PTP_LINK_DELAY(port) (0x0C18 + ((port) * 0x1000))
591#define KSZ9563_PORTn_ETH_PHY_REG(port, addr) (0x0100 + ((port) * 0x1000) + ((addr) * 2))
592
593//PHY Basic Control register
594#define KSZ9563_BMCR_RESET 0x8000
595#define KSZ9563_BMCR_LOOPBACK 0x4000
596#define KSZ9563_BMCR_SPEED_SEL_LSB 0x2000
597#define KSZ9563_BMCR_AN_EN 0x1000
598#define KSZ9563_BMCR_POWER_DOWN 0x0800
599#define KSZ9563_BMCR_ISOLATE 0x0400
600#define KSZ9563_BMCR_RESTART_AN 0x0200
601#define KSZ9563_BMCR_DUPLEX_MODE 0x0100
602#define KSZ9563_BMCR_COL_TEST 0x0080
603#define KSZ9563_BMCR_SPEED_SEL_MSB 0x0040
604
605//PHY Basic Status register
606#define KSZ9563_BMSR_100BT4 0x8000
607#define KSZ9563_BMSR_100BTX_FD 0x4000
608#define KSZ9563_BMSR_100BTX_HD 0x2000
609#define KSZ9563_BMSR_10BT_FD 0x1000
610#define KSZ9563_BMSR_10BT_HD 0x0800
611#define KSZ9563_BMSR_EXTENDED_STATUS 0x0100
612#define KSZ9563_BMSR_MF_PREAMBLE_SUPPR 0x0040
613#define KSZ9563_BMSR_AN_COMPLETE 0x0020
614#define KSZ9563_BMSR_REMOTE_FAULT 0x0010
615#define KSZ9563_BMSR_AN_CAPABLE 0x0008
616#define KSZ9563_BMSR_LINK_STATUS 0x0004
617#define KSZ9563_BMSR_JABBER_DETECT 0x0002
618#define KSZ9563_BMSR_EXTENDED_CAPABLE 0x0001
619
620//PHY ID High register
621#define KSZ9563_PHYID1_DEFAULT 0x0022
622
623//PHY ID Low register
624#define KSZ9563_PHYID2_DEFAULT 0x1631
625
626//PHY Auto-Negotiation Advertisement register
627#define KSZ9563_ANAR_NEXT_PAGE 0x8000
628#define KSZ9563_ANAR_REMOTE_FAULT 0x2000
629#define KSZ9563_ANAR_PAUSE 0x0C00
630#define KSZ9563_ANAR_100BT4 0x0200
631#define KSZ9563_ANAR_100BTX_FD 0x0100
632#define KSZ9563_ANAR_100BTX_HD 0x0080
633#define KSZ9563_ANAR_10BT_FD 0x0040
634#define KSZ9563_ANAR_10BT_HD 0x0020
635#define KSZ9563_ANAR_SELECTOR 0x001F
636#define KSZ9563_ANAR_SELECTOR_DEFAULT 0x0001
637
638//PHY Auto-Negotiation Link Partner Ability register
639#define KSZ9563_ANLPAR_NEXT_PAGE 0x8000
640#define KSZ9563_ANLPAR_ACK 0x4000
641#define KSZ9563_ANLPAR_REMOTE_FAULT 0x2000
642#define KSZ9563_ANLPAR_PAUSE 0x0C00
643#define KSZ9563_ANLPAR_100BT4 0x0200
644#define KSZ9563_ANLPAR_100BTX_FD 0x0100
645#define KSZ9563_ANLPAR_100BTX_HD 0x0080
646#define KSZ9563_ANLPAR_10BT_FD 0x0040
647#define KSZ9563_ANLPAR_10BT_HD 0x0020
648#define KSZ9563_ANLPAR_SELECTOR 0x001F
649#define KSZ9563_ANLPAR_SELECTOR_DEFAULT 0x0001
650
651//PHY Auto-Negotiation Expansion Status register
652#define KSZ9563_ANER_PAR_DETECT_FAULT 0x0010
653#define KSZ9563_ANER_LP_NEXT_PAGE_ABLE 0x0008
654#define KSZ9563_ANER_NEXT_PAGE_ABLE 0x0004
655#define KSZ9563_ANER_PAGE_RECEIVED 0x0002
656#define KSZ9563_ANER_LP_AN_ABLE 0x0001
657
658//PHY Auto-Negotiation Next Page register
659#define KSZ9563_ANNPR_NEXT_PAGE 0x8000
660#define KSZ9563_ANNPR_MSG_PAGE 0x2000
661#define KSZ9563_ANNPR_ACK2 0x1000
662#define KSZ9563_ANNPR_TOGGLE 0x0800
663#define KSZ9563_ANNPR_MESSAGE 0x07FF
664
665//PHY Auto-Negotiation Link Partner Next Page Ability register
666#define KSZ9563_ANLPNPR_NEXT_PAGE 0x8000
667#define KSZ9563_ANLPNPR_ACK 0x4000
668#define KSZ9563_ANLPNPR_MSG_PAGE 0x2000
669#define KSZ9563_ANLPNPR_ACK2 0x1000
670#define KSZ9563_ANLPNPR_TOGGLE 0x0800
671#define KSZ9563_ANLPNPR_MESSAGE 0x07FF
672
673//PHY 1000BASE-T Control register
674#define KSZ9563_GBCR_TEST_MODE 0xE000
675#define KSZ9563_GBCR_MS_MAN_CONF_EN 0x1000
676#define KSZ9563_GBCR_MS_MAN_CONF_VAL 0x0800
677#define KSZ9563_GBCR_PORT_TYPE 0x0400
678#define KSZ9563_GBCR_1000BT_FD 0x0200
679#define KSZ9563_GBCR_1000BT_HD 0x0100
680
681//PHY 1000BASE-T Status register
682#define KSZ9563_GBSR_MS_CONF_FAULT 0x8000
683#define KSZ9563_GBSR_MS_CONF_RES 0x4000
684#define KSZ9563_GBSR_LOCAL_RECEIVER_STATUS 0x2000
685#define KSZ9563_GBSR_REMOTE_RECEIVER_STATUS 0x1000
686#define KSZ9563_GBSR_LP_1000BT_FD 0x0800
687#define KSZ9563_GBSR_LP_1000BT_HD 0x0400
688#define KSZ9563_GBSR_IDLE_ERR_COUNT 0x00FF
689
690//PHY MMD Setup register
691#define KSZ9563_MMDACR_FUNC 0xC000
692#define KSZ9563_MMDACR_FUNC_ADDR 0x0000
693#define KSZ9563_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
694#define KSZ9563_MMDACR_FUNC_DATA_POST_INC_RW 0x8000
695#define KSZ9563_MMDACR_FUNC_DATA_POST_INC_W 0xC000
696#define KSZ9563_MMDACR_DEVAD 0x001F
697
698//PHY Extended Status register
699#define KSZ9563_GBESR_1000BX_FD 0x8000
700#define KSZ9563_GBESR_1000BX_HD 0x4000
701#define KSZ9563_GBESR_1000BT_FD 0x2000
702#define KSZ9563_GBESR_1000BT_HD 0x1000
703
704//PHY Remote Loopback register
705#define KSZ9563_RLB_REMOTE_LOOPBACK 0x0100
706
707//PHY LinkMD register
708#define KSZ9563_LINKMD_TEST_EN 0x8000
709#define KSZ9563_LINKMD_PAIR 0x3000
710#define KSZ9563_LINKMD_PAIR_A 0x0000
711#define KSZ9563_LINKMD_PAIR_B 0x1000
712#define KSZ9563_LINKMD_PAIR_C 0x2000
713#define KSZ9563_LINKMD_PAIR_D 0x3000
714#define KSZ9563_LINKMD_STATUS 0x0300
715#define KSZ9563_LINKMD_STATUS_NORMAL 0x0000
716#define KSZ9563_LINKMD_STATUS_OPEN 0x0100
717#define KSZ9563_LINKMD_STATUS_SHORT 0x0200
718
719//PHY Digital PMA/PCS Status register
720#define KSZ9563_DPMAPCSS_1000BT_LINK_STATUS 0x0002
721#define KSZ9563_DPMAPCSS_100BTX_LINK_STATUS 0x0001
722
723//Port Interrupt Control/Status register
724#define KSZ9563_ICSR_JABBER_IE 0x8000
725#define KSZ9563_ICSR_RECEIVE_ERROR_IE 0x4000
726#define KSZ9563_ICSR_PAGE_RECEIVED_IE 0x2000
727#define KSZ9563_ICSR_PAR_DETECT_FAULT_IE 0x1000
728#define KSZ9563_ICSR_LP_ACK_IE 0x0800
729#define KSZ9563_ICSR_LINK_DOWN_IE 0x0400
730#define KSZ9563_ICSR_REMOTE_FAULT_IE 0x0200
731#define KSZ9563_ICSR_LINK_UP_IE 0x0100
732#define KSZ9563_ICSR_JABBER_IF 0x0080
733#define KSZ9563_ICSR_RECEIVE_ERROR_IF 0x0040
734#define KSZ9563_ICSR_PAGE_RECEIVED_IF 0x0020
735#define KSZ9563_ICSR_PAR_DETECT_FAULT_IF 0x0010
736#define KSZ9563_ICSR_LP_ACK_IF 0x0008
737#define KSZ9563_ICSR_LINK_DOWN_IF 0x0004
738#define KSZ9563_ICSR_REMOTE_FAULT_IF 0x0002
739#define KSZ9563_ICSR_LINK_UP_IF 0x0001
740
741//PHY Auto MDI/MDI-X register
742#define KSZ9563_AUTOMDI_MDI_SET 0x0080
743#define KSZ9563_AUTOMDI_SWAP_OFF 0x0040
744
745//PHY Control register
746#define KSZ9563_PHYCON_JABBER_EN 0x0200
747#define KSZ9563_PHYCON_SPEED_1000BT 0x0040
748#define KSZ9563_PHYCON_SPEED_100BTX 0x0020
749#define KSZ9563_PHYCON_SPEED_10BT 0x0010
750#define KSZ9563_PHYCON_DUPLEX_STATUS 0x0008
751#define KSZ9563_PHYCON_1000BT_MS_STATUS 0x0004
752
753//MMD LED Mode register
754#define KSZ9563_MMD_LED_MODE_LED_MODE 0x0010
755#define KSZ9563_MMD_LED_MODE_LED_MODE_TRI_COLOR_DUAL 0x0000
756#define KSZ9563_MMD_LED_MODE_LED_MODE_SINGLE 0x0010
757#define KSZ9563_MMD_LED_MODE_RESERVED 0x000F
758#define KSZ9563_MMD_LED_MODE_RESERVED_DEFAULT 0x0001
759
760//MMD EEE Advertisement register
761#define KSZ9563_MMD_EEE_ADV_1000BT_EEE_EN 0x0004
762#define KSZ9563_MMD_EEE_ADV_100BT_EEE_EN 0x0002
763
764//Global Chip ID 0 register
765#define KSZ9563_CHIP_ID0_DEFAULT 0x00
766
767//Global Chip ID 1 register
768#define KSZ9563_CHIP_ID1_DEFAULT 0x98
769
770//Global Chip ID 2 register
771#define KSZ9563_CHIP_ID2_DEFAULT 0x93
772
773//Global Chip ID 3 register
774#define KSZ9563_CHIP_ID3_REVISION_ID 0xF0
775#define KSZ9563_CHIP_ID3_GLOBAL_SOFT_RESET 0x01
776
777//PME Pin Control register
778#define KSZ9563_PME_PIN_CTRL_PME_PIN_OUT_EN 0x02
779#define KSZ9563_PME_PIN_CTRL_PME_PIN_OUT_POL 0x01
780
781//Global Chip ID 4 register
782#define KSZ9563_CHIP_ID4_SKU_ID 0xFF
783
784//Global Interrupt Status register
785#define KSZ9563_GLOBAL_INT_STAT_LUE 0x80000000
786#define KSZ9563_GLOBAL_INT_STAT_GPIO_TRIG_TS_UNIT 0x40000000
787
788//Global Interrupt Mask register
789#define KSZ9563_GLOBAL_INT_MASK_LUE 0x80000000
790#define KSZ9563_GLOBAL_INT_MASK_GPIO_TRIG_TS_UNIT 0x40000000
791
792//Global Port Interrupt Status register
793#define KSZ9563_GLOBAL_PORT_INT_STAT_PORT3 0x00000004
794#define KSZ9563_GLOBAL_PORT_INT_STAT_PORT2 0x00000002
795#define KSZ9563_GLOBAL_PORT_INT_STAT_PORT1 0x00000001
796
797//Global Port Interrupt Mask register
798#define KSZ9563_GLOBAL_PORT_INT_MASK_PORT3 0x00000004
799#define KSZ9563_GLOBAL_PORT_INT_MASK_PORT2 0x00000002
800#define KSZ9563_GLOBAL_PORT_INT_MASK_PORT1 0x00000001
801
802//Serial I/O Control register
803#define KSZ9563_SERIAL_IO_CTRL_MIIM_PREAMBLE_SUPPR 0x04
804#define KSZ9563_SERIAL_IO_CTRL_AUTO_SPI_DATA_OUT_EDGE_SEL 0x02
805#define KSZ9563_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL 0x01
806#define KSZ9563_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL_FALLING 0x00
807#define KSZ9563_SERIAL_IO_CTRL_SPI_DATA_OUT_EDGE_SEL_RISING 0x01
808
809//In-Band Management Control register
810#define KSZ9563_IBA_CTRL_IBA_EN 0x80000000
811#define KSZ9563_IBA_CTRL_DEST_MAC_ADDR_MATCH_EN 0x40000000
812#define KSZ9563_IBA_CTRL_IBA_RESET 0x20000000
813#define KSZ9563_IBA_CTRL_RESP_PRIO_QUEUE 0x00C00000
814#define KSZ9563_IBA_CTRL_RESP_PRIO_QUEUE_DEFAULT 0x00400000
815#define KSZ9563_IBA_CTRL_IBA_COMM 0x00070000
816#define KSZ9563_IBA_CTRL_IBA_COMM_PORT1 0x00000000
817#define KSZ9563_IBA_CTRL_IBA_COMM_PORT2 0x00010000
818#define KSZ9563_IBA_CTRL_IBA_COMM_PORT3 0x00020000
819#define KSZ9563_IBA_CTRL_TPID 0x0000FFFF
820#define KSZ9563_IBA_CTRL_TPID_DEFAULT 0x000040FE
821
822//I/O Drive Strength register
823#define KSZ9563_IO_DRIVE_STRENGTH_HIGH_SPEED_DRIVE_STRENGTH 0x70
824#define KSZ9563_IO_DRIVE_STRENGTH_LOW_SPEED_DRIVE_STRENGTH 0x07
825
826//In-Band Management Operation Status 1 register
827#define KSZ9563_IBA_OP_STAT1_GOOD_PKT_DETECT 0x80000000
828#define KSZ9563_IBA_OP_STAT1_RESP_PKT_TX_DONE 0x40000000
829#define KSZ9563_IBA_OP_STAT1_EXEC_DONE 0x20000000
830#define KSZ9563_IBA_OP_STAT1_MAC_ADDR_MISMATCH_ERR 0x00004000
831#define KSZ9563_IBA_OP_STAT1_ACCESS_FORMAT_ERR 0x00002000
832#define KSZ9563_IBA_OP_STAT1_ACCESS_CODE_ERR 0x00001000
833#define KSZ9563_IBA_OP_STAT1_ACCESS_CMD_ERR 0x00000800
834#define KSZ9563_IBA_OP_STAT1_OVERSIZE_PKT_ERR 0x00000400
835#define KSZ9563_IBA_OP_STAT1_ACCESS_CODE_ERR_LOC 0x0000007F
836
837//LED Override register
838#define KSZ9563_LED_OVERRIDE_OVERRIDE 0x0000000F
839#define KSZ9563_LED_OVERRIDE_OVERRIDE_LED1_0 0x00000001
840#define KSZ9563_LED_OVERRIDE_OVERRIDE_LED1_1 0x00000002
841#define KSZ9563_LED_OVERRIDE_OVERRIDE_LED2_0 0x00000004
842#define KSZ9563_LED_OVERRIDE_OVERRIDE_LED2_1 0x00000008
843
844//LED Output register
845#define KSZ9563_LED_OUTPUT_GPIO_OUT_CTRL 0x0000000F
846#define KSZ9563_LED_OUTPUT_GPIO_OUT_CTRL_LED1_0 0x00000001
847#define KSZ9563_LED_OUTPUT_GPIO_OUT_CTRL_LED1_1 0x00000002
848#define KSZ9563_LED_OUTPUT_GPIO_OUT_CTRL_LED2_0 0x00000004
849#define KSZ9563_LED_OUTPUT_GPIO_OUT_CTRL_LED2_1 0x00000008
850
851//LED2_0/LED2_1 Source register
852#define KSZ9563_LED2_0_LED2_1_SRC_LED2_1_SRC 0x00000008
853#define KSZ9563_LED2_0_LED2_1_SRC_LED2_0_SRC 0x00000004
854
855//Power Down Control 0 register
856#define KSZ9563_PWR_DOWN_CTRL0_PLL_PWR_DOWN 0x20
857#define KSZ9563_PWR_DOWN_CTRL0_PWR_MGMT_MODE 0x18
858#define KSZ9563_PWR_DOWN_CTRL0_PWR_MGMT_MODE_NORMAL 0x00
859#define KSZ9563_PWR_DOWN_CTRL0_PWR_MGMT_MODE_EDPD 0x08
860#define KSZ9563_PWR_DOWN_CTRL0_PWR_MGMT_MODE_SOFT_PWR_DOWN 0x10
861
862//LED Strap-In register
863#define KSZ9563_LED_STRAP_IN_STRAP_IN 0x0000000F
864#define KSZ9563_LED_STRAP_IN_STRAP_IN_LED1_0 0x00000001
865#define KSZ9563_LED_STRAP_IN_STRAP_IN_LED1_1 0x00000002
866#define KSZ9563_LED_STRAP_IN_STRAP_IN_RXD2_0 0x00000004
867#define KSZ9563_LED_STRAP_IN_STRAP_IN_RXD2_1 0x00000008
868
869//Switch Operation register
870#define KSZ9563_SWITCH_OP_DOUBLE_TAG_EN 0x80
871#define KSZ9563_SWITCH_OP_SOFT_HARD_RESET 0x02
872#define KSZ9563_SWITCH_OP_START_SWITCH 0x01
873
874//Switch Maximum Transmit Unit register
875#define KSZ9563_SWITCH_MTU_MTU 0x3FFF
876#define KSZ9563_SWITCH_MTU_MTU_DEFAULT 0x07D0
877
878//Switch ISP TPID register
879#define KSZ9563_SWITCH_ISP_TPID_ISP_TAG_TPID 0xFFFF
880
881//AVB Credit Based Shaper Strategy register
882#define KSZ9563_AVB_CBS_STRATEGY_SHAPING_CREDIT_ACCOUNTING 0x0002
883#define KSZ9563_AVB_CBS_STRATEGY_POLICING_CREDIT_ACCOUNTING 0x0001
884
885//Switch Lookup Engine Control 0 register
886#define KSZ9563_SWITCH_LUE_CTRL0_VLAN_EN 0x80
887#define KSZ9563_SWITCH_LUE_CTRL0_DROP_INVALID_VID 0x40
888#define KSZ9563_SWITCH_LUE_CTRL0_AGE_COUNT 0x38
889#define KSZ9563_SWITCH_LUE_CTRL0_AGE_COUNT_DEFAULT 0x20
890#define KSZ9563_SWITCH_LUE_CTRL0_RESERVED_MCAST_LOOKUP_EN 0x04
891#define KSZ9563_SWITCH_LUE_CTRL0_HASH_OPTION 0x03
892#define KSZ9563_SWITCH_LUE_CTRL0_HASH_OPTION_NONE 0x00
893#define KSZ9563_SWITCH_LUE_CTRL0_HASH_OPTION_CRC 0x01
894#define KSZ9563_SWITCH_LUE_CTRL0_HASH_OPTION_XOR 0x02
895
896//Switch Lookup Engine Control 1 register
897#define KSZ9563_SWITCH_LUE_CTRL1_UNICAST_LEARNING_DIS 0x80
898#define KSZ9563_SWITCH_LUE_CTRL1_SELF_ADDR_FILT 0x40
899#define KSZ9563_SWITCH_LUE_CTRL1_FLUSH_ALU_TABLE 0x20
900#define KSZ9563_SWITCH_LUE_CTRL1_FLUSH_MSTP_ENTRIES 0x10
901#define KSZ9563_SWITCH_LUE_CTRL1_MCAST_SRC_ADDR_FILT 0x08
902#define KSZ9563_SWITCH_LUE_CTRL1_AGING_EN 0x04
903#define KSZ9563_SWITCH_LUE_CTRL1_FAST_AGING 0x02
904#define KSZ9563_SWITCH_LUE_CTRL1_LINK_DOWN_FLUSH 0x01
905
906//Switch Lookup Engine Control 2 register
907#define KSZ9563_SWITCH_LUE_CTRL2_DOUBLE_TAG_MCAST_TRAP 0x40
908#define KSZ9563_SWITCH_LUE_CTRL2_DYNAMIC_ENTRY_EG_VLAN_FILT 0x20
909#define KSZ9563_SWITCH_LUE_CTRL2_STATIC_ENTRY_EG_VLAN_FILT 0x10
910#define KSZ9563_SWITCH_LUE_CTRL2_FLUSH_OPTION 0x0C
911#define KSZ9563_SWITCH_LUE_CTRL2_FLUSH_OPTION_NONE 0x00
912#define KSZ9563_SWITCH_LUE_CTRL2_FLUSH_OPTION_DYNAMIC 0x04
913#define KSZ9563_SWITCH_LUE_CTRL2_FLUSH_OPTION_STATIC 0x08
914#define KSZ9563_SWITCH_LUE_CTRL2_FLUSH_OPTION_BOTH 0x0C
915#define KSZ9563_SWITCH_LUE_CTRL2_MAC_ADDR_PRIORITY 0x03
916
917//Switch Lookup Engine Control 3 register
918#define KSZ9563_SWITCH_LUE_CTRL3_AGE_PERIOD 0xFF
919#define KSZ9563_SWITCH_LUE_CTRL3_AGE_PERIOD_DEFAULT 0x4B
920
921//Address Lookup Table Interrupt register
922#define KSZ9563_ALU_TABLE_INT_LEARN_FAIL 0x04
923#define KSZ9563_ALU_TABLE_INT_ALMOST_FULL 0x02
924#define KSZ9563_ALU_TABLE_INT_WRITE_FAIL 0x01
925
926//Address Lookup Table Mask register
927#define KSZ9563_ALU_TABLE_MASK_LEARN_FAIL 0x04
928#define KSZ9563_ALU_TABLE_MASK_ALMOST_FULL 0x02
929#define KSZ9563_ALU_TABLE_MASK_WRITE_FAIL 0x01
930
931//Address Lookup Table Entry Index 0 register
932#define KSZ9563_ALU_TABLE_ENTRY_INDEX0_ALMOST_FULL_ENTRY_INDEX 0x0FFF
933#define KSZ9563_ALU_TABLE_ENTRY_INDEX0_FAIL_WRITE_INDEX 0x03FF
934
935//Address Lookup Table Entry Index 1 register
936#define KSZ9563_ALU_TABLE_ENTRY_INDEX1_FAIL_LEARN_INDEX 0x03FF
937
938//Address Lookup Table Entry Index 2 register
939#define KSZ9563_ALU_TABLE_ENTRY_INDEX2_CPU_ACCESS_INDEX 0x03FF
940
941//Unknown Unicast Control register
942#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD 0x80000000
943#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD_MAP 0x00000007
944#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT1 0x00000001
945#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT2 0x00000002
946#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD_MAP_PORT3 0x00000004
947#define KSZ9563_UNKNOWN_UNICAST_CTRL_FWD_MAP_ALL 0x00000007
948
949//Unknown Multicast Control register
950#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD 0x80000000
951#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD_MAP 0x00000007
952#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT1 0x00000001
953#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT2 0x00000002
954#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT3 0x00000004
955#define KSZ9563_UNKONWN_MULTICAST_CTRL_FWD_MAP_ALL 0x00000007
956
957//Unknown VLAN ID Control register
958#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD 0x80000000
959#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD_MAP 0x00000007
960#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT1 0x00000001
961#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT2 0x00000002
962#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_PORT3 0x00000004
963#define KSZ9563_UNKNOWN_VLAN_ID_CTRL_FWD_MAP_ALL 0x00000007
964
965//Switch MAC Control 0 register
966#define KSZ9563_SWITCH_MAC_CTRL0_ALT_BACK_OFF_MODE 0x80
967#define KSZ9563_SWITCH_MAC_CTRL0_FRAME_LEN_CHECK_EN 0x08
968#define KSZ9563_SWITCH_MAC_CTRL0_FLOW_CTRL_PKT_DROP_MODE 0x02
969#define KSZ9563_SWITCH_MAC_CTRL0_AGGRESSIVE_BACK_OFF_EN 0x01
970
971//Switch MAC Control 1 register
972#define KSZ9563_SWITCH_MAC_CTRL1_MCAST_STORM_PROTECT_DIS 0x40
973#define KSZ9563_SWITCH_MAC_CTRL1_BACK_PRESSURE_MODE 0x20
974#define KSZ9563_SWITCH_MAC_CTRL1_FLOW_CTRL_FAIR_MODE 0x10
975#define KSZ9563_SWITCH_MAC_CTRL1_NO_EXCESSIVE_COL_DROP 0x08
976#define KSZ9563_SWITCH_MAC_CTRL1_JUMBO_PKT_SUPPORT 0x04
977#define KSZ9563_SWITCH_MAC_CTRL1_MAX_PKT_SIZE_CHECK_DIS 0x02
978#define KSZ9563_SWITCH_MAC_CTRL1_PASS_SHORT_PKT 0x01
979
980//Switch MAC Control 2 register
981#define KSZ9563_SWITCH_MAC_CTRL2_NULL_VID_REPLACEMENT 0x08
982#define KSZ9563_SWITCH_MAC_CTRL2_BCAST_STORM_PROTECT_RATE_MSB 0x07
983
984//Switch MAC Control 3 register
985#define KSZ9563_SWITCH_MAC_CTRL3_BCAST_STORM_PROTECT_RATE_LSB 0xFF
986
987//Switch MAC Control 4 register
988#define KSZ9563_SWITCH_MAC_CTRL4_PASS_FLOW_CTRL_PKT 0x01
989
990//Switch MAC Control 5 register
991#define KSZ9563_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD 0x30
992#define KSZ9563_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_16MS 0x00
993#define KSZ9563_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_64MS 0x10
994#define KSZ9563_SWITCH_MAC_CTRL5_IG_RATE_LIMIT_PERIOD_256MS 0x20
995#define KSZ9563_SWITCH_MAC_CTRL5_QUEUE_BASED_EG_RATE_LIMITE_EN 0x08
996
997//Switch MIB Control register
998#define KSZ9563_SWITCH_MIB_CTRL_FLUSH 0x80
999#define KSZ9563_SWITCH_MIB_CTRL_FREEZE 0x40
1000
1001//Global Port Mirroring and Snooping Control register
1002#define KSZ9563_GLOBAL_PORT_MIRROR_SNOOP_CTRL_IGMP_SNOOP_EN 0x40
1003#define KSZ9563_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_OPT 0x08
1004#define KSZ9563_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_EN 0x04
1005#define KSZ9563_GLOBAL_PORT_MIRROR_SNOOP_CTRL_SNIFF_MODE_SEL 0x01
1006
1007//WRED DiffServ Color Mapping register
1008#define KSZ9563_WRED_DIFFSERV_COLOR_MAPPING_RED 0x30
1009#define KSZ9563_WRED_DIFFSERV_COLOR_MAPPING_YELLOW 0x0C
1010#define KSZ9563_WRED_DIFFSERV_COLOR_MAPPING_GREEN 0x03
1011
1012//PTP Event Message Priority register
1013#define KSZ9563_PTP_EVENT_MSG_PRIO_OVERRIDE 0x80
1014#define KSZ9563_PTP_EVENT_MSG_PRIO_PRIORITY 0x0F
1015
1016//PTP Non-Event Message Priority register
1017#define KSZ9563_PTP_NON_EVENT_MSG_PRIO_OVERRIDE 0x80
1018#define KSZ9563_PTP_NON_EVENT_MSG_PRIO_PRIORITY 0x0F
1019
1020//Queue Management Control 0 register
1021#define KSZ9563_QUEUE_MGMT_CTRL0_PRIORITY_2Q 0x000000C0
1022#define KSZ9563_QUEUE_MGMT_CTRL0_UNICAST_PORT_VLAN_DISCARD 0x00000002
1023
1024//VLAN Table Entry 0 register
1025#define KSZ9563_VLAN_TABLE_ENTRY0_VALID 0x80000000
1026#define KSZ9563_VLAN_TABLE_ENTRY0_FORWARD_OPTION 0x08000000
1027#define KSZ9563_VLAN_TABLE_ENTRY0_PRIORITY 0x07000000
1028#define KSZ9563_VLAN_TABLE_ENTRY0_MSTP_INDEX 0x00007000
1029#define KSZ9563_VLAN_TABLE_ENTRY0_FID 0x0000007F
1030
1031//VLAN Table Entry 1 register
1032#define KSZ9563_VLAN_TABLE_ENTRY1_PORT_UNTAG 0x00000007
1033#define KSZ9563_VLAN_TABLE_ENTRY1_PORT3_UNTAG 0x00000004
1034#define KSZ9563_VLAN_TABLE_ENTRY1_PORT2_UNTAG 0x00000002
1035#define KSZ9563_VLAN_TABLE_ENTRY1_PORT1_UNTAG 0x00000001
1036
1037//VLAN Table Entry 2 register
1038#define KSZ9563_VLAN_TABLE_ENTRY2_PORT_FORWARD 0x00000007
1039#define KSZ9563_VLAN_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1040#define KSZ9563_VLAN_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1041#define KSZ9563_VLAN_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1042
1043//VLAN Table Index register
1044#define KSZ9563_VLAN_TABLE_INDEX_VLAN_INDEX 0x0FFF
1045
1046//VLAN Table Access Control register
1047#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_START_FINISH 0x80
1048#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_ACTION 0x03
1049#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_ACTION_NOP 0x00
1050#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_ACTION_WRITE 0x01
1051#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_ACTION_READ 0x02
1052#define KSZ9563_VLAN_TABLE_ACCESS_CTRL_ACTION_CLEAR 0x03
1053
1054//ALU Table Index 0 register
1055#define KSZ9563_ALU_TABLE_INDEX0_FID_INDEX 0x007F0000
1056#define KSZ9563_ALU_TABLE_INDEX0_MAC_INDEX_MSB 0x0000FFFF
1057
1058//ALU Table Index 1 register
1059#define KSZ9563_ALU_TABLE_INDEX1_MAC_INDEX_LSB 0xFFFFFFFF
1060
1061//ALU Table Access Control register
1062#define KSZ9563_ALU_TABLE_CTRL_VALID_COUNT 0x3FFF0000
1063#define KSZ9563_ALU_TABLE_CTRL_START_FINISH 0x00000080
1064#define KSZ9563_ALU_TABLE_CTRL_VALID 0x00000040
1065#define KSZ9563_ALU_TABLE_CTRL_VALID_ENTRY_OR_SEARCH_END 0x00000020
1066#define KSZ9563_ALU_TABLE_CTRL_DIRECT 0x00000004
1067#define KSZ9563_ALU_TABLE_CTRL_ACTION 0x00000003
1068#define KSZ9563_ALU_TABLE_CTRL_ACTION_NOP 0x00000000
1069#define KSZ9563_ALU_TABLE_CTRL_ACTION_WRITE 0x00000001
1070#define KSZ9563_ALU_TABLE_CTRL_ACTION_READ 0x00000002
1071#define KSZ9563_ALU_TABLE_CTRL_ACTION_SEARCH 0x00000003
1072
1073//Static Address and Reserved Multicast Table Control register
1074#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_TABLE_INDEX 0x003F0000
1075#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_START_FINISH 0x00000080
1076#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_TABLE_SELECT 0x00000002
1077#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_ACTION 0x00000001
1078#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_ACTION_READ 0x00000000
1079#define KSZ9563_STATIC_RES_MCAST_TABLE_CTRL_ACTION_WRITE 0x00000001
1080
1081//ALU Table Entry 1 register
1082#define KSZ9563_ALU_TABLE_ENTRY1_STATIC 0x80000000
1083#define KSZ9563_ALU_TABLE_ENTRY1_SRC_FILTER 0x40000000
1084#define KSZ9563_ALU_TABLE_ENTRY1_DES_FILTER 0x20000000
1085#define KSZ9563_ALU_TABLE_ENTRY1_PRIORITY 0x1C000000
1086#define KSZ9563_ALU_TABLE_ENTRY1_AGE_COUNT 0x1C000000
1087#define KSZ9563_ALU_TABLE_ENTRY1_MSTP 0x00000007
1088
1089//ALU Table Entry 2 register
1090#define KSZ9563_ALU_TABLE_ENTRY2_OVERRIDE 0x80000000
1091#define KSZ9563_ALU_TABLE_ENTRY2_PORT_FORWARD 0x00000007
1092#define KSZ9563_ALU_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1093#define KSZ9563_ALU_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1094#define KSZ9563_ALU_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1095
1096//ALU Table Entry 3 register
1097#define KSZ9563_ALU_TABLE_ENTRY3_FID 0x007F0000
1098#define KSZ9563_ALU_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
1099
1100//ALU Table Entry 4 register
1101#define KSZ9563_ALU_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
1102
1103//Static Address Table Entry 1 register
1104#define KSZ9563_STATIC_TABLE_ENTRY1_VALID 0x80000000
1105#define KSZ9563_STATIC_TABLE_ENTRY1_SRC_FILTER 0x40000000
1106#define KSZ9563_STATIC_TABLE_ENTRY1_DES_FILTER 0x20000000
1107#define KSZ9563_STATIC_TABLE_ENTRY1_PRIORITY 0x1C000000
1108#define KSZ9563_STATIC_TABLE_ENTRY1_MSTP 0x00000007
1109
1110//Static Address Table Entry 2 register
1111#define KSZ9563_STATIC_TABLE_ENTRY2_OVERRIDE 0x80000000
1112#define KSZ9563_STATIC_TABLE_ENTRY2_USE_FID 0x40000000
1113#define KSZ9563_STATIC_TABLE_ENTRY2_PORT_FORWARD 0x00000007
1114#define KSZ9563_STATIC_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1115#define KSZ9563_STATIC_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1116#define KSZ9563_STATIC_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1117
1118//Static Address Table Entry 3 register
1119#define KSZ9563_STATIC_TABLE_ENTRY3_FID 0x007F0000
1120#define KSZ9563_STATIC_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
1121
1122//Static Address Table Entry 4 register
1123#define KSZ9563_STATIC_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
1124
1125//Reserved Multicast Table Entry 2 register
1126#define KSZ9563_RES_MCAST_TABLE_ENTRY2_PORT_FORWARD 0x00000007
1127#define KSZ9563_RES_MCAST_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
1128#define KSZ9563_RES_MCAST_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
1129#define KSZ9563_RES_MCAST_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
1130
1131//Global PTP Clock Control register
1132#define KSZ9563_GLOBAL_PTP_CLK_CTRL_SW_FREQ_ADJ_DIS 0x8000
1133#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_STEP_ADJ 0x0040
1134#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_STEP_DIR 0x0020
1135#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_READ 0x0010
1136#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_LOAD 0x0008
1137#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_CONTINUOUS_ADJ 0x0004
1138#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_EN 0x0002
1139#define KSZ9563_GLOBAL_PTP_CLK_CTRL_PTP_CLK_RESET 0x0001
1140
1141//Global PTP RTC Clock Phase register
1142#define KSZ9563_GLOBAL_PTP_RTC_CLK_PHASE_PTP_RTC_8NS_PHASE 0x0007
1143
1144//Global PTP Clock Sub-Nanosecond Rate High Word register
1145#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_H_PTP_RATE_DIR 0x8000
1146#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_H_PTP_TEMP_ADJ_MODE 0x4000
1147#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_H_PTP_RTC_SUB_NS_29_16 0x3FFF
1148
1149//Global PTP Clock Sub-Nanosecond Rate Low Word register
1150#define KSZ9563_GLOBAL_PTP_CLK_SUB_NS_RATE_L_PTP_RTC_SUB_NS_15_0 0xFFFF
1151
1152//Global PTP Message Config 1 register
1153#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_IEEE_1588_PTP_MODE 0x0040
1154#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_ETH_PTP_DETECT 0x0020
1155#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_IPV4_UDP_PTP_DETECT 0x0010
1156#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_IPV6_UDP_PTP_DETECT 0x0008
1157#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_E2E_CLK_MODE 0x0000
1158#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_P2P_CLK_MODE 0x0004
1159#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_SLAVE_OC_CLK_MODE 0x0000
1160#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_MASTER_OC_CLK_MODE 0x0002
1161#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_TWO_STEP_CLK_MODE 0x0000
1162#define KSZ9563_GLOBAL_PTP_MSG_CONFIG1_ONE_STEP_CLK_MODE 0x0001
1163
1164//Global PTP Message Config 2 register
1165#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_UNICAST_PTP_EN 0x1000
1166#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_ALT_MASTER_EN 0x0800
1167#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_PTP_MSG_PRIO_TX_QUEUE 0x0400
1168#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_CHECK_SYNC_FOLLOW_UP 0x0200
1169#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_CHECK_DELAY_REQ_RESP 0x0100
1170#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_CHECK_PDELAY_REQ_RESP 0x0080
1171#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_DROP_SYNC_FOLLOW_UP_DELAY_REQ 0x0020
1172#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_CHECK_DOMAIN 0x0010
1173#define KSZ9563_GLOBAL_PTP_MSG_CONFIG2_IPV4_UDP_CHECKSUM_EN 0x0004
1174
1175//Global PTP Domain and Version register
1176#define KSZ9563_GLOBAL_PTP_DOMAIN_VERSION_PTP_VERSION 0x0F00
1177#define KSZ9563_GLOBAL_PTP_DOMAIN_VERSION_PTP_DOMAIN 0x00FF
1178
1179//Global PTP Unit Index register
1180#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_GPIO_PTR_INDEX 0x00010000
1181#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_GPIO_PTR_INDEX_GPIO1 0x00000000
1182#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_GPIO_PTR_INDEX_GPIO2 0x00010000
1183#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TS_PTR_INDEX 0x00000100
1184#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TS_PTR_INDEX_UNIT0 0x00000000
1185#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TS_PTR_INDEX_UNIT1 0x00000100
1186#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TRIGGER_PTR_INDEX 0x00000003
1187#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TRIGGER_PTR_INDEX_UNIT0 0x00000000
1188#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TRIGGER_PTR_INDEX_UNIT1 0x00000001
1189#define KSZ9563_GLOBAL_PTP_UNIT_INDEX_TRIGGER_PTR_INDEX_UNIT2 0x00000002
1190
1191//GPIO Status Monitor 0 register
1192#define KSZ9563_GPIO_STATUS_MONITOR0_TRIGGER_ERROR 0x00070000
1193#define KSZ9563_GPIO_STATUS_MONITOR0_TRIGGER_DONE 0x00000007
1194
1195//GPIO Status Monitor 1 register
1196#define KSZ9563_GPIO_STATUS_MONITOR1_TRIGGER_INT_STATUS 0x00070000
1197#define KSZ9563_GPIO_STATUS_MONITOR1_TS_INT_STATUS 0x00000003
1198
1199//Timestamp Control and Status register
1200#define KSZ9563_TS_CTRL_STAT_GPIO_OUT_SEL 0x00000100
1201#define KSZ9563_TS_CTRL_STAT_GPIO_IN 0x00000080
1202#define KSZ9563_TS_CTRL_STAT_GPIO_OEN 0x00000040
1203#define KSZ9563_TS_CTRL_STAT_TS_INT_ENB 0x00000020
1204#define KSZ9563_TS_CTRL_STAT_TRIGGER_ACTIVE 0x00000010
1205#define KSZ9563_TS_CTRL_STAT_TRIGGER_EN 0x00000008
1206#define KSZ9563_TS_CTRL_STAT_TRIGGER_SW_RESET 0x00000004
1207#define KSZ9563_TS_CTRL_STAT_TS_ENB 0x00000002
1208#define KSZ9563_TS_CTRL_STAT_TS_SW_RESET 0x00000001
1209
1210//Trigger Output Unit Target Time Nanosecond register
1211#define KSZ9563_TOU_TARGET_TIME_NS_TRIGGER_TARGET_TIME_NS 0x3FFFFFFF
1212
1213//Trigger Output Unit Target Time Second register
1214#define KSZ9563_TOU_TARGET_TIME_S_TRIGGER_TARGET_TIME_S 0xFFFFFFFF
1215
1216//Trigger Output Unit Control 1 register
1217#define KSZ9563_TOU_CTRL1_CASCADE_MODE_ENB 0x80000000
1218#define KSZ9563_TOU_CTRL1_CASCADE_MODE_TAIL 0x40000000
1219#define KSZ9563_TOU_CTRL1_CASCADE_MODE_DONE 0x0C000000
1220#define KSZ9563_TOU_CTRL1_TRIGGER_NOW 0x02000000
1221#define KSZ9563_TOU_CTRL1_TRIGGER_NOTIFY 0x01000000
1222#define KSZ9563_TOU_CTRL1_TRIGGER_EDGE 0x00800000
1223#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN 0x00700000
1224#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_NEG_EDGE 0x00000000
1225#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_POS_EDGE 0x00100000
1226#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_NEG_PULSE 0x00200000
1227#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_POS_PULSE 0x00300000
1228#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_NEG_CYCLE 0x00400000
1229#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_POS_CYCLE 0x00500000
1230#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_REG_OUTPUT 0x00600000
1231#define KSZ9563_TOU_CTRL1_TRIGGER_GPIO 0x00010000
1232#define KSZ9563_TOU_CTRL1_TRIGGER_GPIO_1 0x00000000
1233#define KSZ9563_TOU_CTRL1_TRIGGER_GPIO_2 0x00010000
1234#define KSZ9563_TOU_CTRL1_TRIGGER_PATTERN_ITERATION 0x0000FFFF
1235
1236//Trigger Output Unit Control 2 register
1237#define KSZ9563_TOU_CTRL2_TRIGGER_CYCLE_WIDTH 0xFFFFFFFF
1238
1239//Trigger Output Unit Control 3 register
1240#define KSZ9563_TOU_CTRL3_TRIGGER_CYCLE 0xFFFF0000
1241#define KSZ9563_TOU_CTRL3_TRIGGER_BIT_PATTERN 0x0000FFFF
1242
1243//Trigger Output Unit Control 4 register
1244#define KSZ9563_TOU_CTRL4_CASCADE_INTERATION_CYCLE_TIME 0xFFFFFFFF
1245
1246//Trigger Output Unit Control 5 register
1247#define KSZ9563_TOU_CTRL5_PPS_PULSE_WIDTH 0x00FF0000
1248#define KSZ9563_TOU_CTRL5_TRIGGER_PULSE_WIDTH 0x0000FFFF
1249
1250//Timestamp Status and Control register
1251#define KSZ9563_TS_STAT_CTRL_TS_EVENT_DET_CNT 0x001E0000
1252#define KSZ9563_TS_STAT_CTRL_TS_DET_EVENT_CNT_OVERFLOW 0x00010000
1253#define KSZ9563_TS_STAT_CTRL_TS_RISING_EDGE_ENB 0x00000080
1254#define KSZ9563_TS_STAT_CTRL_TS_FALLING_EDGE_ENB 0x00000040
1255#define KSZ9563_TS_STAT_CTRL_TS_CASCADE_MODE_TAIL 0x00000020
1256#define KSZ9563_TS_STAT_CTRL_TS_UPSTREAM_CASCADE_MODE_SEL 0x00000002
1257#define KSZ9563_TS_STAT_CTRL_TS_CASCADE_MODE_ENB 0x00000001
1258
1259//Timestamp 1st Sample Time Nanoseconds register
1260#define KSZ9563_TS_SAMPLE1_TIME_NS_TS_SAMPLE_EDGE_1ST 0x40000000
1261#define KSZ9563_TS_SAMPLE1_TIME_NS_TS_SAMPLE_TIME_NS_1ST 0x3FFFFFFF
1262
1263//Timestamp 1st Sample Time Seconds register
1264#define KSZ9563_TS_SAMPLE1_TIME_S_TS_SAMPLE_TIME_S_1ST 0xFFFFFFFF
1265
1266//Timestamp 1st Sample Time Phase register
1267#define KSZ9563_TS_SAMPLE1_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_1ST 0x00000007
1268
1269//Timestamp 2nd Sample Time Nanoseconds register
1270#define KSZ9563_TS_SAMPLE2_TIME_NS_TS_SAMPLE_EDGE_2ND 0x40000000
1271#define KSZ9563_TS_SAMPLE2_TIME_NS_TS_SAMPLE_TIME_NS_2ND 0x3FFFFFFF
1272
1273//Timestamp 2nd Sample Time Seconds register
1274#define KSZ9563_TS_SAMPLE2_TIME_S_TS_SAMPLE_TIME_S_2ND 0xFFFFFFFF
1275
1276//Timestamp 2nd Sample Time Phase register
1277#define KSZ9563_TS_SAMPLE2_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_2ND 0x00000007
1278
1279//Timestamp 3rd Sample Time Nanoseconds register
1280#define KSZ9563_TS_SAMPLE3_TIME_NS_TS_SAMPLE_EDGE_3RD 0x40000000
1281#define KSZ9563_TS_SAMPLE3_TIME_NS_TS_SAMPLE_TIME_NS_3RD 0x3FFFFFFF
1282
1283//Timestamp 3rd Sample Time Seconds register
1284#define KSZ9563_TS_SAMPLE3_TIME_S_TS_SAMPLE_TIME_S_3RD 0xFFFFFFFF
1285
1286//Timestamp 3rd Sample Time Phase register
1287#define KSZ9563_TS_SAMPLE3_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_3RD 0x00000007
1288
1289//Timestamp 4th Sample Time Nanoseconds register
1290#define KSZ9563_TS_SAMPLE4_TIME_NS_TS_SAMPLE_EDGE_4TH 0x40000000
1291#define KSZ9563_TS_SAMPLE4_TIME_NS_TS_SAMPLE_TIME_NS_4TH 0x3FFFFFFF
1292
1293//Timestamp 4th Sample Time Seconds register
1294#define KSZ9563_TS_SAMPLE4_TIME_S_TS_SAMPLE_TIME_S_4TH 0xFFFFFFFF
1295
1296//Timestamp 4th Sample Time Phase register
1297#define KSZ9563_TS_SAMPLE4_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_4TH 0x00000007
1298
1299//Timestamp 5th Sample Time Nanoseconds register
1300#define KSZ9563_TS_SAMPLE5_TIME_NS_TS_SAMPLE_EDGE_5TH 0x40000000
1301#define KSZ9563_TS_SAMPLE5_TIME_NS_TS_SAMPLE_TIME_NS_5TH 0x3FFFFFFF
1302
1303//Timestamp 5th Sample Time Seconds register
1304#define KSZ9563_TS_SAMPLE5_TIME_S_TS_SAMPLE_TIME_S_5TH 0xFFFFFFFF
1305
1306//Timestamp 5th Sample Time Phase register
1307#define KSZ9563_TS_SAMPLE5_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_5TH 0x00000007
1308
1309//Timestamp 6th Sample Time Nanoseconds register
1310#define KSZ9563_TS_SAMPLE6_TIME_NS_TS_SAMPLE_EDGE_6TH 0x40000000
1311#define KSZ9563_TS_SAMPLE6_TIME_NS_TS_SAMPLE_TIME_NS_6TH 0x3FFFFFFF
1312
1313//Timestamp 6th Sample Time Seconds register
1314#define KSZ9563_TS_SAMPLE6_TIME_S_TS_SAMPLE_TIME_S_6TH 0xFFFFFFFF
1315
1316//Timestamp 6th Sample Time Phase register
1317#define KSZ9563_TS_SAMPLE6_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_6TH 0x00000007
1318
1319//Timestamp 7th Sample Time Nanoseconds register
1320#define KSZ9563_TS_SAMPLE7_TIME_NS_TS_SAMPLE_EDGE_7TH 0x40000000
1321#define KSZ9563_TS_SAMPLE7_TIME_NS_TS_SAMPLE_TIME_NS_7TH 0x3FFFFFFF
1322
1323//Timestamp 7th Sample Time Seconds register
1324#define KSZ9563_TS_SAMPLE7_TIME_S_TS_SAMPLE_TIME_S_7TH 0xFFFFFFFF
1325
1326//Timestamp 7th Sample Time Phase register
1327#define KSZ9563_TS_SAMPLE7_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_7TH 0x00000007
1328
1329//Timestamp 8th Sample Time Nanoseconds register
1330#define KSZ9563_TS_SAMPLE8_TIME_NS_TS_SAMPLE_EDGE_8TH 0x40000000
1331#define KSZ9563_TS_SAMPLE8_TIME_NS_TS_SAMPLE_TIME_NS_8TH 0x3FFFFFFF
1332
1333//Timestamp 8th Sample Time Seconds register
1334#define KSZ9563_TS_SAMPLE8_TIME_S_TS_SAMPLE_TIME_S_8TH 0xFFFFFFFF
1335
1336//Timestamp 8th Sample Time Phase register
1337#define KSZ9563_TS_SAMPLE8_TIME_PHASE_TS_SAMPLE_TIME_SUB_8NS_8TH 0x00000007
1338
1339//Port N Default Tag 0 register
1340#define KSZ9563_PORTn_DEFAULT_TAG0_PCP 0xE0
1341#define KSZ9563_PORTn_DEFAULT_TAG0_DEI 0x10
1342#define KSZ9563_PORTn_DEFAULT_TAG0_VID_MSB 0x0F
1343
1344//Port N Default Tag 1 register
1345#define KSZ9563_PORTn_DEFAULT_TAG1_VID_LSB 0xFF
1346
1347//Port N Interrupt Status register
1348#define KSZ9563_PORTn_INT_STATUS_PTP 0x04
1349#define KSZ9563_PORTn_INT_STATUS_PHY 0x02
1350#define KSZ9563_PORTn_INT_STATUS_ACL 0x01
1351
1352//Port N Interrupt Mask register
1353#define KSZ9563_PORTn_INT_MASK_PTP 0x04
1354#define KSZ9563_PORTn_INT_MASK_PHY 0x02
1355#define KSZ9563_PORTn_INT_MASK_ACL 0x01
1356
1357//Port N Operation Control 0 register
1358#define KSZ9563_PORTn_OP_CTRL0_LOCAL_LOOPBACK 0x80
1359#define KSZ9563_PORTn_OP_CTRL0_REMOTE_LOOPBACK 0x40
1360#define KSZ9563_PORTn_OP_CTRL0_TAIL_TAG_EN 0x04
1361#define KSZ9563_PORTn_OP_CTRL0_TX_QUEUE_SPLIT_EN 0x03
1362
1363//Port N Status register
1364#define KSZ9563_PORTn_STATUS_SPEED 0x18
1365#define KSZ9563_PORTn_STATUS_SPEED_10MBPS 0x00
1366#define KSZ9563_PORTn_STATUS_SPEED_100MBPS 0x08
1367#define KSZ9563_PORTn_STATUS_SPEED_1000MBPS 0x10
1368#define KSZ9563_PORTn_STATUS_DUPLEX 0x04
1369#define KSZ9563_PORTn_STATUS_TX_FLOW_CTRL_EN 0x02
1370#define KSZ9563_PORTn_STATUS_RX_FLOW_CTRL_EN 0x01
1371
1372//XMII Port N Control 0 register
1373#define KSZ9563_PORTn_XMII_CTRL0_DUPLEX 0x40
1374#define KSZ9563_PORTn_XMII_CTRL0_TX_FLOW_CTRL_EN 0x20
1375#define KSZ9563_PORTn_XMII_CTRL0_SPEED_10_100 0x10
1376#define KSZ9563_PORTn_XMII_CTRL0_RX_FLOW_CTRL_EN 0x08
1377
1378//XMII Port N Control 1 register
1379#define KSZ9563_PORTn_XMII_CTRL1_SPEED_1000 0x40
1380#define KSZ9563_PORTn_XMII_CTRL1_RGMII_ID_IG 0x10
1381#define KSZ9563_PORTn_XMII_CTRL1_RGMII_ID_EG 0x08
1382#define KSZ9563_PORTn_XMII_CTRL1_MII_RMII_MODE 0x04
1383#define KSZ9563_PORTn_XMII_CTRL1_IF_TYPE 0x03
1384#define KSZ9563_PORTn_XMII_CTRL1_IF_TYPE_MII 0x00
1385#define KSZ9563_PORTn_XMII_CTRL1_IF_TYPE_RMII 0x01
1386#define KSZ9563_PORTn_XMII_CTRL1_IF_TYPE_RGMII 0x03
1387
1388//XMII Port N Control 3 register
1389#define KSZ9563_PORTn_XMII_CTRL3_RGMII_IBS_DUPLEX_STATUS 0x08
1390#define KSZ9563_PORTn_XMII_CTRL3_RGMII_IBS_RX_CLK_SPEED 0x06
1391#define KSZ9563_PORTn_XMII_CTRL3_RGMII_IBS_LINK_STATUS 0x01
1392
1393//Port N MAC Control 0 register
1394#define KSZ9563_PORTn_MAC_CTRL0_BCAST_STORM_PROTECT_EN 0x02
1395
1396//Port N MAC Control 1 register
1397#define KSZ9563_PORTn_MAC_CTRL1_BACK_PRESSURE_EN 0x08
1398#define KSZ9563_PORTn_MAC_CTRL1_PASS_ALL_FRAMES 0x01
1399
1400//Port N MIB Control and Status register
1401#define KSZ9563_PORTn_MIB_CTRL_STAT_MIB_COUNTER_OVERFLOW 0x80000000
1402#define KSZ9563_PORTn_MIB_CTRL_STAT_MIB_READ 0x02000000
1403#define KSZ9563_PORTn_MIB_CTRL_STAT_MIB_FLUSH_FREEZE 0x01000000
1404#define KSZ9563_PORTn_MIB_CTRL_STAT_MIB_INDEX 0x00FF0000
1405#define KSZ9563_PORTn_MIB_CTRL_STAT_MIB_COUNTER_VALUE_35_32 0x0000000F
1406
1407//Port N MIB Data register
1408#define KSZ9563_PORTn_MIB_DATA_MIB_COUNTER_VALUE_31_0 0xFFFFFFFF
1409
1410//Port N ACL Access Control 0 register
1411#define KSZ9563_PORTn_ACL_ACCESS_CTRL0_WRITE_STATUS 0x40
1412#define KSZ9563_PORTn_ACL_ACCESS_CTRL0_READ_STATUS 0x20
1413#define KSZ9563_PORTn_ACL_ACCESS_CTRL0_READ 0x00
1414#define KSZ9563_PORTn_ACL_ACCESS_CTRL0_WRITE 0x10
1415#define KSZ9563_PORTn_ACL_ACCESS_CTRL0_ACL_INDEX 0x0F
1416
1417//Port N Port Mirroring Control register
1418#define KSZ9563_PORTn_MIRRORING_CTRL_RECEIVE_SNIFF 0x40
1419#define KSZ9563_PORTn_MIRRORING_CTRL_TRANSMIT_SNIFF 0x20
1420#define KSZ9563_PORTn_MIRRORING_CTRL_SNIFFER_PORT 0x02
1421
1422//Port N Authentication Control register
1423#define KSZ9563_PORTn_AUTH_CTRL_ACL_EN 0x04
1424#define KSZ9563_PORTn_AUTH_CTRL_AUTH_MODE 0x03
1425#define KSZ9563_PORTn_AUTH_CTRL_AUTH_MODE_PASS 0x00
1426#define KSZ9563_PORTn_AUTH_CTRL_AUTH_MODE_BLOCK 0x01
1427#define KSZ9563_PORTn_AUTH_CTRL_AUTH_MODE_TRAP 0x02
1428
1429//Port N Pointer register
1430#define KSZ9563_PORTn_PTR_PORT_INDEX 0x00070000
1431#define KSZ9563_PORTn_PTR_QUEUE_PTR 0x00000003
1432
1433//Port N Control 1 register
1434#define KSZ9563_PORTn_CTRL1_PORT_VLAN_MEMBERSHIP 0x00000007
1435#define KSZ9563_PORTn_CTRL1_PORT3_VLAN_MEMBERSHIP 0x00000004
1436#define KSZ9563_PORTn_CTRL1_PORT2_VLAN_MEMBERSHIP 0x00000002
1437#define KSZ9563_PORTn_CTRL1_PORT1_VLAN_MEMBERSHIP 0x00000001
1438
1439//Port N Control 2 register
1440#define KSZ9563_PORTn_CTRL2_NULL_VID_LOOKUP_EN 0x80
1441#define KSZ9563_PORTn_CTRL2_INGRESS_VLAN_FILT 0x40
1442#define KSZ9563_PORTn_CTRL2_DISCARD_NON_PVID_PKT 0x20
1443#define KSZ9563_PORTn_CTRL2_802_1X_EN 0x10
1444#define KSZ9563_PORTn_CTRL2_SELF_ADDR_FILT 0x08
1445
1446//Port N MSTP Pointer register
1447#define KSZ9563_PORTn_MSTP_PTR_MSTP_PTR 0x07
1448
1449//Port N MSTP State register
1450#define KSZ9563_PORTn_MSTP_STATE_TRANSMIT_EN 0x04
1451#define KSZ9563_PORTn_MSTP_STATE_RECEIVE_EN 0x02
1452#define KSZ9563_PORTn_MSTP_STATE_LEARNING_DIS 0x01
1453
1454//Port N PTP Asymmetry Correction register
1455#define KSZ9563_PORTn_PTP_ASYM_CORRECTION_PTP_ASYM_COR_SIGN 0x8000
1456#define KSZ9563_PORTn_PTP_ASYM_CORRECTION_PTP_ASYM_COR 0x7FFF
1457
1458//Port N PTP Timestamp Interrupt Status register
1459#define KSZ9563_PORTn_PTP_TS_INT_STAT_TS_SYNC_INT_STATUS 0x8000
1460#define KSZ9563_PORTn_PTP_TS_INT_STAT_TS_PDLY_REQ_INT_STATUS 0x4000
1461#define KSZ9563_PORTn_PTP_TS_INT_STAT_TS_PDLY_RESP_INT_STATUS 0x2000
1462
1463//Port N PTP Timestamp Interrupt Enable register
1464#define KSZ9563_PORTn_PTP_TS_INT_EN_TS_SYNC_INT_ENB 0x8000
1465#define KSZ9563_PORTn_PTP_TS_INT_EN_TS_PDLY_REQ_INT_ENB 0x4000
1466#define KSZ9563_PORTn_PTP_TS_INT_EN_TS_PDLY_RESP_INT_ENB 0x2000
1467
1468//C++ guard
1469#ifdef __cplusplus
1470extern "C" {
1471#endif
1472
1473//KSZ9563 Ethernet switch driver
1474extern const SwitchDriver ksz9563SwitchDriver;
1475
1476//KSZ9563 related functions
1477error_t ksz9563Init(NetInterface *interface);
1478void ksz9563InitHook(NetInterface *interface);
1479
1480void ksz9563Tick(NetInterface *interface);
1481
1482void ksz9563EnableIrq(NetInterface *interface);
1483void ksz9563DisableIrq(NetInterface *interface);
1484
1485void ksz9563EventHandler(NetInterface *interface);
1486
1487error_t ksz9563TagFrame(NetInterface *interface, NetBuffer *buffer,
1488 size_t *offset, NetTxAncillary *ancillary);
1489
1490error_t ksz9563UntagFrame(NetInterface *interface, uint8_t **frame,
1491 size_t *length, NetRxAncillary *ancillary);
1492
1493bool_t ksz9563GetLinkState(NetInterface *interface, uint8_t port);
1494uint32_t ksz9563GetLinkSpeed(NetInterface *interface, uint8_t port);
1495NicDuplexMode ksz9563GetDuplexMode(NetInterface *interface, uint8_t port);
1496
1497void ksz9563SetPortState(NetInterface *interface, uint8_t port,
1498 SwitchPortState state);
1499
1500SwitchPortState ksz9563GetPortState(NetInterface *interface, uint8_t port);
1501
1502void ksz9563SetAgingTime(NetInterface *interface, uint32_t agingTime);
1503
1504void ksz9563EnableIgmpSnooping(NetInterface *interface, bool_t enable);
1505void ksz9563EnableMldSnooping(NetInterface *interface, bool_t enable);
1506void ksz9563EnableRsvdMcastTable(NetInterface *interface, bool_t enable);
1507
1508error_t ksz9563AddStaticFdbEntry(NetInterface *interface,
1509 const SwitchFdbEntry *entry);
1510
1511error_t ksz9563DeleteStaticFdbEntry(NetInterface *interface,
1512 const SwitchFdbEntry *entry);
1513
1514error_t ksz9563GetStaticFdbEntry(NetInterface *interface, uint_t index,
1515 SwitchFdbEntry *entry);
1516
1517void ksz9563FlushStaticFdbTable(NetInterface *interface);
1518
1519error_t ksz9563GetDynamicFdbEntry(NetInterface *interface, uint_t index,
1520 SwitchFdbEntry *entry);
1521
1522void ksz9563FlushDynamicFdbTable(NetInterface *interface, uint8_t port);
1523
1524void ksz9563SetUnknownMcastFwdPorts(NetInterface *interface,
1525 bool_t enable, uint32_t forwardPorts);
1526
1527void ksz9563WritePhyReg(NetInterface *interface, uint8_t port,
1528 uint8_t address, uint16_t data);
1529
1530uint16_t ksz9563ReadPhyReg(NetInterface *interface, uint8_t port,
1531 uint8_t address);
1532
1533void ksz9563DumpPhyReg(NetInterface *interface, uint8_t port);
1534
1535void ksz9563WriteMmdReg(NetInterface *interface, uint8_t port,
1536 uint8_t devAddr, uint16_t regAddr, uint16_t data);
1537
1538uint16_t ksz9563ReadMmdReg(NetInterface *interface, uint8_t port,
1539 uint8_t devAddr, uint16_t regAddr);
1540
1541void ksz9563WriteSwitchReg8(NetInterface *interface, uint16_t address,
1542 uint8_t data);
1543
1544uint8_t ksz9563ReadSwitchReg8(NetInterface *interface, uint16_t address);
1545
1546void ksz9563WriteSwitchReg16(NetInterface *interface, uint16_t address,
1547 uint16_t data);
1548
1549uint16_t ksz9563ReadSwitchReg16(NetInterface *interface, uint16_t address);
1550
1551void ksz9563WriteSwitchReg32(NetInterface *interface, uint16_t address,
1552 uint32_t data);
1553
1554uint32_t ksz9563ReadSwitchReg32(NetInterface *interface, uint16_t address);
1555
1556//C++ guard
1557#ifdef __cplusplus
1558}
1559#endif
1560
1561#endif
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