xref: /freebsd/sys/dev/ale/if_alereg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
13c6e15bcSPyun YongHyeon /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
43c6e15bcSPyun YongHyeon  * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
53c6e15bcSPyun YongHyeon  * All rights reserved.
63c6e15bcSPyun YongHyeon  *
73c6e15bcSPyun YongHyeon  * Redistribution and use in source and binary forms, with or without
83c6e15bcSPyun YongHyeon  * modification, are permitted provided that the following conditions
93c6e15bcSPyun YongHyeon  * are met:
103c6e15bcSPyun YongHyeon  * 1. Redistributions of source code must retain the above copyright
113c6e15bcSPyun YongHyeon  *    notice unmodified, this list of conditions, and the following
123c6e15bcSPyun YongHyeon  *    disclaimer.
133c6e15bcSPyun YongHyeon  * 2. Redistributions in binary form must reproduce the above copyright
143c6e15bcSPyun YongHyeon  *    notice, this list of conditions and the following disclaimer in the
153c6e15bcSPyun YongHyeon  *    documentation and/or other materials provided with the distribution.
163c6e15bcSPyun YongHyeon  *
173c6e15bcSPyun YongHyeon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
183c6e15bcSPyun YongHyeon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
193c6e15bcSPyun YongHyeon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
203c6e15bcSPyun YongHyeon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
213c6e15bcSPyun YongHyeon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2283ad330dSPyun YongHyeon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
233c6e15bcSPyun YongHyeon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
243c6e15bcSPyun YongHyeon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
253c6e15bcSPyun YongHyeon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
263c6e15bcSPyun YongHyeon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2783ad330dSPyun YongHyeon  * SUCH DAMAGE.
283c6e15bcSPyun YongHyeon  */
293c6e15bcSPyun YongHyeon 
303c6e15bcSPyun YongHyeon #ifndef	_IF_ALEREG_H
313c6e15bcSPyun YongHyeon #define	_IF_ALEREG_H
323c6e15bcSPyun YongHyeon 
333c6e15bcSPyun YongHyeon /*
343c6e15bcSPyun YongHyeon  * Atheros Communucations, Inc. PCI vendor ID
353c6e15bcSPyun YongHyeon  */
363c6e15bcSPyun YongHyeon #define	VENDORID_ATHEROS		0x1969
373c6e15bcSPyun YongHyeon 
383c6e15bcSPyun YongHyeon /*
393c6e15bcSPyun YongHyeon  * Atheros AR8121/AR8113/AR8114 device ID
403c6e15bcSPyun YongHyeon  */
413c6e15bcSPyun YongHyeon #define	DEVICEID_ATHEROS_AR81XX		0x1026
423c6e15bcSPyun YongHyeon 
433c6e15bcSPyun YongHyeon #define	ALE_SPI_CTRL			0x200
443c6e15bcSPyun YongHyeon #define	SPI_VPD_ENB			0x00002000
453c6e15bcSPyun YongHyeon 
463c6e15bcSPyun YongHyeon #define	ALE_SPI_ADDR			0x204	/* 16bits */
473c6e15bcSPyun YongHyeon 
483c6e15bcSPyun YongHyeon #define	ALE_SPI_DATA			0x208
493c6e15bcSPyun YongHyeon 
503c6e15bcSPyun YongHyeon #define	ALE_SPI_CONFIG			0x20C
513c6e15bcSPyun YongHyeon 
523c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_PROGRAM		0x210	/* 8bits */
533c6e15bcSPyun YongHyeon 
543c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_SC_ERASE		0x211	/* 8bits */
553c6e15bcSPyun YongHyeon 
563c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_CHIP_ERASE		0x212	/* 8bits */
573c6e15bcSPyun YongHyeon 
583c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_RDID			0x213	/* 8bits */
593c6e15bcSPyun YongHyeon 
603c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_WREN			0x214	/* 8bits */
613c6e15bcSPyun YongHyeon 
623c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_RDSR			0x215	/* 8bits */
633c6e15bcSPyun YongHyeon 
643c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_WRSR			0x216	/* 8bits */
653c6e15bcSPyun YongHyeon 
663c6e15bcSPyun YongHyeon #define	ALE_SPI_OP_READ			0x217	/* 8bits */
673c6e15bcSPyun YongHyeon 
683c6e15bcSPyun YongHyeon #define	ALE_TWSI_CTRL			0x218
693c6e15bcSPyun YongHyeon #define	TWSI_CTRL_SW_LD_START		0x00000800
703c6e15bcSPyun YongHyeon #define	TWSI_CTRL_HW_LD_START		0x00001000
713c6e15bcSPyun YongHyeon #define	TWSI_CTRL_LD_EXIST		0x00400000
723c6e15bcSPyun YongHyeon 
733c6e15bcSPyun YongHyeon #define ALE_DEV_MISC_CTRL		0x21C
743c6e15bcSPyun YongHyeon 
753c6e15bcSPyun YongHyeon #define	ALE_PCIE_PHYMISC		0x1000
763c6e15bcSPyun YongHyeon #define	PCIE_PHYMISC_FORCE_RCV_DET	0x00000004
773c6e15bcSPyun YongHyeon 
783c6e15bcSPyun YongHyeon #define	ALE_MASTER_CFG			0x1400
793c6e15bcSPyun YongHyeon #define	MASTER_RESET			0x00000001
803c6e15bcSPyun YongHyeon #define	MASTER_MTIMER_ENB		0x00000002
813c6e15bcSPyun YongHyeon #define	MASTER_IM_TX_TIMER_ENB		0x00000004
823c6e15bcSPyun YongHyeon #define	MASTER_MANUAL_INT_ENB		0x00000008
833c6e15bcSPyun YongHyeon #define	MASTER_IM_RX_TIMER_ENB		0x00000020
843c6e15bcSPyun YongHyeon #define	MASTER_INT_RDCLR		0x00000040
853c6e15bcSPyun YongHyeon #define	MASTER_LED_MODE			0x00000200
863c6e15bcSPyun YongHyeon #define	MASTER_CHIP_REV_MASK		0x00FF0000
873c6e15bcSPyun YongHyeon #define	MASTER_CHIP_ID_MASK		0xFF000000
883c6e15bcSPyun YongHyeon #define	MASTER_CHIP_REV_SHIFT		16
893c6e15bcSPyun YongHyeon #define	MASTER_CHIP_ID_SHIFT		24
903c6e15bcSPyun YongHyeon 
913c6e15bcSPyun YongHyeon /* Number of ticks per usec for AR81xx. */
923c6e15bcSPyun YongHyeon #define	ALE_TICK_USECS			2
933c6e15bcSPyun YongHyeon #define	ALE_USECS(x)			((x) / ALE_TICK_USECS)
943c6e15bcSPyun YongHyeon 
953c6e15bcSPyun YongHyeon #define	ALE_MANUAL_TIMER		0x1404
963c6e15bcSPyun YongHyeon 
973c6e15bcSPyun YongHyeon #define	ALE_IM_TIMER			0x1408
983c6e15bcSPyun YongHyeon #define	IM_TIMER_TX_MASK		0x0000FFFF
993c6e15bcSPyun YongHyeon #define	IM_TIMER_RX_MASK		0xFFFF0000
1003c6e15bcSPyun YongHyeon #define	IM_TIMER_TX_SHIFT		0
1013c6e15bcSPyun YongHyeon #define	IM_TIMER_RX_SHIFT		16
1023c6e15bcSPyun YongHyeon #define	ALE_IM_TIMER_MIN		0
1033c6e15bcSPyun YongHyeon #define	ALE_IM_TIMER_MAX		130000	/* 130ms */
1043c6e15bcSPyun YongHyeon #define	ALE_IM_RX_TIMER_DEFAULT		30
1053c6e15bcSPyun YongHyeon #define	ALE_IM_TX_TIMER_DEFAULT		1000
1063c6e15bcSPyun YongHyeon 
1073c6e15bcSPyun YongHyeon #define	ALE_GPHY_CTRL			0x140C	/* 16bits */
1083c6e15bcSPyun YongHyeon #define	GPHY_CTRL_EXT_RESET		0x0001
1093c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PIPE_MOD		0x0002
1103c6e15bcSPyun YongHyeon #define	GPHY_CTRL_BERT_START		0x0010
1113c6e15bcSPyun YongHyeon #define	GPHY_CTRL_GALE_25M_ENB		0x0020
1123c6e15bcSPyun YongHyeon #define	GPHY_CTRL_LPW_EXIT		0x0040
1133c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PHY_IDDQ		0x0080
1143c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PHY_IDDQ_DIS		0x0100
1153c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PCLK_SEL_DIS		0x0200
1163c6e15bcSPyun YongHyeon #define	GPHY_CTRL_HIB_EN		0x0400
1173c6e15bcSPyun YongHyeon #define	GPHY_CTRL_HIB_PULSE		0x0800
1183c6e15bcSPyun YongHyeon #define	GPHY_CTRL_SEL_ANA_RESET		0x1000
1193c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PHY_PLL_ON		0x2000
1203c6e15bcSPyun YongHyeon #define	GPHY_CTRL_PWDOWN_HW		0x4000
1213c6e15bcSPyun YongHyeon 
1223c6e15bcSPyun YongHyeon #define	ALE_INTR_CLR_TIMER		0x140E	/* 16bits */
1233c6e15bcSPyun YongHyeon 
1243c6e15bcSPyun YongHyeon #define	ALE_IDLE_STATUS			0x1410
1253c6e15bcSPyun YongHyeon #define	IDLE_STATUS_RXMAC		0x00000001
1263c6e15bcSPyun YongHyeon #define	IDLE_STATUS_TXMAC		0x00000002
1273c6e15bcSPyun YongHyeon #define	IDLE_STATUS_RXQ			0x00000004
1283c6e15bcSPyun YongHyeon #define	IDLE_STATUS_TXQ			0x00000008
1293c6e15bcSPyun YongHyeon #define	IDLE_STATUS_DMARD		0x00000010
1303c6e15bcSPyun YongHyeon #define	IDLE_STATUS_DMAWR		0x00000020
1313c6e15bcSPyun YongHyeon #define	IDLE_STATUS_SMB			0x00000040
1323c6e15bcSPyun YongHyeon #define	IDLE_STATUS_CMB			0x00000080
1333c6e15bcSPyun YongHyeon 
1343c6e15bcSPyun YongHyeon #define	ALE_MDIO			0x1414
1353c6e15bcSPyun YongHyeon #define	MDIO_DATA_MASK			0x0000FFFF
1363c6e15bcSPyun YongHyeon #define	MDIO_REG_ADDR_MASK		0x001F0000
1373c6e15bcSPyun YongHyeon #define	MDIO_OP_READ			0x00200000
1383c6e15bcSPyun YongHyeon #define	MDIO_OP_WRITE			0x00000000
1393c6e15bcSPyun YongHyeon #define	MDIO_SUP_PREAMBLE		0x00400000
1403c6e15bcSPyun YongHyeon #define	MDIO_OP_EXECUTE			0x00800000
1413c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_4			0x00000000
1423c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_6			0x02000000
1433c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_8			0x03000000
1443c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_10			0x04000000
1453c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_14			0x05000000
1463c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_20			0x06000000
1473c6e15bcSPyun YongHyeon #define	MDIO_CLK_25_28			0x07000000
1483c6e15bcSPyun YongHyeon #define	MDIO_OP_BUSY			0x08000000
1493c6e15bcSPyun YongHyeon #define	MDIO_DATA_SHIFT			0
1503c6e15bcSPyun YongHyeon #define	MDIO_REG_ADDR_SHIFT		16
1513c6e15bcSPyun YongHyeon 
1523c6e15bcSPyun YongHyeon #define	MDIO_REG_ADDR(x)	\
1533c6e15bcSPyun YongHyeon 	(((x) << MDIO_REG_ADDR_SHIFT) & MDIO_REG_ADDR_MASK)
1543c6e15bcSPyun YongHyeon /* Default PHY address. */
1553c6e15bcSPyun YongHyeon #define	ALE_PHY_ADDR			0
1563c6e15bcSPyun YongHyeon 
1573c6e15bcSPyun YongHyeon #define	ALE_PHY_STATUS			0x1418
1583c6e15bcSPyun YongHyeon #define	PHY_STATUS_100M			0x00020000
1593c6e15bcSPyun YongHyeon 
1603c6e15bcSPyun YongHyeon /* Packet memory BIST. */
1613c6e15bcSPyun YongHyeon #define	ALE_BIST0			0x141C
1623c6e15bcSPyun YongHyeon #define	BIST0_ENB			0x00000001
1633c6e15bcSPyun YongHyeon #define	BIST0_SRAM_FAIL			0x00000002
1643c6e15bcSPyun YongHyeon #define	BIST0_FUSE_FLAG			0x00000004
1653c6e15bcSPyun YongHyeon 
1663c6e15bcSPyun YongHyeon /* PCIe retry buffer BIST. */
1673c6e15bcSPyun YongHyeon #define	ALE_BIST1			0x1420
1683c6e15bcSPyun YongHyeon #define	BIST1_ENB			0x00000001
1693c6e15bcSPyun YongHyeon #define	BIST1_SRAM_FAIL			0x00000002
1703c6e15bcSPyun YongHyeon #define	BIST1_FUSE_FLAG			0x00000004
1713c6e15bcSPyun YongHyeon 
1723c6e15bcSPyun YongHyeon #define	ALE_SERDES_LOCK			0x1424
1733c6e15bcSPyun YongHyeon #define	SERDES_LOCK_DET			0x00000001
1743c6e15bcSPyun YongHyeon #define	SERDES_LOCK_DET_ENB		0x00000002
1753c6e15bcSPyun YongHyeon 
1763c6e15bcSPyun YongHyeon #define	ALE_MAC_CFG			0x1480
1773c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_ENB			0x00000001
1783c6e15bcSPyun YongHyeon #define	MAC_CFG_RX_ENB			0x00000002
1793c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_FC			0x00000004
1803c6e15bcSPyun YongHyeon #define	MAC_CFG_RX_FC			0x00000008
1813c6e15bcSPyun YongHyeon #define	MAC_CFG_LOOP			0x00000010
1823c6e15bcSPyun YongHyeon #define	MAC_CFG_FULL_DUPLEX		0x00000020
1833c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_CRC_ENB		0x00000040
1843c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_AUTO_PAD		0x00000080
1853c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_LENCHK		0x00000100
1863c6e15bcSPyun YongHyeon #define	MAC_CFG_RX_JUMBO_ENB		0x00000200
1873c6e15bcSPyun YongHyeon #define	MAC_CFG_PREAMBLE_MASK		0x00003C00
1883c6e15bcSPyun YongHyeon #define	MAC_CFG_VLAN_TAG_STRIP		0x00004000
1893c6e15bcSPyun YongHyeon #define	MAC_CFG_PROMISC			0x00008000
1903c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_PAUSE		0x00010000
1913c6e15bcSPyun YongHyeon #define	MAC_CFG_SCNT			0x00020000
1923c6e15bcSPyun YongHyeon #define	MAC_CFG_SYNC_RST_TX		0x00040000
1933c6e15bcSPyun YongHyeon #define	MAC_CFG_SPEED_MASK		0x00300000
1943c6e15bcSPyun YongHyeon #define	MAC_CFG_SPEED_10_100		0x00100000
1953c6e15bcSPyun YongHyeon #define	MAC_CFG_SPEED_1000		0x00200000
1963c6e15bcSPyun YongHyeon #define	MAC_CFG_DBG_TX_BACKOFF		0x00400000
1973c6e15bcSPyun YongHyeon #define	MAC_CFG_TX_JUMBO_ENB		0x00800000
1983c6e15bcSPyun YongHyeon #define	MAC_CFG_RXCSUM_ENB		0x01000000
1993c6e15bcSPyun YongHyeon #define	MAC_CFG_ALLMULTI		0x02000000
2003c6e15bcSPyun YongHyeon #define	MAC_CFG_BCAST			0x04000000
2013c6e15bcSPyun YongHyeon #define	MAC_CFG_DBG			0x08000000
2023c6e15bcSPyun YongHyeon #define	MAC_CFG_PREAMBLE_SHIFT		10
2033c6e15bcSPyun YongHyeon #define	MAC_CFG_PREAMBLE_DEFAULT	7
2043c6e15bcSPyun YongHyeon 
2053c6e15bcSPyun YongHyeon #define	ALE_IPG_IFG_CFG			0x1484
2063c6e15bcSPyun YongHyeon #define	IPG_IFG_IPGT_MASK		0x0000007F
2073c6e15bcSPyun YongHyeon #define	IPG_IFG_MIFG_MASK		0x0000FF00
2083c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG1_MASK		0x007F0000
2093c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG2_MASK		0x7F000000
2103c6e15bcSPyun YongHyeon #define	IPG_IFG_IPGT_SHIFT		0
2113c6e15bcSPyun YongHyeon #define	IPG_IFG_IPGT_DEFAULT		0x60
2123c6e15bcSPyun YongHyeon #define	IPG_IFG_MIFG_SHIFT		8
2133c6e15bcSPyun YongHyeon #define	IPG_IFG_MIFG_DEFAULT		0x50
2143c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG1_SHIFT		16
2153c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG1_DEFAULT		0x40
2163c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG2_SHIFT		24
2173c6e15bcSPyun YongHyeon #define	IPG_IFG_IPG2_DEFAULT		0x60
2183c6e15bcSPyun YongHyeon 
2193c6e15bcSPyun YongHyeon /* Station address. */
2203c6e15bcSPyun YongHyeon #define	ALE_PAR0			0x1488
2213c6e15bcSPyun YongHyeon #define	ALE_PAR1			0x148C
2223c6e15bcSPyun YongHyeon 
2233c6e15bcSPyun YongHyeon /* 64bit multicast hash register. */
2243c6e15bcSPyun YongHyeon #define	ALE_MAR0			0x1490
2253c6e15bcSPyun YongHyeon #define	ALE_MAR1			0x1494
2263c6e15bcSPyun YongHyeon 
2273c6e15bcSPyun YongHyeon /* half-duplex parameter configuration. */
2283c6e15bcSPyun YongHyeon #define	ALE_HDPX_CFG			0x1498
2293c6e15bcSPyun YongHyeon #define	HDPX_CFG_LCOL_MASK		0x000003FF
2303c6e15bcSPyun YongHyeon #define	HDPX_CFG_RETRY_MASK		0x0000F000
2313c6e15bcSPyun YongHyeon #define	HDPX_CFG_EXC_DEF_EN		0x00010000
2323c6e15bcSPyun YongHyeon #define	HDPX_CFG_NO_BACK_C		0x00020000
2333c6e15bcSPyun YongHyeon #define	HDPX_CFG_NO_BACK_P		0x00040000
2343c6e15bcSPyun YongHyeon #define	HDPX_CFG_ABEBE			0x00080000
2353c6e15bcSPyun YongHyeon #define	HDPX_CFG_ABEBT_MASK		0x00F00000
2363c6e15bcSPyun YongHyeon #define	HDPX_CFG_JAMIPG_MASK		0x0F000000
2373c6e15bcSPyun YongHyeon #define	HDPX_CFG_LCOL_SHIFT		0
2383c6e15bcSPyun YongHyeon #define	HDPX_CFG_LCOL_DEFAULT		0x37
2393c6e15bcSPyun YongHyeon #define	HDPX_CFG_RETRY_SHIFT		12
2403c6e15bcSPyun YongHyeon #define	HDPX_CFG_RETRY_DEFAULT		0x0F
2413c6e15bcSPyun YongHyeon #define	HDPX_CFG_ABEBT_SHIFT		20
2423c6e15bcSPyun YongHyeon #define	HDPX_CFG_ABEBT_DEFAULT		0x0A
2433c6e15bcSPyun YongHyeon #define	HDPX_CFG_JAMIPG_SHIFT		24
2443c6e15bcSPyun YongHyeon #define	HDPX_CFG_JAMIPG_DEFAULT		0x07
2453c6e15bcSPyun YongHyeon 
2463c6e15bcSPyun YongHyeon #define	ALE_FRAME_SIZE			0x149C
2473c6e15bcSPyun YongHyeon 
2483c6e15bcSPyun YongHyeon #define	ALE_WOL_CFG			0x14A0
2493c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN			0x00000001
2503c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN_ENB		0x00000002
2513c6e15bcSPyun YongHyeon #define	WOL_CFG_MAGIC			0x00000004
2523c6e15bcSPyun YongHyeon #define	WOL_CFG_MAGIC_ENB		0x00000008
2533c6e15bcSPyun YongHyeon #define	WOL_CFG_LINK_CHG		0x00000010
2543c6e15bcSPyun YongHyeon #define	WOL_CFG_LINK_CHG_ENB		0x00000020
2553c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN_DET		0x00000100
2563c6e15bcSPyun YongHyeon #define	WOL_CFG_MAGIC_DET		0x00000200
2573c6e15bcSPyun YongHyeon #define	WOL_CFG_LINK_CHG_DET		0x00000400
2583c6e15bcSPyun YongHyeon #define	WOL_CFG_CLK_SWITCH_ENB		0x00008000
2593c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN0		0x00010000
2603c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN1		0x00020000
2613c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN2		0x00040000
2623c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN3		0x00080000
2633c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN4		0x00100000
2643c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN5		0x00200000
2653c6e15bcSPyun YongHyeon #define	WOL_CFG_PATTERN6		0x00400000
2663c6e15bcSPyun YongHyeon 
2673c6e15bcSPyun YongHyeon /* WOL pattern length. */
2683c6e15bcSPyun YongHyeon #define	ALE_PATTERN_CFG0		0x14A4
2693c6e15bcSPyun YongHyeon #define	PATTERN_CFG_0_LEN_MASK		0x0000007F
2703c6e15bcSPyun YongHyeon #define	PATTERN_CFG_1_LEN_MASK		0x00007F00
2713c6e15bcSPyun YongHyeon #define	PATTERN_CFG_2_LEN_MASK		0x007F0000
2723c6e15bcSPyun YongHyeon #define	PATTERN_CFG_3_LEN_MASK		0x7F000000
2733c6e15bcSPyun YongHyeon 
2743c6e15bcSPyun YongHyeon #define	ALE_PATTERN_CFG1		0x14A8
2753c6e15bcSPyun YongHyeon #define	PATTERN_CFG_4_LEN_MASK		0x0000007F
2763c6e15bcSPyun YongHyeon #define	PATTERN_CFG_5_LEN_MASK		0x00007F00
2773c6e15bcSPyun YongHyeon #define	PATTERN_CFG_6_LEN_MASK		0x007F0000
2783c6e15bcSPyun YongHyeon 
2793c6e15bcSPyun YongHyeon /* RSS */
2803c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY0			0x14B0
2813c6e15bcSPyun YongHyeon 
2823c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY1			0x14B4
2833c6e15bcSPyun YongHyeon 
2843c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY2			0x14B8
2853c6e15bcSPyun YongHyeon 
2863c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY3			0x14BC
2873c6e15bcSPyun YongHyeon 
2883c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY4			0x14C0
2893c6e15bcSPyun YongHyeon 
2903c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY5			0x14C4
2913c6e15bcSPyun YongHyeon 
2923c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY6			0x14C8
2933c6e15bcSPyun YongHyeon 
2943c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY7			0x14CC
2953c6e15bcSPyun YongHyeon 
2963c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY8			0x14D0
2973c6e15bcSPyun YongHyeon 
2983c6e15bcSPyun YongHyeon #define	ALE_RSS_KEY9			0x14D4
2993c6e15bcSPyun YongHyeon 
3003c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE4		0x14E0
3013c6e15bcSPyun YongHyeon 
3023c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE5		0x14E4
3033c6e15bcSPyun YongHyeon 
3043c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE6		0x14E8
3053c6e15bcSPyun YongHyeon 
3063c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE7		0x14EC
3073c6e15bcSPyun YongHyeon 
3083c6e15bcSPyun YongHyeon #define	ALE_SRAM_RD_ADDR		0x1500
3093c6e15bcSPyun YongHyeon 
3103c6e15bcSPyun YongHyeon #define	ALE_SRAM_RD_LEN			0x1504
3113c6e15bcSPyun YongHyeon 
3123c6e15bcSPyun YongHyeon #define	ALE_SRAM_RRD_ADDR		0x1508
3133c6e15bcSPyun YongHyeon 
3143c6e15bcSPyun YongHyeon #define	ALE_SRAM_RRD_LEN		0x150C
3153c6e15bcSPyun YongHyeon 
3163c6e15bcSPyun YongHyeon #define	ALE_SRAM_TPD_ADDR		0x1510
3173c6e15bcSPyun YongHyeon 
3183c6e15bcSPyun YongHyeon #define	ALE_SRAM_TPD_LEN		0x1514
3193c6e15bcSPyun YongHyeon 
3203c6e15bcSPyun YongHyeon #define	ALE_SRAM_TRD_ADDR		0x1518
3213c6e15bcSPyun YongHyeon 
3223c6e15bcSPyun YongHyeon #define	ALE_SRAM_TRD_LEN		0x151C
3233c6e15bcSPyun YongHyeon 
3243c6e15bcSPyun YongHyeon #define	ALE_SRAM_RX_FIFO_ADDR		0x1520
3253c6e15bcSPyun YongHyeon 
3263c6e15bcSPyun YongHyeon #define	ALE_SRAM_RX_FIFO_LEN		0x1524
3273c6e15bcSPyun YongHyeon 
3283c6e15bcSPyun YongHyeon #define	ALE_SRAM_TX_FIFO_ADDR		0x1528
3293c6e15bcSPyun YongHyeon 
3303c6e15bcSPyun YongHyeon #define	ALE_SRAM_TX_FIFO_LEN		0x152C
3313c6e15bcSPyun YongHyeon 
3323c6e15bcSPyun YongHyeon #define	ALE_SRAM_TCPH_ADDR		0x1530
3333c6e15bcSPyun YongHyeon #define	SRAM_TCPH_ADDR_MASK		0x00000FFF
3343c6e15bcSPyun YongHyeon #define	SRAM_PATH_ADDR_MASK		0x0FFF0000
3353c6e15bcSPyun YongHyeon #define	SRAM_TCPH_ADDR_SHIFT		0
3363c6e15bcSPyun YongHyeon #define	SRAM_PATH_ADDR_SHIFT		16
3373c6e15bcSPyun YongHyeon 
3383c6e15bcSPyun YongHyeon #define	ALE_DMA_BLOCK			0x1534
3393c6e15bcSPyun YongHyeon #define	DMA_BLOCK_LOAD			0x00000001
3403c6e15bcSPyun YongHyeon 
3413c6e15bcSPyun YongHyeon #define	ALE_RXF3_ADDR_HI		0x153C
3423c6e15bcSPyun YongHyeon 
3433c6e15bcSPyun YongHyeon #define	ALE_TPD_ADDR_HI			0x1540
3443c6e15bcSPyun YongHyeon 
3453c6e15bcSPyun YongHyeon #define	ALE_RXF0_PAGE0_ADDR_LO		0x1544
3463c6e15bcSPyun YongHyeon 
3473c6e15bcSPyun YongHyeon #define	ALE_RXF0_PAGE1_ADDR_LO		0x1548
3483c6e15bcSPyun YongHyeon 
3493c6e15bcSPyun YongHyeon #define	ALE_TPD_ADDR_LO			0x154C
3503c6e15bcSPyun YongHyeon 
3513c6e15bcSPyun YongHyeon #define	ALE_RXF1_ADDR_HI		0x1550
3523c6e15bcSPyun YongHyeon 
3533c6e15bcSPyun YongHyeon #define	ALE_RXF2_ADDR_HI		0x1554
3543c6e15bcSPyun YongHyeon 
3553c6e15bcSPyun YongHyeon #define	ALE_RXF_PAGE_SIZE		0x1558
3563c6e15bcSPyun YongHyeon 
3573c6e15bcSPyun YongHyeon #define	ALE_TPD_CNT			0x155C
3583c6e15bcSPyun YongHyeon #define	TPD_CNT_MASK			0x00003FF
3593c6e15bcSPyun YongHyeon #define	TPD_CNT_SHIFT			0
3603c6e15bcSPyun YongHyeon 
3613c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE0		0x1560
3623c6e15bcSPyun YongHyeon 
3633c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE1		0x1564
3643c6e15bcSPyun YongHyeon 
3653c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE2		0x1568
3663c6e15bcSPyun YongHyeon 
3673c6e15bcSPyun YongHyeon #define	ALE_RSS_IDT_TABLE3		0x156C
3683c6e15bcSPyun YongHyeon 
3693c6e15bcSPyun YongHyeon #define	ALE_RSS_HASH_VALUE		0x1570
3703c6e15bcSPyun YongHyeon 
3713c6e15bcSPyun YongHyeon #define	ALE_RSS_HASH_FLAG		0x1574
3723c6e15bcSPyun YongHyeon 
3733c6e15bcSPyun YongHyeon #define	ALE_RSS_CPU			0x157C
3743c6e15bcSPyun YongHyeon 
3753c6e15bcSPyun YongHyeon #define	ALE_TXQ_CFG			0x1580
3763c6e15bcSPyun YongHyeon #define	TXQ_CFG_TPD_BURST_MASK		0x0000000F
3773c6e15bcSPyun YongHyeon #define	TXQ_CFG_ENB			0x00000020
3783c6e15bcSPyun YongHyeon #define	TXQ_CFG_ENHANCED_MODE		0x00000040
3793c6e15bcSPyun YongHyeon #define	TXQ_CFG_TX_FIFO_BURST_MASK	0xFFFF0000
3803c6e15bcSPyun YongHyeon #define	TXQ_CFG_TPD_BURST_SHIFT		0
3813c6e15bcSPyun YongHyeon #define	TXQ_CFG_TPD_BURST_DEFAULT	4
3823c6e15bcSPyun YongHyeon #define	TXQ_CFG_TX_FIFO_BURST_SHIFT	16
3833c6e15bcSPyun YongHyeon #define	TXQ_CFG_TX_FIFO_BURST_DEFAULT	256
3843c6e15bcSPyun YongHyeon 
3853c6e15bcSPyun YongHyeon #define	ALE_TX_JUMBO_THRESH		0x1584
3863c6e15bcSPyun YongHyeon #define	TX_JUMBO_THRESH_MASK		0x000007FF
3873c6e15bcSPyun YongHyeon #define	TX_JUMBO_THRESH_SHIFT		0
3883c6e15bcSPyun YongHyeon #define	TX_JUMBO_THRESH_UNIT		8
3893c6e15bcSPyun YongHyeon #define	TX_JUMBO_THRESH_UNIT_SHIFT	3
3903c6e15bcSPyun YongHyeon 
3913c6e15bcSPyun YongHyeon #define	ALE_RXQ_CFG			0x15A0
3923c6e15bcSPyun YongHyeon #define	RXQ_CFG_ALIGN_32		0x00000000
3933c6e15bcSPyun YongHyeon #define	RXQ_CFG_ALIGN_64		0x00000001
3943c6e15bcSPyun YongHyeon #define	RXQ_CFG_ALIGN_128		0x00000002
3953c6e15bcSPyun YongHyeon #define	RXQ_CFG_ALIGN_256		0x00000003
3963c6e15bcSPyun YongHyeon #define	RXQ_CFG_QUEUE1_ENB		0x00000010
3973c6e15bcSPyun YongHyeon #define	RXQ_CFG_QUEUE2_ENB		0x00000020
3983c6e15bcSPyun YongHyeon #define	RXQ_CFG_QUEUE3_ENB		0x00000040
3993c6e15bcSPyun YongHyeon #define	RXQ_CFG_IPV6_CSUM_VERIFY	0x00000080
4003c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_TBL_LEN_MASK	0x0000FF00
4013c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_IPV4		0x00010000
4023c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_IPV4_TCP	0x00020000
4033c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_IPV6		0x00040000
4043c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_IPV6_TCP	0x00080000
4053c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_MODE_DIS		0x00000000
4063c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_MODE_SQSINT		0x04000000
4073c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_MODE_MQUESINT	0x08000000
4083c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_MODE_MQUEMINT	0x0C000000
4093c6e15bcSPyun YongHyeon #define	RXQ_CFG_NIP_QUEUE_SEL_TBL	0x10000000
4103c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_ENB		0x20000000
4113c6e15bcSPyun YongHyeon #define	RXQ_CFG_CUT_THROUGH_ENB		0x40000000
4123c6e15bcSPyun YongHyeon #define	RXQ_CFG_ENB			0x80000000
4133c6e15bcSPyun YongHyeon #define	RXQ_CFG_RSS_HASH_TBL_LEN_SHIFT	8
4143c6e15bcSPyun YongHyeon 
4153c6e15bcSPyun YongHyeon #define	ALE_RX_JUMBO_THRESH		0x15A4	/* 16bits */
4163c6e15bcSPyun YongHyeon #define	RX_JUMBO_THRESH_MASK		0x07FF
4173c6e15bcSPyun YongHyeon #define	RX_JUMBO_LKAH_MASK		0x7800
4183c6e15bcSPyun YongHyeon #define	RX_JUMBO_THRESH_MASK_SHIFT	0
4193c6e15bcSPyun YongHyeon #define	RX_JUMBO_THRESH_UNIT		8
4203c6e15bcSPyun YongHyeon #define	RX_JUMBO_THRESH_UNIT_SHIFT	3
4213c6e15bcSPyun YongHyeon #define	RX_JUMBO_LKAH_SHIFT		11
4223c6e15bcSPyun YongHyeon #define	RX_JUMBO_LKAH_DEFAULT		1
4233c6e15bcSPyun YongHyeon 
4243c6e15bcSPyun YongHyeon #define	ALE_RX_FIFO_PAUSE_THRESH	0x15A8
4253c6e15bcSPyun YongHyeon #define	RX_FIFO_PAUSE_THRESH_LO_MASK	0x00000FFF
4263c6e15bcSPyun YongHyeon #define	RX_FIFO_PAUSE_THRESH_HI_MASK	0x0FFF0000
4273c6e15bcSPyun YongHyeon #define	RX_FIFO_PAUSE_THRESH_LO_SHIFT	0
4283c6e15bcSPyun YongHyeon #define	RX_FIFO_PAUSE_THRESH_HI_SHIFT	16
4293c6e15bcSPyun YongHyeon 
4303c6e15bcSPyun YongHyeon #define	ALE_CMB_RXF1			0x15B4
4313c6e15bcSPyun YongHyeon 
4323c6e15bcSPyun YongHyeon #define	ALE_CMB_RXF2			0x15B8
4333c6e15bcSPyun YongHyeon 
4343c6e15bcSPyun YongHyeon #define	ALE_CMB_RXF3			0x15BC
4353c6e15bcSPyun YongHyeon 
4363c6e15bcSPyun YongHyeon #define	ALE_DMA_CFG			0x15C0
4373c6e15bcSPyun YongHyeon #define	DMA_CFG_IN_ORDER		0x00000001
4383c6e15bcSPyun YongHyeon #define	DMA_CFG_ENH_ORDER		0x00000002
4393c6e15bcSPyun YongHyeon #define	DMA_CFG_OUT_ORDER		0x00000004
4403c6e15bcSPyun YongHyeon #define	DMA_CFG_RCB_64			0x00000000
4413c6e15bcSPyun YongHyeon #define	DMA_CFG_RCB_128			0x00000008
4423c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_128		0x00000000
4433c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_256		0x00000010
4443c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_512		0x00000020
4453c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_1024		0x00000030
4463c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_2048		0x00000040
4473c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_4096		0x00000050
4483c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_128		0x00000000
4493c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_256		0x00000080
4503c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_512		0x00000100
4513c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_1024		0x00000180
4523c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_2048		0x00000200
4533c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_4096		0x00000280
4543c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_REQ_PRI		0x00000400
4553c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_DELAY_CNT_MASK	0x0000F800
4563c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_DELAY_CNT_MASK	0x000F0000
4573c6e15bcSPyun YongHyeon #define	DMA_CFG_TXCMB_ENB		0x00100000
4583c6e15bcSPyun YongHyeon #define	DMA_CFG_RXCMB_ENB		0x00200000
4593c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_MASK		0x07
4603c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_BURST_SHIFT		4
4613c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_MASK		0x07
4623c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_BURST_SHIFT		7
4633c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_DELAY_CNT_SHIFT	11
4643c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_DELAY_CNT_SHIFT	16
4653c6e15bcSPyun YongHyeon #define	DMA_CFG_RD_DELAY_CNT_DEFAULT	15
4663c6e15bcSPyun YongHyeon #define	DMA_CFG_WR_DELAY_CNT_DEFAULT	4
4673c6e15bcSPyun YongHyeon 
4683c6e15bcSPyun YongHyeon #define	ALE_SMB_STAT_TIMER		0x15C4
4693c6e15bcSPyun YongHyeon 
4703c6e15bcSPyun YongHyeon #define	ALE_INT_TRIG_THRESH		0x15C8
4713c6e15bcSPyun YongHyeon #define	INT_TRIG_TX_THRESH_MASK		0x0000FFFF
4723c6e15bcSPyun YongHyeon #define	INT_TRIG_RX_THRESH_MASK		0xFFFF0000
4733c6e15bcSPyun YongHyeon #define	INT_TRIG_TX_THRESH_SHIFT	0
4743c6e15bcSPyun YongHyeon #define	INT_TRIG_RX_THRESH_SHIFT	16
4753c6e15bcSPyun YongHyeon 
4763c6e15bcSPyun YongHyeon #define	ALE_INT_TRIG_TIMER		0x15CC
4773c6e15bcSPyun YongHyeon #define	INT_TRIG_TX_TIMER_MASK		0x0000FFFF
4783c6e15bcSPyun YongHyeon #define	INT_TRIG_RX_TIMER_MASK		0x0000FFFF
4793c6e15bcSPyun YongHyeon #define	INT_TRIG_TX_TIMER_SHIFT		0
4803c6e15bcSPyun YongHyeon #define	INT_TRIG_RX_TIMER_SHIFT		16
4813c6e15bcSPyun YongHyeon 
4823c6e15bcSPyun YongHyeon #define	ALE_RXF1_PAGE0_ADDR_LO		0x15D0
4833c6e15bcSPyun YongHyeon 
4843c6e15bcSPyun YongHyeon #define	ALE_RXF1_PAGE1_ADDR_LO		0x15D4
4853c6e15bcSPyun YongHyeon 
4863c6e15bcSPyun YongHyeon #define	ALE_RXF2_PAGE0_ADDR_LO		0x15D8
4873c6e15bcSPyun YongHyeon 
4883c6e15bcSPyun YongHyeon #define	ALE_RXF2_PAGE1_ADDR_LO		0x15DC
4893c6e15bcSPyun YongHyeon 
4903c6e15bcSPyun YongHyeon #define	ALE_RXF3_PAGE0_ADDR_LO		0x15E0
4913c6e15bcSPyun YongHyeon 
4923c6e15bcSPyun YongHyeon #define	ALE_RXF3_PAGE1_ADDR_LO		0x15E4
4933c6e15bcSPyun YongHyeon 
4943c6e15bcSPyun YongHyeon #define	ALE_MBOX_TPD_PROD_IDX		0x15F0
4953c6e15bcSPyun YongHyeon 
4963c6e15bcSPyun YongHyeon #define	ALE_RXF0_PAGE0			0x15F4
4973c6e15bcSPyun YongHyeon 
4983c6e15bcSPyun YongHyeon #define	ALE_RXF0_PAGE1			0x15F5
4993c6e15bcSPyun YongHyeon 
5003c6e15bcSPyun YongHyeon #define	ALE_RXF1_PAGE0			0x15F6
5013c6e15bcSPyun YongHyeon 
5023c6e15bcSPyun YongHyeon #define	ALE_RXF1_PAGE1			0x15F7
5033c6e15bcSPyun YongHyeon 
5043c6e15bcSPyun YongHyeon #define	ALE_RXF2_PAGE0			0x15F8
5053c6e15bcSPyun YongHyeon 
5063c6e15bcSPyun YongHyeon #define	ALE_RXF2_PAGE1			0x15F9
5073c6e15bcSPyun YongHyeon 
5083c6e15bcSPyun YongHyeon #define	ALE_RXF3_PAGE0			0x15FA
5093c6e15bcSPyun YongHyeon 
5103c6e15bcSPyun YongHyeon #define	ALE_RXF3_PAGE1			0x15FB
5113c6e15bcSPyun YongHyeon 
5123c6e15bcSPyun YongHyeon #define	RXF_VALID			0x01
5133c6e15bcSPyun YongHyeon 
5143c6e15bcSPyun YongHyeon #define	ALE_INTR_STATUS			0x1600
5153c6e15bcSPyun YongHyeon #define	INTR_SMB			0x00000001
5163c6e15bcSPyun YongHyeon #define	INTR_TIMER			0x00000002
5173c6e15bcSPyun YongHyeon #define	INTR_MANUAL_TIMER		0x00000004
5183c6e15bcSPyun YongHyeon #define	INTR_RX_FIFO_OFLOW		0x00000008
5193c6e15bcSPyun YongHyeon #define	INTR_RXF0_OFLOW			0x00000010
5203c6e15bcSPyun YongHyeon #define	INTR_RXF1_OFLOW			0x00000020
5213c6e15bcSPyun YongHyeon #define	INTR_RXF2_OFLOW			0x00000040
5223c6e15bcSPyun YongHyeon #define	INTR_RXF3_OFLOW			0x00000080
5233c6e15bcSPyun YongHyeon #define	INTR_TX_FIFO_UNDERRUN		0x00000100
5243c6e15bcSPyun YongHyeon #define	INTR_RX0_PAGE_FULL		0x00000200
5253c6e15bcSPyun YongHyeon #define	INTR_DMA_RD_TO_RST		0x00000400
5263c6e15bcSPyun YongHyeon #define	INTR_DMA_WR_TO_RST		0x00000800
5273c6e15bcSPyun YongHyeon #define	INTR_GPHY			0x00001000
5283c6e15bcSPyun YongHyeon #define	INTR_TX_CREDIT			0x00002000
5293c6e15bcSPyun YongHyeon #define	INTR_GPHY_LOW_PW		0x00004000
5303c6e15bcSPyun YongHyeon #define	INTR_RX_PKT			0x00010000
5313c6e15bcSPyun YongHyeon #define	INTR_TX_PKT			0x00020000
5323c6e15bcSPyun YongHyeon #define	INTR_TX_DMA			0x00040000
5333c6e15bcSPyun YongHyeon #define	INTR_RX_PKT1			0x00080000
5343c6e15bcSPyun YongHyeon #define	INTR_RX_PKT2			0x00100000
5353c6e15bcSPyun YongHyeon #define	INTR_RX_PKT3			0x00200000
5363c6e15bcSPyun YongHyeon #define	INTR_MAC_RX			0x00400000
5373c6e15bcSPyun YongHyeon #define	INTR_MAC_TX			0x00800000
5383c6e15bcSPyun YongHyeon #define	INTR_UNDERRUN			0x01000000
5393c6e15bcSPyun YongHyeon #define	INTR_FRAME_ERROR		0x02000000
5403c6e15bcSPyun YongHyeon #define	INTR_FRAME_OK			0x04000000
5413c6e15bcSPyun YongHyeon #define	INTR_CSUM_ERROR			0x08000000
5423c6e15bcSPyun YongHyeon #define	INTR_PHY_LINK_DOWN		0x10000000
5433c6e15bcSPyun YongHyeon #define	INTR_DIS_INT			0x80000000
5443c6e15bcSPyun YongHyeon 
5453c6e15bcSPyun YongHyeon /* Interrupt Mask Register */
5463c6e15bcSPyun YongHyeon #define	ALE_INTR_MASK			0x1604
5473c6e15bcSPyun YongHyeon 
5483c6e15bcSPyun YongHyeon #define	ALE_INTRS						\
5493c6e15bcSPyun YongHyeon 	(INTR_DMA_RD_TO_RST | INTR_DMA_WR_TO_RST |		\
5503c6e15bcSPyun YongHyeon 	INTR_RX_PKT | INTR_TX_PKT | INTR_RX_FIFO_OFLOW |	\
5513c6e15bcSPyun YongHyeon 	INTR_TX_FIFO_UNDERRUN)
5523c6e15bcSPyun YongHyeon 
5533c6e15bcSPyun YongHyeon /*
5543c6e15bcSPyun YongHyeon  * AR81xx requires register access to get MAC statistics
5553c6e15bcSPyun YongHyeon  * and the format of statistics seems to be the same of L1 .
5563c6e15bcSPyun YongHyeon  */
5573c6e15bcSPyun YongHyeon #define	ALE_RX_MIB_BASE			0x1700
5583c6e15bcSPyun YongHyeon 
5593c6e15bcSPyun YongHyeon #define	ALE_TX_MIB_BASE			0x1760
5603c6e15bcSPyun YongHyeon 
5613c6e15bcSPyun YongHyeon /* Statistics counters collected by the MAC. */
5623c6e15bcSPyun YongHyeon struct smb {
5633c6e15bcSPyun YongHyeon 	/* Rx stats. */
5643c6e15bcSPyun YongHyeon 	uint32_t rx_frames;
5653c6e15bcSPyun YongHyeon 	uint32_t rx_bcast_frames;
5663c6e15bcSPyun YongHyeon 	uint32_t rx_mcast_frames;
5673c6e15bcSPyun YongHyeon 	uint32_t rx_pause_frames;
5683c6e15bcSPyun YongHyeon 	uint32_t rx_control_frames;
5693c6e15bcSPyun YongHyeon 	uint32_t rx_crcerrs;
5703c6e15bcSPyun YongHyeon 	uint32_t rx_lenerrs;
5713c6e15bcSPyun YongHyeon 	uint32_t rx_bytes;
5723c6e15bcSPyun YongHyeon 	uint32_t rx_runts;
5733c6e15bcSPyun YongHyeon 	uint32_t rx_fragments;
5743c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_64;
5753c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_65_127;
5763c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_128_255;
5773c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_256_511;
5783c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_512_1023;
5793c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_1024_1518;
5803c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_1519_max;
5813c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_truncated;
5823c6e15bcSPyun YongHyeon 	uint32_t rx_fifo_oflows;
5833c6e15bcSPyun YongHyeon 	uint32_t rx_rrs_errs;
5843c6e15bcSPyun YongHyeon 	uint32_t rx_alignerrs;
5853c6e15bcSPyun YongHyeon 	uint32_t rx_bcast_bytes;
5863c6e15bcSPyun YongHyeon 	uint32_t rx_mcast_bytes;
5873c6e15bcSPyun YongHyeon 	uint32_t rx_pkts_filtered;
5883c6e15bcSPyun YongHyeon 	/* Tx stats. */
5893c6e15bcSPyun YongHyeon 	uint32_t tx_frames;
5903c6e15bcSPyun YongHyeon 	uint32_t tx_bcast_frames;
5913c6e15bcSPyun YongHyeon 	uint32_t tx_mcast_frames;
5923c6e15bcSPyun YongHyeon 	uint32_t tx_pause_frames;
5933c6e15bcSPyun YongHyeon 	uint32_t tx_excess_defer;
5943c6e15bcSPyun YongHyeon 	uint32_t tx_control_frames;
5953c6e15bcSPyun YongHyeon 	uint32_t tx_deferred;
5963c6e15bcSPyun YongHyeon 	uint32_t tx_bytes;
5973c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_64;
5983c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_65_127;
5993c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_128_255;
6003c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_256_511;
6013c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_512_1023;
6023c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_1024_1518;
6033c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_1519_max;
6043c6e15bcSPyun YongHyeon 	uint32_t tx_single_colls;
6053c6e15bcSPyun YongHyeon 	uint32_t tx_multi_colls;
6063c6e15bcSPyun YongHyeon 	uint32_t tx_late_colls;
6073c6e15bcSPyun YongHyeon 	uint32_t tx_excess_colls;
6083c6e15bcSPyun YongHyeon 	uint32_t tx_underrun;
6093c6e15bcSPyun YongHyeon 	uint32_t tx_desc_underrun;
6103c6e15bcSPyun YongHyeon 	uint32_t tx_lenerrs;
6113c6e15bcSPyun YongHyeon 	uint32_t tx_pkts_truncated;
6123c6e15bcSPyun YongHyeon 	uint32_t tx_bcast_bytes;
6133c6e15bcSPyun YongHyeon 	uint32_t tx_mcast_bytes;
6143c6e15bcSPyun YongHyeon } __packed;
6153c6e15bcSPyun YongHyeon 
6163c6e15bcSPyun YongHyeon #define	ALE_HOST_RXF0_PAGEOFF		0x1800
6173c6e15bcSPyun YongHyeon 
6183c6e15bcSPyun YongHyeon #define	ALE_TPD_CONS_IDX		0x1804
6193c6e15bcSPyun YongHyeon 
6203c6e15bcSPyun YongHyeon #define	ALE_HOST_RXF1_PAGEOFF		0x1808
6213c6e15bcSPyun YongHyeon 
6223c6e15bcSPyun YongHyeon #define	ALE_HOST_RXF2_PAGEOFF		0x180C
6233c6e15bcSPyun YongHyeon 
6243c6e15bcSPyun YongHyeon #define	ALE_HOST_RXF3_PAGEOFF		0x1810
6253c6e15bcSPyun YongHyeon 
6263c6e15bcSPyun YongHyeon #define	ALE_RXF0_CMB0_ADDR_LO		0x1820
6273c6e15bcSPyun YongHyeon 
6283c6e15bcSPyun YongHyeon #define	ALE_RXF0_CMB1_ADDR_LO		0x1824
6293c6e15bcSPyun YongHyeon 
6303c6e15bcSPyun YongHyeon #define	ALE_RXF1_CMB0_ADDR_LO		0x1828
6313c6e15bcSPyun YongHyeon 
6323c6e15bcSPyun YongHyeon #define	ALE_RXF1_CMB1_ADDR_LO		0x182C
6333c6e15bcSPyun YongHyeon 
6343c6e15bcSPyun YongHyeon #define	ALE_RXF2_CMB0_ADDR_LO		0x1830
6353c6e15bcSPyun YongHyeon 
6363c6e15bcSPyun YongHyeon #define	ALE_RXF2_CMB1_ADDR_LO		0x1834
6373c6e15bcSPyun YongHyeon 
6383c6e15bcSPyun YongHyeon #define	ALE_RXF3_CMB0_ADDR_LO		0x1838
6393c6e15bcSPyun YongHyeon 
6403c6e15bcSPyun YongHyeon #define	ALE_RXF3_CMB1_ADDR_LO		0x183C
6413c6e15bcSPyun YongHyeon 
6423c6e15bcSPyun YongHyeon #define	ALE_TX_CMB_ADDR_LO		0x1840
6433c6e15bcSPyun YongHyeon 
6443c6e15bcSPyun YongHyeon #define	ALE_SMB_ADDR_LO			0x1844
6453c6e15bcSPyun YongHyeon 
6463c6e15bcSPyun YongHyeon /*
6473c6e15bcSPyun YongHyeon  * RRS(receive return status) structure.
6483c6e15bcSPyun YongHyeon  *
6493c6e15bcSPyun YongHyeon  * Note:
6503c6e15bcSPyun YongHyeon  * Atheros AR81xx does not support descriptor based DMA on Rx
6513c6e15bcSPyun YongHyeon  * instead it just prepends a Rx status structure prior to a
6523c6e15bcSPyun YongHyeon  * received frame which also resides on the same Rx buffer.
6533c6e15bcSPyun YongHyeon  * This means driver should copy an entire frame from the
6543c6e15bcSPyun YongHyeon  * buffer to new mbuf chain which in turn greatly increases CPU
6553c6e15bcSPyun YongHyeon  * cycles and effectively nullify the advantage of DMA
6563c6e15bcSPyun YongHyeon  * operation of controller. So you should have fast CPU to cope
6573c6e15bcSPyun YongHyeon  * with the copy operation. Implementing flow-controls may help
6583c6e15bcSPyun YongHyeon  * a lot to minimize Rx FIFO overflows but it's not available
6593c6e15bcSPyun YongHyeon  * yet on FreeBSD and hardware doesn't seem to support
6603c6e15bcSPyun YongHyeon  * fine-grained Tx/Rx flow controls.
6613c6e15bcSPyun YongHyeon  */
6623c6e15bcSPyun YongHyeon struct rx_rs {
6633c6e15bcSPyun YongHyeon 	uint32_t	seqno;
6643c6e15bcSPyun YongHyeon #define	ALE_RD_SEQNO_MASK		0x0000FFFF
6653c6e15bcSPyun YongHyeon #define	ALE_RD_HASH_MASK		0xFFFF0000
6663c6e15bcSPyun YongHyeon #define	ALE_RD_SEQNO_SHIFT		0
6673c6e15bcSPyun YongHyeon #define	ALE_RD_HASH_SHIFT		16
6683c6e15bcSPyun YongHyeon #define	ALE_RX_SEQNO(x)		\
6693c6e15bcSPyun YongHyeon 	(((x) & ALE_RD_SEQNO_MASK) >> ALE_RD_SEQNO_SHIFT)
6703c6e15bcSPyun YongHyeon 	uint32_t	length;
6713c6e15bcSPyun YongHyeon #define	ALE_RD_CSUM_MASK		0x0000FFFF
6723c6e15bcSPyun YongHyeon #define	ALE_RD_LEN_MASK			0x3FFF0000
6733c6e15bcSPyun YongHyeon #define	ALE_RD_CPU_MASK			0xC0000000
6743c6e15bcSPyun YongHyeon #define	ALE_RD_CSUM_SHIFT		0
6753c6e15bcSPyun YongHyeon #define	ALE_RD_LEN_SHIFT		16
6763c6e15bcSPyun YongHyeon #define	ALE_RD_CPU_SHIFT		30
6773c6e15bcSPyun YongHyeon #define	ALE_RX_CSUM(x)		\
6783c6e15bcSPyun YongHyeon 	(((x) & ALE_RD_CSUM_MASK) >> ALE_RD_CSUM_SHIFT)
6793c6e15bcSPyun YongHyeon #define	ALE_RX_BYTES(x)		\
6803c6e15bcSPyun YongHyeon 	(((x) & ALE_RD_LEN_MASK) >> ALE_RD_LEN_SHIFT)
6813c6e15bcSPyun YongHyeon #define	ALE_RX_CPU(x)		\
6823c6e15bcSPyun YongHyeon 	(((x) & ALE_RD_CPU_MASK) >> ALE_RD_CPU_SHIFT)
6833c6e15bcSPyun YongHyeon 	uint32_t	flags;
6843c6e15bcSPyun YongHyeon #define	ALE_RD_RSS_IPV4			0x00000001
6853c6e15bcSPyun YongHyeon #define	ALE_RD_RSS_IPV4_TCP		0x00000002
6863c6e15bcSPyun YongHyeon #define	ALE_RD_RSS_IPV6			0x00000004
6873c6e15bcSPyun YongHyeon #define	ALE_RD_RSS_IPV6_TCP		0x00000008
6883c6e15bcSPyun YongHyeon #define	ALE_RD_IPV6			0x00000010
6893c6e15bcSPyun YongHyeon #define	ALE_RD_IPV4_FRAG		0x00000020
6903c6e15bcSPyun YongHyeon #define	ALE_RD_IPV4_DF			0x00000040
6913c6e15bcSPyun YongHyeon #define	ALE_RD_802_3			0x00000080
6923c6e15bcSPyun YongHyeon #define	ALE_RD_VLAN			0x00000100
6933c6e15bcSPyun YongHyeon #define	ALE_RD_ERROR			0x00000200
6943c6e15bcSPyun YongHyeon #define	ALE_RD_IPV4			0x00000400
6953c6e15bcSPyun YongHyeon #define	ALE_RD_UDP			0x00000800
6963c6e15bcSPyun YongHyeon #define	ALE_RD_TCP			0x00001000
6973c6e15bcSPyun YongHyeon #define	ALE_RD_BCAST			0x00002000
6983c6e15bcSPyun YongHyeon #define	ALE_RD_MCAST			0x00004000
6993c6e15bcSPyun YongHyeon #define	ALE_RD_PAUSE			0x00008000
7003c6e15bcSPyun YongHyeon #define	ALE_RD_CRC			0x00010000
7013c6e15bcSPyun YongHyeon #define	ALE_RD_CODE			0x00020000
7023c6e15bcSPyun YongHyeon #define	ALE_RD_DRIBBLE			0x00040000
7033c6e15bcSPyun YongHyeon #define	ALE_RD_RUNT			0x00080000
7043c6e15bcSPyun YongHyeon #define	ALE_RD_OFLOW			0x00100000
7053c6e15bcSPyun YongHyeon #define	ALE_RD_TRUNC			0x00200000
7063c6e15bcSPyun YongHyeon #define	ALE_RD_IPCSUM_NOK		0x00400000
7073c6e15bcSPyun YongHyeon #define	ALE_RD_TCP_UDPCSUM_NOK		0x00800000
7083c6e15bcSPyun YongHyeon #define	ALE_RD_LENGTH_NOK		0x01000000
7093c6e15bcSPyun YongHyeon #define	ALE_RD_DES_ADDR_FILTERED	0x02000000
7103c6e15bcSPyun YongHyeon 	uint32_t vtags;
7113c6e15bcSPyun YongHyeon #define	ALE_RD_HASH_HI_MASK		0x0000FFFF
7123c6e15bcSPyun YongHyeon #define	ALE_RD_HASH_HI_SHIFT		0
7133c6e15bcSPyun YongHyeon #define	ALE_RD_VLAN_MASK		0xFFFF0000
7143c6e15bcSPyun YongHyeon #define	ALE_RD_VLAN_SHIFT		16
7153c6e15bcSPyun YongHyeon #define	ALE_RX_VLAN(x)		\
7163c6e15bcSPyun YongHyeon 	(((x) & ALE_RD_VLAN_MASK) >> ALE_RD_VLAN_SHIFT)
7173c6e15bcSPyun YongHyeon #define	ALE_RX_VLAN_TAG(x)	\
7183c6e15bcSPyun YongHyeon 	(((x) >> 4) | (((x) & 7) << 13) | (((x) & 8) << 9))
7193c6e15bcSPyun YongHyeon } __packed;
7203c6e15bcSPyun YongHyeon 
7213c6e15bcSPyun YongHyeon /* Tx descriptor. */
7223c6e15bcSPyun YongHyeon struct tx_desc {
7233c6e15bcSPyun YongHyeon 	uint64_t addr;
7243c6e15bcSPyun YongHyeon 	uint32_t len;
7253c6e15bcSPyun YongHyeon #define	ALE_TD_VLAN_MASK		0xFFFF0000
7263c6e15bcSPyun YongHyeon #define	ALE_TD_PKT_INT			0x00008000
7273c6e15bcSPyun YongHyeon #define	ALE_TD_DMA_INT			0x00004000
7283c6e15bcSPyun YongHyeon #define	ALE_TD_BUFLEN_MASK		0x00003FFF
7293c6e15bcSPyun YongHyeon #define	ALE_TD_VLAN_SHIFT		16
7303c6e15bcSPyun YongHyeon #define	ALE_TX_VLAN_TAG(x)	\
7313c6e15bcSPyun YongHyeon 	(((x) << 4) | ((x) >> 13) | (((x) >> 9) & 8))
7323c6e15bcSPyun YongHyeon #define	ALE_TD_BUFLEN_SHIFT		0
7333c6e15bcSPyun YongHyeon #define	ALE_TX_BYTES(x)		\
7343c6e15bcSPyun YongHyeon 	(((x) << ALE_TD_BUFLEN_SHIFT) & ALE_TD_BUFLEN_MASK)
7353c6e15bcSPyun YongHyeon 	uint32_t flags;
7363c6e15bcSPyun YongHyeon #define	ALE_TD_MSS			0xFFF80000
7373c6e15bcSPyun YongHyeon #define	ALE_TD_TSO_HDR			0x00040000
7383c6e15bcSPyun YongHyeon #define	ALE_TD_TCPHDR_LEN		0x0003C000
7393c6e15bcSPyun YongHyeon #define	ALE_TD_IPHDR_LEN		0x00003C00
7403c6e15bcSPyun YongHyeon #define	ALE_TD_IPV6HDR_LEN2		0x00003C00
7413c6e15bcSPyun YongHyeon #define	ALE_TD_LLC_SNAP			0x00000200
7423c6e15bcSPyun YongHyeon #define	ALE_TD_VLAN_TAGGED		0x00000100
7433c6e15bcSPyun YongHyeon #define	ALE_TD_UDPCSUM			0x00000080
7443c6e15bcSPyun YongHyeon #define	ALE_TD_TCPCSUM			0x00000040
7453c6e15bcSPyun YongHyeon #define	ALE_TD_IPCSUM			0x00000020
7463c6e15bcSPyun YongHyeon #define	ALE_TD_IPV6HDR_LEN1		0x000000E0
7473c6e15bcSPyun YongHyeon #define	ALE_TD_TSO			0x00000010
7483c6e15bcSPyun YongHyeon #define	ALE_TD_CXSUM			0x00000008
7493c6e15bcSPyun YongHyeon #define	ALE_TD_INSERT_VLAN_TAG		0x00000004
7503c6e15bcSPyun YongHyeon #define	ALE_TD_IPV6			0x00000002
7513c6e15bcSPyun YongHyeon #define	ALE_TD_EOP			0x00000001
7523c6e15bcSPyun YongHyeon 
7533c6e15bcSPyun YongHyeon #define	ALE_TD_CSUM_PLOADOFFSET		0x00FF0000
7543c6e15bcSPyun YongHyeon #define	ALE_TD_CSUM_XSUMOFFSET		0xFF000000
7553c6e15bcSPyun YongHyeon #define	ALE_TD_CSUM_XSUMOFFSET_SHIFT	24
7563c6e15bcSPyun YongHyeon #define	ALE_TD_CSUM_PLOADOFFSET_SHIFT	16
7573c6e15bcSPyun YongHyeon #define	ALE_TD_MSS_SHIFT		19
7583c6e15bcSPyun YongHyeon #define	ALE_TD_TCPHDR_LEN_SHIFT		14
7593c6e15bcSPyun YongHyeon #define	ALE_TD_IPHDR_LEN_SHIFT		10
7603c6e15bcSPyun YongHyeon } __packed;
7613c6e15bcSPyun YongHyeon 
7623c6e15bcSPyun YongHyeon #endif	/* _IF_ALEREG_H */
763