xref: /dflybsd-src/sys/dev/netif/alc/if_alcreg.h (revision d2a0039676c3d65066e3e2c8b1912e011bfc9139)
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_AR8132		0x1062	/* L2C */
4276375588SSepherosa Ziehau #define	DEVICEID_ATHEROS_AR8131		0x1063	/* L1C */
43cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8151		0x1073	/* L1D V1.0 */
44cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8151_V2	0x1083	/* L1D V2.0 */
4576375588SSepherosa Ziehau #define DEVICEID_ATHEROS_AR8162		0x1090
4676375588SSepherosa Ziehau #define DEVICEID_ATHEROS_AR8161		0x1091
4776375588SSepherosa Ziehau #define DEVICEID_ATHEROS_AR8172		0x10A0
4876375588SSepherosa Ziehau #define DEVICEID_ATHEROS_AR8171		0x10A1
49cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8152_B	0x2060	/* L2C V1.1 */
50cffbd125SMatthew Dillon #define DEVICEID_ATHEROS_AR8152_B2	0x2062	/* L2C V2.0 */
516421ab1dSMatthew Dillon #define DEVICEID_ATHEROS_E2200		0xE091
5276375588SSepherosa Ziehau #define DEVICEID_ATHEROS_E2400		0xE0A1
53*d2a00396SSepherosa Ziehau #define DEVICEID_ATHEROS_E2500		0xE0B1
54cffbd125SMatthew Dillon 
55cffbd125SMatthew Dillon #define ATHEROS_AR8152_B_V10		0xC0
56cffbd125SMatthew Dillon #define ATHEROS_AR8152_B_V11		0xC1
57bbf76eecSMatthew Dillon 
58bbf76eecSMatthew Dillon /*
596421ab1dSMatthew Dillon  * Atheros AR816x/AR817x revisions
606421ab1dSMatthew Dillon  */
616421ab1dSMatthew Dillon #define        AR816X_REV_A0                   0
626421ab1dSMatthew Dillon #define        AR816X_REV_A1                   1
636421ab1dSMatthew Dillon #define        AR816X_REV_B0                   2
646421ab1dSMatthew Dillon #define        AR816X_REV_C0                   3
656421ab1dSMatthew Dillon 
666421ab1dSMatthew Dillon #define        AR816X_REV_SHIFT                3
676421ab1dSMatthew Dillon #define        AR816X_REV(x)                   ((x) >> AR816X_REV_SHIFT)
686421ab1dSMatthew Dillon 
696421ab1dSMatthew Dillon /*
70bbf76eecSMatthew Dillon  * From FreeBSD dev/pci/pcireg.h
71bbf76eecSMatthew Dillon  *
72bbf76eecSMatthew Dillon  * PCIM_xxx: mask to locate subfield in register
73bbf76eecSMatthew Dillon  * PCIR_xxx: config register offset
74bbf76eecSMatthew Dillon  */
75bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_DEVICE_CTL		0x8
76bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_LINK_CAP		0xc
77bbf76eecSMatthew Dillon #define	PCIR_EXPRESS_LINK_CTL		0x10
78bbf76eecSMatthew Dillon #define PCIM_EXP_CTL_MAX_READ_REQUEST	0x7000
79bbf76eecSMatthew Dillon #define	PCIM_EXP_CTL_MAX_PAYLOAD	0x00e0
80bbf76eecSMatthew Dillon #define PCIM_LINK_CAP_ASPM		0x00000c00
81bbf76eecSMatthew Dillon 
82bbf76eecSMatthew Dillon /* 0x0000 - 0x02FF : PCIe configuration space */
83bbf76eecSMatthew Dillon 
84bbf76eecSMatthew Dillon #define	ALC_PEX_UNC_ERR_SEV		0x10C
85bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_TRN		0x00000001
86bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_DLP		0x00000010
87bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_PSN_TLP		0x00001000
88bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_FCP		0x00002000
89bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_CPL_TO		0x00004000
90bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_CA		0x00008000
91bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_UC		0x00010000
92bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_ROV		0x00020000
93bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_MLFP		0x00040000
94bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_ECRC		0x00080000
95bbf76eecSMatthew Dillon #define	PEX_UNC_ERR_SEV_UR		0x00100000
96bbf76eecSMatthew Dillon 
976421ab1dSMatthew Dillon #define        ALC_EEPROM_LD                   0x204   /* AR816x */
986421ab1dSMatthew Dillon #define        EEPROM_LD_START                 0x00000001
996421ab1dSMatthew Dillon #define        EEPROM_LD_IDLE                  0x00000010
1006421ab1dSMatthew Dillon #define        EEPROM_LD_DONE                  0x00000000
1016421ab1dSMatthew Dillon #define        EEPROM_LD_PROGRESS              0x00000020
1026421ab1dSMatthew Dillon #define        EEPROM_LD_EXIST                 0x00000100
1036421ab1dSMatthew Dillon #define        EEPROM_LD_EEPROM_EXIST          0x00000200
1046421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_EXIST           0x00000400
1056421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_END_ADDR_MASK   0x03FF0000
1066421ab1dSMatthew Dillon #define        EEPROM_LD_FLASH_END_ADDR_SHIFT  16
1076421ab1dSMatthew Dillon 
108bbf76eecSMatthew Dillon #define	ALC_TWSI_CFG			0x218
109bbf76eecSMatthew Dillon #define	TWSI_CFG_SW_LD_START		0x00000800
110bbf76eecSMatthew Dillon #define	TWSI_CFG_HW_LD_START		0x00001000
111bbf76eecSMatthew Dillon #define	TWSI_CFG_LD_EXIST		0x00400000
112bbf76eecSMatthew Dillon 
1136421ab1dSMatthew Dillon #define        ALC_SLD                         0x218   /* AR816x */
1146421ab1dSMatthew Dillon #define        SLD_START                       0x00000800
1156421ab1dSMatthew Dillon #define        SLD_PROGRESS                    0x00001000
1166421ab1dSMatthew Dillon #define        SLD_IDLE                        0x00002000
1176421ab1dSMatthew Dillon #define        SLD_SLVADDR_MASK                0x007F0000
1186421ab1dSMatthew Dillon #define        SLD_EXIST                       0x00800000
1196421ab1dSMatthew Dillon #define        SLD_FREQ_MASK                   0x03000000
1206421ab1dSMatthew Dillon #define        SLD_FREQ_100K                   0x00000000
1216421ab1dSMatthew Dillon #define        SLD_FREQ_200K                   0x01000000
1226421ab1dSMatthew Dillon #define        SLD_FREQ_300K                   0x02000000
1236421ab1dSMatthew Dillon #define        SLD_FREQ_400K                   0x03000000
1246421ab1dSMatthew Dillon 
125bbf76eecSMatthew Dillon #define	ALC_PCIE_PHYMISC		0x1000
126bbf76eecSMatthew Dillon #define	PCIE_PHYMISC_FORCE_RCV_DET	0x00000004
127bbf76eecSMatthew Dillon 
128cffbd125SMatthew Dillon #define ALC_PCIE_PHYMISC2		0x1004
129cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_CDR_MASK	0x00030000
130cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_TH_MASK	0x000C0000
131cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_CDR_SHIFT	16
132cffbd125SMatthew Dillon #define PCIE_PHYMISC2_SERDES_TH_SHIFT	18
133cffbd125SMatthew Dillon 
1346421ab1dSMatthew Dillon #define        ALC_PDLL_TRNS1                  0x1104
1356421ab1dSMatthew Dillon #define        PDLL_TRNS1_D3PLLOFF_ENB         0x00000800
1366421ab1dSMatthew Dillon 
137bbf76eecSMatthew Dillon #define	ALC_TWSI_DEBUG			0x1108
138bbf76eecSMatthew Dillon #define	TWSI_DEBUG_DEV_EXIST		0x20000000
139bbf76eecSMatthew Dillon 
140bbf76eecSMatthew Dillon #define	ALC_EEPROM_CFG			0x12C0
141bbf76eecSMatthew Dillon #define	EEPROM_CFG_DATA_HI_MASK		0x0000FFFF
142bbf76eecSMatthew Dillon #define	EEPROM_CFG_ADDR_MASK		0x03FF0000
143bbf76eecSMatthew Dillon #define	EEPROM_CFG_ACK			0x40000000
144bbf76eecSMatthew Dillon #define	EEPROM_CFG_RW			0x80000000
145bbf76eecSMatthew Dillon #define	EEPROM_CFG_DATA_HI_SHIFT	0
146bbf76eecSMatthew Dillon #define	EEPROM_CFG_ADDR_SHIFT		16
147bbf76eecSMatthew Dillon 
148bbf76eecSMatthew Dillon #define	ALC_EEPROM_DATA_LO		0x12C4
149bbf76eecSMatthew Dillon 
150bbf76eecSMatthew Dillon #define	ALC_OPT_CFG			0x12F0
151bbf76eecSMatthew Dillon #define	OPT_CFG_CLK_ENB			0x00000002
152bbf76eecSMatthew Dillon 
153bbf76eecSMatthew Dillon #define	ALC_PM_CFG			0x12F8
154bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_ENB		0x00000001
155bbf76eecSMatthew Dillon #define	PM_CFG_RBER_ENB			0x00000002
156bbf76eecSMatthew Dillon #define	PM_CFG_CLK_REQ_ENB		0x00000004
157bbf76eecSMatthew Dillon #define	PM_CFG_ASPM_L1_ENB		0x00000008
158bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_L1_ENB		0x00000010
159bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_PLL_L1_ENB	0x00000020
160bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_PD_EX_L1		0x00000040
161bbf76eecSMatthew Dillon #define	PM_CFG_SERDES_BUDS_RX_L1_ENB	0x00000080
162bbf76eecSMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_MASK	0x00000F00
1636421ab1dSMatthew Dillon #define	PM_CFG_RX_L1_AFTER_L0S		0x00000800
164bbf76eecSMatthew Dillon #define	PM_CFG_ASPM_L0S_ENB		0x00001000
165bbf76eecSMatthew Dillon #define	PM_CFG_CLK_SWH_L1		0x00002000
166bbf76eecSMatthew Dillon #define	PM_CFG_CLK_PWM_VER1_1		0x00004000
167bbf76eecSMatthew Dillon #define	PM_CFG_PCIE_RECV		0x00008000
168bbf76eecSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_MASK	0x000F0000
1696421ab1dSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_816X_MASK	0x00070000
1706421ab1dSMatthew Dillon #define	PM_CFG_TX_L1_AFTER_L0S		0x00080000
171bbf76eecSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_MASK	0x00F00000
172a45385feSMichael Neumann #define	PM_CFG_LCKDET_TIMER_MASK	0x0F000000
173cffbd125SMatthew Dillon #define PM_CFG_EN_BUFS_RX_L0S		0x10000000
174cffbd125SMatthew Dillon #define PM_CFG_SA_DLY_ENB		0x20000000
175bbf76eecSMatthew Dillon #define	PM_CFG_MAC_ASPM_CHK		0x40000000
176bbf76eecSMatthew Dillon #define	PM_CFG_HOTRST			0x80000000
177bbf76eecSMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_SHIFT	8
178bbf76eecSMatthew Dillon #define	PM_CFG_L1_ENTRY_TIMER_SHIFT	16
179bbf76eecSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_SHIFT	20
180bbf76eecSMatthew Dillon #define	PM_CFG_LCKDET_TIMER_SHIFT	24
181bbf76eecSMatthew Dillon 
182cffbd125SMatthew Dillon #define	PM_CFG_L0S_ENTRY_TIMER_DEFAULT	6
183a45385feSMichael Neumann #define PM_CFG_L1_ENTRY_TIMER_DEFAULT	1
1846421ab1dSMatthew Dillon #define PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT      4
185a45385feSMichael Neumann #define PM_CFG_LCKDET_TIMER_DEFAULT	12
186a45385feSMichael Neumann #define PM_CFG_PM_REQ_TIMER_DEFAULT	12
1876421ab1dSMatthew Dillon #define	PM_CFG_PM_REQ_TIMER_816X_DEFAULT        15
188cffbd125SMatthew Dillon 
189cffbd125SMatthew Dillon #define ALC_LTSSM_ID_CFG		0x12FC
190cffbd125SMatthew Dillon #define LTSSM_ID_WRO_ENB		0x00001000
191cffbd125SMatthew Dillon 
192bbf76eecSMatthew Dillon #define	ALC_MASTER_CFG			0x1400
193bbf76eecSMatthew Dillon #define	MASTER_RESET			0x00000001
194cffbd125SMatthew Dillon #define MASTER_TEST_MODE_MASK		0x0000000C
195bbf76eecSMatthew Dillon #define	MASTER_BERT_START		0x00000010
1966421ab1dSMatthew Dillon #define MASTER_WAKEN_25M		0x00000020
197cffbd125SMatthew Dillon #define MASTER_OOB_DIS_OFF		0x00000040
198cffbd125SMatthew Dillon #define MASTER_SA_TIMER_ENB		0x00000080
199bbf76eecSMatthew Dillon #define	MASTER_MTIMER_ENB		0x00000100
200bbf76eecSMatthew Dillon #define	MASTER_MANUAL_INTR_ENB		0x00000200
201bbf76eecSMatthew Dillon #define	MASTER_IM_TX_TIMER_ENB		0x00000400
202bbf76eecSMatthew Dillon #define	MASTER_IM_RX_TIMER_ENB		0x00000800
203bbf76eecSMatthew Dillon #define	MASTER_CLK_SEL_DIS		0x00001000
204bbf76eecSMatthew Dillon #define	MASTER_CLK_SWH_MODE		0x00002000
205bbf76eecSMatthew Dillon #define	MASTER_INTR_RD_CLR		0x00004000
206bbf76eecSMatthew Dillon #define	MASTER_CHIP_REV_MASK		0x00FF0000
207bbf76eecSMatthew Dillon #define	MASTER_CHIP_ID_MASK		0x7F000000
208bbf76eecSMatthew Dillon #define	MASTER_OTP_SEL			0x80000000
209bbf76eecSMatthew Dillon #define	MASTER_TEST_MODE_SHIFT		2
210bbf76eecSMatthew Dillon #define	MASTER_CHIP_REV_SHIFT		16
211bbf76eecSMatthew Dillon #define	MASTER_CHIP_ID_SHIFT		24
212bbf76eecSMatthew Dillon 
213cffbd125SMatthew Dillon /* Number of ticks per usec for AR813x/AR815x. */
214bbf76eecSMatthew Dillon #define	ALC_TICK_USECS			2
215bbf76eecSMatthew Dillon #define	ALC_USECS(x)			((x) / ALC_TICK_USECS)
216bbf76eecSMatthew Dillon 
217bbf76eecSMatthew Dillon #define	ALC_MANUAL_TIMER		0x1404
218bbf76eecSMatthew Dillon 
219bbf76eecSMatthew Dillon #define	ALC_IM_TIMER			0x1408
220bbf76eecSMatthew Dillon #define	IM_TIMER_TX_MASK		0x0000FFFF
221bbf76eecSMatthew Dillon #define	IM_TIMER_RX_MASK		0xFFFF0000
222bbf76eecSMatthew Dillon #define	IM_TIMER_TX_SHIFT		0
223bbf76eecSMatthew Dillon #define	IM_TIMER_RX_SHIFT		16
224bbf76eecSMatthew Dillon #define	ALC_IM_TIMER_MIN		0
225bbf76eecSMatthew Dillon #define	ALC_IM_TIMER_MAX		130000	/* 130ms */
226bbf76eecSMatthew Dillon /*
227bbf76eecSMatthew Dillon  * 100us will ensure alc(4) wouldn't generate more than 10000 Rx
228bbf76eecSMatthew Dillon  * interrupts in a second.
229bbf76eecSMatthew Dillon  */
230bbf76eecSMatthew Dillon #define	ALC_IM_RX_TIMER_DEFAULT		100	/* 100us */
231bbf76eecSMatthew Dillon /*
232bbf76eecSMatthew Dillon  * alc(4) does not rely on Tx completion interrupts, so set it
233bbf76eecSMatthew Dillon  * somewhat large value to reduce Tx completion interrupts.
234bbf76eecSMatthew Dillon  */
235cffbd125SMatthew Dillon #define ALC_IM_TX_TIMER_DEFAULT		1000	/* 1ms */
236bbf76eecSMatthew Dillon 
2376421ab1dSMatthew Dillon #define ALC_GPHY_CFG                    0x140C  /* 16 bits, 32 bits on AR816x */
238bbf76eecSMatthew Dillon #define	GPHY_CFG_EXT_RESET		0x0001
239bbf76eecSMatthew Dillon #define	GPHY_CFG_RTL_MODE		0x0002
240bbf76eecSMatthew Dillon #define	GPHY_CFG_LED_MODE		0x0004
241bbf76eecSMatthew Dillon #define	GPHY_CFG_ANEG_NOW		0x0008
242bbf76eecSMatthew Dillon #define	GPHY_CFG_RECV_ANEG		0x0010
243bbf76eecSMatthew Dillon #define	GPHY_CFG_GATE_25M_ENB		0x0020
244bbf76eecSMatthew Dillon #define	GPHY_CFG_LPW_EXIT		0x0040
245bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_IDDQ		0x0080
246bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_IDDQ_DIS		0x0100
247bbf76eecSMatthew Dillon #define	GPHY_CFG_PCLK_SEL_DIS		0x0200
248bbf76eecSMatthew Dillon #define	GPHY_CFG_HIB_EN			0x0400
249bbf76eecSMatthew Dillon #define	GPHY_CFG_HIB_PULSE		0x0800
250bbf76eecSMatthew Dillon #define	GPHY_CFG_SEL_ANA_RESET		0x1000
251bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_PLL_ON		0x2000
252bbf76eecSMatthew Dillon #define	GPHY_CFG_PWDOWN_HW		0x4000
253bbf76eecSMatthew Dillon #define	GPHY_CFG_PHY_PLL_BYPASS		0x8000
2546421ab1dSMatthew Dillon #define GPHY_CFG_100AB_ENB		0x00020000
255bbf76eecSMatthew Dillon 
256bbf76eecSMatthew Dillon #define	ALC_IDLE_STATUS			0x1410
257bbf76eecSMatthew Dillon #define	IDLE_STATUS_RXMAC		0x00000001
258bbf76eecSMatthew Dillon #define	IDLE_STATUS_TXMAC		0x00000002
259bbf76eecSMatthew Dillon #define	IDLE_STATUS_RXQ			0x00000004
260bbf76eecSMatthew Dillon #define	IDLE_STATUS_TXQ			0x00000008
261bbf76eecSMatthew Dillon #define	IDLE_STATUS_DMARD		0x00000010
262bbf76eecSMatthew Dillon #define	IDLE_STATUS_DMAWR		0x00000020
263bbf76eecSMatthew Dillon #define	IDLE_STATUS_SMB			0x00000040
264bbf76eecSMatthew Dillon #define	IDLE_STATUS_CMB			0x00000080
265bbf76eecSMatthew Dillon 
266bbf76eecSMatthew Dillon #define	ALC_MDIO			0x1414
267bbf76eecSMatthew Dillon #define	MDIO_DATA_MASK			0x0000FFFF
268bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR_MASK		0x001F0000
269bbf76eecSMatthew Dillon #define	MDIO_OP_READ			0x00200000
270bbf76eecSMatthew Dillon #define	MDIO_OP_WRITE			0x00000000
271bbf76eecSMatthew Dillon #define	MDIO_SUP_PREAMBLE		0x00400000
272bbf76eecSMatthew Dillon #define	MDIO_OP_EXECUTE			0x00800000
273bbf76eecSMatthew Dillon #define	MDIO_CLK_25_4			0x00000000
274bbf76eecSMatthew Dillon #define	MDIO_CLK_25_6			0x02000000
275bbf76eecSMatthew Dillon #define	MDIO_CLK_25_8			0x03000000
276bbf76eecSMatthew Dillon #define	MDIO_CLK_25_10			0x04000000
277bbf76eecSMatthew Dillon #define	MDIO_CLK_25_14			0x05000000
278bbf76eecSMatthew Dillon #define	MDIO_CLK_25_20			0x06000000
2796421ab1dSMatthew Dillon #define MDIO_CLK_25_128			0x07000000
280bbf76eecSMatthew Dillon #define	MDIO_OP_BUSY			0x08000000
281bbf76eecSMatthew Dillon #define	MDIO_AP_ENB			0x10000000
2826421ab1dSMatthew Dillon #define MDIO_MODE_EXT			0x40000000
283bbf76eecSMatthew Dillon #define	MDIO_DATA_SHIFT			0
284bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR_SHIFT		16
285bbf76eecSMatthew Dillon 
286bbf76eecSMatthew Dillon #define	MDIO_REG_ADDR(x)	\
287bbf76eecSMatthew Dillon 	(((x) << MDIO_REG_ADDR_SHIFT) & MDIO_REG_ADDR_MASK)
288bbf76eecSMatthew Dillon /* Default PHY address. */
289bbf76eecSMatthew Dillon #define	ALC_PHY_ADDR			0
290bbf76eecSMatthew Dillon 
291bbf76eecSMatthew Dillon #define	ALC_PHY_STATUS			0x1418
292bbf76eecSMatthew Dillon #define	PHY_STATUS_RECV_ENB		0x00000001
293bbf76eecSMatthew Dillon #define	PHY_STATUS_GENERAL_MASK		0x0000FFFF
294bbf76eecSMatthew Dillon #define	PHY_STATUS_OE_PWSP_MASK		0x07FF0000
295bbf76eecSMatthew Dillon #define	PHY_STATUS_LPW_STATE		0x80000000
296bbf76eecSMatthew Dillon #define	PHY_STATIS_OE_PWSP_SHIFT	16
297bbf76eecSMatthew Dillon 
298bbf76eecSMatthew Dillon /* Packet memory BIST. */
299bbf76eecSMatthew Dillon #define	ALC_BIST0			0x141C
300bbf76eecSMatthew Dillon #define	BIST0_ENB			0x00000001
301bbf76eecSMatthew Dillon #define	BIST0_SRAM_FAIL			0x00000002
302bbf76eecSMatthew Dillon #define	BIST0_FUSE_FLAG			0x00000004
303bbf76eecSMatthew Dillon 
304bbf76eecSMatthew Dillon /* PCIe retry buffer BIST. */
305bbf76eecSMatthew Dillon #define	ALC_BIST1			0x1420
306bbf76eecSMatthew Dillon #define	BIST1_ENB			0x00000001
307bbf76eecSMatthew Dillon #define	BIST1_SRAM_FAIL			0x00000002
308bbf76eecSMatthew Dillon #define	BIST1_FUSE_FLAG			0x00000004
309bbf76eecSMatthew Dillon 
310bbf76eecSMatthew Dillon #define	ALC_SERDES_LOCK			0x1424
311bbf76eecSMatthew Dillon #define	SERDES_LOCK_DET			0x00000001
312bbf76eecSMatthew Dillon #define	SERDES_LOCK_DET_ENB		0x00000002
313cffbd125SMatthew Dillon #define SERDES_MAC_CLK_SLOWDOWN		0x00020000
314cffbd125SMatthew Dillon #define SERDES_PHY_CLK_SLOWDOWN		0x00040000
315bbf76eecSMatthew Dillon 
3166421ab1dSMatthew Dillon #define	ALC_LPI_CTL                     0x1440
3176421ab1dSMatthew Dillon #define	LPI_CTL_ENB                     0x00000001
3186421ab1dSMatthew Dillon 
3196421ab1dSMatthew Dillon #define	ALC_EXT_MDIO                    0x1448
3206421ab1dSMatthew Dillon #define	EXT_MDIO_REG_MASK               0x0000FFFF
3216421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR_MASK           0x001F0000
3226421ab1dSMatthew Dillon #define	EXT_MDIO_REG_SHIFT              0
3236421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR_SHIFT          16
3246421ab1dSMatthew Dillon 
3256421ab1dSMatthew Dillon #define	EXT_MDIO_REG(x)         \
3266421ab1dSMatthew Dillon 	(((x) << EXT_MDIO_REG_SHIFT) & EXT_MDIO_REG_MASK)
3276421ab1dSMatthew Dillon #define	EXT_MDIO_DEVADDR(x)     \
3286421ab1dSMatthew Dillon 	(((x) << EXT_MDIO_DEVADDR_SHIFT) & EXT_MDIO_DEVADDR_MASK)
3296421ab1dSMatthew Dillon 
3306421ab1dSMatthew Dillon #define	ALC_IDLE_DECISN_TIMER           0x1474
3316421ab1dSMatthew Dillon #define	IDLE_DECISN_TIMER_DEFAULT_1MS   0x400
3326421ab1dSMatthew Dillon 
333bbf76eecSMatthew Dillon #define	ALC_MAC_CFG			0x1480
334bbf76eecSMatthew Dillon #define	MAC_CFG_TX_ENB			0x00000001
335bbf76eecSMatthew Dillon #define	MAC_CFG_RX_ENB			0x00000002
336bbf76eecSMatthew Dillon #define	MAC_CFG_TX_FC			0x00000004
337bbf76eecSMatthew Dillon #define	MAC_CFG_RX_FC			0x00000008
338bbf76eecSMatthew Dillon #define	MAC_CFG_LOOP			0x00000010
339bbf76eecSMatthew Dillon #define	MAC_CFG_FULL_DUPLEX		0x00000020
340bbf76eecSMatthew Dillon #define	MAC_CFG_TX_CRC_ENB		0x00000040
341bbf76eecSMatthew Dillon #define	MAC_CFG_TX_AUTO_PAD		0x00000080
342bbf76eecSMatthew Dillon #define	MAC_CFG_TX_LENCHK		0x00000100
343bbf76eecSMatthew Dillon #define	MAC_CFG_RX_JUMBO_ENB		0x00000200
344bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_MASK		0x00003C00
345bbf76eecSMatthew Dillon #define	MAC_CFG_VLAN_TAG_STRIP		0x00004000
346bbf76eecSMatthew Dillon #define	MAC_CFG_PROMISC			0x00008000
347bbf76eecSMatthew Dillon #define	MAC_CFG_TX_PAUSE		0x00010000
348bbf76eecSMatthew Dillon #define	MAC_CFG_SCNT			0x00020000
349bbf76eecSMatthew Dillon #define	MAC_CFG_SYNC_RST_TX		0x00040000
350bbf76eecSMatthew Dillon #define	MAC_CFG_SIM_RST_TX		0x00080000
351bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_MASK		0x00300000
352bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_10_100		0x00100000
353bbf76eecSMatthew Dillon #define	MAC_CFG_SPEED_1000		0x00200000
354bbf76eecSMatthew Dillon #define	MAC_CFG_DBG_TX_BACKOFF		0x00400000
355bbf76eecSMatthew Dillon #define	MAC_CFG_TX_JUMBO_ENB		0x00800000
356bbf76eecSMatthew Dillon #define	MAC_CFG_RXCSUM_ENB		0x01000000
357bbf76eecSMatthew Dillon #define	MAC_CFG_ALLMULTI		0x02000000
358bbf76eecSMatthew Dillon #define	MAC_CFG_BCAST			0x04000000
359bbf76eecSMatthew Dillon #define	MAC_CFG_DBG			0x08000000
360bbf76eecSMatthew Dillon #define	MAC_CFG_SINGLE_PAUSE_ENB	0x10000000
361cffbd125SMatthew Dillon #define MAC_CFG_HASH_ALG_CRC32		0x20000000
362cffbd125SMatthew Dillon #define MAC_CFG_SPEED_MODE_SW		0x40000000
3636421ab1dSMatthew Dillon #define	MAC_CFG_FAST_PAUSE		0x80000000
364bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_SHIFT		10
365bbf76eecSMatthew Dillon #define	MAC_CFG_PREAMBLE_DEFAULT	7
366bbf76eecSMatthew Dillon 
367bbf76eecSMatthew Dillon #define	ALC_IPG_IFG_CFG			0x1484
368bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_MASK		0x0000007F
369bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_MASK		0x0000FF00
370bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_MASK		0x007F0000
371bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_MASK		0x7F000000
372bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_SHIFT		0
373bbf76eecSMatthew Dillon #define	IPG_IFG_IPGT_DEFAULT		0x60
374bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_SHIFT		8
375bbf76eecSMatthew Dillon #define	IPG_IFG_MIFG_DEFAULT		0x50
376bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_SHIFT		16
377bbf76eecSMatthew Dillon #define	IPG_IFG_IPG1_DEFAULT		0x40
378bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_SHIFT		24
379bbf76eecSMatthew Dillon #define	IPG_IFG_IPG2_DEFAULT		0x60
380bbf76eecSMatthew Dillon 
381bbf76eecSMatthew Dillon /* Station address. */
382bbf76eecSMatthew Dillon #define	ALC_PAR0			0x1488
383bbf76eecSMatthew Dillon #define	ALC_PAR1			0x148C
384bbf76eecSMatthew Dillon 
385bbf76eecSMatthew Dillon /* 64bit multicast hash register. */
386bbf76eecSMatthew Dillon #define	ALC_MAR0			0x1490
387bbf76eecSMatthew Dillon #define	ALC_MAR1			0x1494
388bbf76eecSMatthew Dillon 
389bbf76eecSMatthew Dillon /* half-duplex parameter configuration. */
390bbf76eecSMatthew Dillon #define	ALC_HDPX_CFG			0x1498
391bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_MASK		0x000003FF
392bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_MASK		0x0000F000
393bbf76eecSMatthew Dillon #define	HDPX_CFG_EXC_DEF_EN		0x00010000
394bbf76eecSMatthew Dillon #define	HDPX_CFG_NO_BACK_C		0x00020000
395bbf76eecSMatthew Dillon #define	HDPX_CFG_NO_BACK_P		0x00040000
396bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBE			0x00080000
397bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_MASK		0x00F00000
398bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_MASK		0x0F000000
399bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_SHIFT		0
400bbf76eecSMatthew Dillon #define	HDPX_CFG_LCOL_DEFAULT		0x37
401bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_SHIFT		12
402bbf76eecSMatthew Dillon #define	HDPX_CFG_RETRY_DEFAULT		0x0F
403bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_SHIFT		20
404bbf76eecSMatthew Dillon #define	HDPX_CFG_ABEBT_DEFAULT		0x0A
405bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_SHIFT		24
406bbf76eecSMatthew Dillon #define	HDPX_CFG_JAMIPG_DEFAULT		0x07
407bbf76eecSMatthew Dillon 
408bbf76eecSMatthew Dillon #define	ALC_FRAME_SIZE			0x149C
409bbf76eecSMatthew Dillon 
410bbf76eecSMatthew Dillon #define	ALC_WOL_CFG			0x14A0
411bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN			0x00000001
412bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN_ENB		0x00000002
413bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC			0x00000004
414bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC_ENB		0x00000008
415bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG		0x00000010
416bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG_ENB		0x00000020
417bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN_DET		0x00000100
418bbf76eecSMatthew Dillon #define	WOL_CFG_MAGIC_DET		0x00000200
419bbf76eecSMatthew Dillon #define	WOL_CFG_LINK_CHG_DET		0x00000400
420bbf76eecSMatthew Dillon #define	WOL_CFG_CLK_SWITCH_ENB		0x00008000
421bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN0		0x00010000
422bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN1		0x00020000
423bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN2		0x00040000
424bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN3		0x00080000
425bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN4		0x00100000
426bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN5		0x00200000
427bbf76eecSMatthew Dillon #define	WOL_CFG_PATTERN6		0x00400000
428bbf76eecSMatthew Dillon 
429bbf76eecSMatthew Dillon /* WOL pattern length. */
430bbf76eecSMatthew Dillon #define	ALC_PATTERN_CFG0		0x14A4
431bbf76eecSMatthew Dillon #define	PATTERN_CFG_0_LEN_MASK		0x0000007F
432bbf76eecSMatthew Dillon #define	PATTERN_CFG_1_LEN_MASK		0x00007F00
433bbf76eecSMatthew Dillon #define	PATTERN_CFG_2_LEN_MASK		0x007F0000
434bbf76eecSMatthew Dillon #define	PATTERN_CFG_3_LEN_MASK		0x7F000000
435bbf76eecSMatthew Dillon 
436bbf76eecSMatthew Dillon #define	ALC_PATTERN_CFG1		0x14A8
437bbf76eecSMatthew Dillon #define	PATTERN_CFG_4_LEN_MASK		0x0000007F
438bbf76eecSMatthew Dillon #define	PATTERN_CFG_5_LEN_MASK		0x00007F00
439bbf76eecSMatthew Dillon #define	PATTERN_CFG_6_LEN_MASK		0x007F0000
440bbf76eecSMatthew Dillon 
441bbf76eecSMatthew Dillon /* RSS */
442bbf76eecSMatthew Dillon #define	ALC_RSS_KEY0			0x14B0
443bbf76eecSMatthew Dillon 
444bbf76eecSMatthew Dillon #define	ALC_RSS_KEY1			0x14B4
445bbf76eecSMatthew Dillon 
446bbf76eecSMatthew Dillon #define	ALC_RSS_KEY2			0x14B8
447bbf76eecSMatthew Dillon 
448bbf76eecSMatthew Dillon #define	ALC_RSS_KEY3			0x14BC
449bbf76eecSMatthew Dillon 
450bbf76eecSMatthew Dillon #define	ALC_RSS_KEY4			0x14C0
451bbf76eecSMatthew Dillon 
452bbf76eecSMatthew Dillon #define	ALC_RSS_KEY5			0x14C4
453bbf76eecSMatthew Dillon 
454bbf76eecSMatthew Dillon #define	ALC_RSS_KEY6			0x14C8
455bbf76eecSMatthew Dillon 
456bbf76eecSMatthew Dillon #define	ALC_RSS_KEY7			0x14CC
457bbf76eecSMatthew Dillon 
458bbf76eecSMatthew Dillon #define	ALC_RSS_KEY8			0x14D0
459bbf76eecSMatthew Dillon 
460bbf76eecSMatthew Dillon #define	ALC_RSS_KEY9			0x14D4
461bbf76eecSMatthew Dillon 
462bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE0		0x14E0
463bbf76eecSMatthew Dillon 
4646421ab1dSMatthew Dillon #define	ALC_TD_PRI2_HEAD_ADDR_LO	0x14E0	/* AR816x */
4656421ab1dSMatthew Dillon 
466bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE1		0x14E4
467bbf76eecSMatthew Dillon 
4686421ab1dSMatthew Dillon #define	ALC_TD_PRI3_HEAD_ADDR_LO	0x14E4	/* AR816x */
4696421ab1dSMatthew Dillon 
470bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE2		0x14E8
471bbf76eecSMatthew Dillon 
472bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE3		0x14EC
473bbf76eecSMatthew Dillon 
474bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE4		0x14F0
475bbf76eecSMatthew Dillon 
476bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE5		0x14F4
477bbf76eecSMatthew Dillon 
478bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE6		0x14F8
479bbf76eecSMatthew Dillon 
480bbf76eecSMatthew Dillon #define	ALC_RSS_IDT_TABLE7		0x14FC
481bbf76eecSMatthew Dillon 
482bbf76eecSMatthew Dillon #define	ALC_SRAM_RD0_ADDR		0x1500
483bbf76eecSMatthew Dillon 
484bbf76eecSMatthew Dillon #define	ALC_SRAM_RD1_ADDR		0x1504
485bbf76eecSMatthew Dillon 
486bbf76eecSMatthew Dillon #define	ALC_SRAM_RD2_ADDR		0x1508
487bbf76eecSMatthew Dillon 
488bbf76eecSMatthew Dillon #define	ALC_SRAM_RD3_ADDR		0x150C
489bbf76eecSMatthew Dillon 
490bbf76eecSMatthew Dillon #define	RD_HEAD_ADDR_MASK		0x000003FF
491bbf76eecSMatthew Dillon #define	RD_TAIL_ADDR_MASK		0x03FF0000
492bbf76eecSMatthew Dillon #define	RD_HEAD_ADDR_SHIFT		0
493bbf76eecSMatthew Dillon #define	RD_TAIL_ADDR_SHIFT		16
494bbf76eecSMatthew Dillon 
495bbf76eecSMatthew Dillon #define	ALC_RD_NIC_LEN0			0x1510	/* 8 bytes unit */
496bbf76eecSMatthew Dillon #define	RD_NIC_LEN_MASK			0x000003FF
497bbf76eecSMatthew Dillon 
498bbf76eecSMatthew Dillon #define	ALC_RD_NIC_LEN1			0x1514
499bbf76eecSMatthew Dillon 
500bbf76eecSMatthew Dillon #define	ALC_SRAM_TD_ADDR		0x1518
501bbf76eecSMatthew Dillon #define	TD_HEAD_ADDR_MASK		0x000003FF
502bbf76eecSMatthew Dillon #define	TD_TAIL_ADDR_MASK		0x03FF0000
503bbf76eecSMatthew Dillon #define	TD_HEAD_ADDR_SHIFT		0
504bbf76eecSMatthew Dillon #define	TD_TAIL_ADDR_SHIFT		16
505bbf76eecSMatthew Dillon 
506bbf76eecSMatthew Dillon #define	ALC_SRAM_TD_LEN			0x151C	/* 8 bytes unit */
507bbf76eecSMatthew Dillon #define	SRAM_TD_LEN_MASK		0x000003FF
508bbf76eecSMatthew Dillon 
509bbf76eecSMatthew Dillon #define	ALC_SRAM_RX_FIFO_ADDR		0x1520
510bbf76eecSMatthew Dillon 
511bbf76eecSMatthew Dillon #define	ALC_SRAM_RX_FIFO_LEN		0x1524
5126421ab1dSMatthew Dillon #define	SRAM_RX_FIFO_LEN_MASK		0x00000FFF
5136421ab1dSMatthew Dillon #define	SRAM_RX_FIFO_LEN_SHIFT		0
514bbf76eecSMatthew Dillon 
515bbf76eecSMatthew Dillon #define	ALC_SRAM_TX_FIFO_ADDR		0x1528
516bbf76eecSMatthew Dillon 
517bbf76eecSMatthew Dillon #define	ALC_SRAM_TX_FIFO_LEN		0x152C
518bbf76eecSMatthew Dillon 
519bbf76eecSMatthew Dillon #define	ALC_SRAM_TCPH_ADDR		0x1530
520bbf76eecSMatthew Dillon #define	SRAM_TCPH_ADDR_MASK		0x00000FFF
521bbf76eecSMatthew Dillon #define	SRAM_PATH_ADDR_MASK		0x0FFF0000
522bbf76eecSMatthew Dillon #define	SRAM_TCPH_ADDR_SHIFT		0
523bbf76eecSMatthew Dillon #define	SRAM_PKTH_ADDR_SHIFT		16
524bbf76eecSMatthew Dillon 
525bbf76eecSMatthew Dillon #define	ALC_DMA_BLOCK			0x1534
526bbf76eecSMatthew Dillon #define	DMA_BLOCK_LOAD			0x00000001
527bbf76eecSMatthew Dillon 
528bbf76eecSMatthew Dillon #define	ALC_RX_BASE_ADDR_HI		0x1540
529bbf76eecSMatthew Dillon 
530bbf76eecSMatthew Dillon #define	ALC_TX_BASE_ADDR_HI		0x1544
531bbf76eecSMatthew Dillon 
532bbf76eecSMatthew Dillon #define	ALC_SMB_BASE_ADDR_HI		0x1548
533bbf76eecSMatthew Dillon 
534bbf76eecSMatthew Dillon #define	ALC_SMB_BASE_ADDR_LO		0x154C
535bbf76eecSMatthew Dillon 
536bbf76eecSMatthew Dillon #define	ALC_RD0_HEAD_ADDR_LO		0x1550
537bbf76eecSMatthew Dillon 
538bbf76eecSMatthew Dillon #define	ALC_RD1_HEAD_ADDR_LO		0x1554
539bbf76eecSMatthew Dillon 
540bbf76eecSMatthew Dillon #define	ALC_RD2_HEAD_ADDR_LO		0x1558
541bbf76eecSMatthew Dillon 
542bbf76eecSMatthew Dillon #define	ALC_RD3_HEAD_ADDR_LO		0x155C
543bbf76eecSMatthew Dillon 
544bbf76eecSMatthew Dillon #define	ALC_RD_RING_CNT			0x1560
545bbf76eecSMatthew Dillon #define	RD_RING_CNT_MASK		0x00000FFF
546bbf76eecSMatthew Dillon #define	RD_RING_CNT_SHIFT		0
547bbf76eecSMatthew Dillon 
548bbf76eecSMatthew Dillon #define	ALC_RX_BUF_SIZE			0x1564
549bbf76eecSMatthew Dillon #define	RX_BUF_SIZE_MASK		0x0000FFFF
550bbf76eecSMatthew Dillon /*
551bbf76eecSMatthew Dillon  * If larger buffer size than 1536 is specified the controller
552bbf76eecSMatthew Dillon  * will be locked up. This is hardware limitation.
553bbf76eecSMatthew Dillon  */
554bbf76eecSMatthew Dillon #define	RX_BUF_SIZE_MAX			1536
555bbf76eecSMatthew Dillon 
556bbf76eecSMatthew Dillon #define	ALC_RRD0_HEAD_ADDR_LO		0x1568
557bbf76eecSMatthew Dillon 
558bbf76eecSMatthew Dillon #define	ALC_RRD1_HEAD_ADDR_LO		0x156C
559bbf76eecSMatthew Dillon 
560bbf76eecSMatthew Dillon #define	ALC_RRD2_HEAD_ADDR_LO		0x1570
561bbf76eecSMatthew Dillon 
562bbf76eecSMatthew Dillon #define	ALC_RRD3_HEAD_ADDR_LO		0x1574
563bbf76eecSMatthew Dillon 
564bbf76eecSMatthew Dillon #define	ALC_RRD_RING_CNT		0x1578
565bbf76eecSMatthew Dillon #define	RRD_RING_CNT_MASK		0x00000FFF
566bbf76eecSMatthew Dillon #define	RRD_RING_CNT_SHIFT		0
567bbf76eecSMatthew Dillon 
568bbf76eecSMatthew Dillon #define	ALC_TDH_HEAD_ADDR_LO		0x157C
569bbf76eecSMatthew Dillon 
5706421ab1dSMatthew Dillon #define	ALC_TD_PRI1_HEAD_ADDR_LO	0x157C	/* AR816x */
5716421ab1dSMatthew Dillon 
572bbf76eecSMatthew Dillon #define	ALC_TDL_HEAD_ADDR_LO		0x1580
573bbf76eecSMatthew Dillon 
5746421ab1dSMatthew Dillon #define	ALC_TD_PRI0_HEAD_ADDR_LO	0x1580	/* AR816x */
5756421ab1dSMatthew Dillon 
576bbf76eecSMatthew Dillon #define	ALC_TD_RING_CNT			0x1584
577bbf76eecSMatthew Dillon #define	TD_RING_CNT_MASK		0x0000FFFF
578bbf76eecSMatthew Dillon #define	TD_RING_CNT_SHIFT		0
579bbf76eecSMatthew Dillon 
580bbf76eecSMatthew Dillon #define	ALC_CMB_BASE_ADDR_LO		0x1588
581bbf76eecSMatthew Dillon 
582bbf76eecSMatthew Dillon #define	ALC_TXQ_CFG			0x1590
583bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_MASK		0x0000000F
584bbf76eecSMatthew Dillon #define	TXQ_CFG_IP_OPTION_ENB		0x00000010
585bbf76eecSMatthew Dillon #define	TXQ_CFG_ENB			0x00000020
586bbf76eecSMatthew Dillon #define	TXQ_CFG_ENHANCED_MODE		0x00000040
587bbf76eecSMatthew Dillon #define	TXQ_CFG_8023_ENB		0x00000080
588bbf76eecSMatthew Dillon #define	TXQ_CFG_TX_FIFO_BURST_MASK	0xFFFF0000
589bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_SHIFT		0
590bbf76eecSMatthew Dillon #define	TXQ_CFG_TD_BURST_DEFAULT	5
591bbf76eecSMatthew Dillon #define	TXQ_CFG_TX_FIFO_BURST_SHIFT	16
592bbf76eecSMatthew Dillon 
593bbf76eecSMatthew Dillon #define	ALC_TSO_OFFLOAD_THRESH		0x1594	/* 8 bytes unit */
594bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_MASK		0x000007FF
5956421ab1dSMatthew Dillon #define	TSO_OFFLOAD_ERRLGPKT_DROP_ENB	0x00000800
596bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_SHIFT	0
597bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_UNIT		8
598bbf76eecSMatthew Dillon #define	TSO_OFFLOAD_THRESH_UNIT_SHIFT	3
599bbf76eecSMatthew Dillon 
600bbf76eecSMatthew Dillon #define	ALC_TXF_WATER_MARK		0x1598	/* 8 bytes unit */
601bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_HI_MASK		0x00000FFF
602bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_LO_MASK		0x0FFF0000
603bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_BURST_ENB	0x80000000
604bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_LO_SHIFT		0
605bbf76eecSMatthew Dillon #define	TXF_WATER_MARK_HI_SHIFT		16
606bbf76eecSMatthew Dillon 
607bbf76eecSMatthew Dillon #define	ALC_THROUGHPUT_MON		0x159C
608bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_RATE_MASK	0x00000003
609bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_ENB		0x00000080
610bbf76eecSMatthew Dillon #define	THROUGHPUT_MON_RATE_SHIFT	0
611bbf76eecSMatthew Dillon 
612bbf76eecSMatthew Dillon #define	ALC_RXQ_CFG			0x15A0
613bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_MASK	0x00000003
614bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_NONE	0x00000000
615bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M	0x00000001
616bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_10M	0x00000002
617bbf76eecSMatthew Dillon #define	RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M	0x00000003
618bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE1_ENB		0x00000010
619bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE2_ENB		0x00000020
620bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE3_ENB		0x00000040
621bbf76eecSMatthew Dillon #define	RXQ_CFG_IPV6_CSUM_ENB		0x00000080
622bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_TBL_LEN_MASK	0x0000FF00
623bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV4		0x00010000
624bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV4_TCP	0x00020000
625bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV6		0x00040000
626bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_IPV6_TCP	0x00080000
627bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_MASK		0x03F00000
628bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_DIS		0x00000000
629bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_SQSINT		0x04000000
630bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_MQUESINT	0x08000000
631bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_MODE_MQUEMINT	0x0C000000
632bbf76eecSMatthew Dillon #define	RXQ_CFG_NIP_QUEUE_SEL_TBL	0x10000000
633bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_ENB		0x20000000
634bbf76eecSMatthew Dillon #define	RXQ_CFG_CUT_THROUGH_ENB		0x40000000
635bbf76eecSMatthew Dillon #define	RXQ_CFG_QUEUE0_ENB		0x80000000
636bbf76eecSMatthew Dillon #define	RXQ_CFG_RSS_HASH_TBL_LEN_SHIFT	8
637bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_DEFAULT	8
638bbf76eecSMatthew Dillon #define	RXQ_CFG_RD_BURST_SHIFT		20
639bbf76eecSMatthew Dillon #define	RXQ_CFG_ENB					\
640bbf76eecSMatthew Dillon 	(RXQ_CFG_QUEUE0_ENB | RXQ_CFG_QUEUE1_ENB |	\
641bbf76eecSMatthew Dillon 	 RXQ_CFG_QUEUE2_ENB | RXQ_CFG_QUEUE3_ENB)
642bbf76eecSMatthew Dillon 
6436421ab1dSMatthew Dillon /* AR816x specific bits */
6446421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV4      0x00000004
6456421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV4_TCP  0x00000008
6466421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV6      0x00000010
6476421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_IPV6_TCP  0x00000020
6486421ab1dSMatthew Dillon #define	RXQ_CFG_816X_RSS_HASH_MASK      0x0000003C
6496421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IPV6_PARSE_ENB     0x00000080
6506421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_MASK  0x0001FF00
6516421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_SHIFT 8
6526421ab1dSMatthew Dillon #define	RXQ_CFG_816X_IDT_TBL_SIZE_DEFAULT       0x100
6536421ab1dSMatthew Dillon 
654bbf76eecSMatthew Dillon #define	ALC_RX_RD_FREE_THRESH		0x15A4	/* 8 bytes unit. */
655bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_MASK	0x0000003F
656bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_MASK	0x00000FC0
657bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_SHIFT	0
658bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_SHIFT	6
659bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_HI_DEFAULT	16
660bbf76eecSMatthew Dillon #define	RX_RD_FREE_THRESH_LO_DEFAULT	8
661bbf76eecSMatthew Dillon 
662bbf76eecSMatthew Dillon #define	ALC_RX_FIFO_PAUSE_THRESH	0x15A8
663bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_LO_MASK	0x00000FFF
664bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_HI_MASK	0x0FFF0000
665bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_LO_SHIFT	0
666bbf76eecSMatthew Dillon #define	RX_FIFO_PAUSE_THRESH_HI_SHIFT	16
667bbf76eecSMatthew Dillon 
6686421ab1dSMatthew Dillon /*
6696421ab1dSMatthew Dillon  * Size = tx-packet(1522) + IPG(12) + SOF(8) + 64(Pause) + IPG(12) + SOF(8) +
6706421ab1dSMatthew Dillon  *       rx-packet(1522) + delay-of-link(64)
6716421ab1dSMatthew Dillon  *     = 3212.
6726421ab1dSMatthew Dillon  */
6736421ab1dSMatthew Dillon #define	RX_FIFO_PAUSE_816X_RSVD         3212
6746421ab1dSMatthew Dillon 
675bbf76eecSMatthew Dillon #define	ALC_RD_DMA_CFG			0x15AC
676bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_MASK		0x00000FFF	/* 8 bytes unit */
677bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_MASK		0xFFFF0000
678bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_SHIFT		0
679bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_SHIFT		16
680bbf76eecSMatthew Dillon #define	RD_DMA_CFG_THRESH_DEFAULT	0x100
681bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TIMER_DEFAULT	0
682bbf76eecSMatthew Dillon #define	RD_DMA_CFG_TICK_USECS		8
683bbf76eecSMatthew Dillon #define	ALC_RD_DMA_CFG_USECS(x)		((x) / RD_DMA_CFG_TICK_USECS)
684bbf76eecSMatthew Dillon 
685bbf76eecSMatthew Dillon #define	ALC_RSS_HASH_VALUE		0x15B0
686bbf76eecSMatthew Dillon 
687bbf76eecSMatthew Dillon #define	ALC_RSS_HASH_FLAG		0x15B4
688bbf76eecSMatthew Dillon 
689bbf76eecSMatthew Dillon #define	ALC_RSS_CPU			0x15B8
690bbf76eecSMatthew Dillon 
691bbf76eecSMatthew Dillon #define	ALC_DMA_CFG			0x15C0
692bbf76eecSMatthew Dillon #define	DMA_CFG_IN_ORDER		0x00000001
693bbf76eecSMatthew Dillon #define	DMA_CFG_ENH_ORDER		0x00000002
694bbf76eecSMatthew Dillon #define	DMA_CFG_OUT_ORDER		0x00000004
695bbf76eecSMatthew Dillon #define	DMA_CFG_RCB_64			0x00000000
696bbf76eecSMatthew Dillon #define	DMA_CFG_RCB_128			0x00000008
6976421ab1dSMatthew Dillon #define	DMA_CFG_PEND_AUTO_RST		0x00000008
698bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_128		0x00000000
699bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_256		0x00000010
700bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_512		0x00000020
701bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_1024		0x00000030
702bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_2048		0x00000040
703bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_4096		0x00000050
704bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_128		0x00000000
705bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_256		0x00000080
706bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_512		0x00000100
707bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_1024		0x00000180
708bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_2048		0x00000200
709bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_4096		0x00000280
710bbf76eecSMatthew Dillon #define	DMA_CFG_RD_REQ_PRI		0x00000400
711bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_MASK	0x0000F800
712bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_MASK	0x000F0000
713bbf76eecSMatthew Dillon #define	DMA_CFG_CMB_ENB			0x00100000
714bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_ENB			0x00200000
715bbf76eecSMatthew Dillon #define	DMA_CFG_CMB_NOW			0x00400000
716bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_DIS			0x01000000
7176421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_MASK        0x0C000000
7186421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_1           0x00000000
7196421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_2           0x04000000
7206421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_3           0x08000000
7216421ab1dSMatthew Dillon #define	DMA_CFG_RD_CHNL_SEL_4           0x0C000000
7226421ab1dSMatthew Dillon #define	DMA_CFG_WSRAM_RDCTL             0x10000000
7236421ab1dSMatthew Dillon #define	DMA_CFG_RD_PEND_CLR             0x20000000
7246421ab1dSMatthew Dillon #define	DMA_CFG_WR_PEND_CLR             0x40000000
725bbf76eecSMatthew Dillon #define	DMA_CFG_SMB_NOW			0x80000000
726bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_MASK		0x07
727bbf76eecSMatthew Dillon #define	DMA_CFG_RD_BURST_SHIFT		4
728bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_MASK		0x07
729bbf76eecSMatthew Dillon #define	DMA_CFG_WR_BURST_SHIFT		7
730bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_SHIFT	11
731bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_SHIFT	16
732bbf76eecSMatthew Dillon #define	DMA_CFG_RD_DELAY_CNT_DEFAULT	15
733bbf76eecSMatthew Dillon #define	DMA_CFG_WR_DELAY_CNT_DEFAULT	4
734bbf76eecSMatthew Dillon 
735bbf76eecSMatthew Dillon #define	ALC_SMB_STAT_TIMER		0x15C4
736bbf76eecSMatthew Dillon #define	SMB_STAT_TIMER_MASK		0x00FFFFFF
737bbf76eecSMatthew Dillon #define	SMB_STAT_TIMER_SHIFT		0
738bbf76eecSMatthew Dillon 
739bbf76eecSMatthew Dillon #define	ALC_CMB_TD_THRESH		0x15C8
740bbf76eecSMatthew Dillon #define	CMB_TD_THRESH_MASK		0x0000FFFF
741bbf76eecSMatthew Dillon #define	CMB_TD_THRESH_SHIFT		0
742bbf76eecSMatthew Dillon 
743bbf76eecSMatthew Dillon #define	ALC_CMB_TX_TIMER		0x15CC
744bbf76eecSMatthew Dillon #define	CMB_TX_TIMER_MASK		0x0000FFFF
745bbf76eecSMatthew Dillon #define	CMB_TX_TIMER_SHIFT		0
746bbf76eecSMatthew Dillon 
7476421ab1dSMatthew Dillon #define	ALC_MSI_MAP_TBL1                0x15D0
7486421ab1dSMatthew Dillon 
7496421ab1dSMatthew Dillon #define	ALC_MSI_ID_MAP                  0x15D4
7506421ab1dSMatthew Dillon 
7516421ab1dSMatthew Dillon #define	ALC_MSI_MAP_TBL2                0x15D8
7526421ab1dSMatthew Dillon 
753bbf76eecSMatthew Dillon #define	ALC_MBOX_RD0_PROD_IDX		0x15E0
754bbf76eecSMatthew Dillon 
755bbf76eecSMatthew Dillon #define	ALC_MBOX_RD1_PROD_IDX		0x15E4
756bbf76eecSMatthew Dillon 
757bbf76eecSMatthew Dillon #define	ALC_MBOX_RD2_PROD_IDX		0x15E8
758bbf76eecSMatthew Dillon 
759bbf76eecSMatthew Dillon #define	ALC_MBOX_RD3_PROD_IDX		0x15EC
760bbf76eecSMatthew Dillon 
761bbf76eecSMatthew Dillon #define	ALC_MBOX_RD_PROD_MASK		0x0000FFFF
762bbf76eecSMatthew Dillon #define	MBOX_RD_PROD_SHIFT		0
763bbf76eecSMatthew Dillon 
764bbf76eecSMatthew Dillon #define	ALC_MBOX_TD_PROD_IDX		0x15F0
765bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_HI_IDX_MASK	0x0000FFFF
766bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_LO_IDX_MASK	0xFFFF0000
767bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_HI_IDX_SHIFT	0
768bbf76eecSMatthew Dillon #define	MBOX_TD_PROD_LO_IDX_SHIFT	16
769bbf76eecSMatthew Dillon 
7706421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI1_PROD_IDX       0x15F0  /* 16 bits AR816x */
7716421ab1dSMatthew Dillon 
7726421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI0_PROD_IDX       0x15F2  /* 16 bits AR816x */
7736421ab1dSMatthew Dillon 
774bbf76eecSMatthew Dillon #define	ALC_MBOX_TD_CONS_IDX		0x15F4
775bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_HI_IDX_MASK	0x0000FFFF
776bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_LO_IDX_MASK	0xFFFF0000
777bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_HI_IDX_SHIFT	0
778bbf76eecSMatthew Dillon #define	MBOX_TD_CONS_LO_IDX_SHIFT	16
779bbf76eecSMatthew Dillon 
7806421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI1_CONS_IDX       0x15F4  /* 16 bits AR816x */
7816421ab1dSMatthew Dillon 
7826421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI0_CONS_IDX       0x15F6  /* 16 bits AR816x */
7836421ab1dSMatthew Dillon 
784bbf76eecSMatthew Dillon #define	ALC_MBOX_RD01_CONS_IDX		0x15F8
785bbf76eecSMatthew Dillon #define	MBOX_RD0_CONS_IDX_MASK		0x0000FFFF
786bbf76eecSMatthew Dillon #define	MBOX_RD1_CONS_IDX_MASK		0xFFFF0000
787bbf76eecSMatthew Dillon #define	MBOX_RD0_CONS_IDX_SHIFT		0
788bbf76eecSMatthew Dillon #define	MBOX_RD1_CONS_IDX_SHIFT		16
789bbf76eecSMatthew Dillon 
790bbf76eecSMatthew Dillon #define	ALC_MBOX_RD23_CONS_IDX		0x15FC
791bbf76eecSMatthew Dillon #define	MBOX_RD2_CONS_IDX_MASK		0x0000FFFF
792bbf76eecSMatthew Dillon #define	MBOX_RD3_CONS_IDX_MASK		0xFFFF0000
793bbf76eecSMatthew Dillon #define	MBOX_RD2_CONS_IDX_SHIFT		0
794bbf76eecSMatthew Dillon #define	MBOX_RD3_CONS_IDX_SHIFT		16
795bbf76eecSMatthew Dillon 
796bbf76eecSMatthew Dillon #define	ALC_INTR_STATUS			0x1600
797bbf76eecSMatthew Dillon #define	INTR_SMB			0x00000001
798bbf76eecSMatthew Dillon #define	INTR_TIMER			0x00000002
799bbf76eecSMatthew Dillon #define	INTR_MANUAL_TIMER		0x00000004
800bbf76eecSMatthew Dillon #define	INTR_RX_FIFO_OFLOW		0x00000008
801bbf76eecSMatthew Dillon #define	INTR_RD0_UNDERRUN		0x00000010
802bbf76eecSMatthew Dillon #define	INTR_RD1_UNDERRUN		0x00000020
803bbf76eecSMatthew Dillon #define	INTR_RD2_UNDERRUN		0x00000040
804bbf76eecSMatthew Dillon #define	INTR_RD3_UNDERRUN		0x00000080
805bbf76eecSMatthew Dillon #define	INTR_TX_FIFO_UNDERRUN		0x00000100
806bbf76eecSMatthew Dillon #define	INTR_DMA_RD_TO_RST		0x00000200
807bbf76eecSMatthew Dillon #define	INTR_DMA_WR_TO_RST		0x00000400
808bbf76eecSMatthew Dillon #define	INTR_TX_CREDIT			0x00000800
809bbf76eecSMatthew Dillon #define	INTR_GPHY			0x00001000
810bbf76eecSMatthew Dillon #define	INTR_GPHY_LOW_PW		0x00002000
811bbf76eecSMatthew Dillon #define	INTR_TXQ_TO_RST			0x00004000
8126421ab1dSMatthew Dillon #define	INTR_TX_PKT0			0x00008000
813bbf76eecSMatthew Dillon #define	INTR_RX_PKT0			0x00010000
814bbf76eecSMatthew Dillon #define	INTR_RX_PKT1			0x00020000
815bbf76eecSMatthew Dillon #define	INTR_RX_PKT2			0x00040000
816bbf76eecSMatthew Dillon #define	INTR_RX_PKT3			0x00080000
817bbf76eecSMatthew Dillon #define	INTR_MAC_RX			0x00100000
818bbf76eecSMatthew Dillon #define	INTR_MAC_TX			0x00200000
819bbf76eecSMatthew Dillon #define	INTR_UNDERRUN			0x00400000
820bbf76eecSMatthew Dillon #define	INTR_FRAME_ERROR		0x00800000
821bbf76eecSMatthew Dillon #define	INTR_FRAME_OK			0x01000000
822bbf76eecSMatthew Dillon #define	INTR_CSUM_ERROR			0x02000000
823bbf76eecSMatthew Dillon #define	INTR_PHY_LINK_DOWN		0x04000000
824bbf76eecSMatthew Dillon #define	INTR_DIS_INT			0x80000000
825bbf76eecSMatthew Dillon 
8266421ab1dSMatthew Dillon /* INTR status for AR816x/AR817x  4 TX queues, 8 RX queues */
8276421ab1dSMatthew Dillon #define	INTR_TX_PKT1                    0x00000020
8286421ab1dSMatthew Dillon #define	INTR_TX_PKT2                    0x00000040
8296421ab1dSMatthew Dillon #define	INTR_TX_PKT3                    0x00000080
8306421ab1dSMatthew Dillon #define	INTR_RX_PKT4                    0x08000000
8316421ab1dSMatthew Dillon #define	INTR_RX_PKT5                    0x10000000
8326421ab1dSMatthew Dillon #define	INTR_RX_PKT6                    0x20000000
8336421ab1dSMatthew Dillon #define	INTR_RX_PKT7                    0x40000000
8346421ab1dSMatthew Dillon 
835bbf76eecSMatthew Dillon /* Interrupt Mask Register */
836bbf76eecSMatthew Dillon #define	ALC_INTR_MASK			0x1604
837bbf76eecSMatthew Dillon 
838bbf76eecSMatthew Dillon #ifdef	notyet
839bbf76eecSMatthew Dillon #define	INTR_RX_PKT					\
840bbf76eecSMatthew Dillon 	(INTR_RX_PKT0 | INTR_RX_PKT1 | INTR_RX_PKT2 |	\
841bbf76eecSMatthew Dillon 	 INTR_RX_PKT3)
842bbf76eecSMatthew Dillon #define	INTR_RD_UNDERRUN				\
843bbf76eecSMatthew Dillon 	(INTR_RD0_UNDERRUN | INTR_RD1_UNDERRUN |	\
844bbf76eecSMatthew Dillon 	INTR_RD2_UNDERRUN | INTR_RD3_UNDERRUN)
845bbf76eecSMatthew Dillon #else
8466421ab1dSMatthew Dillon #define	INTR_TX_PKT			INTR_TX_PKT0
847bbf76eecSMatthew Dillon #define	INTR_RX_PKT			INTR_RX_PKT0
848bbf76eecSMatthew Dillon #define	INTR_RD_UNDERRUN		INTR_RD0_UNDERRUN
849bbf76eecSMatthew Dillon #endif
850bbf76eecSMatthew Dillon 
851bbf76eecSMatthew Dillon #define	ALC_INTRS					\
852bbf76eecSMatthew Dillon 	(INTR_DMA_RD_TO_RST | INTR_DMA_WR_TO_RST |	\
853bbf76eecSMatthew Dillon 	INTR_TXQ_TO_RST	| INTR_RX_PKT | INTR_TX_PKT |	\
854bbf76eecSMatthew Dillon 	INTR_RX_FIFO_OFLOW | INTR_RD_UNDERRUN |		\
855bbf76eecSMatthew Dillon 	INTR_TX_FIFO_UNDERRUN)
856bbf76eecSMatthew Dillon 
857bbf76eecSMatthew Dillon #define	ALC_INTR_RETRIG_TIMER		0x1608
858bbf76eecSMatthew Dillon #define	INTR_RETRIG_TIMER_MASK		0x0000FFFF
859bbf76eecSMatthew Dillon #define	INTR_RETRIG_TIMER_SHIFT		0
860bbf76eecSMatthew Dillon 
861bbf76eecSMatthew Dillon #define	ALC_HDS_CFG			0x160C
862bbf76eecSMatthew Dillon #define	HDS_CFG_ENB			0x00000001
863bbf76eecSMatthew Dillon #define	HDS_CFG_BACKFILLSIZE_MASK	0x000FFF00
864bbf76eecSMatthew Dillon #define	HDS_CFG_MAX_HDRSIZE_MASK	0xFFF00000
865bbf76eecSMatthew Dillon #define	HDS_CFG_BACKFILLSIZE_SHIFT	8
866bbf76eecSMatthew Dillon #define	HDS_CFG_MAX_HDRSIZE_SHIFT	20
867bbf76eecSMatthew Dillon 
8686421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI3_PROD_IDX       0x1618  /* 16 bits AR816x */
8696421ab1dSMatthew Dillon 
8706421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI2_PROD_IDX       0x161A  /* 16 bits AR816x */
8716421ab1dSMatthew Dillon 
8726421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI3_CONS_IDX       0x161C  /* 16 bits AR816x */
8736421ab1dSMatthew Dillon 
8746421ab1dSMatthew Dillon #define	ALC_MBOX_TD_PRI2_CONS_IDX       0x161E  /* 16 bits AR816x */
8756421ab1dSMatthew Dillon 
876cffbd125SMatthew Dillon /* AR813x/AR815x registers for MAC statistics */
877bbf76eecSMatthew Dillon #define	ALC_RX_MIB_BASE			0x1700
878bbf76eecSMatthew Dillon 
879bbf76eecSMatthew Dillon #define	ALC_TX_MIB_BASE			0x1760
880bbf76eecSMatthew Dillon 
8816421ab1dSMatthew Dillon #define	ALC_DRV                         0x1804  /* AR816x */
8826421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_1M            0x00000000
8836421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_10M           0x00000001
8846421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_100M          0x00000002
8856421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_NO            0x00000003
8866421ab1dSMatthew Dillon #define	DRV_ASPM_SPD10LMT_MASK          0x00000003
8876421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_1M           0x00000000
8886421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_10M          0x00000004
8896421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_100M         0x00000008
8906421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_NO           0x0000000C
8916421ab1dSMatthew Dillon #define	DRV_ASPM_SPD100LMT_MASK         0x0000000C
8926421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_100M        0x00000000
8936421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_NO          0x00000010
8946421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_1M          0x00000020
8956421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_10M         0x00000030
8966421ab1dSMatthew Dillon #define	DRV_ASPM_SPD1000LMT_MASK        0x00000000
8976421ab1dSMatthew Dillon #define	DRV_WOLCAP_BIOS_EN              0x00000100
8986421ab1dSMatthew Dillon #define	DRV_WOLMAGIC_EN                 0x00000200
8996421ab1dSMatthew Dillon #define	DRV_WOLLINKUP_EN                0x00000400
9006421ab1dSMatthew Dillon #define	DRV_WOLPATTERN_EN               0x00000800
9016421ab1dSMatthew Dillon #define	DRV_AZ_EN                       0x00001000
9026421ab1dSMatthew Dillon #define	DRV_WOLS5_BIOS_EN               0x00010000
9036421ab1dSMatthew Dillon #define	DRV_WOLS5_EN                    0x00020000
9046421ab1dSMatthew Dillon #define	DRV_DISABLE                     0x00040000
9056421ab1dSMatthew Dillon #define	DRV_PHY_MASK                    0x1FE00000
9066421ab1dSMatthew Dillon #define	DRV_PHY_EEE                     0x00200000
9076421ab1dSMatthew Dillon #define	DRV_PHY_APAUSE                  0x00400000
9086421ab1dSMatthew Dillon #define	DRV_PHY_PAUSE                   0x00800000
9096421ab1dSMatthew Dillon #define	DRV_PHY_DUPLEX                  0x01000000
9106421ab1dSMatthew Dillon #define	DRV_PHY_10                      0x02000000
9116421ab1dSMatthew Dillon #define	DRV_PHY_100                     0x04000000
9126421ab1dSMatthew Dillon #define	DRV_PHY_1000                    0x08000000
9136421ab1dSMatthew Dillon #define	DRV_PHY_AUTO                    0x10000000
9146421ab1dSMatthew Dillon #define	DRV_PHY_SHIFT                   21
9156421ab1dSMatthew Dillon 
916a45385feSMichael Neumann #define ALC_CLK_GATING_CFG		0x1814
917a45385feSMichael Neumann #define CLK_GATING_DMAW_ENB		0x0001
918a45385feSMichael Neumann #define CLK_GATING_DMAR_ENB		0x0002
919a45385feSMichael Neumann #define CLK_GATING_TXQ_ENB		0x0004
920a45385feSMichael Neumann #define CLK_GATING_RXQ_ENB		0x0008
921a45385feSMichael Neumann #define CLK_GATING_TXMAC_ENB		0x0010
922a45385feSMichael Neumann #define CLK_GATING_RXMAC_ENB		0x0020
923a45385feSMichael Neumann 
924bbf76eecSMatthew Dillon #define	ALC_DEBUG_DATA0			0x1900
925bbf76eecSMatthew Dillon 
926bbf76eecSMatthew Dillon #define	ALC_DEBUG_DATA1			0x1904
927bbf76eecSMatthew Dillon 
9286421ab1dSMatthew Dillon #define	ALC_MSI_RETRANS_TIMER           0x1920
9296421ab1dSMatthew Dillon #define	MSI_RETRANS_TIMER_MASK          0x0000FFFF
9306421ab1dSMatthew Dillon #define	MSI_RETRANS_MASK_SEL_STD        0x00000000
9316421ab1dSMatthew Dillon #define	MSI_RETRANS_MASK_SEL_LINE       0x00010000
9326421ab1dSMatthew Dillon #define	MSI_RETRANS_TIMER_SHIFT         0
9336421ab1dSMatthew Dillon 
9346421ab1dSMatthew Dillon #define	ALC_WRR                         0x1938
9356421ab1dSMatthew Dillon #define	WRR_PRI0_MASK                   0x0000001F
9366421ab1dSMatthew Dillon #define	WRR_PRI1_MASK                   0x00001F00
9376421ab1dSMatthew Dillon #define	WRR_PRI2_MASK                   0x001F0000
9386421ab1dSMatthew Dillon #define	WRR_PRI3_MASK                   0x1F000000
9396421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_MASK           0x60000000
9406421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_ALL            0x00000000
9416421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_HI             0x20000000
9426421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_HI2            0x40000000
9436421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_NONE           0x60000000
9446421ab1dSMatthew Dillon #define	WRR_PRI0_SHIFT                  0
9456421ab1dSMatthew Dillon #define	WRR_PRI1_SHIFT                  8
9466421ab1dSMatthew Dillon #define	WRR_PRI2_SHIFT                  16
9476421ab1dSMatthew Dillon #define	WRR_PRI3_SHIFT                  24
9486421ab1dSMatthew Dillon #define	WRR_PRI_DEFAULT                 4
9496421ab1dSMatthew Dillon #define	WRR_PRI_RESTRICT_SHIFT          29
9506421ab1dSMatthew Dillon 
9516421ab1dSMatthew Dillon #define	ALC_HQTD_CFG                    0x193C
9526421ab1dSMatthew Dillon #define	HQTD_CFG_Q1_BURST_MASK          0x0000000F
9536421ab1dSMatthew Dillon #define	HQTD_CFG_Q2_BURST_MASK          0x000000F0
9546421ab1dSMatthew Dillon #define	HQTD_CFG_Q3_BURST_MASK          0x00000F00
9556421ab1dSMatthew Dillon #define	HQTD_CFG_BURST_ENB              0x80000000
9566421ab1dSMatthew Dillon #define	HQTD_CFG_Q1_BURST_SHIFT         0
9576421ab1dSMatthew Dillon #define	HQTD_CFG_Q2_BURST_SHIFT         4
9586421ab1dSMatthew Dillon #define	HQTD_CFG_Q3_BURST_SHIFT         8
9596421ab1dSMatthew Dillon 
9606421ab1dSMatthew Dillon #define	ALC_MISC                        0x19C0
9616421ab1dSMatthew Dillon #define	MISC_INTNLOSC_OPEN              0x00000008
9626421ab1dSMatthew Dillon #define	MISC_ISO_ENB                    0x00001000
9636421ab1dSMatthew Dillon #define	MISC_PSW_OCP_MASK               0x00E00000
9646421ab1dSMatthew Dillon #define	MISC_PSW_OCP_SHIFT              21
9656421ab1dSMatthew Dillon #define	MISC_PSW_OCP_DEFAULT            7
9666421ab1dSMatthew Dillon 
9676421ab1dSMatthew Dillon #define	ALC_MISC2                       0x19C8
9686421ab1dSMatthew Dillon #define	MISC2_CALB_START                0x00000001
9696421ab1dSMatthew Dillon 
9706421ab1dSMatthew Dillon #define	ALC_MISC3                       0x19CC
9716421ab1dSMatthew Dillon #define	MISC3_25M_NOTO_INTNL            0x00000001
9726421ab1dSMatthew Dillon #define	MISC3_25M_BY_SW                 0x00000002
9736421ab1dSMatthew Dillon 
974bbf76eecSMatthew Dillon #define	ALC_MII_DBG_ADDR		0x1D
975bbf76eecSMatthew Dillon #define	ALC_MII_DBG_DATA		0x1E
976bbf76eecSMatthew Dillon 
977bbf76eecSMatthew Dillon #define	MII_ANA_CFG0			0x00
978bbf76eecSMatthew Dillon #define	ANA_RESTART_CAL			0x0001
979bbf76eecSMatthew Dillon #define	ANA_MANUL_SWICH_ON_MASK		0x001E
980bbf76eecSMatthew Dillon #define	ANA_MAN_ENABLE			0x0020
981bbf76eecSMatthew Dillon #define	ANA_SEL_HSP			0x0040
982bbf76eecSMatthew Dillon #define	ANA_EN_HB			0x0080
983bbf76eecSMatthew Dillon #define	ANA_EN_HBIAS			0x0100
984bbf76eecSMatthew Dillon #define	ANA_OEN_125M			0x0200
985bbf76eecSMatthew Dillon #define	ANA_EN_LCKDT			0x0400
986bbf76eecSMatthew Dillon #define	ANA_LCKDT_PHY			0x0800
987bbf76eecSMatthew Dillon #define	ANA_AFE_MODE			0x1000
988bbf76eecSMatthew Dillon #define	ANA_VCO_SLOW			0x2000
989bbf76eecSMatthew Dillon #define	ANA_VCO_FAST			0x4000
990bbf76eecSMatthew Dillon #define	ANA_SEL_CLK125M_DSP		0x8000
991bbf76eecSMatthew Dillon #define	ANA_MANUL_SWICH_ON_SHIFT	1
992bbf76eecSMatthew Dillon 
9936421ab1dSMatthew Dillon #define	MII_DBG_ANACTL			0x00
9946421ab1dSMatthew Dillon #define	DBG_ANACTL_DEFAULT		0x02EF
9956421ab1dSMatthew Dillon 
996bbf76eecSMatthew Dillon #define	MII_ANA_CFG4			0x04
997bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_MASK		0x0F
998bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_3_MASK		0x000F
999bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_2_MASK		0x00F0
1000bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_1_MASK		0x0F00
1001bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_0_MASK		0xF000
1002bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_3_SHIFT		0
1003bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_2_SHIFT		4
1004bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_1_SHIFT		8
1005bbf76eecSMatthew Dillon #define	ANA_IECHO_ADJ_0_SHIFT		12
1006bbf76eecSMatthew Dillon 
10076421ab1dSMatthew Dillon #define	MII_DBG_SYSMODCTL               0x04
10086421ab1dSMatthew Dillon #define	DBG_SYSMODCTL_DEFAULT           0xBB8B
10096421ab1dSMatthew Dillon 
1010bbf76eecSMatthew Dillon #define	MII_ANA_CFG5			0x05
1011bbf76eecSMatthew Dillon #define	ANA_SERDES_CDR_BW_MASK		0x0003
1012bbf76eecSMatthew Dillon #define	ANA_MS_PAD_DBG			0x0004
1013bbf76eecSMatthew Dillon #define	ANA_SPEEDUP_DBG			0x0008
1014bbf76eecSMatthew Dillon #define	ANA_SERDES_TH_LOS_MASK		0x0030
1015bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_DEEM		0x0040
1016bbf76eecSMatthew Dillon #define	ANA_SERDES_TXELECIDLE		0x0080
1017bbf76eecSMatthew Dillon #define	ANA_SERDES_BEACON		0x0100
1018bbf76eecSMatthew Dillon #define	ANA_SERDES_HALFTXDR		0x0200
1019bbf76eecSMatthew Dillon #define	ANA_SERDES_SEL_HSP		0x0400
1020bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_PLL		0x0800
1021bbf76eecSMatthew Dillon #define	ANA_SERDES_EN			0x1000
1022bbf76eecSMatthew Dillon #define	ANA_SERDES_EN_LCKDT		0x2000
1023bbf76eecSMatthew Dillon #define	ANA_SERDES_CDR_BW_SHIFT		0
1024bbf76eecSMatthew Dillon #define	ANA_SERDES_TH_LOS_SHIFT		4
1025bbf76eecSMatthew Dillon 
10266421ab1dSMatthew Dillon #define	MII_DBG_SRDSYSMOD               0x05
10276421ab1dSMatthew Dillon #define	DBG_SRDSYSMOD_DEFAULT           0x2C46
10286421ab1dSMatthew Dillon 
1029bbf76eecSMatthew Dillon #define	MII_ANA_CFG11			0x0B
1030bbf76eecSMatthew Dillon #define	ANA_PS_HIB_EN			0x8000
1031bbf76eecSMatthew Dillon 
10326421ab1dSMatthew Dillon #define	MII_DBG_HIBNEG                  0x0B
10336421ab1dSMatthew Dillon #define	DBG_HIBNEG_HIB_PULSE            0x1000
10346421ab1dSMatthew Dillon #define	DBG_HIBNEG_PSHIB_EN             0x8000
10356421ab1dSMatthew Dillon #define	DBG_HIBNEG_DEFAULT              0xBC40
10366421ab1dSMatthew Dillon 
1037bbf76eecSMatthew Dillon #define	MII_ANA_CFG18			0x12
1038bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_01MASK	0x0003
1039bbf76eecSMatthew Dillon #define	ANA_LOOP_SEL_10BT		0x0004
1040bbf76eecSMatthew Dillon #define	ANA_RGMII_MODE_SW		0x0008
1041bbf76eecSMatthew Dillon #define	ANA_EN_LONGECABLE		0x0010
1042bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_2		0x0020
1043bbf76eecSMatthew Dillon #define	ANA_EN_10BT_IDLE		0x0400
1044bbf76eecSMatthew Dillon #define	ANA_EN_MASK_TB			0x0800
1045bbf76eecSMatthew Dillon #define	ANA_TRIGGER_SEL_TIMER_MASK	0x3000
1046bbf76eecSMatthew Dillon #define	ANA_INTERVAL_SEL_TIMER_MASK	0xC000
1047bbf76eecSMatthew Dillon #define	ANA_TEST_MODE_10BT_01SHIFT	0
1048bbf76eecSMatthew Dillon #define	ANA_TRIGGER_SEL_TIMER_SHIFT	12
1049bbf76eecSMatthew Dillon #define	ANA_INTERVAL_SEL_TIMER_SHIFT	14
1050bbf76eecSMatthew Dillon 
10516421ab1dSMatthew Dillon #define	MII_DBG_TST10BTCFG              0x12
10526421ab1dSMatthew Dillon #define	DBG_TST10BTCFG_DEFAULT          0x4C04
10536421ab1dSMatthew Dillon 
10546421ab1dSMatthew Dillon #define	MII_DBG_AZ_ANADECT              0x15
10556421ab1dSMatthew Dillon #define	DBG_AZ_ANADECT_DEFAULT          0x3220
10566421ab1dSMatthew Dillon #define	DBG_AZ_ANADECT_LONG             0x3210
10576421ab1dSMatthew Dillon 
10586421ab1dSMatthew Dillon #define	MII_DBG_MSE16DB                 0x18
10596421ab1dSMatthew Dillon #define	DBG_MSE16DB_UP                  0x05EA
10606421ab1dSMatthew Dillon #define	DBG_MSE16DB_DOWN                0x02EA
10616421ab1dSMatthew Dillon 
10626421ab1dSMatthew Dillon #define	MII_DBG_MSE20DB                 0x1C
10636421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_MASK             0x01FC
10646421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_DEFAULT          0x2E
10656421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_HI               0x54
10666421ab1dSMatthew Dillon #define	DBG_MSE20DB_TH_SHIFT            2
10676421ab1dSMatthew Dillon 
10686421ab1dSMatthew Dillon #define	MII_DBG_AGC                     0x23
10696421ab1dSMatthew Dillon #define	DBG_AGC_2_VGA_MASK              0x3F00
10706421ab1dSMatthew Dillon #define	DBG_AGC_2_VGA_SHIFT             8
10716421ab1dSMatthew Dillon #define	DBG_AGC_LONG1G_LIMT             40
10726421ab1dSMatthew Dillon #define	DBG_AGC_LONG100M_LIMT           44
10736421ab1dSMatthew Dillon 
1074bbf76eecSMatthew Dillon #define	MII_ANA_CFG41			0x29
1075bbf76eecSMatthew Dillon #define	ANA_TOP_PS_EN			0x8000
1076bbf76eecSMatthew Dillon 
10776421ab1dSMatthew Dillon #define	MII_DBG_LEGCYPS                 0x29
10786421ab1dSMatthew Dillon #define	DBG_LEGCYPS_ENB                 0x8000
10796421ab1dSMatthew Dillon #define	DBG_LEGCYPS_DEFAULT             0x129D
10806421ab1dSMatthew Dillon 
1081bbf76eecSMatthew Dillon #define	MII_ANA_CFG54			0x36
1082bbf76eecSMatthew Dillon #define	ANA_LONG_CABLE_TH_100_MASK	0x003F
1083bbf76eecSMatthew Dillon #define	ANA_DESERVED			0x0040
1084bbf76eecSMatthew Dillon #define	ANA_EN_LIT_CH			0x0080
1085bbf76eecSMatthew Dillon #define	ANA_SHORT_CABLE_TH_100_MASK	0x3F00
1086bbf76eecSMatthew Dillon #define	ANA_BP_BAD_LINK_ACCUM		0x4000
1087bbf76eecSMatthew Dillon #define	ANA_BP_SMALL_BW			0x8000
1088bbf76eecSMatthew Dillon #define	ANA_LONG_CABLE_TH_100_SHIFT	0
1089bbf76eecSMatthew Dillon #define	ANA_SHORT_CABLE_TH_100_SHIFT	8
1090bbf76eecSMatthew Dillon 
10916421ab1dSMatthew Dillon #define	MII_DBG_TST100BTCFG             0x36
10926421ab1dSMatthew Dillon #define	DBG_TST100BTCFG_DEFAULT         0xE12C
10936421ab1dSMatthew Dillon 
10946421ab1dSMatthew Dillon #define	MII_DBG_GREENCFG                0x3B
10956421ab1dSMatthew Dillon #define	DBG_GREENCFG_DEFAULT            0x7078
10966421ab1dSMatthew Dillon 
10976421ab1dSMatthew Dillon #define	MII_DBG_GREENCFG2               0x3D
10986421ab1dSMatthew Dillon #define	DBG_GREENCFG2_GATE_DFSE_EN      0x0080
10996421ab1dSMatthew Dillon #define	DBG_GREENCFG2_BP_GREEN          0x8000
11006421ab1dSMatthew Dillon 
11016421ab1dSMatthew Dillon /* Device addr 3 */
11026421ab1dSMatthew Dillon #define	MII_EXT_PCS                     3
11036421ab1dSMatthew Dillon 
11046421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL3                 0x8003
11056421ab1dSMatthew Dillon #define	EXT_CLDCTL3_BP_CABLE1TH_DET_GT  0x8000
11066421ab1dSMatthew Dillon 
11076421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL5                 0x8005
11086421ab1dSMatthew Dillon #define	EXT_CLDCTL5_BP_VD_HLFBIAS       0x4000
11096421ab1dSMatthew Dillon 
11106421ab1dSMatthew Dillon #define	MII_EXT_CLDCTL6                 0x8006
11116421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_MASK        0x00FF
11126421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHIFT       0
11136421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHORT1G     116
11146421ab1dSMatthew Dillon #define	EXT_CLDCTL6_CAB_LEN_SHORT100M   152
11156421ab1dSMatthew Dillon 
11166421ab1dSMatthew Dillon #define	MII_EXT_VDRVBIAS                0x8062
11176421ab1dSMatthew Dillon #define	EXT_VDRVBIAS_DEFAULT            3
11186421ab1dSMatthew Dillon 
11196421ab1dSMatthew Dillon /* Device addr 7 */
11206421ab1dSMatthew Dillon #define	MII_EXT_ANEG                    7
11216421ab1dSMatthew Dillon 
11226421ab1dSMatthew Dillon #define	MII_EXT_ANEG_LOCAL_EEEADV       0x3C
11236421ab1dSMatthew Dillon #define	ANEG_LOCA_EEEADV_100BT          0x0002
11246421ab1dSMatthew Dillon #define	ANEG_LOCA_EEEADV_1000BT         0x0004
11256421ab1dSMatthew Dillon 
11266421ab1dSMatthew Dillon #define	MII_EXT_ANEG_AFE                0x801A
11276421ab1dSMatthew Dillon #define	ANEG_AFEE_10BT_100M_TH          0x0040
11286421ab1dSMatthew Dillon 
11296421ab1dSMatthew Dillon #define	MII_EXT_ANEG_S3DIG10            0x8023
11306421ab1dSMatthew Dillon #define	ANEG_S3DIG10_SL                 0x0001
11316421ab1dSMatthew Dillon #define	ANEG_S3DIG10_DEFAULT            0
11326421ab1dSMatthew Dillon 
11336421ab1dSMatthew Dillon #define	MII_EXT_ANEG_NLP78              0x8027
11346421ab1dSMatthew Dillon #define	ANEG_NLP78_120M_DEFAULT         0x8A05
11356421ab1dSMatthew Dillon 
1136bbf76eecSMatthew Dillon /* Statistics counters collected by the MAC. */
1137bbf76eecSMatthew Dillon struct smb {
1138bbf76eecSMatthew Dillon 	/* Rx stats. */
1139bbf76eecSMatthew Dillon 	uint32_t rx_frames;
1140bbf76eecSMatthew Dillon 	uint32_t rx_bcast_frames;
1141bbf76eecSMatthew Dillon 	uint32_t rx_mcast_frames;
1142bbf76eecSMatthew Dillon 	uint32_t rx_pause_frames;
1143bbf76eecSMatthew Dillon 	uint32_t rx_control_frames;
1144bbf76eecSMatthew Dillon 	uint32_t rx_crcerrs;
1145bbf76eecSMatthew Dillon 	uint32_t rx_lenerrs;
1146bbf76eecSMatthew Dillon 	uint32_t rx_bytes;
1147bbf76eecSMatthew Dillon 	uint32_t rx_runts;
1148bbf76eecSMatthew Dillon 	uint32_t rx_fragments;
1149bbf76eecSMatthew Dillon 	uint32_t rx_pkts_64;
1150bbf76eecSMatthew Dillon 	uint32_t rx_pkts_65_127;
1151bbf76eecSMatthew Dillon 	uint32_t rx_pkts_128_255;
1152bbf76eecSMatthew Dillon 	uint32_t rx_pkts_256_511;
1153bbf76eecSMatthew Dillon 	uint32_t rx_pkts_512_1023;
1154bbf76eecSMatthew Dillon 	uint32_t rx_pkts_1024_1518;
1155bbf76eecSMatthew Dillon 	uint32_t rx_pkts_1519_max;
1156bbf76eecSMatthew Dillon 	uint32_t rx_pkts_truncated;
1157bbf76eecSMatthew Dillon 	uint32_t rx_fifo_oflows;
1158bbf76eecSMatthew Dillon 	uint32_t rx_rrs_errs;
1159bbf76eecSMatthew Dillon 	uint32_t rx_alignerrs;
1160bbf76eecSMatthew Dillon 	uint32_t rx_bcast_bytes;
1161bbf76eecSMatthew Dillon 	uint32_t rx_mcast_bytes;
1162bbf76eecSMatthew Dillon 	uint32_t rx_pkts_filtered;
1163bbf76eecSMatthew Dillon 	/* Tx stats. */
1164bbf76eecSMatthew Dillon 	uint32_t tx_frames;
1165bbf76eecSMatthew Dillon 	uint32_t tx_bcast_frames;
1166bbf76eecSMatthew Dillon 	uint32_t tx_mcast_frames;
1167bbf76eecSMatthew Dillon 	uint32_t tx_pause_frames;
1168bbf76eecSMatthew Dillon 	uint32_t tx_excess_defer;
1169bbf76eecSMatthew Dillon 	uint32_t tx_control_frames;
1170bbf76eecSMatthew Dillon 	uint32_t tx_deferred;
1171bbf76eecSMatthew Dillon 	uint32_t tx_bytes;
1172bbf76eecSMatthew Dillon 	uint32_t tx_pkts_64;
1173bbf76eecSMatthew Dillon 	uint32_t tx_pkts_65_127;
1174bbf76eecSMatthew Dillon 	uint32_t tx_pkts_128_255;
1175bbf76eecSMatthew Dillon 	uint32_t tx_pkts_256_511;
1176bbf76eecSMatthew Dillon 	uint32_t tx_pkts_512_1023;
1177bbf76eecSMatthew Dillon 	uint32_t tx_pkts_1024_1518;
1178bbf76eecSMatthew Dillon 	uint32_t tx_pkts_1519_max;
1179bbf76eecSMatthew Dillon 	uint32_t tx_single_colls;
1180bbf76eecSMatthew Dillon 	uint32_t tx_multi_colls;
1181bbf76eecSMatthew Dillon 	uint32_t tx_late_colls;
1182bbf76eecSMatthew Dillon 	uint32_t tx_excess_colls;
1183bbf76eecSMatthew Dillon 	uint32_t tx_underrun;
1184bbf76eecSMatthew Dillon 	uint32_t tx_desc_underrun;
1185bbf76eecSMatthew Dillon 	uint32_t tx_lenerrs;
1186bbf76eecSMatthew Dillon 	uint32_t tx_pkts_truncated;
1187bbf76eecSMatthew Dillon 	uint32_t tx_bcast_bytes;
1188bbf76eecSMatthew Dillon 	uint32_t tx_mcast_bytes;
1189bbf76eecSMatthew Dillon 	uint32_t updated;
1190bbf76eecSMatthew Dillon };
1191bbf76eecSMatthew Dillon 
1192bbf76eecSMatthew Dillon /* CMB(Coalesing message block) */
1193bbf76eecSMatthew Dillon struct cmb {
1194bbf76eecSMatthew Dillon 	uint32_t cons;
1195bbf76eecSMatthew Dillon };
1196bbf76eecSMatthew Dillon 
1197bbf76eecSMatthew Dillon /* Rx free descriptor */
1198bbf76eecSMatthew Dillon struct rx_desc {
1199bbf76eecSMatthew Dillon 	uint64_t addr;
1200bbf76eecSMatthew Dillon };
1201bbf76eecSMatthew Dillon 
1202bbf76eecSMatthew Dillon /* Rx return descriptor */
1203bbf76eecSMatthew Dillon struct rx_rdesc {
1204bbf76eecSMatthew Dillon 	uint32_t rdinfo;
1205bbf76eecSMatthew Dillon #define	RRD_CSUM_MASK			0x0000FFFF
1206bbf76eecSMatthew Dillon #define	RRD_RD_CNT_MASK			0x000F0000
1207bbf76eecSMatthew Dillon #define	RRD_RD_IDX_MASK			0xFFF00000
1208bbf76eecSMatthew Dillon #define	RRD_CSUM_SHIFT			0
1209bbf76eecSMatthew Dillon #define	RRD_RD_CNT_SHIFT		16
1210bbf76eecSMatthew Dillon #define	RRD_RD_IDX_SHIFT		20
1211bbf76eecSMatthew Dillon #define	RRD_CSUM(x)			\
1212bbf76eecSMatthew Dillon 	(((x) & RRD_CSUM_MASK) >> RRD_CSUM_SHIFT)
1213bbf76eecSMatthew Dillon #define	RRD_RD_CNT(x)			\
1214bbf76eecSMatthew Dillon 	(((x) & RRD_RD_CNT_MASK) >> RRD_RD_CNT_SHIFT)
1215bbf76eecSMatthew Dillon #define	RRD_RD_IDX(x)			\
1216bbf76eecSMatthew Dillon 	(((x) & RRD_RD_IDX_MASK) >> RRD_RD_IDX_SHIFT)
1217bbf76eecSMatthew Dillon 	uint32_t rss;
1218bbf76eecSMatthew Dillon 	uint32_t vtag;
1219bbf76eecSMatthew Dillon #define	RRD_VLAN_MASK			0x0000FFFF
1220bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN_MASK		0x00FF0000
1221bbf76eecSMatthew Dillon #define	RRD_HDS_MASK			0x03000000
1222bbf76eecSMatthew Dillon #define	RRD_HDS_NONE			0x00000000
1223bbf76eecSMatthew Dillon #define	RRD_HDS_HEAD			0x01000000
1224bbf76eecSMatthew Dillon #define	RRD_HDS_DATA			0x02000000
1225bbf76eecSMatthew Dillon #define	RRD_CPU_MASK			0x0C000000
1226bbf76eecSMatthew Dillon #define	RRD_HASH_FLAG_MASK		0xF0000000
1227bbf76eecSMatthew Dillon #define	RRD_VLAN_SHIFT			0
1228bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN_SHIFT		16
1229bbf76eecSMatthew Dillon #define	RRD_HDS_SHIFT			24
1230bbf76eecSMatthew Dillon #define	RRD_CPU_SHIFT			26
1231bbf76eecSMatthew Dillon #define	RRD_HASH_FLAG_SHIFT		28
1232bbf76eecSMatthew Dillon #define	RRD_VLAN(x)			\
1233bbf76eecSMatthew Dillon 	(((x) & RRD_VLAN_MASK) >> RRD_VLAN_SHIFT)
1234bbf76eecSMatthew Dillon #define	RRD_HEAD_LEN(x)			\
1235bbf76eecSMatthew Dillon 	(((x) & RRD_HEAD_LEN_MASK) >> RRD_HEAD_LEN_SHIFT)
1236bbf76eecSMatthew Dillon #define	RRD_CPU(x)			\
1237bbf76eecSMatthew Dillon 	(((x) & RRD_CPU_MASK) >> RRD_CPU_SHIFT)
1238bbf76eecSMatthew Dillon 	uint32_t status;
1239bbf76eecSMatthew Dillon #define	RRD_LEN_MASK			0x00003FFF
1240bbf76eecSMatthew Dillon #define	RRD_LEN_SHIFT			0
1241bbf76eecSMatthew Dillon #define	RRD_TCP_UDPCSUM_NOK		0x00004000
1242bbf76eecSMatthew Dillon #define	RRD_IPCSUM_NOK			0x00008000
1243bbf76eecSMatthew Dillon #define	RRD_VLAN_TAG			0x00010000
1244bbf76eecSMatthew Dillon #define	RRD_PROTO_MASK			0x000E0000
1245bbf76eecSMatthew Dillon #define	RRD_PROTO_IPV4			0x00020000
1246bbf76eecSMatthew Dillon #define	RRD_PROTO_IPV6			0x000C0000
1247bbf76eecSMatthew Dillon #define	RRD_ERR_SUM			0x00100000
1248bbf76eecSMatthew Dillon #define	RRD_ERR_CRC			0x00200000
1249bbf76eecSMatthew Dillon #define	RRD_ERR_ALIGN			0x00400000
1250bbf76eecSMatthew Dillon #define	RRD_ERR_TRUNC			0x00800000
1251bbf76eecSMatthew Dillon #define	RRD_ERR_RUNT			0x01000000
1252bbf76eecSMatthew Dillon #define	RRD_ERR_ICMP			0x02000000
1253bbf76eecSMatthew Dillon #define	RRD_BCAST			0x04000000
1254bbf76eecSMatthew Dillon #define	RRD_MCAST			0x08000000
1255bbf76eecSMatthew Dillon #define	RRD_SNAP_LLC			0x10000000
1256bbf76eecSMatthew Dillon #define	RRD_ETHER			0x00000000
1257bbf76eecSMatthew Dillon #define	RRD_FIFO_FULL			0x20000000
1258bbf76eecSMatthew Dillon #define	RRD_ERR_LENGTH			0x40000000
1259bbf76eecSMatthew Dillon #define	RRD_VALID			0x80000000
1260bbf76eecSMatthew Dillon #define	RRD_BYTES(x)			\
1261bbf76eecSMatthew Dillon 	(((x) & RRD_LEN_MASK) >> RRD_LEN_SHIFT)
1262bbf76eecSMatthew Dillon #define	RRD_IPV4(x)			\
1263bbf76eecSMatthew Dillon 	(((x) & RRD_PROTO_MASK) == RRD_PROTO_IPV4)
1264bbf76eecSMatthew Dillon };
1265bbf76eecSMatthew Dillon 
1266bbf76eecSMatthew Dillon /* Tx descriptor */
1267bbf76eecSMatthew Dillon struct tx_desc {
1268bbf76eecSMatthew Dillon 	uint32_t len;
1269bbf76eecSMatthew Dillon #define	TD_BUFLEN_MASK			0x00003FFF
1270bbf76eecSMatthew Dillon #define	TD_VLAN_MASK			0xFFFF0000
1271bbf76eecSMatthew Dillon #define	TD_BUFLEN_SHIFT			0
1272bbf76eecSMatthew Dillon #define	TX_BYTES(x)			\
1273bbf76eecSMatthew Dillon 	(((x) << TD_BUFLEN_SHIFT) & TD_BUFLEN_MASK)
1274bbf76eecSMatthew Dillon #define	TD_VLAN_SHIFT			16
1275bbf76eecSMatthew Dillon 	uint32_t flags;
1276bbf76eecSMatthew Dillon #define	TD_L4HDR_OFFSET_MASK		0x000000FF	/* byte unit */
1277bbf76eecSMatthew Dillon #define	TD_TCPHDR_OFFSET_MASK		0x000000FF	/* byte unit */
1278bbf76eecSMatthew Dillon #define	TD_PLOAD_OFFSET_MASK		0x000000FF	/* 2 bytes unit */
1279bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM			0x00000100
1280bbf76eecSMatthew Dillon #define	TD_IPCSUM			0x00000200
1281bbf76eecSMatthew Dillon #define	TD_TCPCSUM			0x00000400
1282bbf76eecSMatthew Dillon #define	TD_UDPCSUM			0x00000800
1283bbf76eecSMatthew Dillon #define	TD_TSO				0x00001000
1284bbf76eecSMatthew Dillon #define	TD_TSO_DESCV1			0x00000000
1285bbf76eecSMatthew Dillon #define	TD_TSO_DESCV2			0x00002000
1286bbf76eecSMatthew Dillon #define	TD_CON_VLAN_TAG			0x00004000
1287bbf76eecSMatthew Dillon #define	TD_INS_VLAN_TAG			0x00008000
1288bbf76eecSMatthew Dillon #define	TD_IPV4_DESCV2			0x00010000
1289bbf76eecSMatthew Dillon #define	TD_LLC_SNAP			0x00020000
1290bbf76eecSMatthew Dillon #define	TD_ETHERNET			0x00000000
1291bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_OFFSET_MASK	0x03FC0000	/* 2 bytes unit */
1292bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_EVEN_PAD		0x40000000
1293bbf76eecSMatthew Dillon #define	TD_MSS_MASK			0x7FFC0000
1294bbf76eecSMatthew Dillon #define	TD_EOP				0x80000000
1295bbf76eecSMatthew Dillon #define	TD_L4HDR_OFFSET_SHIFT		0
1296bbf76eecSMatthew Dillon #define	TD_TCPHDR_OFFSET_SHIFT		0
1297bbf76eecSMatthew Dillon #define	TD_PLOAD_OFFSET_SHIFT		0
1298bbf76eecSMatthew Dillon #define	TD_CUSTOM_CSUM_OFFSET_SHIFT	18
1299bbf76eecSMatthew Dillon #define	TD_MSS_SHIFT			18
1300bbf76eecSMatthew Dillon 	uint64_t addr;
1301bbf76eecSMatthew Dillon };
1302bbf76eecSMatthew Dillon 
1303bbf76eecSMatthew Dillon #endif	/* _IF_ALCREG_H */
1304