1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Bjoern A. Zeeb
5 * All rights reserved.
6 *
7 * This software was developed by SRI International and the University of
8 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-11-C-0249)
9 * ("MRC2"), as part of the DARPA MRC research programme.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: releng/12.0/sys/dev/altera/atse/if_atsereg.h 332474 2018-04-13 15:59:24Z br $
33 */
34
35 #ifndef _DEV_IF_ATSEREG_H
36 #define _DEV_IF_ATSEREG_H
37
38 #include <dev/xdma/xdma.h>
39
40 #define ATSE_VENDOR 0x6af7
41 #define ATSE_DEVICE 0x00bd
42
43 /* See hints file/fdt for ctrl port and Avalon FIFO addresses. */
44
45 /* Section 3. Parameter Settings. */
46 /*
47 * This is a lot of options that affect the way things are synthesized.
48 * We cannot really make them all hints and most of them might be stale.
49 */
50
51 /* 3-1 Core Configuration */
52 #if 0
53 static const char *atse_core_core_variation[] = {
54 [0] = "10/100/1000 Mbps Ethernet MAC only",
55 [1] = "10/100/1000 Mbps Ethernet MAC with 1000BASE-X/SGMII PCS",
56 [2] = "1000BASE-X/SGMII PCS only",
57 [3] = "1000 Mbps Small MAC",
58 [4] = "10/100 Mbps Small MAC",
59 NULL
60 };
61 static const char *atse_core_interface[] = {
62 [0] = "MII", /* Core variation 4. */
63 [1] = "GMII", /* Core variation 3. */
64 [2] = "RGMII", /* Core variation 0,1,3. */
65 [3] = "MII/GMII", /* Core variation 0,1. */
66 NULL
67 };
68 #endif
69 #define CORE_CORE_VARIATION 1 /* atse_core_core_variation[] */
70 #define CORE_INTERFACE 3 /* atse_core_interface[] */
71 #define CORE_USE_INTERNAL_FIFO 1
72 #define CORE_NUMBER_OF_PORTS 1 /* Internal FIFO count. */
73 #define CORE_USE_TRANSCEIVER_BLOCK 1 /* SGMII PCS transceiver:
74 * LVDS I/O. */
75
76 /* 3-2 MAC Options. */
77 /* Ethernet MAC Options. */
78 #define MAC_ENABLE_10_100_HDX_SUPPORT 0
79 #define MAC_ENABLE_RG_G_MII_LOOPBACK 0
80 #define MAC_ENABLE_SUPL_MAC_UCAST_ADDR 0 /* Supplementary MAC unicast. */
81 #define MAC_INCLUDE_STATISTICS_COUNTERS 0
82 #define MAC_STATISTICS_COUNTERS_64BIT 0
83 #define MAC_INCLUDE_MC_HASHTABLE 0 /* Multicast. */
84 #define MAC_ALIGN_PKTHDR_32BIT 1
85 #define MAC_ENABLE_FDX_FLOW_CTRL 0
86 #define MAC_ENABLE_VLAN_DETECTION 0 /* VLAN and stacked VLANs. */
87 #define MAC_ENABLE_MAGIC_PKT_DETECTION 0
88 /* MDIO Module. */
89 #define MAC_MDIO_INCLUDE_MDIO_MODULE 1
90 #define MAC_MDIO_HOST_CLOCK_DIVISOR 40 /* Not just On/Off. */
91
92 /* 3-4 FIFO Options. */
93 /* Width and Memory Type. */
94 #if 0
95 static char *fifo_memory_block[] = {
96 [0] = "M4K",
97 [1] = "M9K",
98 [2] = "M144K",
99 [3] = "MRAM",
100 [4] = "AUTO",
101 NULL
102 };
103 #endif
104 #define FIFO_MEMORY_BLOCK 4
105 #define FIFO_WITDH 32 /* Other: 8 bits. */
106 /* Depth. */
107 #define FIFO_DEPTH_TX 2048 /* 64 .. 64k, 2048x32bits. */
108 #define FIFO_DEPTH_RX 2048 /* 64 .. 64k, 2048x32bits. */
109
110 #define ATSE_TX_LIST_CNT 5 /* Certainly not bufferbloat. */
111
112 /* 3-4 PCS/Transceiver Options */
113 /* PCS Options. */
114 #define PCS_TXRX_PHY_ID 0x00000000 /* 32 bits */
115 #define PCS_TXRX_ENABLE_SGMII_BRIDGE 0
116 /* Transceiver Options. */
117 #define PCS_TXRX_EXP_POWER_DOWN_SIGNAL 0 /* Export power down signal. */
118 #define PCS_TXRX_ENABLE_DYNAMIC_RECONF 0 /* Dynamic trans. reconfig. */
119 #define PCS_TXRX_STARTING_CHANNEL 0 /* 0..284. */
120
121
122 /* -------------------------------------------------------------------------- */
123
124 /* XXX more values based on the bitmaps provided. Cleanup. */
125 /* See regs above. */
126 #define AVALON_FIFO_TX_BLOCK_DIAGRAM 0
127 #define AVALON_FIFO_TX_BLOCK_DIAGRAM_SHOW_SIGANLS 0
128 #define AVALON_FIFO_TX_PARAM_SINGLE_RESET_MODE 0
129 #define AVALON_FIFO_TX_BASIC_OPTS_DEPTH 16
130 #define AVALON_FIFO_TX_BASIC_OPTS_ALLOW_BACKPRESSURE 1
131 #define AVALON_FIFO_TX_BASIC_OPTS_CLOCK_SETTING "Single Clock Mode"
132 #define AVALON_FIFO_TX_BASIC_OPTS_FIFO_IMPL "Construct FIFO from embedded memory blocks"
133 #define AVALON_FIFO_TX_STATUS_PORT_CREATE_STATUS_INT_FOR_INPUT 1
134 #define AVALON_FIFO_TX_STATUS_PORT_CREATE_STATUS_INT_FOR_OUTPUT 0
135 #define AVALON_FIFO_TX_STATUS_PORT_ENABLE_IRQ_FOR_STATUS_PORT 1
136 #define AVALON_FIFO_TX_INPUT_TYPE "AVALONMM_WRITE"
137 #define AVALON_FIFO_TX_OUTPUT_TYPE "AVALONST_SOURCE"
138 #define AVALON_FIFO_TX_AVALON_MM_PORT_SETTINGS_DATA_WIDTH ""
139 #define AVALON_FIFO_TX_AVALON_ST_PORT_SETTINGS_BITS_PER_SYMBOL 8
140 #define AVALON_FIFO_TX_AVALON_ST_PORT_SETTINGS_SYM_PER_BEAT 4
141 #define AVALON_FIFO_TX_AVALON_ST_PORT_SETTINGS_ERROR_WIDTH 1
142 #define AVALON_FIFO_TX_AVALON_ST_PORT_SETTINGS_CHANNEL_WIDTH 0
143 #define AVALON_FIFO_TX_AVALON_ST_PORT_SETTINGS_ENABLE_PACKET_DATA 1
144
145 #define AVALON_FIFO_RX_BLOCK_DIAGRAM 0
146 #define AVALON_FIFO_RX_BLOCK_DIAGRAM_SHOW_SIGNALS 0
147 #define AVALON_FIFO_RX_PARAM_SINGLE_RESET_MODE 0
148 #define AVALON_FIFO_RX_BASIC_OPTS_DEPTH 16
149 #define AVALON_FIFO_RX_BASIC_OPTS_ALLOW_BACKPRESSURE 1
150 #define AVALON_FIFO_RX_BASIC_OPTS_CLOCK_SETTING "Single Clock Mode"
151 #define AVALON_FIFO_RX_BASIC_OPTS_FIFO_IMPL "Construct FIFO from embedded memory blocks"
152 #define AVALON_FIFO_RX_STATUS_PORT_CREATE_STATUS_INT_FOR_INPUT 1
153 #define AVALON_FIFO_RX_STATUS_PORT_CREATE_STATUS_INT_FOR_OUTPUT 0
154 #define AVALON_FIFO_RX_STATUS_PORT_ENABLE_IRQ_FOR_STATUS_PORT 1
155 #define AVALON_FIFO_RX_INPUT_TYPE "AVALONST_SINK"
156 #define AVALON_FIFO_RX_OUTPUT_TYPE "AVALONMM_READ"
157 #define AVALON_FIFO_RX_AVALON_MM_PORT_SETTINGS_DATA_WIDTH ""
158 #define AVALON_FIFO_RX_AVALON_ST_PORT_SETTINGS_BITS_PER_SYMBOL 8
159 #define AVALON_FIFO_RX_AVALON_ST_PORT_SETTINGS_SYM_PER_BEAT 4
160 #define AVALON_FIFO_RX_AVALON_ST_PORT_SETTINGS_ERROR_WIDTH 6
161 #define AVALON_FIFO_RX_AVALON_ST_PORT_SETTINGS_CHANNEL_WIDTH 0
162 #define AVALON_FIFO_RX_AVALON_ST_PORT_SETTINGS_ENABLE_PACKET_DATA 1
163
164 /* -------------------------------------------------------------------------- */
165
166 /* 5. Configuration Register Space. */
167
168 /* 5-1, MAC Configuration Register Space; Dword offsets. */
169 /* 0x00 - 0x17, Base Configuration. */
170 #define BASE_CONFIG_REV 0x00 /* ro, IP Core ver. */
171 #define BASE_CFG_REV_VER_MASK 0x0000FFFF
172 #define BASE_CFG_REV_CUST_VERSION__MASK 0xFFFF0000
173
174 #define BASE_CFG_SCRATCH 0x01 /* rw, 0 */
175
176 #define BASE_CFG_COMMAND_CONFIG 0x02 /* rw, 0 */
177 #define BASE_CFG_COMMAND_CONFIG_TX_ENA (1<<0) /* rw */
178 #define BASE_CFG_COMMAND_CONFIG_RX_ENA (1<<1) /* rw */
179 #define BASE_CFG_COMMAND_CONFIG_XON_GEN (1<<2) /* rw */
180 #define BASE_CFG_COMMAND_CONFIG_ETH_SPEED (1<<3) /* rw */
181 #define BASE_CFG_COMMAND_CONFIG_PROMIS_EN (1<<4) /* rw */
182 #define BASE_CFG_COMMAND_CONFIG_PAD_EN (1<<5) /* rw */
183 #define BASE_CFG_COMMAND_CONFIG_CRC_FWD (1<<6) /* rw */
184 #define BASE_CFG_COMMAND_CONFIG_PAUSE_FWD (1<<7) /* rw */
185 #define BASE_CFG_COMMAND_CONFIG_PAUSE_IGNORE (1<<8) /* rw */
186 #define BASE_CFG_COMMAND_CONFIG_TX_ADDR_INS (1<<9) /* rw */
187 #define BASE_CFG_COMMAND_CONFIG_HD_ENA (1<<10) /* rw */
188 #define BASE_CFG_COMMAND_CONFIG_EXCESS_COL (1<<11) /* ro */
189 #define BASE_CFG_COMMAND_CONFIG_LATE_COL (1<<12) /* ro */
190 #define BASE_CFG_COMMAND_CONFIG_SW_RESET (1<<13) /* rw */
191 #define BASE_CFG_COMMAND_CONFIG_MHASH_SEL (1<<14) /* rw */
192 #define BASE_CFG_COMMAND_CONFIG_LOOP_ENA (1<<15) /* rw */
193 #define BASE_CFG_COMMAND_CONFIG_TX_ADDR_SEL (1<<16|1<<17|1<<18) /* rw */
194 #define BASE_CFG_COMMAND_CONFIG_MAGIC_ENA (1<<19) /* rw */
195 #define BASE_CFG_COMMAND_CONFIG_SLEEP (1<<20) /* rw */
196 #define BASE_CFG_COMMAND_CONFIG_WAKEUP (1<<21) /* ro */
197 #define BASE_CFG_COMMAND_CONFIG_XOFF_GEN (1<<22) /* rw */
198 #define BASE_CFG_COMMAND_CONFIG_CNTL_FRM_ENA (1<<23) /* rw */
199 #define BASE_CFG_COMMAND_CONFIG_NO_LGTH_CHECK (1<<24) /* rw */
200 #define BASE_CFG_COMMAND_CONFIG_ENA_10 (1<<25) /* rw */
201 #define BASE_CFG_COMMAND_CONFIG_RX_ERR_DISC (1<<26) /* rw */
202 #define BASE_CFG_COMMAND_CONFIG_DISABLE_READ_TIMEOUT (1<<27) /* rw */
203 /* 28-30 Reserved. */ /* - */
204 #define BASE_CFG_COMMAND_CONFIG_CNT_RESET (1<<31) /* rw */
205
206 #define BASE_CFG_MAC_0 0x03 /* rw, 0 */
207 #define BASE_CFG_MAC_1 0x04 /* rw, 0 */
208 #define BASE_CFG_FRM_LENGTH 0x05 /* rw/ro, 1518 */
209 #define BASE_CFG_PAUSE_QUANT 0x06 /* rw, 0 */
210 #define BASE_CFG_RX_SECTION_EMPTY 0x07 /* rw/ro, 0 */
211 #define BASE_CFG_RX_SECTION_FULL 0x08 /* rw/ro, 0 */
212 #define BASE_CFG_TX_SECTION_EMPTY 0x09 /* rw/ro, 0 */
213 #define BASE_CFG_TX_SECTION_FULL 0x0A /* rw/ro, 0 */
214 #define BASE_CFG_RX_ALMOST_EMPTY 0x0B /* rw/ro, 0 */
215 #define BASE_CFG_RX_ALMOST_FULL 0x0C /* rw/ro, 0 */
216 #define BASE_CFG_TX_ALMOST_EMPTY 0x0D /* rw/ro, 0 */
217 #define BASE_CFG_TX_ALMOST_FULL 0x0E /* rw/ro, 0 */
218 #define BASE_CFG_MDIO_ADDR0 0x0F /* rw, 0 */
219 #define BASE_CFG_MDIO_ADDR1 0x10 /* rw, 1 */
220 #define BASE_CFG_HOLDOFF_QUANT 0x11 /* rw, 0xFFFF */
221 /* 0x12-0x16 Reserved. */ /* -, 0 */
222 #define BASE_CFG_TX_IPG_LENGTH 0x17 /* rw, 0 */
223
224 /* 0x18 - 0x38, Statistics Counters. */
225 #define STATS_A_MAC_ID_0 0x18 /* ro */
226 #define STATS_A_MAC_ID_1 0x19 /* ro */
227 #define STATS_A_FRAMES_TX_OK 0x1A /* ro */
228 #define STATS_A_FRAMES_RX_OK 0x1B /* ro */
229 #define STATS_A_FCS_ERRORS 0x1C /* ro */
230 #define STATS_A_ALIGNMENT_ERRORS 0x1D /* ro */
231 #define STATS_A_OCTETS_TX_OK 0x1E /* ro */
232 #define STATS_A_OCTETS_RX_OK 0x1F /* ro */
233 #define STATS_A_TX_PAUSE_MAX_CTRL_FRAME 0x20 /* ro */
234 #define STATS_A_RX_PAUSE_MAX_CTRL_FRAME 0x21 /* ro */
235 #define STATS_IF_IN_ERRORS 0x22 /* ro */
236 #define STATS_IF_OUT_ERRORS 0x23 /* ro */
237 #define STATS_IF_IN_UCAST_PKTS 0x24 /* ro */
238 #define STATS_IF_IN_MULTICAST_PKTS 0x25 /* ro */
239 #define STATS_IF_IN_BROADCAST_PKTS 0x26 /* ro */
240 #define STATS_IF_OUT_DISCARDS 0x27 /* ro */
241 #define STATS_IF_OUT_UCAST_PKTS 0x28 /* ro */
242 #define STATS_IF_OUT_MULTICAST_PKTS 0x29 /* ro */
243 #define STATS_IF_OUT_BROADCAST_PKTS 0x2A /* ro */
244 #define STATS_ETHER_STATS_DROP_EVENT 0x2B /* ro */
245 #define STATS_ETHER_STATS_OCTETS 0x2C /* ro */
246 #define STATS_ETHER_STATS_PKTS 0x2D /* ro */
247 #define STATS_ETHER_STATS_USIZE_PKTS 0x2E /* ro */
248 #define STATS_ETHER_STATS_OSIZE_PKTS 0x2F /* ro */
249 #define STATS_ETHER_STATS_PKTS_64_OCTETS 0x30 /* ro */
250 #define STATS_ETHER_STATS_PKTS_65_TO_127_OCTETS 0x31 /* ro */
251 #define STATS_ETHER_STATS_PKTS_128_TO_255_OCTETS 0x32 /* ro */
252 #define STATS_ETHER_STATS_PKTS_256_TO_511_OCTETS 0x33 /* ro */
253 #define STATS_ETHER_STATS_PKTS_512_TO_1023_OCTETS 0x34 /* ro */
254 #define STATS_ETHER_STATS_PKTS_1024_TO_1518_OCTETS 0x35 /* ro */
255 #define STATS_ETHER_STATS_PKTS_1519_TO_X_OCTETS 0x36 /* ro */
256 #define STATS_ETHER_STATS_JABBERS 0x37 /* ro */
257 #define STATS_ETHER_STATS_FRAGMENTS 0x38 /* ro */
258 /* 0x39, Reserved. */ /* - */
259
260 /* 0x3A, Transmit Command. */
261 #define TX_CMD_STAT 0x3A /* rw */
262 #define TX_CMD_STAT_OMIT_CRC (1<<17)
263 #define TX_CMD_STAT_TX_SHIFT16 (1<<18)
264
265 /* 0x3B, Receive Command. */
266 #define RX_CMD_STAT 0x3B /* rw */
267 #define RX_CMD_STAT_RX_SHIFT16 (1<<25)
268
269 /* 0x3C - 0x3E, Extended Statistics Counters. */
270 #define ESTATS_MSB_A_OCTETS_TX_OK 0x3C /* ro */
271 #define ESTATS_MSB_A_OCTETS_RX_OK 0x3D /* ro */
272 #define ESTATS_MSB_ETHER_STATS_OCTETS 0x3E /* ro */
273
274 /* 0x3F, Reserved. */
275
276 /* 0x40 - 0x7F, Multicast Hash Table. */
277 #define MHASH_START 0x40
278 #define MHASH_LEN 0x3F
279
280 /* 0x80 - 0x9F, MDIO Space 0 or PCS Function Configuration. */
281 #define MDIO_0_START 0x80
282
283 /* The following are offsets to the first PCS register at 0x80. */
284 /* See sys/dev/mii/mii.h. */
285 #define PCS_CONTROL 0x00 /* rw */
286 /* Bits 0:4, Reserved. */ /* - */
287 #define PCS_CONTROL_UNIDIRECTIONAL_ENABLE (1<<5) /* rw */
288 #define PCS_CONTROL_SPEED_SELECTION (1<<6|1<<13) /* ro */
289 #define PCS_CONTROL_COLLISION_TEST (1<<7) /* ro */
290 #define PCS_CONTROL_DUPLEX_MODE (1<<8) /* ro */
291 #define PCS_CONTROL_RESTART_AUTO_NEGOTIATION (1<<9) /* rw */
292 #define PCS_CONTROL_ISOLATE (1<<10) /* rw */
293 #define PCS_CONTROL_POWERDOWN (1<<11) /* rw */
294 #define PCS_CONTROL_AUTO_NEGOTIATION_ENABLE (1<<12) /* rw */
295 /* See bit 6 above. */ /* ro */
296 #define PCS_CONTROL_LOOPBACK (1<<14) /* rw */
297 #define PCS_CONTROL_RESET (1<<15) /* rw */
298
299 #define PCS_STATUS 0x01 /* ro */
300 #define PCS_STATUS_EXTENDED_CAPABILITY (1<<0) /* ro */
301 #define PCS_STATUS_JABBER_DETECT (1<<1) /* -, 0 */
302 #define PCS_STATUS_LINK_STATUS (1<<2) /* ro */
303 #define PCS_STATUS_AUTO_NEGOTIATION_ABILITY (1<<3) /* ro */
304 #define PCS_STATUS_REMOTE_FAULT (1<<4) /* -, 0 */
305 #define PCS_STATUS_AUTO_NEGOTIATION_COMPLETE (1<<5) /* ro */
306 #define PCS_STATUS_MF_PREAMBLE_SUPPRESSION (1<<6) /* -, 0 */
307 #define PCS_STATUS_UNIDIRECTIONAL_ABILITY (1<<7) /* ro */
308 #define PCS_STATUS_EXTENDED_STATUS (1<<8) /* -, 0 */
309 #define PCS_STATUS_100BASET2_HALF_DUPLEX (1<<9) /* ro */
310 #define PCS_STATUS_100BASET2_FULL_DUPLEX (1<<10) /* ro */
311 #define PCS_STATUS_10MBPS_HALF_DUPLEX (1<<11) /* ro */
312 #define PCS_STATUS_10MBPS_FULL_DUPLEX (1<<12) /* ro */
313 #define PCS_STATUS_100BASE_X_HALF_DUPLEX (1<<13) /* ro */
314 #define PCS_STATUS_100BASE_X_FULL_DUPLEX (1<<14) /* ro */
315 #define PCS_STATUS_100BASE_T4 (1<<15) /* ro */
316
317 #define PCS_PHY_IDENTIFIER_0 0x02 /* ro */
318 #define PCS_PHY_IDENTIFIER_1 0x03 /* ro */
319
320 #define PCS_DEV_ABILITY 0x04 /* rw */
321 /* 1000BASE-X */
322 /* Bits 0:4, Reserved. */ /* - */
323 #define PCS_DEV_ABILITY_1000BASE_X_FD (1<<5) /* rw */
324 #define PCS_DEV_ABILITY_1000BASE_X_HD (1<<6) /* rw */
325 #define PCS_DEV_ABILITY_1000BASE_X_PS1 (1<<7) /* rw */
326 #define PCS_DEV_ABILITY_1000BASE_X_PS2 (1<<8) /* rw */
327 /* Bits 9:11, Reserved. */ /* - */
328 #define PCS_DEV_ABILITY_1000BASE_X_RF1 (1<<12) /* rw */
329 #define PCS_DEV_ABILITY_1000BASE_X_RF2 (1<<13) /* rw */
330 #define PCS_DEV_ABILITY_1000BASE_X_ACK (1<<14) /* rw */
331 #define PCS_DEV_ABILITY_1000BASE_X_NP (1<<15) /* rw */
332
333 #define PCS_PARTNER_ABILITY 0x05 /* ro */
334 /* 1000BASE-X */
335 /* Bits 0:4, Reserved. */ /* - */
336 #define PCS_PARTNER_ABILITY_1000BASE_X_FD (1<<5) /* ro */
337 #define PCS_PARTNER_ABILITY_1000BASE_X_HD (1<<6) /* ro */
338 #define PCS_PARTNER_ABILITY_1000BASE_X_PS1 (1<<7) /* ro */
339 #define PCS_PARTNER_ABILITY_1000BASE_X_PS2 (1<<8) /* ro */
340 /* Bits 9:11, Reserved. */ /* - */
341 #define PCS_PARTNER_ABILITY_1000BASE_X_RF1 (1<<12) /* ro */
342 #define PCS_PARTNER_ABILITY_1000BASE_X_RF2 (1<<13) /* ro */
343 #define PCS_PARTNER_ABILITY_1000BASE_X_ACK (1<<14) /* ro */
344 #define PCS_PARTNER_ABILITY_1000BASE_X_NP (1<<15) /* ro */
345 /* SGMII */
346 /* Bits 0:9, Reserved. */ /* - */
347 #define PCS_PARTNER_ABILITY_SGMII_COPPER_SPEED0 (1<<10) /* ro */
348 #define PCS_PARTNER_ABILITY_SGMII_COPPER_SPEED1 (1<<11) /* ro */
349 #define PCS_PARTNER_ABILITY_SGMII_COPPER_DUPLEX_STATUS (1<<12) /* ro */
350 /* Bit 13, Reserved. */ /* - */
351 #define PCS_PARTNER_ABILITY_SGMII_ACK (1<<14) /* ro */
352 #define PCS_PARTNER_ABILITY_SGMII_COPPER_LINK_STATUS (1<<15) /* ro */
353
354 #define PCS_AN_EXPANSION 0x06 /* ro */
355 #define PCS_AN_EXPANSION_LINK_PARTNER_AUTO_NEGOTIATION_ABLE (1<<0) /* ro */
356 #define PCS_AN_EXPANSION_PAGE_RECEIVE (1<<1) /* ro */
357 #define PCS_AN_EXPANSION_NEXT_PAGE_ABLE (1<<2) /* -, 0 */
358 /* Bits 3:15, Reserved. */ /* - */
359
360 #define PCS_DEVICE_NEXT_PAGE 0x07 /* ro */
361 #define PCS_PARTNER_NEXT_PAGE 0x08 /* ro */
362 #define PCS_MASTER_SLAVE_CNTL 0x09 /* ro */
363 #define PCS_MASTER_SLAVE_STAT 0x0A /* ro */
364 /* 0x0B - 0x0E, Reserved */ /* - */
365 #define PCS_EXTENDED_STATUS 0x0F /* ro */
366 /* Specific Extended Registers. */
367 #define PCS_EXT_SCRATCH 0x10 /* rw */
368 #define PCS_EXT_REV 0x11 /* ro */
369 #define PCS_EXT_LINK_TIMER_0 0x12 /* rw */
370 #define PCS_EXT_LINK_TIMER_1 0x13 /* rw */
371 #define PCS_EXT_IF_MODE 0x14 /* rw */
372 #define PCS_EXT_IF_MODE_SGMII_ENA (1<<0) /* rw */
373 #define PCS_EXT_IF_MODE_USE_SGMII_AN (1<<1) /* rw */
374 #define PCS_EXT_IF_MODE_SGMII_SPEED1 (1<<2) /* rw */
375 #define PCS_EXT_IF_MODE_SGMII_SPEED0 (1<<3) /* rw */
376 #define PCS_EXT_IF_MODE_SGMII_DUPLEX (1<<4) /* rw */
377 /* Bits 5:15, Reserved. */ /* - */
378
379 #define PCS_EXT_DISABLE_READ_TIMEOUT 0x15 /* rw */
380 #define PCS_EXT_READ_TIMEOUT 0x16 /* r0 */
381 /* 0x17-0x1F, Reserved. */
382
383 /* 0xA0 - 0xBF, MDIO Space 1. */
384 #define MDIO_1_START 0xA0
385 #define ATSE_BMCR MDIO_1_START
386
387 /* 0xC0 - 0xC7, Supplementary Address. */
388 #define SUPPL_ADDR_SMAC_0_0 0xC0 /* rw */
389 #define SUPPL_ADDR_SMAC_0_1 0xC1 /* rw */
390 #define SUPPL_ADDR_SMAC_1_0 0xC2 /* rw */
391 #define SUPPL_ADDR_SMAC_1_1 0xC3 /* rw */
392 #define SUPPL_ADDR_SMAC_2_0 0xC4 /* rw */
393 #define SUPPL_ADDR_SMAC_2_1 0xC5 /* rw */
394 #define SUPPL_ADDR_SMAC_3_0 0xC6 /* rw */
395 #define SUPPL_ADDR_SMAC_3_1 0xC7 /* rw */
396
397 /* 0xC8 - 0xCF, Reserved; set to zero, ignore on read. */
398 /* 0xD7 - 0xFF, Reserved; set to zero, ignore on read. */
399
400
401 /* -------------------------------------------------------------------------- */
402
403 /* DE4 Intel Strata Flash Ethernet Option Bits area. */
404 /* XXX-BZ this is something a loader will have to handle for us. */
405 #define ALTERA_ETHERNET_OPTION_BITS_OFF 0x00008000
406 #define ALTERA_ETHERNET_OPTION_BITS_LEN 0x00007fff
407
408 /* -------------------------------------------------------------------------- */
409
410 struct atse_softc {
411 struct ifnet *atse_ifp;
412 struct resource *atse_mem_res;
413 device_t atse_miibus;
414 device_t atse_dev;
415 int atse_unit;
416 int atse_mem_rid;
417 int atse_phy_addr;
418 int atse_if_flags;
419 bus_addr_t atse_bmcr0;
420 bus_addr_t atse_bmcr1;
421 uint32_t atse_flags;
422 #define ATSE_FLAGS_LINK 0x00000001
423 #define ATSE_FLAGS_ERROR 0x00000002
424 #define ATSE_FLAGS_SOP_SEEN 0x00000004
425 uint8_t atse_eth_addr[ETHER_ADDR_LEN];
426 #define ATSE_ETH_ADDR_DEF 0x01
427 #define ATSE_ETH_ADDR_SUPP1 0x02
428 #define ATSE_ETH_ADDR_SUPP2 0x04
429 #define ATSE_ETH_ADDR_SUPP3 0x08
430 #define ATSE_ETH_ADDR_SUPP4 0x10
431 #define ATSE_ETH_ADDR_ALL 0x1f
432 int16_t atse_rx_cycles; /* POLLING */
433 #define RX_CYCLES_IN_INTR 5
434 uint32_t atse_rx_err[6];
435 #define ATSE_RX_ERR_FIFO_THRES_EOP 0 /* FIFO threshold reached, on EOP. */
436 #define ATSE_RX_ERR_ELEN 1 /* Frame/payload length not valid. */
437 #define ATSE_RX_ERR_CRC32 2 /* CRC-32 error. */
438 #define ATSE_RX_ERR_FIFO_THRES_TRUNC 3 /* FIFO thresh., truncated frame. */
439 #define ATSE_RX_ERR_4 4 /* ? */
440 #define ATSE_RX_ERR_5 5 /* / */
441 #define ATSE_RX_ERR_MAX 6
442 struct callout atse_tick;
443 struct mtx atse_mtx;
444 device_t dev;
445
446 /* xDMA */
447 xdma_controller_t *xdma_tx;
448 xdma_channel_t *xchan_tx;
449 void *ih_tx;
450 int txcount;
451
452 xdma_controller_t *xdma_rx;
453 xdma_channel_t *xchan_rx;
454 void *ih_rx;
455
456 struct buf_ring *br;
457 struct mtx br_mtx;
458 };
459
460
461 int atse_attach(device_t);
462 int atse_detach_dev(device_t);
463 void atse_detach_resources(device_t);
464
465 int atse_miibus_readreg(device_t, int, int);
466 int atse_miibus_writereg(device_t, int, int, int);
467 void atse_miibus_statchg(device_t);
468
469 extern devclass_t atse_devclass;
470
471 #endif /* _DEV_IF_ATSEREG_H */
Cache object: 57787562900a95a7629f174a1bc16fde
|