xref: /dflybsd-src/sys/dev/netif/alc/if_alcreg.h (revision 6421ab1dd66d7f647f437699dcad80e6ce2db09f)
1bbf76eecSMatthew Dillon /*-
2bbf76eecSMatthew Dillon  * Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
3bbf76eecSMatthew Dillon  * All rights reserved.
4bbf76eecSMatthew Dillon  *
5bbf76eecSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
6bbf76eecSMatthew Dillon  * modification, are permitted provided that the following conditions
7bbf76eecSMatthew Dillon  * are met:
8bbf76eecSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
9bbf76eecSMatthew Dillon  *    notice unmodified, this list of conditions, and the following
10bbf76eecSMatthew Dillon  *    disclaimer.
11bbf76eecSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
12bbf76eecSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
13bbf76eecSMatthew Dillon  *    documentation and/or other materials provided with the distribution.
14bbf76eecSMatthew Dillon  *
15bbf76eecSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16bbf76eecSMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17bbf76eecSMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18bbf76eecSMatthew Dillon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19bbf76eecSMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20111fade5SMichael Neumann  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21bbf76eecSMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22bbf76eecSMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23bbf76eecSMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24bbf76eecSMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25111fade5SMichael Neumann  * SUCH DAMAGE.
26bbf76eecSMatthew Dillon  *
27bbf76eecSMatthew Dillon  * $FreeBSD: src/sys/dev/alc/if_alcreg.h,v 1.1 2009/06/10 02:07:58 yongari Exp $
28bbf76eecSMatthew Dillon  */
29bbf76eecSMatthew Dillon 
30bbf76eecSMatthew Dillon #ifndef	_IF_ALCREG_H
31bbf76eecSMatthew Dillon #define	_IF_ALCREG_H
32bbf76eecSMatthew Dillon 
33bbf76eecSMatthew Dillon /*
34bbf76eecSMatthew Dillon  * Atheros Communucations, Inc. PCI vendor ID
35bbf76eecSMatthew Dillon  */
36bbf76eecSMatthew Dillon #define	VENDORID_ATHEROS		0x1969
37bbf76eecSMatthew Dillon 
38bbf76eecSMatthew Dillon /*
39cffbd125SMatthew Dillon  * Atheros AR813x/AR815x device ID
40bbf76eecSMatthew Dillon  */
41bbf76eecSMatthew Dillon #define	DEVICEID_ATHEROS_AR8131		0x1063	/* L1C */
42bbf76eecSMatthew Dillon #define	DEVICEID_ATHEROS_AR8132		0x1062	/* L2C */
43cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8151         0x1073  /* L1D V1.0 */
44cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8151_V2	0x1083  /* L1D V2.0 */
45cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8152_B	0x2060  /* L2C V1.1 */
46cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8152_B2	0x2062  /* L2C V2.0 */
47*6421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_AR8161         0x1091
48*6421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_E2200          0xE091
49*6421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_AR8162         0x1090
50*6421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_AR8171         0x10A1
51*6421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_AR8172         0x10A0
52cffbd125SMatthew Dillon 
53cffbd125SMatthew Dillon #define ATHEROS_AR8152_B_V10		0xC0
54cffbd125SMatthew Dillon #define ATHEROS_AR8152_B_V11		0xC1
55bbf76eecSMatthew Dillon 
56bbf76eecSMatthew Dillon /*
57*6421ab1dSMatthew Dillon  * Atheros AR816x/AR817x revisions
58*6421ab1dSMatthew Dillon  */
59*6421ab1dSMatthew Dillon #define        AR816X_REV_A0                   0
60*6421ab1dSMatthew Dillon #define        AR816X_REV_A1                   1
61*6421ab1dSMatthew Dillon #define        AR816X_REV_B0                   2
62*6421ab1dSMatthew Dillon #define        AR816X_REV_C0                   3
63*6421ab1dSMatthew Dillon 
64*6421ab1dSMatthew Dillon #define        AR816X_REV_SHIFT                3
65*6421ab1dSMatthew Dillon #define        AR816X_REV(x)                   ((x) >> AR816X_REV_SHIFT)
66*6421ab1dSMatthew Dillon 
67*6421ab1dSMatthew Dillon /*
68bbf76eecSMatthew Dillon  * From FreeBSD dev/pci/pcireg.h
69bbf76eecSMatthew Dillon  *
70bbf76eecSMatthew Dillon  * PCIM_xxx: mask to locate subfield in register
71bbf76eecSMatthew Dillon  * PCIR_xxx: config register offset
72bbf76eecSMatthew Dillon  */
73bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_DEVICE_CTL		0x8
74bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_LINK_CAP		0xc
75bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_LINK_CTL		0x10
76bbf76eecSMatthew Dillon #define PCIM_EXP_CTL_MAX_READ_REQUEST	0x7000
77bbf76eecSMatthew Dillon #define	PCIM_EXP_CTL_MAX_PAYLOAD	0x00e0
78bbf76eecSMatthew Dillon #define PCIM_LINK_CAP_ASPM		0x00000c00
79bbf76eecSMatthew Dillon 
80bbf76eecSMatthew Dillon /* 0x0000 - 0x02FF : PCIe configuration space */
81bbf76eecSMatthew Dillon 
82bbf76eecSMatthew Dillon #define	ALC_PEX_UNC_ERR_SEV		0x10C
83bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_TRN		0x00000001
84bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_DLP		0x00000010
85bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_PSN_TLP		0x00001000
86bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_FCP		0x00002000
87bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_CPL_TO		0x00004000
88bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_CA		0x00008000
89bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_UC		0x00010000
90bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_ROV		0x00020000
91bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_MLFP		0x00040000
92bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_ECRC		0x00080000
93bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_UR		0x00100000
94bbf76eecSMatthew Dillon 
95*6421ab1dSMatthew Dillon #define        ALC_EEPROM_LD                   0x204   /* AR816x */
96*6421ab1dSMatthew Dillon #define        EEPROM_LD_START                 0x00000001
97*6421ab1dSMatthew Dillon #define        EEPROM_LD_IDLE                  0x00000010
98*6421ab1dSMatthew Dillon #define        EEPROM_LD_DONE                  0x00000000
99*6421ab1dSMatthew Dillon #define        EEPROM_LD_PROGRESS              0x00000020
100*6421ab1dSMatthew Dillon #define        EEPROM_LD_EXIST                 0x00000100
101*6421ab1dSMatthew Dillon #define        EEPROM_LD_EEPROM_EXIST          0x00000200
102*6421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_EXIST           0x00000400
103*6421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_END_ADDR_MASK   0x03FF0000
104*6421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_END_ADDR_SHIFT  16
105*6421ab1dSMatthew Dillon 
106bbf76eecSMatthew Dillon #define	ALC_TWSI_CFG			0x218
107bbf76eecSMatthew Dillon #define	TWSI_CFG_SW_LD_START		0x00000800
108bbf76eecSMatthew Dillon #define	TWSI_CFG_HW_LD_START		0x00001000
109bbf76eecSMatthew Dillon #define	TWSI_CFG_LD_EXIST		0x00400000
110bbf76eecSMatthew Dillon 
111*6421ab1dSMatthew Dillon #define        ALC_SLD                         0x218   /* AR816x */
112*6421ab1dSMatthew Dillon #define        SLD_START                       0x00000800
113*6421ab1dSMatthew Dillon #define        SLD_PROGRESS                    0x00001000
114*6421ab1dSMatthew Dillon #define        SLD_IDLE                        0x00002000
115*6421ab1dSMatthew Dillon #define        SLD_SLVADDR_MASK                0x007F0000
116*6421ab1dSMatthew Dillon #define        SLD_EXIST                       0x00800000
117*6421ab1dSMatthew Dillon #define        SLD_FREQ_MASK                   0x03000000
118*6421ab1dSMatthew Dillon #define        SLD_FREQ_100K                   0x00000000
119*6421ab1dSMatthew Dillon #define        SLD_FREQ_200K                   0x01000000
120*6421ab1dSMatthew Dillon #define        SLD_FREQ_300K                   0x02000000
121*6421ab1dSMatthew Dillon #define        SLD_FREQ_400K                   0x03000000
122*6421ab1dSMatthew Dillon 
123bbf76eecSMatthew Dillon #define	ALC_PCIE_PHYMISC		0x1000
124bbf76eecSMatthew Dillon #define	PCIE_PHYMISC_FORCE_RCV_DET	0x00000004
125bbf76eecSMatthew Dillon 
126cffbd125SMatthew Dillon #define ALC_PCIE_PHYMISC2		0x1004
127cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_CDR_MASK	0x00030000
128cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_TH_MASK	0x000C0000
129cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_CDR_SHIFT	16
130cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_TH_SHIFT	18
131cffbd125SMatthew Dillon 
132*6421ab1dSMatthew Dillon #define        ALC_PDLL_TRNS1                  0x1104
133*6421ab1dSMatthew Dillon #define        PDLL_TRNS1_D3PLLOFF_ENB         0x00000800
134*6421ab1dSMatthew Dillon 
135bbf76eecSMatthew Dillon #define	ALC_TWSI_DEBUG			0x1108
136bbf76eecSMatthew Dillon #define	TWSI_DEBUG_DEV_EXIST		0x20000000
137bbf76eecSMatthew Dillon 
138bbf76eecSMatthew Dillon #define	ALC_EEPROM_CFG			0x12C0
139bbf76eecSMatthew Dillon #define	EEPROM_CFG_DATA_HI_MASK		0x0000FFFF
140bbf76eecSMatthew Dillon #define	EEPROM_CFG_ADDR_MASK		0x03FF0000
141bbf76eecSMatthew Dillon #define	EEPROM_CFG_ACK			0x40000000
142bbf76eecSMatthew Dillon #define	EEPROM_CFG_RW			0x80000000
143bbf76eecSMatthew Dillon #define	EEPROM_CFG_DATA_HI_SHIFT	0
144bbf76eecSMatthew Dillon #define	EEPROM_CFG_ADDR_SHIFT		16
145bbf76eecSMatthew Dillon 
146bbf76eecSMatthew Dillon #define	ALC_EEPROM_DATA_LO		0x12C4
147bbf76eecSMatthew Dillon 
148bbf76eecSMatthew Dillon #define	ALC_OPT_CFG			0x12F0
149bbf76eecSMatthew Dillon #define	OPT_CFG_CLK_ENB			0x00000002
150bbf76eecSMatthew Dillon 
151bbf76eecSMatthew Dillon #define	ALC_PM_CFG			0x12F8
152bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_ENB		0x00000001
153bbf76eecSMatthew Dillon #define	PM_CFG_RBER_ENB			0x00000002
154bbf76eecSMatthew Dillon #define	PM_CFG_CLK_REQ_ENB		0x00000004
155bbf76eecSMatthew Dillon #define	PM_CFG_ASPM_L1_ENB		0x00000008
156bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_L1_ENB		0x00000010
157bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_PLL_L1_ENB	0x00000020
158bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_PD_EX_L1		0x00000040
159bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_BUDS_RX_L1_ENB	0x00000080
160bbf76eecSMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_MASK	0x00000F00
161*6421ab1dSMatthew Dillon #define	PM_CFG_RX_L1_AFTER_L0S		0x00000800
162bbf76eecSMatthew Dillon #define	PM_CFG_ASPM_L0S_ENB		0x00001000
163bbf76eecSMatthew Dillon #define	PM_CFG_CLK_SWH_L1		0x00002000
164bbf76eecSMatthew Dillon #define	PM_CFG_CLK_PWM_VER1_1		0x00004000
165bbf76eecSMatthew Dillon #define	PM_CFG_PCIE_RECV		0x00008000
166bbf76eecSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_MASK	0x000F0000
167*6421ab1dSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_816X_MASK	0x00070000
168*6421ab1dSMatthew Dillon #define	PM_CFG_TX_L1_AFTER_L0S		0x00080000
169bbf76eecSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_MASK	0x00F00000
170a45385feSMichael Neumann #define	PM_CFG_LCKDET_TIMER_MASK	0x0F000000
171cffbd125SMatthew Dillon #define PM_CFG_EN_BUFS_RX_L0S		0x10000000
172cffbd125SMatthew Dillon #define PM_CFG_SA_DLY_ENB		0x20000000
173bbf76eecSMatthew Dillon #define	PM_CFG_MAC_ASPM_CHK		0x40000000
174bbf76eecSMatthew Dillon #define	PM_CFG_HOTRST			0x80000000
175bbf76eecSMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_SHIFT	8
176bbf76eecSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_SHIFT	16
177bbf76eecSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_SHIFT	20
178bbf76eecSMatthew Dillon #define	PM_CFG_LCKDET_TIMER_SHIFT	24
179bbf76eecSMatthew Dillon 
180cffbd125SMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_DEFAULT	6
181a45385feSMichael Neumann #define PM_CFG_L1_ENTRY_TIMER_DEFAULT	1
182*6421ab1dSMatthew Dillon #define PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT      4
183a45385feSMichael Neumann #define PM_CFG_LCKDET_TIMER_DEFAULT	12
184a45385feSMichael Neumann #define PM_CFG_PM_REQ_TIMER_DEFAULT	12
185*6421ab1dSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_816X_DEFAULT        15
186cffbd125SMatthew Dillon 
187cffbd125SMatthew Dillon #define ALC_LTSSM_ID_CFG		0x12FC
188cffbd125SMatthew Dillon #define LTSSM_ID_WRO_ENB		0x00001000
189cffbd125SMatthew Dillon 
190bbf76eecSMatthew Dillon #define	ALC_MASTER_CFG			0x1400
191bbf76eecSMatthew Dillon #define	MASTER_RESET			0x00000001
192cffbd125SMatthew Dillon #define MASTER_TEST_MODE_MASK		0x0000000C
193bbf76eecSMatthew Dillon #define	MASTER_BERT_START		0x00000010
194*6421ab1dSMatthew Dillon #define MASTER_WAKEN_25M		0x00000020
195cffbd125SMatthew Dillon #define MASTER_OOB_DIS_OFF		0x00000040
196cffbd125SMatthew Dillon #define MASTER_SA_TIMER_ENB		0x00000080
197bbf76eecSMatthew Dillon #define	MASTER_MTIMER_ENB		0x00000100
198bbf76eecSMatthew Dillon #define	MASTER_MANUAL_INTR_ENB		0x00000200
199bbf76eecSMatthew Dillon #define	MASTER_IM_TX_TIMER_ENB		0x00000400
200bbf76eecSMatthew Dillon #define	MASTER_IM_RX_TIMER_ENB		0x00000800
201bbf76eecSMatthew Dillon #define	MASTER_CLK_SEL_DIS		0x00001000
202bbf76eecSMatthew Dillon #define	MASTER_CLK_SWH_MODE		0x00002000
203bbf76eecSMatthew Dillon #define	MASTER_INTR_RD_CLR		0x00004000
204bbf76eecSMatthew Dillon #define	MASTER_CHIP_REV_MASK		0x00FF0000
205bbf76eecSMatthew Dillon #define	MASTER_CHIP_ID_MASK		0x7F000000
206bbf76eecSMatthew Dillon #define	MASTER_OTP_SEL			0x80000000
207bbf76eecSMatthew Dillon #define	MASTER_TEST_MODE_SHIFT		2
208bbf76eecSMatthew Dillon #define	MASTER_CHIP_REV_SHIFT		16
209bbf76eecSMatthew Dillon #define	MASTER_CHIP_ID_SHIFT		24
210bbf76eecSMatthew Dillon 
211cffbd125SMatthew Dillon /* Number of ticks per usec for AR813x/AR815x. */
212bbf76eecSMatthew Dillon #define	ALC_TICK_USECS			2
213bbf76eecSMatthew Dillon #define	ALC_USECS(x)			((x) / ALC_TICK_USECS)
214bbf76eecSMatthew Dillon 
215bbf76eecSMatthew Dillon #define	ALC_MANUAL_TIMER		0x1404
216bbf76eecSMatthew Dillon 
217bbf76eecSMatthew Dillon #define	ALC_IM_TIMER			0x1408
218bbf76eecSMatthew Dillon #define	IM_TIMER_TX_MASK		0x0000FFFF
219bbf76eecSMatthew Dillon #define	IM_TIMER_RX_MASK		0xFFFF0000
220bbf76eecSMatthew Dillon #define	IM_TIMER_TX_SHIFT		0
221bbf76eecSMatthew Dillon #define	IM_TIMER_RX_SHIFT		16
222bbf76eecSMatthew Dillon #define	ALC_IM_TIMER_MIN		0
223bbf76eecSMatthew Dillon #define	ALC_IM_TIMER_MAX		130000	/* 130ms */
224bbf76eecSMatthew Dillon /*
225bbf76eecSMatthew Dillon  * 100us will ensure alc(4) wouldn't generate more than 10000 Rx
226bbf76eecSMatthew Dillon  * interrupts in a second.
227bbf76eecSMatthew Dillon  */
228bbf76eecSMatthew Dillon #define	ALC_IM_RX_TIMER_DEFAULT		100	/* 100us */
229bbf76eecSMatthew Dillon /*
230bbf76eecSMatthew Dillon  * alc(4) does not rely on Tx completion interrupts, so set it
231bbf76eecSMatthew Dillon  * somewhat large value to reduce Tx completion interrupts.
232bbf76eecSMatthew Dillon  */
233cffbd125SMatthew Dillon #define ALC_IM_TX_TIMER_DEFAULT		1000	/* 1ms */
234bbf76eecSMatthew Dillon 
235*6421ab1dSMatthew Dillon #define ALC_GPHY_CFG                    0x140C  /* 16 bits, 32 bits on AR816x */
236bbf76eecSMatthew Dillon #define	GPHY_CFG_EXT_RESET		0x0001
237bbf76eecSMatthew Dillon #define	GPHY_CFG_RTL_MODE		0x0002
238bbf76eecSMatthew Dillon #define	GPHY_CFG_LED_MODE		0x0004
239bbf76eecSMatthew Dillon #define	GPHY_CFG_ANEG_NOW		0x0008
240bbf76eecSMatthew Dillon #define	GPHY_CFG_RECV_ANEG		0x0010
241bbf76eecSMatthew Dillon #define	GPHY_CFG_GATE_25M_ENB		0x0020
242bbf76eecSMatthew Dillon #define	GPHY_CFG_LPW_EXIT		0x0040
243bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_IDDQ		0x0080
244bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_IDDQ_DIS		0x0100
245bbf76eecSMatthew Dillon #define	GPHY_CFG_PCLK_SEL_DIS		0x0200
246bbf76eecSMatthew Dillon #define	GPHY_CFG_HIB_EN			0x0400
247bbf76eecSMatthew Dillon #define	GPHY_CFG_HIB_PULSE		0x0800
248bbf76eecSMatthew Dillon #define	GPHY_CFG_SEL_ANA_RESET		0x1000
249bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_PLL_ON		0x2000
250bbf76eecSMatthew Dillon #define	GPHY_CFG_PWDOWN_HW		0x4000
251bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_PLL_BYPASS		0x8000
252*6421ab1dSMatthew Dillon #define GPHY_CFG_100AB_ENB		0x00020000
253bbf76eecSMatthew Dillon 
254bbf76eecSMatthew Dillon #define	ALC_IDLE_STATUS			0x1410
255bbf76eecSMatthew Dillon #define	IDLE_STATUS_RXMAC		0x00000001
256bbf76eecSMatthew Dillon #define	IDLE_STATUS_TXMAC		0x00000002
257bbf76eecSMatthew Dillon #define	IDLE_STATUS_RXQ			0x00000004
258bbf76eecSMatthew Dillon #define	IDLE_STATUS_TXQ			0x00000008
259bbf76eecSMatthew Dillon #define	IDLE_STATUS_DMARD		0x00000010
260bbf76eecSMatthew Dillon #define	IDLE_STATUS_DMAWR		0x00000020
261bbf76eecSMatthew Dillon #define	IDLE_STATUS_SMB			0x00000040
262bbf76eecSMatthew Dillon #define	IDLE_STATUS_CMB			0x00000080
263bbf76eecSMatthew Dillon 
264bbf76eecSMatthew Dillon #define	ALC_MDIO			0x1414
265bbf76eecSMatthew Dillon #define	MDIO_DATA_MASK			0x0000FFFF
266bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR_MASK		0x001F0000
267bbf76eecSMatthew Dillon #define	MDIO_OP_READ			0x00200000
268bbf76eecSMatthew Dillon #define	MDIO_OP_WRITE			0x00000000
269bbf76eecSMatthew Dillon #define	MDIO_SUP_PREAMBLE		0x00400000
270bbf76eecSMatthew Dillon #define	MDIO_OP_EXECUTE			0x00800000
271bbf76eecSMatthew Dillon #define	MDIO_CLK_25_4			0x00000000
272bbf76eecSMatthew Dillon #define	MDIO_CLK_25_6			0x02000000
273bbf76eecSMatthew Dillon #define	MDIO_CLK_25_8			0x03000000
274bbf76eecSMatthew Dillon #define	MDIO_CLK_25_10			0x04000000
275bbf76eecSMatthew Dillon #define	MDIO_CLK_25_14			0x05000000
276bbf76eecSMatthew Dillon #define	MDIO_CLK_25_20			0x06000000
277*6421ab1dSMatthew Dillon #define MDIO_CLK_25_128			0x07000000
278bbf76eecSMatthew Dillon #define	MDIO_OP_BUSY			0x08000000
279bbf76eecSMatthew Dillon #define	MDIO_AP_ENB			0x10000000
280*6421ab1dSMatthew Dillon #define MDIO_MODE_EXT			0x40000000
281bbf76eecSMatthew Dillon #define	MDIO_DATA_SHIFT			0
282bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR_SHIFT		16
283bbf76eecSMatthew Dillon 
284bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR(x)	\
285bbf76eecSMatthew Dillon 	(((x) << MDIO_REG_ADDR_SHIFT) & MDIO_REG_ADDR_MASK)
286bbf76eecSMatthew Dillon /* Default PHY address. */
287bbf76eecSMatthew Dillon #define	ALC_PHY_ADDR			0
288bbf76eecSMatthew Dillon 
289bbf76eecSMatthew Dillon #define	ALC_PHY_STATUS			0x1418
290bbf76eecSMatthew Dillon #define	PHY_STATUS_RECV_ENB		0x00000001
291bbf76eecSMatthew Dillon #define	PHY_STATUS_GENERAL_MASK		0x0000FFFF
292bbf76eecSMatthew Dillon #define	PHY_STATUS_OE_PWSP_MASK		0x07FF0000
293bbf76eecSMatthew Dillon #define	PHY_STATUS_LPW_STATE		0x80000000
294bbf76eecSMatthew Dillon #define	PHY_STATIS_OE_PWSP_SHIFT	16
295bbf76eecSMatthew Dillon 
296bbf76eecSMatthew Dillon /* Packet memory BIST. */
297bbf76eecSMatthew Dillon #define	ALC_BIST0			0x141C
298bbf76eecSMatthew Dillon #define	BIST0_ENB			0x00000001
299bbf76eecSMatthew Dillon #define	BIST0_SRAM_FAIL			0x00000002
300bbf76eecSMatthew Dillon #define	BIST0_FUSE_FLAG			0x00000004
301bbf76eecSMatthew Dillon 
302bbf76eecSMatthew Dillon /* PCIe retry buffer BIST. */
303bbf76eecSMatthew Dillon #define	ALC_BIST1			0x1420
304bbf76eecSMatthew Dillon #define	BIST1_ENB			0x00000001
305bbf76eecSMatthew Dillon #define	BIST1_SRAM_FAIL			0x00000002
306bbf76eecSMatthew Dillon #define	BIST1_FUSE_FLAG			0x00000004
307bbf76eecSMatthew Dillon 
308bbf76eecSMatthew Dillon #define	ALC_SERDES_LOCK			0x1424
309bbf76eecSMatthew Dillon #define	SERDES_LOCK_DET			0x00000001
310bbf76eecSMatthew Dillon #define	SERDES_LOCK_DET_ENB		0x00000002
311cffbd125SMatthew Dillon #define SERDES_MAC_CLK_SLOWDOWN		0x00020000
312cffbd125SMatthew Dillon #define SERDES_PHY_CLK_SLOWDOWN		0x00040000
313bbf76eecSMatthew Dillon 
314*6421ab1dSMatthew Dillon #define	ALC_LPI_CTL                     0x1440
315*6421ab1dSMatthew Dillon #define	LPI_CTL_ENB                     0x00000001
316*6421ab1dSMatthew Dillon 
317*6421ab1dSMatthew Dillon #define	ALC_EXT_MDIO                    0x1448
318*6421ab1dSMatthew Dillon #define	EXT_MDIO_REG_MASK               0x0000FFFF
319*6421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR_MASK           0x001F0000
320*6421ab1dSMatthew Dillon #define	EXT_MDIO_REG_SHIFT              0
321*6421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR_SHIFT          16
322*6421ab1dSMatthew Dillon 
323*6421ab1dSMatthew Dillon #define	EXT_MDIO_REG(x)         \
324*6421ab1dSMatthew Dillon 	(((x) << EXT_MDIO_REG_SHIFT) & EXT_MDIO_REG_MASK)
325*6421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR(x)     \
326*6421ab1dSMatthew Dillon 	(((x) << EXT_MDIO_DEVADDR_SHIFT) & EXT_MDIO_DEVADDR_MASK)
327*6421ab1dSMatthew Dillon 
328*6421ab1dSMatthew Dillon #define	ALC_IDLE_DECISN_TIMER           0x1474
329*6421ab1dSMatthew Dillon #define	IDLE_DECISN_TIMER_DEFAULT_1MS   0x400
330*6421ab1dSMatthew Dillon 
331bbf76eecSMatthew Dillon #define	ALC_MAC_CFG			0x1480
332bbf76eecSMatthew Dillon #define	MAC_CFG_TX_ENB			0x00000001
333bbf76eecSMatthew Dillon #define	MAC_CFG_RX_ENB			0x00000002
334bbf76eecSMatthew Dillon #define	MAC_CFG_TX_FC			0x00000004
335bbf76eecSMatthew Dillon #define	MAC_CFG_RX_FC			0x00000008
336bbf76eecSMatthew Dillon #define	MAC_CFG_LOOP			0x00000010
337bbf76eecSMatthew Dillon #define	MAC_CFG_FULL_DUPLEX		0x00000020
338bbf76eecSMatthew Dillon #define	MAC_CFG_TX_CRC_ENB		0x00000040
339bbf76eecSMatthew Dillon #define	MAC_CFG_TX_AUTO_PAD		0x00000080
340bbf76eecSMatthew Dillon #define	MAC_CFG_TX_LENCHK		0x00000100
341bbf76eecSMatthew Dillon #define	MAC_CFG_RX_JUMBO_ENB		0x00000200
342bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_MASK		0x00003C00
343bbf76eecSMatthew Dillon #define	MAC_CFG_VLAN_TAG_STRIP		0x00004000
344bbf76eecSMatthew Dillon #define	MAC_CFG_PROMISC			0x00008000
345bbf76eecSMatthew Dillon #define	MAC_CFG_TX_PAUSE		0x00010000
346bbf76eecSMatthew Dillon #define	MAC_CFG_SCNT			0x00020000
347bbf76eecSMatthew Dillon #define	MAC_CFG_SYNC_RST_TX		0x00040000
348bbf76eecSMatthew Dillon #define	MAC_CFG_SIM_RST_TX		0x00080000
349bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_MASK		0x00300000
350bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_10_100		0x00100000
351bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_1000		0x00200000
352bbf76eecSMatthew Dillon #define	MAC_CFG_DBG_TX_BACKOFF		0x00400000
353bbf76eecSMatthew Dillon #define	MAC_CFG_TX_JUMBO_ENB		0x00800000
354bbf76eecSMatthew Dillon #define	MAC_CFG_RXCSUM_ENB		0x01000000
355bbf76eecSMatthew Dillon #define	MAC_CFG_ALLMULTI		0x02000000
356bbf76eecSMatthew Dillon #define	MAC_CFG_BCAST			0x04000000
357bbf76eecSMatthew Dillon #define	MAC_CFG_DBG			0x08000000
358bbf76eecSMatthew Dillon #define	MAC_CFG_SINGLE_PAUSE_ENB	0x10000000
359cffbd125SMatthew Dillon #define MAC_CFG_HASH_ALG_CRC32		0x20000000
360cffbd125SMatthew Dillon #define MAC_CFG_SPEED_MODE_SW		0x40000000
361*6421ab1dSMatthew Dillon #define	MAC_CFG_FAST_PAUSE		0x80000000
362bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_SHIFT		10
363bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_DEFAULT	7
364bbf76eecSMatthew Dillon 
365bbf76eecSMatthew Dillon #define	ALC_IPG_IFG_CFG			0x1484
366bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_MASK		0x0000007F
367bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_MASK		0x0000FF00
368bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_MASK		0x007F0000
369bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_MASK		0x7F000000
370bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_SHIFT		0
371bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_DEFAULT		0x60
372bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_SHIFT		8
373bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_DEFAULT		0x50
374bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_SHIFT		16
375bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_DEFAULT		0x40
376bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_SHIFT		24
377bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_DEFAULT		0x60
378bbf76eecSMatthew Dillon 
379bbf76eecSMatthew Dillon /* Station address. */
380bbf76eecSMatthew Dillon #define	ALC_PAR0			0x1488
381bbf76eecSMatthew Dillon #define	ALC_PAR1			0x148C
382bbf76eecSMatthew Dillon 
383bbf76eecSMatthew Dillon /* 64bit multicast hash register. */
384bbf76eecSMatthew Dillon #define	ALC_MAR0			0x1490
385bbf76eecSMatthew Dillon #define	ALC_MAR1			0x1494
386bbf76eecSMatthew Dillon 
387bbf76eecSMatthew Dillon /* half-duplex parameter configuration. */
388bbf76eecSMatthew Dillon #define	ALC_HDPX_CFG			0x1498
389bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_MASK		0x000003FF
390bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_MASK		0x0000F000
391bbf76eecSMatthew Dillon #define	HDPX_CFG_EXC_DEF_EN		0x00010000
392bbf76eecSMatthew Dillon #define	HDPX_CFG_NO_BACK_C		0x00020000
393bbf76eecSMatthew Dillon #define	HDPX_CFG_NO_BACK_P		0x00040000
394bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBE			0x00080000
395bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_MASK		0x00F00000
396bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_MASK		0x0F000000
397bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_SHIFT		0
398bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_DEFAULT		0x37
399bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_SHIFT		12
400bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_DEFAULT		0x0F
401bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_SHIFT		20
402bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_DEFAULT		0x0A
403bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_SHIFT		24
404bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_DEFAULT		0x07
405bbf76eecSMatthew Dillon 
406bbf76eecSMatthew Dillon #define	ALC_FRAME_SIZE			0x149C
407bbf76eecSMatthew Dillon 
408bbf76eecSMatthew Dillon #define	ALC_WOL_CFG			0x14A0
409bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN			0x00000001
410bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN_ENB		0x00000002
411bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC			0x00000004
412bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC_ENB		0x00000008
413bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG		0x00000010
414bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG_ENB		0x00000020
415bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN_DET		0x00000100
416bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC_DET		0x00000200
417bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG_DET		0x00000400
418bbf76eecSMatthew Dillon #define	WOL_CFG_CLK_SWITCH_ENB		0x00008000
419bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN0		0x00010000
420bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN1		0x00020000
421bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN2		0x00040000
422bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN3		0x00080000
423bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN4		0x00100000
424bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN5		0x00200000
425bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN6		0x00400000
426bbf76eecSMatthew Dillon 
427bbf76eecSMatthew Dillon /* WOL pattern length. */
428bbf76eecSMatthew Dillon #define	ALC_PATTERN_CFG0		0x14A4
429bbf76eecSMatthew Dillon #define	PATTERN_CFG_0_LEN_MASK		0x0000007F
430bbf76eecSMatthew Dillon #define	PATTERN_CFG_1_LEN_MASK		0x00007F00
431bbf76eecSMatthew Dillon #define	PATTERN_CFG_2_LEN_MASK		0x007F0000
432bbf76eecSMatthew Dillon #define	PATTERN_CFG_3_LEN_MASK		0x7F000000
433bbf76eecSMatthew Dillon 
434bbf76eecSMatthew Dillon #define	ALC_PATTERN_CFG1		0x14A8
435bbf76eecSMatthew Dillon #define	PATTERN_CFG_4_LEN_MASK		0x0000007F
436bbf76eecSMatthew Dillon #define	PATTERN_CFG_5_LEN_MASK		0x00007F00
437bbf76eecSMatthew Dillon #define	PATTERN_CFG_6_LEN_MASK		0x007F0000
438bbf76eecSMatthew Dillon 
439bbf76eecSMatthew Dillon /* RSS */
440bbf76eecSMatthew Dillon #define	ALC_RSS_KEY0			0x14B0
441bbf76eecSMatthew Dillon 
442bbf76eecSMatthew Dillon #define	ALC_RSS_KEY1			0x14B4
443bbf76eecSMatthew Dillon 
444bbf76eecSMatthew Dillon #define	ALC_RSS_KEY2			0x14B8
445bbf76eecSMatthew Dillon 
446bbf76eecSMatthew Dillon #define	ALC_RSS_KEY3			0x14BC
447bbf76eecSMatthew Dillon 
448bbf76eecSMatthew Dillon #define	ALC_RSS_KEY4			0x14C0
449bbf76eecSMatthew Dillon 
450bbf76eecSMatthew Dillon #define	ALC_RSS_KEY5			0x14C4
451bbf76eecSMatthew Dillon 
452bbf76eecSMatthew Dillon #define	ALC_RSS_KEY6			0x14C8
453bbf76eecSMatthew Dillon 
454bbf76eecSMatthew Dillon #define	ALC_RSS_KEY7			0x14CC
455bbf76eecSMatthew Dillon 
456bbf76eecSMatthew Dillon #define	ALC_RSS_KEY8			0x14D0
457bbf76eecSMatthew Dillon 
458bbf76eecSMatthew Dillon #define	ALC_RSS_KEY9			0x14D4
459bbf76eecSMatthew Dillon 
460bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE0		0x14E0
461bbf76eecSMatthew Dillon 
462*6421ab1dSMatthew Dillon #define	ALC_TD_PRI2_HEAD_ADDR_LO	0x14E0	/* AR816x */
463*6421ab1dSMatthew Dillon 
464bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE1		0x14E4
465bbf76eecSMatthew Dillon 
466*6421ab1dSMatthew Dillon #define	ALC_TD_PRI3_HEAD_ADDR_LO	0x14E4	/* AR816x */
467*6421ab1dSMatthew Dillon 
468bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE2		0x14E8
469bbf76eecSMatthew Dillon 
470bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE3		0x14EC
471bbf76eecSMatthew Dillon 
472bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE4		0x14F0
473bbf76eecSMatthew Dillon 
474bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE5		0x14F4
475bbf76eecSMatthew Dillon 
476bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE6		0x14F8
477bbf76eecSMatthew Dillon 
478bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE7		0x14FC
479bbf76eecSMatthew Dillon 
480bbf76eecSMatthew Dillon #define	ALC_SRAM_RD0_ADDR		0x1500
481bbf76eecSMatthew Dillon 
482bbf76eecSMatthew Dillon #define	ALC_SRAM_RD1_ADDR		0x1504
483bbf76eecSMatthew Dillon 
484bbf76eecSMatthew Dillon #define	ALC_SRAM_RD2_ADDR		0x1508
485bbf76eecSMatthew Dillon 
486bbf76eecSMatthew Dillon #define	ALC_SRAM_RD3_ADDR		0x150C
487bbf76eecSMatthew Dillon 
488bbf76eecSMatthew Dillon #define	RD_HEAD_ADDR_MASK		0x000003FF
489bbf76eecSMatthew Dillon #define	RD_TAIL_ADDR_MASK		0x03FF0000
490bbf76eecSMatthew Dillon #define	RD_HEAD_ADDR_SHIFT		0
491bbf76eecSMatthew Dillon #define	RD_TAIL_ADDR_SHIFT		16
492bbf76eecSMatthew Dillon 
493bbf76eecSMatthew Dillon #define	ALC_RD_NIC_LEN0			0x1510	/* 8 bytes unit */
494bbf76eecSMatthew Dillon #define	RD_NIC_LEN_MASK			0x000003FF
495bbf76eecSMatthew Dillon 
496bbf76eecSMatthew Dillon #define	ALC_RD_NIC_LEN1			0x1514
497bbf76eecSMatthew Dillon 
498bbf76eecSMatthew Dillon #define	ALC_SRAM_TD_ADDR		0x1518
499bbf76eecSMatthew Dillon #define	TD_HEAD_ADDR_MASK		0x000003FF
500bbf76eecSMatthew Dillon #define	TD_TAIL_ADDR_MASK		0x03FF0000
501bbf76eecSMatthew Dillon #define	TD_HEAD_ADDR_SHIFT		0
502bbf76eecSMatthew Dillon #define	TD_TAIL_ADDR_SHIFT		16
503bbf76eecSMatthew Dillon 
504bbf76eecSMatthew Dillon #define	ALC_SRAM_TD_LEN			0x151C	/* 8 bytes unit */
505bbf76eecSMatthew Dillon #define	SRAM_TD_LEN_MASK		0x000003FF
506bbf76eecSMatthew Dillon 
507bbf76eecSMatthew Dillon #define	ALC_SRAM_RX_FIFO_ADDR		0x1520
508bbf76eecSMatthew Dillon 
509bbf76eecSMatthew Dillon #define	ALC_SRAM_RX_FIFO_LEN		0x1524
510*6421ab1dSMatthew Dillon #define	SRAM_RX_FIFO_LEN_MASK		0x00000FFF
511*6421ab1dSMatthew Dillon #define	SRAM_RX_FIFO_LEN_SHIFT		0
512bbf76eecSMatthew Dillon 
513bbf76eecSMatthew Dillon #define	ALC_SRAM_TX_FIFO_ADDR		0x1528
514bbf76eecSMatthew Dillon 
515bbf76eecSMatthew Dillon #define	ALC_SRAM_TX_FIFO_LEN		0x152C
516bbf76eecSMatthew Dillon 
517bbf76eecSMatthew Dillon #define	ALC_SRAM_TCPH_ADDR		0x1530
518bbf76eecSMatthew Dillon #define	SRAM_TCPH_ADDR_MASK		0x00000FFF
519bbf76eecSMatthew Dillon #define	SRAM_PATH_ADDR_MASK		0x0FFF0000
520bbf76eecSMatthew Dillon #define	SRAM_TCPH_ADDR_SHIFT		0
521bbf76eecSMatthew Dillon #define	SRAM_PKTH_ADDR_SHIFT		16
522bbf76eecSMatthew Dillon 
523bbf76eecSMatthew Dillon #define	ALC_DMA_BLOCK			0x1534
524bbf76eecSMatthew Dillon #define	DMA_BLOCK_LOAD			0x00000001
525bbf76eecSMatthew Dillon 
526bbf76eecSMatthew Dillon #define	ALC_RX_BASE_ADDR_HI		0x1540
527bbf76eecSMatthew Dillon 
528bbf76eecSMatthew Dillon #define	ALC_TX_BASE_ADDR_HI		0x1544
529bbf76eecSMatthew Dillon 
530bbf76eecSMatthew Dillon #define	ALC_SMB_BASE_ADDR_HI		0x1548
531bbf76eecSMatthew Dillon 
532bbf76eecSMatthew Dillon #define	ALC_SMB_BASE_ADDR_LO		0x154C
533bbf76eecSMatthew Dillon 
534bbf76eecSMatthew Dillon #define	ALC_RD0_HEAD_ADDR_LO		0x1550
535bbf76eecSMatthew Dillon 
536bbf76eecSMatthew Dillon #define	ALC_RD1_HEAD_ADDR_LO		0x1554
537bbf76eecSMatthew Dillon 
538bbf76eecSMatthew Dillon #define	ALC_RD2_HEAD_ADDR_LO		0x1558
539bbf76eecSMatthew Dillon 
540bbf76eecSMatthew Dillon #define	ALC_RD3_HEAD_ADDR_LO		0x155C
541bbf76eecSMatthew Dillon 
542bbf76eecSMatthew Dillon #define	ALC_RD_RING_CNT			0x1560
543bbf76eecSMatthew Dillon #define	RD_RING_CNT_MASK		0x00000FFF
544bbf76eecSMatthew Dillon #define	RD_RING_CNT_SHIFT		0
545bbf76eecSMatthew Dillon 
546bbf76eecSMatthew Dillon #define	ALC_RX_BUF_SIZE			0x1564
547bbf76eecSMatthew Dillon #define	RX_BUF_SIZE_MASK		0x0000FFFF
548bbf76eecSMatthew Dillon /*
549bbf76eecSMatthew Dillon  * If larger buffer size than 1536 is specified the controller
550bbf76eecSMatthew Dillon  * will be locked up. This is hardware limitation.
551bbf76eecSMatthew Dillon  */
552bbf76eecSMatthew Dillon #define	RX_BUF_SIZE_MAX			1536
553bbf76eecSMatthew Dillon 
554bbf76eecSMatthew Dillon #define	ALC_RRD0_HEAD_ADDR_LO		0x1568
555bbf76eecSMatthew Dillon 
556bbf76eecSMatthew Dillon #define	ALC_RRD1_HEAD_ADDR_LO		0x156C
557bbf76eecSMatthew Dillon 
558bbf76eecSMatthew Dillon #define	ALC_RRD2_HEAD_ADDR_LO		0x1570
559bbf76eecSMatthew Dillon 
560bbf76eecSMatthew Dillon #define	ALC_RRD3_HEAD_ADDR_LO		0x1574
561bbf76eecSMatthew Dillon 
562bbf76eecSMatthew Dillon #define	ALC_RRD_RING_CNT		0x1578
563bbf76eecSMatthew Dillon #define	RRD_RING_CNT_MASK		0x00000FFF
564bbf76eecSMatthew Dillon #define	RRD_RING_CNT_SHIFT		0
565bbf76eecSMatthew Dillon 
566bbf76eecSMatthew Dillon #define	ALC_TDH_HEAD_ADDR_LO		0x157C
567bbf76eecSMatthew Dillon 
568*6421ab1dSMatthew Dillon #define	ALC_TD_PRI1_HEAD_ADDR_LO	0x157C	/* AR816x */
569*6421ab1dSMatthew Dillon 
570bbf76eecSMatthew Dillon #define	ALC_TDL_HEAD_ADDR_LO		0x1580
571bbf76eecSMatthew Dillon 
572*6421ab1dSMatthew Dillon #define	ALC_TD_PRI0_HEAD_ADDR_LO	0x1580	/* AR816x */
573*6421ab1dSMatthew Dillon 
574bbf76eecSMatthew Dillon #define	ALC_TD_RING_CNT			0x1584
575bbf76eecSMatthew Dillon #define	TD_RING_CNT_MASK		0x0000FFFF
576bbf76eecSMatthew Dillon #define	TD_RING_CNT_SHIFT		0
577bbf76eecSMatthew Dillon 
578bbf76eecSMatthew Dillon #define	ALC_CMB_BASE_ADDR_LO		0x1588
579bbf76eecSMatthew Dillon 
580bbf76eecSMatthew Dillon #define	ALC_TXQ_CFG			0x1590
581bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_MASK		0x0000000F
582bbf76eecSMatthew Dillon #define	TXQ_CFG_IP_OPTION_ENB		0x00000010
583bbf76eecSMatthew Dillon #define	TXQ_CFG_ENB			0x00000020
584bbf76eecSMatthew Dillon #define	TXQ_CFG_ENHANCED_MODE		0x00000040
585bbf76eecSMatthew Dillon #define	TXQ_CFG_8023_ENB		0x00000080
586bbf76eecSMatthew Dillon #define	TXQ_CFG_TX_FIFO_BURST_MASK	0xFFFF0000
587bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_SHIFT		0
588bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_DEFAULT	5
589bbf76eecSMatthew Dillon #define	TXQ_CFG_TX_FIFO_BURST_SHIFT	16
590bbf76eecSMatthew Dillon 
591bbf76eecSMatthew Dillon #define	ALC_TSO_OFFLOAD_THRESH		0x1594	/* 8 bytes unit */
592bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_MASK		0x000007FF
593*6421ab1dSMatthew Dillon #define	TSO_OFFLOAD_ERRLGPKT_DROP_ENB	0x00000800
594bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_SHIFT	0
595bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_UNIT		8
596bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_UNIT_SHIFT	3
597bbf76eecSMatthew Dillon 
598bbf76eecSMatthew Dillon #define	ALC_TXF_WATER_MARK		0x1598	/* 8 bytes unit */
599bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_HI_MASK		0x00000FFF
600bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_LO_MASK		0x0FFF0000
601bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_BURST_ENB	0x80000000
602bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_LO_SHIFT		0
603bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_HI_SHIFT		16
604bbf76eecSMatthew Dillon 
605bbf76eecSMatthew Dillon #define	ALC_THROUGHPUT_MON		0x159C
606bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_RATE_MASK	0x00000003
607bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_ENB		0x00000080
608bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_RATE_SHIFT	0
609bbf76eecSMatthew Dillon 
610bbf76eecSMatthew Dillon #define	ALC_RXQ_CFG			0x15A0
611bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_MASK	0x00000003
612bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_NONE	0x00000000
613bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M	0x00000001
614bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_10M	0x00000002
615bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M	0x00000003
616bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE1_ENB		0x00000010
617bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE2_ENB		0x00000020
618bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE3_ENB		0x00000040
619bbf76eecSMatthew Dillon #define	RXQ_CFG_IPV6_CSUM_ENB		0x00000080
620bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_TBL_LEN_MASK	0x0000FF00
621bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV4		0x00010000
622bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV4_TCP	0x00020000
623bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV6		0x00040000
624bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV6_TCP	0x00080000
625bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_MASK		0x03F00000
626bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_DIS		0x00000000
627bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_SQSINT		0x04000000
628bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_MQUESINT	0x08000000
629bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_MQUEMINT	0x0C000000
630bbf76eecSMatthew Dillon #define	RXQ_CFG_NIP_QUEUE_SEL_TBL	0x10000000
631bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_ENB		0x20000000
632bbf76eecSMatthew Dillon #define	RXQ_CFG_CUT_THROUGH_ENB		0x40000000
633bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE0_ENB		0x80000000
634bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_TBL_LEN_SHIFT	8
635bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_DEFAULT	8
636bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_SHIFT		20
637bbf76eecSMatthew Dillon #define	RXQ_CFG_ENB					\
638bbf76eecSMatthew Dillon 	(RXQ_CFG_QUEUE0_ENB | RXQ_CFG_QUEUE1_ENB |	\
639bbf76eecSMatthew Dillon 	 RXQ_CFG_QUEUE2_ENB | RXQ_CFG_QUEUE3_ENB)
640bbf76eecSMatthew Dillon 
641*6421ab1dSMatthew Dillon /* AR816x specific bits */
642*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV4      0x00000004
643*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV4_TCP  0x00000008
644*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV6      0x00000010
645*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV6_TCP  0x00000020
646*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_MASK      0x0000003C
647*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IPV6_PARSE_ENB     0x00000080
648*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_MASK  0x0001FF00
649*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_SHIFT 8
650*6421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_DEFAULT       0x100
651*6421ab1dSMatthew Dillon 
652bbf76eecSMatthew Dillon #define	ALC_RX_RD_FREE_THRESH		0x15A4	/* 8 bytes unit. */
653bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_MASK	0x0000003F
654bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_MASK	0x00000FC0
655bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_SHIFT	0
656bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_SHIFT	6
657bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_DEFAULT	16
658bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_DEFAULT	8
659bbf76eecSMatthew Dillon 
660bbf76eecSMatthew Dillon #define	ALC_RX_FIFO_PAUSE_THRESH	0x15A8
661bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_LO_MASK	0x00000FFF
662bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_HI_MASK	0x0FFF0000
663bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_LO_SHIFT	0
664bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_HI_SHIFT	16
665bbf76eecSMatthew Dillon 
666*6421ab1dSMatthew Dillon /*
667*6421ab1dSMatthew Dillon  * Size = tx-packet(1522) + IPG(12) + SOF(8) + 64(Pause) + IPG(12) + SOF(8) +
668*6421ab1dSMatthew Dillon  *       rx-packet(1522) + delay-of-link(64)
669*6421ab1dSMatthew Dillon  *     = 3212.
670*6421ab1dSMatthew Dillon  */
671*6421ab1dSMatthew Dillon #define	RX_FIFO_PAUSE_816X_RSVD         3212
672*6421ab1dSMatthew Dillon 
673bbf76eecSMatthew Dillon #define	ALC_RD_DMA_CFG			0x15AC
674bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_MASK		0x00000FFF	/* 8 bytes unit */
675bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_MASK		0xFFFF0000
676bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_SHIFT		0
677bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_SHIFT		16
678bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_DEFAULT	0x100
679bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_DEFAULT	0
680bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TICK_USECS		8
681bbf76eecSMatthew Dillon #define	ALC_RD_DMA_CFG_USECS(x)		((x) / RD_DMA_CFG_TICK_USECS)
682bbf76eecSMatthew Dillon 
683bbf76eecSMatthew Dillon #define	ALC_RSS_HASH_VALUE		0x15B0
684bbf76eecSMatthew Dillon 
685bbf76eecSMatthew Dillon #define	ALC_RSS_HASH_FLAG		0x15B4
686bbf76eecSMatthew Dillon 
687bbf76eecSMatthew Dillon #define	ALC_RSS_CPU			0x15B8
688bbf76eecSMatthew Dillon 
689bbf76eecSMatthew Dillon #define	ALC_DMA_CFG			0x15C0
690bbf76eecSMatthew Dillon #define	DMA_CFG_IN_ORDER		0x00000001
691bbf76eecSMatthew Dillon #define	DMA_CFG_ENH_ORDER		0x00000002
692bbf76eecSMatthew Dillon #define	DMA_CFG_OUT_ORDER		0x00000004
693bbf76eecSMatthew Dillon #define	DMA_CFG_RCB_64			0x00000000
694bbf76eecSMatthew Dillon #define	DMA_CFG_RCB_128			0x00000008
695*6421ab1dSMatthew Dillon #define	DMA_CFG_PEND_AUTO_RST		0x00000008
696bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_128		0x00000000
697bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_256		0x00000010
698bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_512		0x00000020
699bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_1024		0x00000030
700bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_2048		0x00000040
701bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_4096		0x00000050
702bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_128		0x00000000
703bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_256		0x00000080
704bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_512		0x00000100
705bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_1024		0x00000180
706bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_2048		0x00000200
707bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_4096		0x00000280
708bbf76eecSMatthew Dillon #define	DMA_CFG_RD_REQ_PRI		0x00000400
709bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_MASK	0x0000F800
710bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_MASK	0x000F0000
711bbf76eecSMatthew Dillon #define	DMA_CFG_CMB_ENB			0x00100000
712bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_ENB			0x00200000
713bbf76eecSMatthew Dillon #define	DMA_CFG_CMB_NOW			0x00400000
714bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_DIS			0x01000000
715*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_MASK        0x0C000000
716*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_1           0x00000000
717*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_2           0x04000000
718*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_3           0x08000000
719*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_4           0x0C000000
720*6421ab1dSMatthew Dillon #define	DMA_CFG_WSRAM_RDCTL             0x10000000
721*6421ab1dSMatthew Dillon #define	DMA_CFG_RD_PEND_CLR             0x20000000
722*6421ab1dSMatthew Dillon #define	DMA_CFG_WR_PEND_CLR             0x40000000
723bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_NOW			0x80000000
724bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_MASK		0x07
725bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_SHIFT		4
726bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_MASK		0x07
727bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_SHIFT		7
728bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_SHIFT	11
729bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_SHIFT	16
730bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_DEFAULT	15
731bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_DEFAULT	4
732bbf76eecSMatthew Dillon 
733bbf76eecSMatthew Dillon #define	ALC_SMB_STAT_TIMER		0x15C4
734bbf76eecSMatthew Dillon #define	SMB_STAT_TIMER_MASK		0x00FFFFFF
735bbf76eecSMatthew Dillon #define	SMB_STAT_TIMER_SHIFT		0
736bbf76eecSMatthew Dillon 
737bbf76eecSMatthew Dillon #define	ALC_CMB_TD_THRESH		0x15C8
738bbf76eecSMatthew Dillon #define	CMB_TD_THRESH_MASK		0x0000FFFF
739bbf76eecSMatthew Dillon #define	CMB_TD_THRESH_SHIFT		0
740bbf76eecSMatthew Dillon 
741bbf76eecSMatthew Dillon #define	ALC_CMB_TX_TIMER		0x15CC
742bbf76eecSMatthew Dillon #define	CMB_TX_TIMER_MASK		0x0000FFFF
743bbf76eecSMatthew Dillon #define	CMB_TX_TIMER_SHIFT		0
744bbf76eecSMatthew Dillon 
745*6421ab1dSMatthew Dillon #define	ALC_MSI_MAP_TBL1                0x15D0
746*6421ab1dSMatthew Dillon 
747*6421ab1dSMatthew Dillon #define	ALC_MSI_ID_MAP                  0x15D4
748*6421ab1dSMatthew Dillon 
749*6421ab1dSMatthew Dillon #define	ALC_MSI_MAP_TBL2                0x15D8
750*6421ab1dSMatthew Dillon 
751bbf76eecSMatthew Dillon #define	ALC_MBOX_RD0_PROD_IDX		0x15E0
752bbf76eecSMatthew Dillon 
753bbf76eecSMatthew Dillon #define	ALC_MBOX_RD1_PROD_IDX		0x15E4
754bbf76eecSMatthew Dillon 
755bbf76eecSMatthew Dillon #define	ALC_MBOX_RD2_PROD_IDX		0x15E8
756bbf76eecSMatthew Dillon 
757bbf76eecSMatthew Dillon #define	ALC_MBOX_RD3_PROD_IDX		0x15EC
758bbf76eecSMatthew Dillon 
759bbf76eecSMatthew Dillon #define	ALC_MBOX_RD_PROD_MASK		0x0000FFFF
760bbf76eecSMatthew Dillon #define	MBOX_RD_PROD_SHIFT		0
761bbf76eecSMatthew Dillon 
762bbf76eecSMatthew Dillon #define	ALC_MBOX_TD_PROD_IDX		0x15F0
763bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_HI_IDX_MASK	0x0000FFFF
764bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_LO_IDX_MASK	0xFFFF0000
765bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_HI_IDX_SHIFT	0
766bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_LO_IDX_SHIFT	16
767bbf76eecSMatthew Dillon 
768*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI1_PROD_IDX       0x15F0  /* 16 bits AR816x */
769*6421ab1dSMatthew Dillon 
770*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI0_PROD_IDX       0x15F2  /* 16 bits AR816x */
771*6421ab1dSMatthew Dillon 
772bbf76eecSMatthew Dillon #define	ALC_MBOX_TD_CONS_IDX		0x15F4
773bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_HI_IDX_MASK	0x0000FFFF
774bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_LO_IDX_MASK	0xFFFF0000
775bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_HI_IDX_SHIFT	0
776bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_LO_IDX_SHIFT	16
777bbf76eecSMatthew Dillon 
778*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI1_CONS_IDX       0x15F4  /* 16 bits AR816x */
779*6421ab1dSMatthew Dillon 
780*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI0_CONS_IDX       0x15F6  /* 16 bits AR816x */
781*6421ab1dSMatthew Dillon 
782bbf76eecSMatthew Dillon #define	ALC_MBOX_RD01_CONS_IDX		0x15F8
783bbf76eecSMatthew Dillon #define	MBOX_RD0_CONS_IDX_MASK		0x0000FFFF
784bbf76eecSMatthew Dillon #define	MBOX_RD1_CONS_IDX_MASK		0xFFFF0000
785bbf76eecSMatthew Dillon #define	MBOX_RD0_CONS_IDX_SHIFT		0
786bbf76eecSMatthew Dillon #define	MBOX_RD1_CONS_IDX_SHIFT		16
787bbf76eecSMatthew Dillon 
788bbf76eecSMatthew Dillon #define	ALC_MBOX_RD23_CONS_IDX		0x15FC
789bbf76eecSMatthew Dillon #define	MBOX_RD2_CONS_IDX_MASK		0x0000FFFF
790bbf76eecSMatthew Dillon #define	MBOX_RD3_CONS_IDX_MASK		0xFFFF0000
791bbf76eecSMatthew Dillon #define	MBOX_RD2_CONS_IDX_SHIFT		0
792bbf76eecSMatthew Dillon #define	MBOX_RD3_CONS_IDX_SHIFT		16
793bbf76eecSMatthew Dillon 
794bbf76eecSMatthew Dillon #define	ALC_INTR_STATUS			0x1600
795bbf76eecSMatthew Dillon #define	INTR_SMB			0x00000001
796bbf76eecSMatthew Dillon #define	INTR_TIMER			0x00000002
797bbf76eecSMatthew Dillon #define	INTR_MANUAL_TIMER		0x00000004
798bbf76eecSMatthew Dillon #define	INTR_RX_FIFO_OFLOW		0x00000008
799bbf76eecSMatthew Dillon #define	INTR_RD0_UNDERRUN		0x00000010
800bbf76eecSMatthew Dillon #define	INTR_RD1_UNDERRUN		0x00000020
801bbf76eecSMatthew Dillon #define	INTR_RD2_UNDERRUN		0x00000040
802bbf76eecSMatthew Dillon #define	INTR_RD3_UNDERRUN		0x00000080
803bbf76eecSMatthew Dillon #define	INTR_TX_FIFO_UNDERRUN		0x00000100
804bbf76eecSMatthew Dillon #define	INTR_DMA_RD_TO_RST		0x00000200
805bbf76eecSMatthew Dillon #define	INTR_DMA_WR_TO_RST		0x00000400
806bbf76eecSMatthew Dillon #define	INTR_TX_CREDIT			0x00000800
807bbf76eecSMatthew Dillon #define	INTR_GPHY			0x00001000
808bbf76eecSMatthew Dillon #define	INTR_GPHY_LOW_PW		0x00002000
809bbf76eecSMatthew Dillon #define	INTR_TXQ_TO_RST			0x00004000
810*6421ab1dSMatthew Dillon #define	INTR_TX_PKT0			0x00008000
811bbf76eecSMatthew Dillon #define	INTR_RX_PKT0			0x00010000
812bbf76eecSMatthew Dillon #define	INTR_RX_PKT1			0x00020000
813bbf76eecSMatthew Dillon #define	INTR_RX_PKT2			0x00040000
814bbf76eecSMatthew Dillon #define	INTR_RX_PKT3			0x00080000
815bbf76eecSMatthew Dillon #define	INTR_MAC_RX			0x00100000
816bbf76eecSMatthew Dillon #define	INTR_MAC_TX			0x00200000
817bbf76eecSMatthew Dillon #define	INTR_UNDERRUN			0x00400000
818bbf76eecSMatthew Dillon #define	INTR_FRAME_ERROR		0x00800000
819bbf76eecSMatthew Dillon #define	INTR_FRAME_OK			0x01000000
820bbf76eecSMatthew Dillon #define	INTR_CSUM_ERROR			0x02000000
821bbf76eecSMatthew Dillon #define	INTR_PHY_LINK_DOWN		0x04000000
822bbf76eecSMatthew Dillon #define	INTR_DIS_INT			0x80000000
823bbf76eecSMatthew Dillon 
824*6421ab1dSMatthew Dillon /* INTR status for AR816x/AR817x  4 TX queues, 8 RX queues */
825*6421ab1dSMatthew Dillon #define	INTR_TX_PKT1                    0x00000020
826*6421ab1dSMatthew Dillon #define	INTR_TX_PKT2                    0x00000040
827*6421ab1dSMatthew Dillon #define	INTR_TX_PKT3                    0x00000080
828*6421ab1dSMatthew Dillon #define	INTR_RX_PKT4                    0x08000000
829*6421ab1dSMatthew Dillon #define	INTR_RX_PKT5                    0x10000000
830*6421ab1dSMatthew Dillon #define	INTR_RX_PKT6                    0x20000000
831*6421ab1dSMatthew Dillon #define	INTR_RX_PKT7                    0x40000000
832*6421ab1dSMatthew Dillon 
833bbf76eecSMatthew Dillon /* Interrupt Mask Register */
834bbf76eecSMatthew Dillon #define	ALC_INTR_MASK			0x1604
835bbf76eecSMatthew Dillon 
836bbf76eecSMatthew Dillon #ifdef	notyet
837bbf76eecSMatthew Dillon #define	INTR_RX_PKT					\
838bbf76eecSMatthew Dillon 	(INTR_RX_PKT0 | INTR_RX_PKT1 | INTR_RX_PKT2 |	\
839bbf76eecSMatthew Dillon 	 INTR_RX_PKT3)
840bbf76eecSMatthew Dillon #define	INTR_RD_UNDERRUN				\
841bbf76eecSMatthew Dillon 	(INTR_RD0_UNDERRUN | INTR_RD1_UNDERRUN |	\
842bbf76eecSMatthew Dillon 	INTR_RD2_UNDERRUN | INTR_RD3_UNDERRUN)
843bbf76eecSMatthew Dillon #else
844*6421ab1dSMatthew Dillon #define	INTR_TX_PKT			INTR_TX_PKT0
845bbf76eecSMatthew Dillon #define	INTR_RX_PKT			INTR_RX_PKT0
846bbf76eecSMatthew Dillon #define	INTR_RD_UNDERRUN		INTR_RD0_UNDERRUN
847bbf76eecSMatthew Dillon #endif
848bbf76eecSMatthew Dillon 
849bbf76eecSMatthew Dillon #define	ALC_INTRS					\
850bbf76eecSMatthew Dillon 	(INTR_DMA_RD_TO_RST | INTR_DMA_WR_TO_RST |	\
851bbf76eecSMatthew Dillon 	INTR_TXQ_TO_RST	| INTR_RX_PKT | INTR_TX_PKT |	\
852bbf76eecSMatthew Dillon 	INTR_RX_FIFO_OFLOW | INTR_RD_UNDERRUN |		\
853bbf76eecSMatthew Dillon 	INTR_TX_FIFO_UNDERRUN)
854bbf76eecSMatthew Dillon 
855bbf76eecSMatthew Dillon #define	ALC_INTR_RETRIG_TIMER		0x1608
856bbf76eecSMatthew Dillon #define	INTR_RETRIG_TIMER_MASK		0x0000FFFF
857bbf76eecSMatthew Dillon #define	INTR_RETRIG_TIMER_SHIFT		0
858bbf76eecSMatthew Dillon 
859bbf76eecSMatthew Dillon #define	ALC_HDS_CFG			0x160C
860bbf76eecSMatthew Dillon #define	HDS_CFG_ENB			0x00000001
861bbf76eecSMatthew Dillon #define	HDS_CFG_BACKFILLSIZE_MASK	0x000FFF00
862bbf76eecSMatthew Dillon #define	HDS_CFG_MAX_HDRSIZE_MASK	0xFFF00000
863bbf76eecSMatthew Dillon #define	HDS_CFG_BACKFILLSIZE_SHIFT	8
864bbf76eecSMatthew Dillon #define	HDS_CFG_MAX_HDRSIZE_SHIFT	20
865bbf76eecSMatthew Dillon 
866*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI3_PROD_IDX       0x1618  /* 16 bits AR816x */
867*6421ab1dSMatthew Dillon 
868*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI2_PROD_IDX       0x161A  /* 16 bits AR816x */
869*6421ab1dSMatthew Dillon 
870*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI3_CONS_IDX       0x161C  /* 16 bits AR816x */
871*6421ab1dSMatthew Dillon 
872*6421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI2_CONS_IDX       0x161E  /* 16 bits AR816x */
873*6421ab1dSMatthew Dillon 
874cffbd125SMatthew Dillon /* AR813x/AR815x registers for MAC statistics */
875bbf76eecSMatthew Dillon #define	ALC_RX_MIB_BASE			0x1700
876bbf76eecSMatthew Dillon 
877bbf76eecSMatthew Dillon #define	ALC_TX_MIB_BASE			0x1760
878bbf76eecSMatthew Dillon 
879*6421ab1dSMatthew Dillon #define	ALC_DRV                         0x1804  /* AR816x */
880*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_1M            0x00000000
881*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_10M           0x00000001
882*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_100M          0x00000002
883*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_NO            0x00000003
884*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_MASK          0x00000003
885*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_1M           0x00000000
886*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_10M          0x00000004
887*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_100M         0x00000008
888*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_NO           0x0000000C
889*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_MASK         0x0000000C
890*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_100M        0x00000000
891*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_NO          0x00000010
892*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_1M          0x00000020
893*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_10M         0x00000030
894*6421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_MASK        0x00000000
895*6421ab1dSMatthew Dillon #define	DRV_WOLCAP_BIOS_EN              0x00000100
896*6421ab1dSMatthew Dillon #define	DRV_WOLMAGIC_EN                 0x00000200
897*6421ab1dSMatthew Dillon #define	DRV_WOLLINKUP_EN                0x00000400
898*6421ab1dSMatthew Dillon #define	DRV_WOLPATTERN_EN               0x00000800
899*6421ab1dSMatthew Dillon #define	DRV_AZ_EN                       0x00001000
900*6421ab1dSMatthew Dillon #define	DRV_WOLS5_BIOS_EN               0x00010000
901*6421ab1dSMatthew Dillon #define	DRV_WOLS5_EN                    0x00020000
902*6421ab1dSMatthew Dillon #define	DRV_DISABLE                     0x00040000
903*6421ab1dSMatthew Dillon #define	DRV_PHY_MASK                    0x1FE00000
904*6421ab1dSMatthew Dillon #define	DRV_PHY_EEE                     0x00200000
905*6421ab1dSMatthew Dillon #define	DRV_PHY_APAUSE                  0x00400000
906*6421ab1dSMatthew Dillon #define	DRV_PHY_PAUSE                   0x00800000
907*6421ab1dSMatthew Dillon #define	DRV_PHY_DUPLEX                  0x01000000
908*6421ab1dSMatthew Dillon #define	DRV_PHY_10                      0x02000000
909*6421ab1dSMatthew Dillon #define	DRV_PHY_100                     0x04000000
910*6421ab1dSMatthew Dillon #define	DRV_PHY_1000                    0x08000000
911*6421ab1dSMatthew Dillon #define	DRV_PHY_AUTO                    0x10000000
912*6421ab1dSMatthew Dillon #define	DRV_PHY_SHIFT                   21
913*6421ab1dSMatthew Dillon 
914a45385feSMichael Neumann #define ALC_CLK_GATING_CFG		0x1814
915a45385feSMichael Neumann #define CLK_GATING_DMAW_ENB		0x0001
916a45385feSMichael Neumann #define CLK_GATING_DMAR_ENB		0x0002
917a45385feSMichael Neumann #define CLK_GATING_TXQ_ENB		0x0004
918a45385feSMichael Neumann #define CLK_GATING_RXQ_ENB		0x0008
919a45385feSMichael Neumann #define CLK_GATING_TXMAC_ENB		0x0010
920a45385feSMichael Neumann #define CLK_GATING_RXMAC_ENB		0x0020
921a45385feSMichael Neumann 
922bbf76eecSMatthew Dillon #define	ALC_DEBUG_DATA0			0x1900
923bbf76eecSMatthew Dillon 
924bbf76eecSMatthew Dillon #define	ALC_DEBUG_DATA1			0x1904
925bbf76eecSMatthew Dillon 
926*6421ab1dSMatthew Dillon #define	ALC_MSI_RETRANS_TIMER           0x1920
927*6421ab1dSMatthew Dillon #define	MSI_RETRANS_TIMER_MASK          0x0000FFFF
928*6421ab1dSMatthew Dillon #define	MSI_RETRANS_MASK_SEL_STD        0x00000000
929*6421ab1dSMatthew Dillon #define	MSI_RETRANS_MASK_SEL_LINE       0x00010000
930*6421ab1dSMatthew Dillon #define	MSI_RETRANS_TIMER_SHIFT         0
931*6421ab1dSMatthew Dillon 
932*6421ab1dSMatthew Dillon #define	ALC_WRR                         0x1938
933*6421ab1dSMatthew Dillon #define	WRR_PRI0_MASK                   0x0000001F
934*6421ab1dSMatthew Dillon #define	WRR_PRI1_MASK                   0x00001F00
935*6421ab1dSMatthew Dillon #define	WRR_PRI2_MASK                   0x001F0000
936*6421ab1dSMatthew Dillon #define	WRR_PRI3_MASK                   0x1F000000
937*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_MASK           0x60000000
938*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_ALL            0x00000000
939*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_HI             0x20000000
940*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_HI2            0x40000000
941*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_NONE           0x60000000
942*6421ab1dSMatthew Dillon #define	WRR_PRI0_SHIFT                  0
943*6421ab1dSMatthew Dillon #define	WRR_PRI1_SHIFT                  8
944*6421ab1dSMatthew Dillon #define	WRR_PRI2_SHIFT                  16
945*6421ab1dSMatthew Dillon #define	WRR_PRI3_SHIFT                  24
946*6421ab1dSMatthew Dillon #define	WRR_PRI_DEFAULT                 4
947*6421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_SHIFT          29
948*6421ab1dSMatthew Dillon 
949*6421ab1dSMatthew Dillon #define	ALC_HQTD_CFG                    0x193C
950*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q1_BURST_MASK          0x0000000F
951*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q2_BURST_MASK          0x000000F0
952*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q3_BURST_MASK          0x00000F00
953*6421ab1dSMatthew Dillon #define	HQTD_CFG_BURST_ENB              0x80000000
954*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q1_BURST_SHIFT         0
955*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q2_BURST_SHIFT         4
956*6421ab1dSMatthew Dillon #define	HQTD_CFG_Q3_BURST_SHIFT         8
957*6421ab1dSMatthew Dillon 
958*6421ab1dSMatthew Dillon #define	ALC_MISC                        0x19C0
959*6421ab1dSMatthew Dillon #define	MISC_INTNLOSC_OPEN              0x00000008
960*6421ab1dSMatthew Dillon #define	MISC_ISO_ENB                    0x00001000
961*6421ab1dSMatthew Dillon #define	MISC_PSW_OCP_MASK               0x00E00000
962*6421ab1dSMatthew Dillon #define	MISC_PSW_OCP_SHIFT              21
963*6421ab1dSMatthew Dillon #define	MISC_PSW_OCP_DEFAULT            7
964*6421ab1dSMatthew Dillon 
965*6421ab1dSMatthew Dillon #define	ALC_MISC2                       0x19C8
966*6421ab1dSMatthew Dillon #define	MISC2_CALB_START                0x00000001
967*6421ab1dSMatthew Dillon 
968*6421ab1dSMatthew Dillon #define	ALC_MISC3                       0x19CC
969*6421ab1dSMatthew Dillon #define	MISC3_25M_NOTO_INTNL            0x00000001
970*6421ab1dSMatthew Dillon #define	MISC3_25M_BY_SW                 0x00000002
971*6421ab1dSMatthew Dillon 
972bbf76eecSMatthew Dillon #define	ALC_MII_DBG_ADDR		0x1D
973bbf76eecSMatthew Dillon #define	ALC_MII_DBG_DATA		0x1E
974bbf76eecSMatthew Dillon 
975bbf76eecSMatthew Dillon #define	MII_ANA_CFG0			0x00
976bbf76eecSMatthew Dillon #define	ANA_RESTART_CAL			0x0001
977bbf76eecSMatthew Dillon #define	ANA_MANUL_SWICH_ON_MASK		0x001E
978bbf76eecSMatthew Dillon #define	ANA_MAN_ENABLE			0x0020
979bbf76eecSMatthew Dillon #define	ANA_SEL_HSP			0x0040
980bbf76eecSMatthew Dillon #define	ANA_EN_HB			0x0080
981bbf76eecSMatthew Dillon #define	ANA_EN_HBIAS			0x0100
982bbf76eecSMatthew Dillon #define	ANA_OEN_125M			0x0200
983bbf76eecSMatthew Dillon #define	ANA_EN_LCKDT			0x0400
984bbf76eecSMatthew Dillon #define	ANA_LCKDT_PHY			0x0800
985bbf76eecSMatthew Dillon #define	ANA_AFE_MODE			0x1000
986bbf76eecSMatthew Dillon #define	ANA_VCO_SLOW			0x2000
987bbf76eecSMatthew Dillon #define	ANA_VCO_FAST			0x4000
988bbf76eecSMatthew Dillon #define	ANA_SEL_CLK125M_DSP		0x8000
989bbf76eecSMatthew Dillon #define	ANA_MANUL_SWICH_ON_SHIFT	1
990bbf76eecSMatthew Dillon 
991*6421ab1dSMatthew Dillon #define	MII_DBG_ANACTL			0x00
992*6421ab1dSMatthew Dillon #define	DBG_ANACTL_DEFAULT		0x02EF
993*6421ab1dSMatthew Dillon 
994bbf76eecSMatthew Dillon #define	MII_ANA_CFG4			0x04
995bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_MASK		0x0F
996bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_3_MASK		0x000F
997bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_2_MASK		0x00F0
998bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_1_MASK		0x0F00
999bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_0_MASK		0xF000
1000bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_3_SHIFT		0
1001bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_2_SHIFT		4
1002bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_1_SHIFT		8
1003bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_0_SHIFT		12
1004bbf76eecSMatthew Dillon 
1005*6421ab1dSMatthew Dillon #define	MII_DBG_SYSMODCTL               0x04
1006*6421ab1dSMatthew Dillon #define	DBG_SYSMODCTL_DEFAULT           0xBB8B
1007*6421ab1dSMatthew Dillon 
1008bbf76eecSMatthew Dillon #define	MII_ANA_CFG5			0x05
1009bbf76eecSMatthew Dillon #define	ANA_SERDES_CDR_BW_MASK		0x0003
1010bbf76eecSMatthew Dillon #define	ANA_MS_PAD_DBG			0x0004
1011bbf76eecSMatthew Dillon #define	ANA_SPEEDUP_DBG			0x0008
1012bbf76eecSMatthew Dillon #define	ANA_SERDES_TH_LOS_MASK		0x0030
1013bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_DEEM		0x0040
1014bbf76eecSMatthew Dillon #define	ANA_SERDES_TXELECIDLE		0x0080
1015bbf76eecSMatthew Dillon #define	ANA_SERDES_BEACON		0x0100
1016bbf76eecSMatthew Dillon #define	ANA_SERDES_HALFTXDR		0x0200
1017bbf76eecSMatthew Dillon #define	ANA_SERDES_SEL_HSP		0x0400
1018bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_PLL		0x0800
1019bbf76eecSMatthew Dillon #define	ANA_SERDES_EN			0x1000
1020bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_LCKDT		0x2000
1021bbf76eecSMatthew Dillon #define	ANA_SERDES_CDR_BW_SHIFT		0
1022bbf76eecSMatthew Dillon #define	ANA_SERDES_TH_LOS_SHIFT		4
1023bbf76eecSMatthew Dillon 
1024*6421ab1dSMatthew Dillon #define	MII_DBG_SRDSYSMOD               0x05
1025*6421ab1dSMatthew Dillon #define	DBG_SRDSYSMOD_DEFAULT           0x2C46
1026*6421ab1dSMatthew Dillon 
1027bbf76eecSMatthew Dillon #define	MII_ANA_CFG11			0x0B
1028bbf76eecSMatthew Dillon #define	ANA_PS_HIB_EN			0x8000
1029bbf76eecSMatthew Dillon 
1030*6421ab1dSMatthew Dillon #define	MII_DBG_HIBNEG                  0x0B
1031*6421ab1dSMatthew Dillon #define	DBG_HIBNEG_HIB_PULSE            0x1000
1032*6421ab1dSMatthew Dillon #define	DBG_HIBNEG_PSHIB_EN             0x8000
1033*6421ab1dSMatthew Dillon #define	DBG_HIBNEG_DEFAULT              0xBC40
1034*6421ab1dSMatthew Dillon 
1035bbf76eecSMatthew Dillon #define	MII_ANA_CFG18			0x12
1036bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_01MASK	0x0003
1037bbf76eecSMatthew Dillon #define	ANA_LOOP_SEL_10BT		0x0004
1038bbf76eecSMatthew Dillon #define	ANA_RGMII_MODE_SW		0x0008
1039bbf76eecSMatthew Dillon #define	ANA_EN_LONGECABLE		0x0010
1040bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_2		0x0020
1041bbf76eecSMatthew Dillon #define	ANA_EN_10BT_IDLE		0x0400
1042bbf76eecSMatthew Dillon #define	ANA_EN_MASK_TB			0x0800
1043bbf76eecSMatthew Dillon #define	ANA_TRIGGER_SEL_TIMER_MASK	0x3000
1044bbf76eecSMatthew Dillon #define	ANA_INTERVAL_SEL_TIMER_MASK	0xC000
1045bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_01SHIFT	0
1046bbf76eecSMatthew Dillon #define	ANA_TRIGGER_SEL_TIMER_SHIFT	12
1047bbf76eecSMatthew Dillon #define	ANA_INTERVAL_SEL_TIMER_SHIFT	14
1048bbf76eecSMatthew Dillon 
1049*6421ab1dSMatthew Dillon #define	MII_DBG_TST10BTCFG              0x12
1050*6421ab1dSMatthew Dillon #define	DBG_TST10BTCFG_DEFAULT          0x4C04
1051*6421ab1dSMatthew Dillon 
1052*6421ab1dSMatthew Dillon #define	MII_DBG_AZ_ANADECT              0x15
1053*6421ab1dSMatthew Dillon #define	DBG_AZ_ANADECT_DEFAULT          0x3220
1054*6421ab1dSMatthew Dillon #define	DBG_AZ_ANADECT_LONG             0x3210
1055*6421ab1dSMatthew Dillon 
1056*6421ab1dSMatthew Dillon #define	MII_DBG_MSE16DB                 0x18
1057*6421ab1dSMatthew Dillon #define	DBG_MSE16DB_UP                  0x05EA
1058*6421ab1dSMatthew Dillon #define	DBG_MSE16DB_DOWN                0x02EA
1059*6421ab1dSMatthew Dillon 
1060*6421ab1dSMatthew Dillon #define	MII_DBG_MSE20DB                 0x1C
1061*6421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_MASK             0x01FC
1062*6421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_DEFAULT          0x2E
1063*6421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_HI               0x54
1064*6421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_SHIFT            2
1065*6421ab1dSMatthew Dillon 
1066*6421ab1dSMatthew Dillon #define	MII_DBG_AGC                     0x23
1067*6421ab1dSMatthew Dillon #define	DBG_AGC_2_VGA_MASK              0x3F00
1068*6421ab1dSMatthew Dillon #define	DBG_AGC_2_VGA_SHIFT             8
1069*6421ab1dSMatthew Dillon #define	DBG_AGC_LONG1G_LIMT             40
1070*6421ab1dSMatthew Dillon #define	DBG_AGC_LONG100M_LIMT           44
1071*6421ab1dSMatthew Dillon 
1072bbf76eecSMatthew Dillon #define	MII_ANA_CFG41			0x29
1073bbf76eecSMatthew Dillon #define	ANA_TOP_PS_EN			0x8000
1074bbf76eecSMatthew Dillon 
1075*6421ab1dSMatthew Dillon #define	MII_DBG_LEGCYPS                 0x29
1076*6421ab1dSMatthew Dillon #define	DBG_LEGCYPS_ENB                 0x8000
1077*6421ab1dSMatthew Dillon #define	DBG_LEGCYPS_DEFAULT             0x129D
1078*6421ab1dSMatthew Dillon 
1079bbf76eecSMatthew Dillon #define	MII_ANA_CFG54			0x36
1080bbf76eecSMatthew Dillon #define	ANA_LONG_CABLE_TH_100_MASK	0x003F
1081bbf76eecSMatthew Dillon #define	ANA_DESERVED			0x0040
1082bbf76eecSMatthew Dillon #define	ANA_EN_LIT_CH			0x0080
1083bbf76eecSMatthew Dillon #define	ANA_SHORT_CABLE_TH_100_MASK	0x3F00
1084bbf76eecSMatthew Dillon #define	ANA_BP_BAD_LINK_ACCUM		0x4000
1085bbf76eecSMatthew Dillon #define	ANA_BP_SMALL_BW			0x8000
1086bbf76eecSMatthew Dillon #define	ANA_LONG_CABLE_TH_100_SHIFT	0
1087bbf76eecSMatthew Dillon #define	ANA_SHORT_CABLE_TH_100_SHIFT	8
1088bbf76eecSMatthew Dillon 
1089*6421ab1dSMatthew Dillon #define	MII_DBG_TST100BTCFG             0x36
1090*6421ab1dSMatthew Dillon #define	DBG_TST100BTCFG_DEFAULT         0xE12C
1091*6421ab1dSMatthew Dillon 
1092*6421ab1dSMatthew Dillon #define	MII_DBG_GREENCFG                0x3B
1093*6421ab1dSMatthew Dillon #define	DBG_GREENCFG_DEFAULT            0x7078
1094*6421ab1dSMatthew Dillon 
1095*6421ab1dSMatthew Dillon #define	MII_DBG_GREENCFG2               0x3D
1096*6421ab1dSMatthew Dillon #define	DBG_GREENCFG2_GATE_DFSE_EN      0x0080
1097*6421ab1dSMatthew Dillon #define	DBG_GREENCFG2_BP_GREEN          0x8000
1098*6421ab1dSMatthew Dillon 
1099*6421ab1dSMatthew Dillon /* Device addr 3 */
1100*6421ab1dSMatthew Dillon #define	MII_EXT_PCS                     3
1101*6421ab1dSMatthew Dillon 
1102*6421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL3                 0x8003
1103*6421ab1dSMatthew Dillon #define	EXT_CLDCTL3_BP_CABLE1TH_DET_GT  0x8000
1104*6421ab1dSMatthew Dillon 
1105*6421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL5                 0x8005
1106*6421ab1dSMatthew Dillon #define	EXT_CLDCTL5_BP_VD_HLFBIAS       0x4000
1107*6421ab1dSMatthew Dillon 
1108*6421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL6                 0x8006
1109*6421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_MASK        0x00FF
1110*6421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHIFT       0
1111*6421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHORT1G     116
1112*6421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHORT100M   152
1113*6421ab1dSMatthew Dillon 
1114*6421ab1dSMatthew Dillon #define	MII_EXT_VDRVBIAS                0x8062
1115*6421ab1dSMatthew Dillon #define	EXT_VDRVBIAS_DEFAULT            3
1116*6421ab1dSMatthew Dillon 
1117*6421ab1dSMatthew Dillon /* Device addr 7 */
1118*6421ab1dSMatthew Dillon #define	MII_EXT_ANEG                    7
1119*6421ab1dSMatthew Dillon 
1120*6421ab1dSMatthew Dillon #define	MII_EXT_ANEG_LOCAL_EEEADV       0x3C
1121*6421ab1dSMatthew Dillon #define	ANEG_LOCA_EEEADV_100BT          0x0002
1122*6421ab1dSMatthew Dillon #define	ANEG_LOCA_EEEADV_1000BT         0x0004
1123*6421ab1dSMatthew Dillon 
1124*6421ab1dSMatthew Dillon #define	MII_EXT_ANEG_AFE                0x801A
1125*6421ab1dSMatthew Dillon #define	ANEG_AFEE_10BT_100M_TH          0x0040
1126*6421ab1dSMatthew Dillon 
1127*6421ab1dSMatthew Dillon #define	MII_EXT_ANEG_S3DIG10            0x8023
1128*6421ab1dSMatthew Dillon #define	ANEG_S3DIG10_SL                 0x0001
1129*6421ab1dSMatthew Dillon #define	ANEG_S3DIG10_DEFAULT            0
1130*6421ab1dSMatthew Dillon 
1131*6421ab1dSMatthew Dillon #define	MII_EXT_ANEG_NLP78              0x8027
1132*6421ab1dSMatthew Dillon #define	ANEG_NLP78_120M_DEFAULT         0x8A05
1133*6421ab1dSMatthew Dillon 
1134bbf76eecSMatthew Dillon /* Statistics counters collected by the MAC. */
1135bbf76eecSMatthew Dillon struct smb {
1136bbf76eecSMatthew Dillon 	/* Rx stats. */
1137bbf76eecSMatthew Dillon 	uint32_t rx_frames;
1138bbf76eecSMatthew Dillon 	uint32_t rx_bcast_frames;
1139bbf76eecSMatthew Dillon 	uint32_t rx_mcast_frames;
1140bbf76eecSMatthew Dillon 	uint32_t rx_pause_frames;
1141bbf76eecSMatthew Dillon 	uint32_t rx_control_frames;
1142bbf76eecSMatthew Dillon 	uint32_t rx_crcerrs;
1143bbf76eecSMatthew Dillon 	uint32_t rx_lenerrs;
1144bbf76eecSMatthew Dillon 	uint32_t rx_bytes;
1145bbf76eecSMatthew Dillon 	uint32_t rx_runts;
1146bbf76eecSMatthew Dillon 	uint32_t rx_fragments;
1147bbf76eecSMatthew Dillon 	uint32_t rx_pkts_64;
1148bbf76eecSMatthew Dillon 	uint32_t rx_pkts_65_127;
1149bbf76eecSMatthew Dillon 	uint32_t rx_pkts_128_255;
1150bbf76eecSMatthew Dillon 	uint32_t rx_pkts_256_511;
1151bbf76eecSMatthew Dillon 	uint32_t rx_pkts_512_1023;
1152bbf76eecSMatthew Dillon 	uint32_t rx_pkts_1024_1518;
1153bbf76eecSMatthew Dillon 	uint32_t rx_pkts_1519_max;
1154bbf76eecSMatthew Dillon 	uint32_t rx_pkts_truncated;
1155bbf76eecSMatthew Dillon 	uint32_t rx_fifo_oflows;
1156bbf76eecSMatthew Dillon 	uint32_t rx_rrs_errs;
1157bbf76eecSMatthew Dillon 	uint32_t rx_alignerrs;
1158bbf76eecSMatthew Dillon 	uint32_t rx_bcast_bytes;
1159bbf76eecSMatthew Dillon 	uint32_t rx_mcast_bytes;
1160bbf76eecSMatthew Dillon 	uint32_t rx_pkts_filtered;
1161bbf76eecSMatthew Dillon 	/* Tx stats. */
1162bbf76eecSMatthew Dillon 	uint32_t tx_frames;
1163bbf76eecSMatthew Dillon 	uint32_t tx_bcast_frames;
1164bbf76eecSMatthew Dillon 	uint32_t tx_mcast_frames;
1165bbf76eecSMatthew Dillon 	uint32_t tx_pause_frames;
1166bbf76eecSMatthew Dillon 	uint32_t tx_excess_defer;
1167bbf76eecSMatthew Dillon 	uint32_t tx_control_frames;
1168bbf76eecSMatthew Dillon 	uint32_t tx_deferred;
1169bbf76eecSMatthew Dillon 	uint32_t tx_bytes;
1170bbf76eecSMatthew Dillon 	uint32_t tx_pkts_64;
1171bbf76eecSMatthew Dillon 	uint32_t tx_pkts_65_127;
1172bbf76eecSMatthew Dillon 	uint32_t tx_pkts_128_255;
1173bbf76eecSMatthew Dillon 	uint32_t tx_pkts_256_511;
1174bbf76eecSMatthew Dillon 	uint32_t tx_pkts_512_1023;
1175bbf76eecSMatthew Dillon 	uint32_t tx_pkts_1024_1518;
1176bbf76eecSMatthew Dillon 	uint32_t tx_pkts_1519_max;
1177bbf76eecSMatthew Dillon 	uint32_t tx_single_colls;
1178bbf76eecSMatthew Dillon 	uint32_t tx_multi_colls;
1179bbf76eecSMatthew Dillon 	uint32_t tx_late_colls;
1180bbf76eecSMatthew Dillon 	uint32_t tx_excess_colls;
1181bbf76eecSMatthew Dillon 	uint32_t tx_underrun;
1182bbf76eecSMatthew Dillon 	uint32_t tx_desc_underrun;
1183bbf76eecSMatthew Dillon 	uint32_t tx_lenerrs;
1184bbf76eecSMatthew Dillon 	uint32_t tx_pkts_truncated;
1185bbf76eecSMatthew Dillon 	uint32_t tx_bcast_bytes;
1186bbf76eecSMatthew Dillon 	uint32_t tx_mcast_bytes;
1187bbf76eecSMatthew Dillon 	uint32_t updated;
1188bbf76eecSMatthew Dillon };
1189bbf76eecSMatthew Dillon 
1190bbf76eecSMatthew Dillon /* CMB(Coalesing message block) */
1191bbf76eecSMatthew Dillon struct cmb {
1192bbf76eecSMatthew Dillon 	uint32_t cons;
1193bbf76eecSMatthew Dillon };
1194bbf76eecSMatthew Dillon 
1195bbf76eecSMatthew Dillon /* Rx free descriptor */
1196bbf76eecSMatthew Dillon struct rx_desc {
1197bbf76eecSMatthew Dillon 	uint64_t addr;
1198bbf76eecSMatthew Dillon };
1199bbf76eecSMatthew Dillon 
1200bbf76eecSMatthew Dillon /* Rx return descriptor */
1201bbf76eecSMatthew Dillon struct rx_rdesc {
1202bbf76eecSMatthew Dillon 	uint32_t rdinfo;
1203bbf76eecSMatthew Dillon #define	RRD_CSUM_MASK			0x0000FFFF
1204bbf76eecSMatthew Dillon #define	RRD_RD_CNT_MASK			0x000F0000
1205bbf76eecSMatthew Dillon #define	RRD_RD_IDX_MASK			0xFFF00000
1206bbf76eecSMatthew Dillon #define	RRD_CSUM_SHIFT			0
1207bbf76eecSMatthew Dillon #define	RRD_RD_CNT_SHIFT		16
1208bbf76eecSMatthew Dillon #define	RRD_RD_IDX_SHIFT		20
1209bbf76eecSMatthew Dillon #define	RRD_CSUM(x)			\
1210bbf76eecSMatthew Dillon 	(((x) & RRD_CSUM_MASK) >> RRD_CSUM_SHIFT)
1211bbf76eecSMatthew Dillon #define	RRD_RD_CNT(x)			\
1212bbf76eecSMatthew Dillon 	(((x) & RRD_RD_CNT_MASK) >> RRD_RD_CNT_SHIFT)
1213bbf76eecSMatthew Dillon #define	RRD_RD_IDX(x)			\
1214bbf76eecSMatthew Dillon 	(((x) & RRD_RD_IDX_MASK) >> RRD_RD_IDX_SHIFT)
1215bbf76eecSMatthew Dillon 	uint32_t rss;
1216bbf76eecSMatthew Dillon 	uint32_t vtag;
1217bbf76eecSMatthew Dillon #define	RRD_VLAN_MASK			0x0000FFFF
1218bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN_MASK		0x00FF0000
1219bbf76eecSMatthew Dillon #define	RRD_HDS_MASK			0x03000000
1220bbf76eecSMatthew Dillon #define	RRD_HDS_NONE			0x00000000
1221bbf76eecSMatthew Dillon #define	RRD_HDS_HEAD			0x01000000
1222bbf76eecSMatthew Dillon #define	RRD_HDS_DATA			0x02000000
1223bbf76eecSMatthew Dillon #define	RRD_CPU_MASK			0x0C000000
1224bbf76eecSMatthew Dillon #define	RRD_HASH_FLAG_MASK		0xF0000000
1225bbf76eecSMatthew Dillon #define	RRD_VLAN_SHIFT			0
1226bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN_SHIFT		16
1227bbf76eecSMatthew Dillon #define	RRD_HDS_SHIFT			24
1228bbf76eecSMatthew Dillon #define	RRD_CPU_SHIFT			26
1229bbf76eecSMatthew Dillon #define	RRD_HASH_FLAG_SHIFT		28
1230bbf76eecSMatthew Dillon #define	RRD_VLAN(x)			\
1231bbf76eecSMatthew Dillon 	(((x) & RRD_VLAN_MASK) >> RRD_VLAN_SHIFT)
1232bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN(x)			\
1233bbf76eecSMatthew Dillon 	(((x) & RRD_HEAD_LEN_MASK) >> RRD_HEAD_LEN_SHIFT)
1234bbf76eecSMatthew Dillon #define	RRD_CPU(x)			\
1235bbf76eecSMatthew Dillon 	(((x) & RRD_CPU_MASK) >> RRD_CPU_SHIFT)
1236bbf76eecSMatthew Dillon 	uint32_t status;
1237bbf76eecSMatthew Dillon #define	RRD_LEN_MASK			0x00003FFF
1238bbf76eecSMatthew Dillon #define	RRD_LEN_SHIFT			0
1239bbf76eecSMatthew Dillon #define	RRD_TCP_UDPCSUM_NOK		0x00004000
1240bbf76eecSMatthew Dillon #define	RRD_IPCSUM_NOK			0x00008000
1241bbf76eecSMatthew Dillon #define	RRD_VLAN_TAG			0x00010000
1242bbf76eecSMatthew Dillon #define	RRD_PROTO_MASK			0x000E0000
1243bbf76eecSMatthew Dillon #define	RRD_PROTO_IPV4			0x00020000
1244bbf76eecSMatthew Dillon #define	RRD_PROTO_IPV6			0x000C0000
1245bbf76eecSMatthew Dillon #define	RRD_ERR_SUM			0x00100000
1246bbf76eecSMatthew Dillon #define	RRD_ERR_CRC			0x00200000
1247bbf76eecSMatthew Dillon #define	RRD_ERR_ALIGN			0x00400000
1248bbf76eecSMatthew Dillon #define	RRD_ERR_TRUNC			0x00800000
1249bbf76eecSMatthew Dillon #define	RRD_ERR_RUNT			0x01000000
1250bbf76eecSMatthew Dillon #define	RRD_ERR_ICMP			0x02000000
1251bbf76eecSMatthew Dillon #define	RRD_BCAST			0x04000000
1252bbf76eecSMatthew Dillon #define	RRD_MCAST			0x08000000
1253bbf76eecSMatthew Dillon #define	RRD_SNAP_LLC			0x10000000
1254bbf76eecSMatthew Dillon #define	RRD_ETHER			0x00000000
1255bbf76eecSMatthew Dillon #define	RRD_FIFO_FULL			0x20000000
1256bbf76eecSMatthew Dillon #define	RRD_ERR_LENGTH			0x40000000
1257bbf76eecSMatthew Dillon #define	RRD_VALID			0x80000000
1258bbf76eecSMatthew Dillon #define	RRD_BYTES(x)			\
1259bbf76eecSMatthew Dillon 	(((x) & RRD_LEN_MASK) >> RRD_LEN_SHIFT)
1260bbf76eecSMatthew Dillon #define	RRD_IPV4(x)			\
1261bbf76eecSMatthew Dillon 	(((x) & RRD_PROTO_MASK) == RRD_PROTO_IPV4)
1262bbf76eecSMatthew Dillon };
1263bbf76eecSMatthew Dillon 
1264bbf76eecSMatthew Dillon /* Tx descriptor */
1265bbf76eecSMatthew Dillon struct tx_desc {
1266bbf76eecSMatthew Dillon 	uint32_t len;
1267bbf76eecSMatthew Dillon #define	TD_BUFLEN_MASK			0x00003FFF
1268bbf76eecSMatthew Dillon #define	TD_VLAN_MASK			0xFFFF0000
1269bbf76eecSMatthew Dillon #define	TD_BUFLEN_SHIFT			0
1270bbf76eecSMatthew Dillon #define	TX_BYTES(x)			\
1271bbf76eecSMatthew Dillon 	(((x) << TD_BUFLEN_SHIFT) & TD_BUFLEN_MASK)
1272bbf76eecSMatthew Dillon #define	TD_VLAN_SHIFT			16
1273bbf76eecSMatthew Dillon 	uint32_t flags;
1274bbf76eecSMatthew Dillon #define	TD_L4HDR_OFFSET_MASK		0x000000FF	/* byte unit */
1275bbf76eecSMatthew Dillon #define	TD_TCPHDR_OFFSET_MASK		0x000000FF	/* byte unit */
1276bbf76eecSMatthew Dillon #define	TD_PLOAD_OFFSET_MASK		0x000000FF	/* 2 bytes unit */
1277bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM			0x00000100
1278bbf76eecSMatthew Dillon #define	TD_IPCSUM			0x00000200
1279bbf76eecSMatthew Dillon #define	TD_TCPCSUM			0x00000400
1280bbf76eecSMatthew Dillon #define	TD_UDPCSUM			0x00000800
1281bbf76eecSMatthew Dillon #define	TD_TSO				0x00001000
1282bbf76eecSMatthew Dillon #define	TD_TSO_DESCV1			0x00000000
1283bbf76eecSMatthew Dillon #define	TD_TSO_DESCV2			0x00002000
1284bbf76eecSMatthew Dillon #define	TD_CON_VLAN_TAG			0x00004000
1285bbf76eecSMatthew Dillon #define	TD_INS_VLAN_TAG			0x00008000
1286bbf76eecSMatthew Dillon #define	TD_IPV4_DESCV2			0x00010000
1287bbf76eecSMatthew Dillon #define	TD_LLC_SNAP			0x00020000
1288bbf76eecSMatthew Dillon #define	TD_ETHERNET			0x00000000
1289bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_OFFSET_MASK	0x03FC0000	/* 2 bytes unit */
1290bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_EVEN_PAD		0x40000000
1291bbf76eecSMatthew Dillon #define	TD_MSS_MASK			0x7FFC0000
1292bbf76eecSMatthew Dillon #define	TD_EOP				0x80000000
1293bbf76eecSMatthew Dillon #define	TD_L4HDR_OFFSET_SHIFT		0
1294bbf76eecSMatthew Dillon #define	TD_TCPHDR_OFFSET_SHIFT		0
1295bbf76eecSMatthew Dillon #define	TD_PLOAD_OFFSET_SHIFT		0
1296bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_OFFSET_SHIFT	18
1297bbf76eecSMatthew Dillon #define	TD_MSS_SHIFT			18
1298bbf76eecSMatthew Dillon 	uint64_t addr;
1299bbf76eecSMatthew Dillon };
1300bbf76eecSMatthew Dillon 
1301bbf76eecSMatthew Dillon #endif	/* _IF_ALCREG_H */
1302