Go to the documentation of this file.
31 #ifndef _LAN9370_DRIVER_H
32 #define _LAN9370_DRIVER_H
38 #define LAN9370_PORT1 1
39 #define LAN9370_PORT2 2
40 #define LAN9370_PORT3 3
41 #define LAN9370_PORT4 4
42 #define LAN9370_PORT5 5
45 #define LAN9370_PORT_MASK 0x1F
46 #define LAN9370_PORT1_MASK 0x01
47 #define LAN9370_PORT2_MASK 0x02
48 #define LAN9370_PORT3_MASK 0x04
49 #define LAN9370_PORT4_MASK 0x08
50 #define LAN9370_PORT5_MASK 0x10
53 #define LAN9370_SPI_CMD_WRITE 0x40000000
54 #define LAN9370_SPI_CMD_READ 0x60000000
55 #define LAN9370_SPI_CMD_ADDR 0x001FFFE0
58 #define LAN9370_STATIC_MAC_TABLE_SIZE 256
59 #define LAN9370_DYNAMIC_MAC_TABLE_SIZE 1024
62 #define LAN9370_TAIL_TAG_VALID 0x2000
63 #define LAN9370_TAIL_TAG_NORMAL_ADDR_LOOKUP 0x1000
64 #define LAN9370_TAIL_TAG_PORT_BLOCKING_OVERRIDE 0x0800
65 #define LAN9370_TAIL_TAG_PRIORITY 0x0700
66 #define LAN9370_TAIL_TAG_DEST_PORT5 0x0010
67 #define LAN9370_TAIL_TAG_DEST_PORT4 0x0008
68 #define LAN9370_TAIL_TAG_DEST_PORT3 0x0004
69 #define LAN9370_TAIL_TAG_DEST_PORT2 0x0002
70 #define LAN9370_TAIL_TAG_DEST_PORT1 0x0001
73 #define LAN9370_TAIL_TAG_PTP_MSG 0x80
74 #define LAN9370_TAIL_TAG_SRC_PORT 0x07
77 #define LAN9370_BASIC_CONTROL 0x00
78 #define LAN9370_BASIC_STATUS 0x01
79 #define LAN9370_PHY_ID1 0x02
80 #define LAN9370_PHY_ID2 0x03
81 #define LAN9370_MASTER_SLAVE_CONTROL 0x09
82 #define LAN9370_MASTER_SLAVE_STATUS 0x0A
83 #define LAN9370_EXT_REG_CTL 0x14
84 #define LAN9370_EXT_REG_RD_DATA 0x15
85 #define LAN9370_EXT_REG_WR_DATA 0x16
88 #define LAN9370_CHIP_ID0 0x0000
89 #define LAN9370_CHIP_ID1 0x0001
90 #define LAN9370_CHIP_ID2 0x0002
91 #define LAN9370_CHIP_ID3 0x0003
92 #define LAN9370_GLOBAL_CTRL0 0x0007
93 #define LAN9370_SWITCH_OP 0x0300
94 #define LAN9370_SWITCH_LUE_CTRL0 0x0310
95 #define LAN9370_SWITCH_LUE_CTRL1 0x0311
96 #define LAN9370_SWITCH_LUE_CTRL2 0x0312
97 #define LAN9370_SWITCH_LUE_CTRL3 0x0313
98 #define LAN9370_SWITCH_LUE_AGE 0x0320
99 #define LAN9370_UNKONWN_MULTICAST_CTRL 0x0324
100 #define LAN9370_GLOBAL_PORT_MIRROR_SNOOP_CTRL 0x0370
101 #define LAN9370_ALU_TABLE_CTRL 0x0418
102 #define LAN9370_STATIC_MCAST_TABLE_CTRL 0x041C
103 #define LAN9370_ALU_TABLE_ENTRY1 0x0420
104 #define LAN9370_STATIC_TABLE_ENTRY1 0x0420
105 #define LAN9370_ALU_TABLE_ENTRY2 0x0424
106 #define LAN9370_STATIC_TABLE_ENTRY2 0x0424
107 #define LAN9370_ALU_TABLE_ENTRY3 0x0428
108 #define LAN9370_STATIC_TABLE_ENTRY3 0x0428
109 #define LAN9370_ALU_TABLE_ENTRY4 0x042C
110 #define LAN9370_STATIC_TABLE_ENTRY4 0x042C
111 #define LAN9370_IND_ADDR 0x075C
112 #define LAN9370_IND_DATA 0x0760
113 #define LAN9370_IND_CTRL 0x0768
114 #define LAN9370_VPHY_SPECIAL_CTRL 0x077C
115 #define LAN9370_PORT1_OP_CTRL0 0x1020
116 #define LAN9370_PORT1_STATUS 0x1030
117 #define LAN9370_PORT1_MAC_CTRL0 0x1400
118 #define LAN9370_PORT1_MSTP_STATE 0x1B04
119 #define LAN9370_PORT2_OP_CTRL0 0x2020
120 #define LAN9370_PORT2_STATUS 0x2030
121 #define LAN9370_PORT2_MAC_CTRL0 0x2400
122 #define LAN9370_PORT2_MSTP_STATE 0x2B04
123 #define LAN9370_PORT3_OP_CTRL0 0x3020
124 #define LAN9370_PORT3_STATUS 0x3030
125 #define LAN9370_PORT3_MAC_CTRL0 0x3400
126 #define LAN9370_PORT3_MSTP_STATE 0x3B04
127 #define LAN9370_PORT4_OP_CTRL0 0x4020
128 #define LAN9370_PORT4_STATUS 0x4030
129 #define LAN9370_PORT4_MAC_CTRL0 0x4400
130 #define LAN9370_PORT4_MSTP_STATE 0x4B04
131 #define LAN9370_PORT5_OP_CTRL0 0x5020
132 #define LAN9370_PORT5_STATUS 0x5030
133 #define LAN9370_PORT5_XMII_CTRL0 0x5300
134 #define LAN9370_PORT5_XMII_CTRL1 0x5301
135 #define LAN9370_PORT5_MAC_CTRL0 0x5400
136 #define LAN9370_PORT5_MSTP_STATE 0x5B04
139 #define LAN9370_PORTn_OP_CTRL0(port) (0x0020 + ((port) * 0x1000))
140 #define LAN9370_PORTn_STATUS(port) (0x0030 + ((port) * 0x1000))
141 #define LAN9370_PORTn_XMII_CTRL0(port) (0x0300 + ((port) * 0x1000))
142 #define LAN9370_PORTn_XMII_CTRL1(port) (0x0301 + ((port) * 0x1000))
143 #define LAN9370_PORTn_MAC_CTRL0(port) (0x0400 + ((port) * 0x1000))
144 #define LAN9370_PORTn_MSTP_STATE(port) (0x0B04 + ((port) * 0x1000))
145 #define LAN9370_PORTn_T1_PHY_REG(port, addr) (0x0100 + ((port) * 0x1000) + ((addr) * 4))
148 #define LAN9370_BASIC_CONTROL_SW_RESET 0x8000
149 #define LAN9370_BASIC_CONTROL_LOOPBACK 0x4000
150 #define LAN9370_BASIC_CONTROL_SPEED_SEL_LSB 0x2000
151 #define LAN9370_BASIC_CONTROL_AN_EN 0x1000
152 #define LAN9370_BASIC_CONTROL_POWER_DOWN 0x0800
153 #define LAN9370_BASIC_CONTROL_ISOLATE 0x0400
154 #define LAN9370_BASIC_CONTROL_RESTART_AN 0x0200
155 #define LAN9370_BASIC_CONTROL_DUPLEX_MODE 0x0100
156 #define LAN9370_BASIC_CONTROL_COL_TEST 0x0080
157 #define LAN9370_BASIC_CONTROL_SPEED_SEL_MSB 0x0040
158 #define LAN9370_BASIC_CONTROL_UNIDIRECTIONAL_EN 0x0020
161 #define LAN9370_BASIC_STATUS_100BT4 0x8000
162 #define LAN9370_BASIC_STATUS_100BTX_FD 0x4000
163 #define LAN9370_BASIC_STATUS_100BTX_HD 0x2000
164 #define LAN9370_BASIC_STATUS_10BT_FD 0x1000
165 #define LAN9370_BASIC_STATUS_10BT_HD 0x0800
166 #define LAN9370_BASIC_STATUS_100BT2_FD 0x0400
167 #define LAN9370_BASIC_STATUS_100BT2_HD 0x0200
168 #define LAN9370_BASIC_STATUS_EXTENDED_STATUS 0x0100
169 #define LAN9370_BASIC_STATUS_UNIDIRECTIONAL_EN 0x0080
170 #define LAN9370_BASIC_STATUS_MF_PREAMBLE_SUPPR 0x0040
171 #define LAN9370_BASIC_STATUS_AN_COMPLETE 0x0020
172 #define LAN9370_BASIC_STATUS_REMOTE_FAULT 0x0010
173 #define LAN9370_BASIC_STATUS_AN_CAPABLE 0x0008
174 #define LAN9370_BASIC_STATUS_LINK_STATUS 0x0004
175 #define LAN9370_BASIC_STATUS_JABBER_DETECT 0x0002
176 #define LAN9370_BASIC_STATUS_EXTENDED_CAPABLE 0x0001
179 #define LAN9370_PHY_ID1_PHY_ID_MSB 0xFFFF
180 #define LAN9370_PHY_ID1_PHY_ID_MSB_DEFAULT 0x0007
183 #define LAN9370_PHY_ID2_PHY_ID_LSB 0xFC00
184 #define LAN9370_PHY_ID2_PHY_ID_LSB_DEFAULT 0xC000
185 #define LAN9370_PHY_ID2_MODEL_NUM 0x03F0
186 #define LAN9370_PHY_ID2_MODEL_NUM_DEFAULT 0x0180
187 #define LAN9370_PHY_ID2_REVISION_NUM 0x000F
190 #define LAN9370_MASTER_SLAVE_CONTROL_TEST_MODE 0xE000
191 #define LAN9370_MASTER_SLAVE_CONTROL_MS_MAN_CONF_EN 0x1000
192 #define LAN9370_MASTER_SLAVE_CONTROL_MS_MAN_CONF_VAL 0x0800
193 #define LAN9370_MASTER_SLAVE_CONTROL_PORT_TYPE 0x0400
194 #define LAN9370_MASTER_SLAVE_CONTROL_1000BT_FD 0x0200
195 #define LAN9370_MASTER_SLAVE_CONTROL_1000BT_HD 0x0100
198 #define LAN9370_MASTER_SLAVE_STATUS_MS_CONF_FAULT 0x8000
199 #define LAN9370_MASTER_SLAVE_STATUS_MS_CONF_RES 0x4000
200 #define LAN9370_MASTER_SLAVE_STATUS_LOC_RCVR_STATUS 0x2000
201 #define LAN9370_MASTER_SLAVE_STATUS_REM_RCVR_STATUS 0x1000
202 #define LAN9370_MASTER_SLAVE_STATUS_LP_1000BT_FD 0x0800
203 #define LAN9370_MASTER_SLAVE_STATUS_LP_1000BT_HD 0x0400
204 #define LAN9370_MASTER_SLAVE_STATUS_IDLE_ERR_COUNT 0x00FF
207 #define LAN9370_EXT_REG_CTL_READ_CONTROL 0x1000
208 #define LAN9370_EXT_REG_CTL_WRITE_CONTROL 0x0800
209 #define LAN9370_EXT_REG_CTL_REGISTER_BANK 0x0700
210 #define LAN9370_EXT_REG_CTL_REGISTER_BANK_MISC 0x0100
211 #define LAN9370_EXT_REG_CTL_REGISTER_BANK_PCS 0x0200
212 #define LAN9370_EXT_REG_CTL_REGISTER_BANK_AFE 0x0300
213 #define LAN9370_EXT_REG_CTL_REGISTER_BANK_DSP 0x0400
214 #define LAN9370_EXT_REG_CTL_REGISTER_ADDR 0x00FF
217 #define LAN9370_CHIP_ID0_DEFAULT 0x00
220 #define LAN9370_CHIP_ID1_DEFAULT 0x93
223 #define LAN9370_CHIP_ID2_DEFAULT 0x70
226 #define LAN9370_CHIP_ID3_REVISION_ID 0xF0
229 #define LAN9370_GLOBAL_CTRL0_APB_PHY_REG_BLK 0x80
230 #define LAN9370_GLOBAL_CTRL0_SW_INI_DONE 0x10
233 #define LAN9370_SWITCH_OP_DOUBLE_TAG_EN 0x80
234 #define LAN9370_SWITCH_OP_OVER_TEMP_ADJ 0x70
235 #define LAN9370_SWITCH_OP_OVER_TEMP_FORCE 0x08
236 #define LAN9370_SWITCH_OP_OVER_TEMP_EN 0x04
237 #define LAN9370_SWITCH_OP_SOFT_HARD_RESET 0x02
238 #define LAN9370_SWITCH_OP_START_SWITCH 0x01
241 #define LAN9370_SWITCH_LUE_CTRL0_VLAN_EN 0x80
242 #define LAN9370_SWITCH_LUE_CTRL0_DROP_INVALID_VID 0x40
243 #define LAN9370_SWITCH_LUE_CTRL0_AGE_COUNT 0x38
244 #define LAN9370_SWITCH_LUE_CTRL0_AGE_COUNT_DEFAULT 0x20
245 #define LAN9370_SWITCH_LUE_CTRL0_RESERVED_LUE_EN 0x04
246 #define LAN9370_SWITCH_LUE_CTRL0_HASH_OPTION 0x03
247 #define LAN9370_SWITCH_LUE_CTRL0_HASH_OPTION_NONE 0x00
248 #define LAN9370_SWITCH_LUE_CTRL0_HASH_OPTION_CRC 0x01
249 #define LAN9370_SWITCH_LUE_CTRL0_HASH_OPTION_XOR 0x02
252 #define LAN9370_SWITCH_LUE_CTRL1_UNICAST_LEARNING_DIS 0x80
253 #define LAN9370_SWITCH_LUE_CTRL1_SELF_ADDR_FILT 0x40
254 #define LAN9370_SWITCH_LUE_CTRL1_FLUSH_ALU_TABLE 0x20
255 #define LAN9370_SWITCH_LUE_CTRL1_FLUSH_MSTP_ENTRIES 0x10
256 #define LAN9370_SWITCH_LUE_CTRL1_SRC_ADDR_FILT 0x08
257 #define LAN9370_SWITCH_LUE_CTRL1_AGING_EN 0x04
258 #define LAN9370_SWITCH_LUE_CTRL1_FAST_AGE_EN 0x02
259 #define LAN9370_SWITCH_LUE_CTRL1_LINK_DOWN_FLUSH 0x01
262 #define LAN9370_SWITCH_LUE_CTRL2_MID_RANGE_AGE 0x80
263 #define LAN9370_SWITCH_LUE_CTRL2_LINK_DOWN_FLUSH_ACTIVATED 0x40
264 #define LAN9370_SWITCH_LUE_CTRL2_DYNAMIC_EGRESS_VLAN_FILTERING 0x20
265 #define LAN9370_SWITCH_LUE_CTRL2_STATIC_EGRESS_VLAN_FILTERING 0x10
266 #define LAN9370_SWITCH_LUE_CTRL2_FLUSH_OPTION 0x0C
267 #define LAN9370_SWITCH_LUE_CTRL2_FLUSH_OPTION_NONE 0x00
268 #define LAN9370_SWITCH_LUE_CTRL2_FLUSH_OPTION_DYNAMIC 0x04
269 #define LAN9370_SWITCH_LUE_CTRL2_FLUSH_OPTION_STATIC 0x08
270 #define LAN9370_SWITCH_LUE_CTRL2_FLUSH_OPTION_BOTH 0x0C
271 #define LAN9370_SWITCH_LUE_CTRL2_ALU_PRIORITY_GEN 0x03
274 #define LAN9370_SWITCH_LUE_CTRL3_AGE_PERIOD_7_0 0xFF
275 #define LAN9370_SWITCH_LUE_CTRL3_AGE_PERIOD_7_0_DEFAULT 0x4B
278 #define LAN9370_SWITCH_LUE_AGE_AGE_PERIOD_19_8 0x0FFF
279 #define LAN9370_SWITCH_LUE_AGE_AGE_PERIOD_19_8_DEFAULT 0x0000
282 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD 0x80000000
283 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP 0x0000001F
284 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT1 0x00000001
285 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT2 0x00000002
286 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT3 0x00000004
287 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT4 0x00000008
288 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT5 0x00000010
289 #define LAN9370_UNKONWN_MULTICAST_CTRL_FWD_MAP_ALL 0x0000001F
292 #define LAN9370_GLOBAL_PORT_MIRROR_SNOOP_CTRL_IGMP_SNOOP_EN 0x40
293 #define LAN9370_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_OPT 0x08
294 #define LAN9370_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_EN 0x04
295 #define LAN9370_GLOBAL_PORT_MIRROR_SNOOP_CTRL_SNIFF_MODE_SEL 0x01
298 #define LAN9370_ALU_TABLE_CTRL_VALID_COUNT 0x3FFF0000
299 #define LAN9370_ALU_TABLE_CTRL_START_FINISH 0x00000080
300 #define LAN9370_ALU_TABLE_CTRL_VALID 0x00000040
301 #define LAN9370_ALU_TABLE_CTRL_VALID_ENTRY_OR_SEARCH_END 0x00000020
302 #define LAN9370_ALU_TABLE_CTRL_DIRECT 0x00000004
303 #define LAN9370_ALU_TABLE_CTRL_ACTION 0x00000003
304 #define LAN9370_ALU_TABLE_CTRL_ACTION_NOP 0x00000000
305 #define LAN9370_ALU_TABLE_CTRL_ACTION_WRITE 0x00000001
306 #define LAN9370_ALU_TABLE_CTRL_ACTION_READ 0x00000002
307 #define LAN9370_ALU_TABLE_CTRL_ACTION_SEARCH 0x00000003
310 #define LAN9370_STATIC_MCAST_TABLE_CTRL_VALID_COUNT 0x1FF00000
311 #define LAN9370_STATIC_MCAST_TABLE_CTRL_TABLE_INDEX 0x0000FF00
312 #define LAN9370_STATIC_MCAST_TABLE_CTRL_START_FINISH 0x00000080
313 #define LAN9370_STATIC_MCAST_TABLE_CTRL_VALID 0x00000040
314 #define LAN9370_STATIC_MCAST_TABLE_CTRL_VALID_ENTRY_OR_SEARCH_END 0x00000020
315 #define LAN9370_STATIC_MCAST_TABLE_CTRL_DIRECT_ACCESS 0x00000008
316 #define LAN9370_STATIC_MCAST_TABLE_CTRL_TABLE_SELECT 0x00000004
317 #define LAN9370_STATIC_MCAST_TABLE_CTRL_TABLE_SELECT_STATIC 0x00000000
318 #define LAN9370_STATIC_MCAST_TABLE_CTRL_TABLE_SELECT_RESERVED 0x00000004
319 #define LAN9370_STATIC_MCAST_TABLE_CTRL_ACTION 0x00000003
320 #define LAN9370_STATIC_MCAST_TABLE_CTRL_ACTION_NOP 0x00000000
321 #define LAN9370_STATIC_MCAST_TABLE_CTRL_ACTION_WRITE 0x00000001
322 #define LAN9370_STATIC_MCAST_TABLE_CTRL_ACTION_READ 0x00000002
323 #define LAN9370_STATIC_MCAST_TABLE_CTRL_ACTION_SEARCH 0x00000003
326 #define LAN9370_ALU_TABLE_ENTRY1_STATIC 0x80000000
327 #define LAN9370_ALU_TABLE_ENTRY1_SRC_FILTER 0x40000000
328 #define LAN9370_ALU_TABLE_ENTRY1_DES_FILTER 0x20000000
329 #define LAN9370_ALU_TABLE_ENTRY1_PRIORITY 0x1C000000
330 #define LAN9370_ALU_TABLE_ENTRY1_AGE_COUNT 0x1C000000
331 #define LAN9370_ALU_TABLE_ENTRY1_MSTP 0x00000007
334 #define LAN9370_ALU_TABLE_ENTRY2_OVERRIDE 0x80000000
335 #define LAN9370_ALU_TABLE_ENTRY2_PORT_FORWARD 0x0000001F
336 #define LAN9370_ALU_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
337 #define LAN9370_ALU_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
338 #define LAN9370_ALU_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
339 #define LAN9370_ALU_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
340 #define LAN9370_ALU_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
343 #define LAN9370_ALU_TABLE_ENTRY3_FID 0x007F0000
344 #define LAN9370_ALU_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
347 #define LAN9370_ALU_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
350 #define LAN9370_STATIC_TABLE_ENTRY1_VALID 0x80000000
351 #define LAN9370_STATIC_TABLE_ENTRY1_SRC_FILTER 0x40000000
352 #define LAN9370_STATIC_TABLE_ENTRY1_DES_FILTER 0x20000000
353 #define LAN9370_STATIC_TABLE_ENTRY1_PRIORITY 0x1C000000
354 #define LAN9370_STATIC_TABLE_ENTRY1_MSTP 0x00000007
357 #define LAN9370_STATIC_TABLE_ENTRY2_OVERRIDE 0x80000000
358 #define LAN9370_STATIC_TABLE_ENTRY2_USE_FID 0x40000000
359 #define LAN9370_STATIC_TABLE_ENTRY2_PORT_FORWARD 0x0000001F
360 #define LAN9370_STATIC_TABLE_ENTRY2_PORT5_FORWARD 0x00000010
361 #define LAN9370_STATIC_TABLE_ENTRY2_PORT4_FORWARD 0x00000008
362 #define LAN9370_STATIC_TABLE_ENTRY2_PORT3_FORWARD 0x00000004
363 #define LAN9370_STATIC_TABLE_ENTRY2_PORT2_FORWARD 0x00000002
364 #define LAN9370_STATIC_TABLE_ENTRY2_PORT1_FORWARD 0x00000001
367 #define LAN9370_STATIC_TABLE_ENTRY3_FID 0x007F0000
368 #define LAN9370_STATIC_TABLE_ENTRY3_MAC_ADDR_MSB 0x0000FFFF
371 #define LAN9370_STATIC_TABLE_ENTRY4_MAC_ADDR_LSB 0xFFFFFFFF
374 #define LAN9370_IND_CTRL_OP 0x0002
375 #define LAN9370_IND_CTRL_OP_READ 0x0000
376 #define LAN9370_IND_CTRL_OP_WRITE 0x0002
377 #define LAN9370_IND_CTRL_BUSY 0x0001
380 #define LAN9370_VPHY_SPECIAL_CTRL_SMI_INDIRECT_EN 0x8000
381 #define LAN9370_VPHY_SPECIAL_CTRL_SW_LOOPBACK 0x4000
382 #define LAN9370_VPHY_SPECIAL_CTRL_MDIO_INT_EN 0x2000
383 #define LAN9370_VPHY_SPECIAL_CTRL_SPI_INDIRECT_EN 0x1000
384 #define LAN9370_VPHY_SPECIAL_CTRL_MODE 0x0300
385 #define LAN9370_VPHY_SPECIAL_CTRL_MODE_RGMII 0x0000
386 #define LAN9370_VPHY_SPECIAL_CTRL_MODE_MII_PHY 0x0100
387 #define LAN9370_VPHY_SPECIAL_CTRL_MODE_SGMII 0x0200
388 #define LAN9370_VPHY_SPECIAL_CTRL_MODE_RMII_PHY 0x0300
389 #define LAN9370_VPHY_SPECIAL_CTRL_SW_COL_TEST 0x0080
390 #define LAN9370_VPHY_SPECIAL_CTRL_SPEED_DUPLEX_IND 0x001C
391 #define LAN9370_VPHY_SPECIAL_CTRL_SPEED_DUPLEX_IND_10_HD 0x0004
392 #define LAN9370_VPHY_SPECIAL_CTRL_SPEED_DUPLEX_IND_100_HD 0x0008
393 #define LAN9370_VPHY_SPECIAL_CTRL_SPEED_DUPLEX_IND_10_FD 0x0014
394 #define LAN9370_VPHY_SPECIAL_CTRL_SPEED_DUPLEX_IND_100_FD 0x0018
397 #define LAN9370_PORTn_OP_CTRL0_LOCAL_LOOPBACK 0x80
398 #define LAN9370_PORTn_OP_CTRL0_REMOTE_LOOPBACK 0x40
399 #define LAN9370_PORTn_OP_CTRL0_K2L_INSERT_EN 0x20
400 #define LAN9370_PORTn_OP_CTRL0_K2L_DEBUG_EN 0x10
401 #define LAN9370_PORTn_OP_CTRL0_TAIL_TAG_EN 0x04
402 #define LAN9370_PORTn_OP_CTRL0_TX_QUEUE_SPLIT_EN 0x03
405 #define LAN9370_PORTn_STATUS_SPEED 0x18
406 #define LAN9370_PORTn_STATUS_SPEED_10MBPS 0x00
407 #define LAN9370_PORTn_STATUS_SPEED_100MBPS 0x08
408 #define LAN9370_PORTn_STATUS_SPEED_1000MBPS 0x10
409 #define LAN9370_PORTn_STATUS_DUPLEX 0x04
410 #define LAN9370_PORTn_STATUS_TX_FLOW_CTRL_EN 0x02
411 #define LAN9370_PORTn_STATUS_RX_FLOW_CTRL_EN 0x01
414 #define LAN9370_PORTn_XMII_CTRL0_DUPLEX 0x40
415 #define LAN9370_PORTn_XMII_CTRL0_TX_FLOW_CTRL_EN 0x20
416 #define LAN9370_PORTn_XMII_CTRL0_SPEED_10_100 0x10
417 #define LAN9370_PORTn_XMII_CTRL0_RX_FLOW_CTRL_EN 0x08
418 #define LAN9370_PORTn_XMII_CTRL0_CRS_COL_EN 0x02
419 #define LAN9370_PORTn_XMII_CTRL0_AUTO_COL_DET 0x01
422 #define LAN9370_PORTn_XMII_CTRL1_RGMII_SPEED_1000 0x40
423 #define LAN9370_PORTn_XMII_CTRL1_SEL_EDGE 0x20
424 #define LAN9370_PORTn_XMII_CTRL1_RGMII_ID_IG 0x10
425 #define LAN9370_PORTn_XMII_CTRL1_RGMII_ID_EG 0x08
426 #define LAN9370_PORTn_XMII_CTRL1_MII_RMII_MODE 0x04
427 #define LAN9370_PORTn_XMII_CTRL1_MII_INTF_SEL 0x03
428 #define LAN9370_PORTn_XMII_CTRL1_MII_INTF_SEL_RGMII 0x00
429 #define LAN9370_PORTn_XMII_CTRL1_MII_INTF_SEL_RMII 0x01
430 #define LAN9370_PORTn_XMII_CTRL1_MII_INTF_SEL_MII 0x03
433 #define LAN9370_PORTn_MAC_CTRL0_FR_LEN_CHK 0x04
434 #define LAN9370_PORTn_MAC_CTRL0_BCAST_STORM_EN 0x02
435 #define LAN9370_PORTn_MAC_CTRL0_JUMBO_PKT_EN 0x01
438 #define LAN9370_PORTn_MSTP_STATE_TRANSMIT_EN 0x04
439 #define LAN9370_PORTn_MSTP_STATE_RECEIVE_EN 0x02
440 #define LAN9370_PORTn_MSTP_STATE_LEARNING_DIS 0x01
499 bool_t enable, uint32_t forwardPorts);
void lan9370SetAgingTime(NetInterface *interface, uint32_t agingTime)
Set aging time for dynamic filtering entries.
uint16_t lan9370ReadExtReg(NetInterface *interface, uint8_t port, uint8_t bank, uint8_t addr)
Read extended register.
void lan9370WriteExtReg(NetInterface *interface, uint8_t port, uint8_t bank, uint8_t addr, uint16_t data)
Write extended register.
Structure describing a buffer that spans multiple chunks.
error_t lan9370DeleteStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Remove an entry from the static MAC table.
void lan9370FlushDynamicFdbTable(NetInterface *interface, uint8_t port)
Flush dynamic MAC table.
void lan9370WriteSwitchReg16(NetInterface *interface, uint16_t address, uint16_t data)
Write switch register (16 bits)
error_t lan9370UntagFrame(NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary)
Decode tail tag from incoming Ethernet frame.
void lan9370EnableIrq(NetInterface *interface)
Enable interrupts.
void lan9370DumpPhyReg(NetInterface *interface, uint8_t port)
Dump PHY registers for debugging purpose.
void lan9370EventHandler(NetInterface *interface)
LAN9370 event handler.
void lan9370SetPortState(NetInterface *interface, uint8_t port, SwitchPortState state)
Set port state.
error_t lan9370AddStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Add a new entry to the static MAC table.
uint32_t lan9370ReadSwitchReg32(NetInterface *interface, uint16_t address)
Read switch register (32 bits)
error_t lan9370GetDynamicFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the dynamic MAC table.
void lan9370FlushStaticFdbTable(NetInterface *interface)
Flush static MAC table.
void lan9370WriteSwitchReg32(NetInterface *interface, uint16_t address, uint32_t data)
Write switch register (32 bits)
void lan9370DisableIrq(NetInterface *interface)
Disable interrupts.
uint16_t lan9370ReadSwitchReg16(NetInterface *interface, uint16_t address)
Read switch register (16 bits)
uint32_t lan9370GetLinkSpeed(NetInterface *interface, uint8_t port)
Get link speed.
void lan9370EnableRsvdMcastTable(NetInterface *interface, bool_t enable)
Enable reserved multicast table.
SwitchPortState
Switch port state.
error_t lan9370TagFrame(NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary)
Add tail tag to Ethernet frame.
void lan9370WritePhyReg(NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
Write PHY register.
void lan9370EnableIgmpSnooping(NetInterface *interface, bool_t enable)
Enable IGMP snooping.
SwitchPortState lan9370GetPortState(NetInterface *interface, uint8_t port)
Get port state.
void lan9370WriteSwitchReg8(NetInterface *interface, uint16_t address, uint8_t data)
Write switch register (8 bits)
NicDuplexMode lan9370GetDuplexMode(NetInterface *interface, uint8_t port)
Get duplex mode.
NicDuplexMode
Duplex mode.
const SwitchDriver lan9370SwitchDriver
LAN9370 Ethernet switch driver.
Network interface controller abstraction layer.
void lan9370EnableMldSnooping(NetInterface *interface, bool_t enable)
Enable MLD snooping.
void lan9370SetUnknownMcastFwdPorts(NetInterface *interface, bool_t enable, uint32_t forwardPorts)
Set forward ports for unknown multicast packets.
error_t lan9370Init(NetInterface *interface)
LAN9370 Ethernet switch initialization.
bool_t lan9370GetLinkState(NetInterface *interface, uint8_t port)
Get link state.
void lan9370Tick(NetInterface *interface)
LAN9370 timer handler.
uint8_t lan9370ReadSwitchReg8(NetInterface *interface, uint16_t address)
Read switch register (8 bits)
error_t lan9370GetStaticFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the static MAC table.
void lan9370InitHook(NetInterface *interface)
LAN9370 custom configuration.
uint16_t lan9370ReadPhyReg(NetInterface *interface, uint8_t port, uint8_t address)
Read PHY register.
Forwarding database entry.