xref: /illumos-gate/usr/src/uts/common/io/atge/atge_cmn_reg.h (revision 46b592853d0f4f11781b6b0a7533f267c6aee132)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _ATGE_CMN_REG_H
27 #define	_ATGE_CMN_REG_H
28 
29 #ifdef __cplusplus
30 	extern "C" {
31 #endif
32 
33 #define	ATGE_SPI_CTRL	0x200
34 #define	SPI_VPD_ENB	0x00002000
35 
36 #define	PCIE_DEVCTRL	0x0060	/* L1 */
37 
38 /*
39  * Station Address
40  */
41 #define	ATGE_PAR0		0x1488
42 #define	ATGE_PAR1		0x148C
43 
44 #define	ATGE_MASTER_CFG		0x1400
45 #define	MASTER_RESET		0x00000001
46 #define	MASTER_MTIMER_ENB	0x00000002
47 #define	MASTER_ITIMER_ENB	0x00000004	/* L1 */
48 #define	MASTER_IM_TX_TIMER_ENB	0x00000004	/* L1E */
49 #define	MASTER_MANUAL_INT_ENB	0x00000008
50 #define	MASTER_IM_RX_TIMER_ENB	0x00000020
51 #define	MASTER_INT_RDCLR	0x00000040
52 #define	MASTER_LED_MODE		0x00000200
53 #define	MASTER_CHIP_REV_MASK	0x00FF0000
54 #define	MASTER_CHIP_ID_MASK	0xFF000000
55 #define	MASTER_CHIP_REV_SHIFT	16
56 #define	MASTER_CHIP_ID_SHIFT	24
57 
58 #define	ATGE_RESET_TIMEOUT	100
59 
60 #define	ATGE_IDLE_STATUS	0x1410
61 #define	IDLE_STATUS_RXMAC	0x00000001
62 #define	IDLE_STATUS_TXMAC	0x00000002
63 #define	IDLE_STATUS_RXQ		0x00000004
64 #define	IDLE_STATUS_TXQ		0x00000008
65 #define	IDLE_STATUS_DMARD	0x00000010
66 #define	IDLE_STATUS_DMAWR	0x00000020
67 #define	IDLE_STATUS_SMB		0x00000040
68 #define	IDLE_STATUS_CMB		0x00000080
69 
70 #define	ATGE_MAC_CFG			0x1480
71 #define	ATGE_CFG_TX_ENB			0x00000001
72 #define	ATGE_CFG_RX_ENB			0x00000002
73 #define	ATGE_CFG_TX_FC			0x00000004
74 #define	ATGE_CFG_RX_FC			0x00000008
75 #define	ATGE_CFG_LOOP			0x00000010
76 #define	ATGE_CFG_FULL_DUPLEX		0x00000020
77 #define	ATGE_CFG_TX_CRC_ENB		0x00000040
78 #define	ATGE_CFG_TX_AUTO_PAD		0x00000080
79 #define	ATGE_CFG_TX_LENCHK		0x00000100
80 #define	ATGE_CFG_RX_JUMBO_ENB		0x00000200
81 #define	ATGE_CFG_PREAMBLE_MASK		0x00003C00
82 #define	ATGE_CFG_VLAN_TAG_STRIP		0x00004000
83 #define	ATGE_CFG_PROMISC		0x00008000
84 #define	ATGE_CFG_TX_PAUSE		0x00010000
85 #define	ATGE_CFG_SCNT			0x00020000
86 #define	ATGE_CFG_SYNC_RST_TX		0x00040000
87 #define	ATGE_CFG_SPEED_MASK		0x00300000
88 #define	ATGE_CFG_SPEED_10_100		0x00100000
89 #define	ATGE_CFG_SPEED_1000		0x00200000
90 #define	ATGE_CFG_DBG_TX_BACKOFF		0x00400000
91 #define	ATGE_CFG_TX_JUMBO_ENB		0x00800000
92 #define	ATGE_CFG_RXCSUM_ENB		0x01000000
93 #define	ATGE_CFG_ALLMULTI		0x02000000
94 #define	ATGE_CFG_BCAST			0x04000000
95 #define	ATGE_CFG_DBG			0x08000000
96 #define	ATGE_CFG_PREAMBLE_SHIFT		10
97 #define	ATGE_CFG_PREAMBLE_DEFAULT	7
98 
99 /*
100  * Interrupt related registers.
101  */
102 #define	ATGE_INTR_MASK			0x1604
103 #define	ATGE_INTR_STATUS		0x1600
104 #define	INTR_SMB			0x00000001
105 #define	INTR_MOD_TIMER			0x00000002
106 #define	INTR_MANUAL_TIMER		0x00000004
107 #define	INTR_RX_FIFO_OFLOW		0x00000008
108 #define	INTR_RD_UNDERRUN		0x00000010
109 #define	INTR_RRD_OFLOW			0x00000020
110 #define	INTR_TX_FIFO_UNDERRUN		0x00000040
111 #define	INTR_LINK_CHG			0x00000080
112 #define	INTR_HOST_RD_UNDERRUN		0x00000100
113 #define	INTR_HOST_RRD_OFLOW		0x00000200
114 #define	INTR_DMA_RD_TO_RST		0x00000400
115 #define	INTR_DMA_WR_TO_RST		0x00000800
116 #define	INTR_GPHY			0x00001000
117 #define	INTR_RX_PKT			0x00010000
118 #define	INTR_TX_PKT			0x00020000
119 #define	INTR_TX_DMA			0x00040000
120 #define	INTR_MAC_RX			0x00400000
121 #define	INTR_MAC_TX			0x00800000
122 #define	INTR_UNDERRUN			0x01000000
123 #define	INTR_FRAME_ERROR		0x02000000
124 #define	INTR_FRAME_OK			0x04000000
125 #define	INTR_CSUM_ERROR			0x08000000
126 #define	INTR_PHY_LINK_DOWN		0x10000000
127 #define	INTR_DIS_INT			0x80000000
128 
129 /* L1E intr status */
130 #define	INTR_RX_PKT1			0x00080000
131 #define	INTR_RX_PKT2			0x00100000
132 #define	INTR_RX_PKT3			0x00200000
133 
134 /* L1 intr status */
135 #define	INTR_TX_DMA			0x00040000
136 
137 /*
138  * L1E specific errors. We keep it here since some errors are common for
139  * both L1 and L1E chip.
140  *
141  */
142 #define	L1E_INTR_ERRORS		\
143 	(INTR_DMA_RD_TO_RST | INTR_DMA_WR_TO_RST)
144 
145 /*
146  * TXQ CFG registers.
147  */
148 #define	ATGE_TXQ_CFG			0x1580
149 #define	TXQ_CFG_TPD_BURST_MASK		0x0000000F
150 #define	TXQ_CFG_ENB			0x00000020
151 #define	TXQ_CFG_ENHANCED_MODE		0x00000040
152 #define	TXQ_CFG_TX_FIFO_BURST_MASK	0xFFFF0000
153 #define	TXQ_CFG_TPD_BURST_SHIFT		0
154 #define	TXQ_CFG_TPD_BURST_DEFAULT	4
155 #define	TXQ_CFG_TX_FIFO_BURST_SHIFT	16
156 #define	TXQ_CFG_TX_FIFO_BURST_DEFAULT	256
157 
158 /*
159  * RXQ CFG register.
160  */
161 #define	ATGE_RXQ_CFG			0x15A0
162 
163 /*
164  * Common registers for DMA CFG.
165  */
166 #define	ATGE_DMA_CFG			0x15C0
167 #define	DMA_CFG_IN_ORDER		0x00000001
168 #define	DMA_CFG_ENH_ORDER		0x00000002
169 #define	DMA_CFG_OUT_ORDER		0x00000004
170 #define	DMA_CFG_RCB_64			0x00000000
171 #define	DMA_CFG_RCB_128			0x00000008
172 #define	DMA_CFG_RD_BURST_128		0x00000000
173 #define	DMA_CFG_RD_BURST_256		0x00000010
174 #define	DMA_CFG_RD_BURST_512		0x00000020
175 #define	DMA_CFG_RD_BURST_1024		0x00000030
176 #define	DMA_CFG_RD_BURST_2048		0x00000040
177 #define	DMA_CFG_RD_BURST_4096		0x00000050
178 #define	DMA_CFG_WR_BURST_128		0x00000000
179 #define	DMA_CFG_WR_BURST_256		0x00000080
180 #define	DMA_CFG_WR_BURST_512		0x00000100
181 #define	DMA_CFG_WR_BURST_1024		0x00000180
182 #define	DMA_CFG_WR_BURST_2048		0x00000200
183 #define	DMA_CFG_WR_BURST_4096		0x00000280
184 
185 /* L1E specific but can go into common regs */
186 #define	DMA_CFG_RXCMB_ENB		0x00200000
187 #define	DMA_CFG_RD_DELAY_CNT_DEFAULT	15
188 #define	DMA_CFG_RD_DELAY_CNT_SHIFT	11
189 #define	DMA_CFG_RD_DELAY_CNT_MASK	0x0000F800
190 #define	DMA_CFG_WR_DELAY_CNT_DEFAULT	4
191 #define	DMA_CFG_WR_DELAY_CNT_SHIFT	16
192 #define	DMA_CFG_WR_DELAY_CNT_MASK	0x000F0000
193 
194 /*
195  * Common PHY registers.
196  */
197 #define	ATGE_MDIO			0x1414
198 #define	MDIO_DATA_MASK			0x0000FFFF
199 #define	MDIO_REG_ADDR_MASK		0x001F0000
200 #define	MDIO_OP_READ			0x00200000
201 #define	MDIO_OP_WRITE			0x00000000
202 #define	MDIO_SUP_PREAMBLE		0x00400000
203 #define	MDIO_OP_EXECUTE			0x00800000
204 #define	MDIO_CLK_25_4			0x00000000
205 #define	MDIO_CLK_25_6			0x02000000
206 #define	MDIO_CLK_25_8			0x03000000
207 #define	MDIO_CLK_25_10			0x04000000
208 #define	MDIO_CLK_25_14			0x05000000
209 #define	MDIO_CLK_25_20			0x06000000
210 #define	MDIO_CLK_25_28			0x07000000
211 #define	MDIO_OP_BUSY			0x08000000
212 #define	MDIO_DATA_SHIFT			0
213 #define	MDIO_REG_ADDR_SHIFT		16
214 
215 #define	MDIO_REG_ADDR(x)	\
216 	(((x) << MDIO_REG_ADDR_SHIFT) & MDIO_REG_ADDR_MASK)
217 
218 
219 #define	ATGE_PHY_ADDR			0
220 #define	ATGE_PHY_STATUS			0x1418
221 #define	PHY_TIMEOUT			1000
222 
223 #define	ATGE_DESC_TPD_CNT		0x155C
224 #define	DESC_TPD_CNT_MASK		0x00003FF
225 #define	DESC_TPD_CNT_SHIFT		0
226 
227 #define	ATGE_DMA_BLOCK			0x1534
228 #define	DMA_BLOCK_LOAD			0x00000001
229 
230 #define	ATGE_MBOX			0x15F0
231 #define	MBOX_RD_PROD_IDX_MASK		0x000007FF
232 #define	MBOX_RRD_CONS_IDX_MASK		0x003FF800
233 #define	MBOX_TD_PROD_IDX_MASK		0xFFC00000
234 #define	MBOX_RD_PROD_IDX_SHIFT		0
235 #define	MBOX_RRD_CONS_IDX_SHIFT		11
236 #define	MBOX_TD_PROD_IDX_SHIFT		22
237 
238 
239 #define	ATGE_IPG_IFG_CFG		0x1484
240 #define	IPG_IFG_IPGT_MASK		0x0000007F
241 #define	IPG_IFG_MIFG_MASK		0x0000FF00
242 #define	IPG_IFG_IPG1_MASK		0x007F0000
243 #define	IPG_IFG_IPG2_MASK		0x7F000000
244 #define	IPG_IFG_IPGT_SHIFT		0
245 #define	IPG_IFG_IPGT_DEFAULT		0x60
246 #define	IPG_IFG_MIFG_SHIFT		8
247 #define	IPG_IFG_MIFG_DEFAULT		0x50
248 #define	IPG_IFG_IPG1_SHIFT		16
249 #define	IPG_IFG_IPG1_DEFAULT		0x40
250 #define	IPG_IFG_IPG2_SHIFT		24
251 #define	IPG_IFG_IPG2_DEFAULT		0x60
252 
253 /* half-duplex parameter configuration. */
254 #define	ATGE_HDPX_CFG			0x1498
255 #define	HDPX_CFG_LCOL_MASK		0x000003FF
256 #define	HDPX_CFG_RETRY_MASK		0x0000F000
257 #define	HDPX_CFG_EXC_DEF_EN		0x00010000
258 #define	HDPX_CFG_NO_BACK_C		0x00020000
259 #define	HDPX_CFG_NO_BACK_P		0x00040000
260 #define	HDPX_CFG_ABEBE			0x00080000
261 #define	HDPX_CFG_ABEBT_MASK		0x00F00000
262 #define	HDPX_CFG_JAMIPG_MASK		0x0F000000
263 #define	HDPX_CFG_LCOL_SHIFT		0
264 #define	HDPX_CFG_LCOL_DEFAULT		0x37
265 #define	HDPX_CFG_RETRY_SHIFT		12
266 #define	HDPX_CFG_RETRY_DEFAULT		0x0F
267 #define	HDPX_CFG_ABEBT_SHIFT		20
268 #define	HDPX_CFG_ABEBT_DEFAULT		0x0A
269 #define	HDPX_CFG_JAMIPG_SHIFT		24
270 #define	HDPX_CFG_JAMIPG_DEFAULT		0x07
271 
272 #define	ATGE_FRAME_SIZE			0x149C
273 
274 #define	ATGE_WOL_CFG			0x14A0
275 #define	WOL_CFG_PATTERN			0x00000001
276 #define	WOL_CFG_PATTERN_ENB		0x00000002
277 #define	WOL_CFG_MAGIC			0x00000004
278 #define	WOL_CFG_MAGIC_ENB		0x00000008
279 #define	WOL_CFG_LINK_CHG		0x00000010
280 #define	WOL_CFG_LINK_CHG_ENB		0x00000020
281 #define	WOL_CFG_PATTERN_DET		0x00000100
282 #define	WOL_CFG_MAGIC_DET		0x00000200
283 #define	WOL_CFG_LINK_CHG_DET		0x00000400
284 #define	WOL_CFG_CLK_SWITCH_ENB		0x00008000
285 #define	WOL_CFG_PATTERN0		0x00010000
286 #define	WOL_CFG_PATTERN1		0x00020000
287 #define	WOL_CFG_PATTERN2		0x00040000
288 #define	WOL_CFG_PATTERN3		0x00080000
289 #define	WOL_CFG_PATTERN4		0x00100000
290 #define	WOL_CFG_PATTERN5		0x00200000
291 #define	WOL_CFG_PATTERN6		0x00400000
292 
293 /* WOL pattern length. */
294 #define	ATGE_PATTERN_CFG0		0x14A4
295 #define	PATTERN_CFG_0_LEN_MASK		0x0000007F
296 #define	PATTERN_CFG_1_LEN_MASK		0x00007F00
297 #define	PATTERN_CFG_2_LEN_MASK		0x007F0000
298 #define	PATTERN_CFG_3_LEN_MASK		0x7F000000
299 
300 #define	ATGE_PATTERN_CFG1		0x14A8
301 #define	PATTERN_CFG_4_LEN_MASK		0x0000007F
302 #define	PATTERN_CFG_5_LEN_MASK		0x00007F00
303 #define	PATTERN_CFG_6_LEN_MASK		0x007F0000
304 
305 #define	ATGE_TICK_USECS			2
306 #define	ATGE_USECS(x)			((x) / ATGE_TICK_USECS)
307 
308 #define	ATGE_INTR_CLR_TIMER		0x140E	/* 16-bits */
309 #define	ATGE_IM_TIMER			0x1408
310 #define	ATGE_IM_TIMER2			0x140A
311 #define	ATGE_IM_TIMER_MIN		0
312 #define	ATGE_IM_TIMER_MAX		130000	/* 130 ms */
313 #define	ATGE_IM_TIMER_DEFAULT		100
314 #define	ATGE_IM_RX_TIMER_DEFAULT	1
315 #define	ATGE_IM_TX_TIMER_DEFAULT	1
316 #define	IM_TIMER_TX_SHIFT		0
317 #define	IM_TIMER_RX_SHIFT		16
318 
319 #define	ATGE_DESC_ADDR_HI		0x1540
320 #define	ATGE_DESC_RD_ADDR_LO		0x1544
321 #define	ATGE_DESC_RRD_ADDR_LO		0x1548
322 #define	ATGE_DESC_TPD_ADDR_LO		0x154C
323 #define	ATGE_DESC_CMB_ADDR_LO		0x1550
324 #define	ATGE_DESC_SMB_ADDR_LO		0x1554
325 #define	ATGE_DESC_RRD_RD_CNT		0x1558
326 
327 #define	ATGE_RXQ_JUMBO_CFG		0x15A4
328 #define	RXQ_JUMBO_CFG_SZ_THRESH_SHIFT	0
329 #define	RXQ_JUMBO_CFG_SZ_THRESH_MASK	0x000007FF
330 #define	RXQ_JUMBO_CFG_LKAH_DEFAULT	0x01
331 #define	RXQ_JUMBO_CFG_LKAH_SHIFT	11
332 #define	RXQ_JUMBO_CFG_LKAH_MASK		0x00007800
333 #define	RXQ_JUMBO_CFG_RRD_TIMER_SHIFT	16
334 #define	RXQ_JUMBO_CFG_RRD_TIMER_MASK	0xFFFF0000
335 
336 #define	ATGE_RXQ_FIFO_PAUSE_THRESH	0x15A8
337 #define	RXQ_FIFO_PAUSE_THRESH_LO_MASK	0x00000FFF
338 #define	RXQ_FIFO_PAUSE_THRESH_HI_MASK	0x0FFF000
339 #define	RXQ_FIFO_PAUSE_THRESH_LO_SHIFT	0
340 #define	RXQ_FIFO_PAUSE_THRESH_HI_SHIFT	16
341 
342 #define	ATGE_RXQ_CFG			0x15A0
343 #define	ATGE_TXQ_CFG			0x1580
344 #define	RXQ_CFG_ALIGN_32		0x00000000
345 #define	RXQ_CFG_ALIGN_64		0x00000001
346 #define	RXQ_CFG_ALIGN_128		0x00000002
347 #define	RXQ_CFG_ALIGN_256		0x00000003
348 #define	RXQ_CFG_QUEUE1_ENB		0x00000010
349 #define	RXQ_CFG_QUEUE2_ENB		0x00000020
350 #define	RXQ_CFG_QUEUE3_ENB		0x00000040
351 #define	RXQ_CFG_IPV6_CSUM_VERIFY	0x00000080
352 #define	RXQ_CFG_RSS_HASH_TBL_LEN_MASK	0x0000FF00
353 #define	RXQ_CFG_RSS_HASH_IPV4		0x00010000
354 #define	RXQ_CFG_RSS_HASH_IPV4_TCP	0x00020000
355 #define	RXQ_CFG_RSS_HASH_IPV6		0x00040000
356 #define	RXQ_CFG_RSS_HASH_IPV6_TCP	0x00080000
357 #define	RXQ_CFG_RSS_MODE_DIS		0x00000000
358 #define	RXQ_CFG_RSS_MODE_SQSINT		0x04000000
359 #define	RXQ_CFG_RSS_MODE_MQUESINT	0x08000000
360 #define	RXQ_CFG_RSS_MODE_MQUEMINT	0x0C000000
361 #define	RXQ_CFG_NIP_QUEUE_SEL_TBL	0x10000000
362 #define	RXQ_CFG_RSS_HASH_ENB		0x20000000
363 #define	RXQ_CFG_CUT_THROUGH_ENB		0x40000000
364 #define	RXQ_CFG_ENB			0x80000000
365 #define	RXQ_CFG_RSS_HASH_TBL_LEN_SHIFT	8
366 
367 /* 64bit multicast hash register. */
368 #define	ATGE_MAR0			0x1490
369 #define	ATGE_MAR1			0x1494
370 
371 #define	ATPHY_DBG_ADDR			0x1D
372 #define	ATPHY_DBG_DATA			0x1E
373 
374 #ifdef __cplusplus
375 }
376 #endif
377 
378 #endif	/* _ATGE_CMN_REG_H */
379