18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2013 Johannes Berg <johannes@sipsolutions.net>
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  This file is free software: you may copy, redistribute and/or modify it
58c2ecf20Sopenharmony_ci *  under the terms of the GNU General Public License as published by the
68c2ecf20Sopenharmony_ci *  Free Software Foundation, either version 2 of the License, or (at your
78c2ecf20Sopenharmony_ci *  option) any later version.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *  This file is distributed in the hope that it will be useful, but
108c2ecf20Sopenharmony_ci *  WITHOUT ANY WARRANTY; without even the implied warranty of
118c2ecf20Sopenharmony_ci *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
128c2ecf20Sopenharmony_ci *  General Public License for more details.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *  You should have received a copy of the GNU General Public License
158c2ecf20Sopenharmony_ci *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * This file incorporates work covered by the following copyright and
188c2ecf20Sopenharmony_ci * permission notice:
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * Copyright (c) 2012 Qualcomm Atheros, Inc.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
238c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
248c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
278c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
288c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
298c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
308c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
318c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
328c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef ALX_REG_H
368c2ecf20Sopenharmony_ci#define ALX_REG_H
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define ALX_DEV_ID_AR8161				0x1091
398c2ecf20Sopenharmony_ci#define ALX_DEV_ID_E2200				0xe091
408c2ecf20Sopenharmony_ci#define ALX_DEV_ID_E2400				0xe0a1
418c2ecf20Sopenharmony_ci#define ALX_DEV_ID_E2500				0xe0b1
428c2ecf20Sopenharmony_ci#define ALX_DEV_ID_AR8162				0x1090
438c2ecf20Sopenharmony_ci#define ALX_DEV_ID_AR8171				0x10A1
448c2ecf20Sopenharmony_ci#define ALX_DEV_ID_AR8172				0x10A0
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* rev definition,
478c2ecf20Sopenharmony_ci * bit(0): with xD support
488c2ecf20Sopenharmony_ci * bit(1): with Card Reader function
498c2ecf20Sopenharmony_ci * bit(7:2): real revision
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci#define ALX_PCI_REVID_SHIFT				3
528c2ecf20Sopenharmony_ci#define ALX_REV_A0					0
538c2ecf20Sopenharmony_ci#define ALX_REV_A1					1
548c2ecf20Sopenharmony_ci#define ALX_REV_B0					2
558c2ecf20Sopenharmony_ci#define ALX_REV_C0					3
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define ALX_DEV_CTRL					0x0060
588c2ecf20Sopenharmony_ci#define ALX_DEV_CTRL_MAXRRS_MIN				2
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define ALX_MSIX_MASK					0x0090
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define ALX_UE_SVRT					0x010C
638c2ecf20Sopenharmony_ci#define ALX_UE_SVRT_FCPROTERR				BIT(13)
648c2ecf20Sopenharmony_ci#define ALX_UE_SVRT_DLPROTERR				BIT(4)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* eeprom & flash load register */
678c2ecf20Sopenharmony_ci#define ALX_EFLD					0x0204
688c2ecf20Sopenharmony_ci#define ALX_EFLD_F_EXIST				BIT(10)
698c2ecf20Sopenharmony_ci#define ALX_EFLD_E_EXIST				BIT(9)
708c2ecf20Sopenharmony_ci#define ALX_EFLD_STAT					BIT(5)
718c2ecf20Sopenharmony_ci#define ALX_EFLD_START					BIT(0)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* eFuse load register */
748c2ecf20Sopenharmony_ci#define ALX_SLD						0x0218
758c2ecf20Sopenharmony_ci#define ALX_SLD_STAT					BIT(12)
768c2ecf20Sopenharmony_ci#define ALX_SLD_START					BIT(11)
778c2ecf20Sopenharmony_ci#define ALX_SLD_MAX_TO					100
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define ALX_PDLL_TRNS1					0x1104
808c2ecf20Sopenharmony_ci#define ALX_PDLL_TRNS1_D3PLLOFF_EN			BIT(11)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define ALX_PMCTRL					0x12F8
838c2ecf20Sopenharmony_ci#define ALX_PMCTRL_HOTRST_WTEN				BIT(31)
848c2ecf20Sopenharmony_ci/* bit30: L0s/L1 controlled by MAC based on throughput(setting in 15A0) */
858c2ecf20Sopenharmony_ci#define ALX_PMCTRL_ASPM_FCEN				BIT(30)
868c2ecf20Sopenharmony_ci#define ALX_PMCTRL_SADLY_EN				BIT(29)
878c2ecf20Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_MASK			0xF
888c2ecf20Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_SHIFT			24
898c2ecf20Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_DEF			0xC
908c2ecf20Sopenharmony_ci/* bit[23:20] if pm_request_l1 time > @, then enter L0s not L1 */
918c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1REQ_TO_MASK			0xF
928c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1REQ_TO_SHIFT			20
938c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1REG_TO_DEF				0xF
948c2ecf20Sopenharmony_ci#define ALX_PMCTRL_TXL1_AFTER_L0S			BIT(19)
958c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_MASK			0x7
968c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_SHIFT			16
978c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_16US			4
988c2ecf20Sopenharmony_ci#define ALX_PMCTRL_RCVR_WT_1US				BIT(15)
998c2ecf20Sopenharmony_ci/* bit13: enable pcie clk switch in L1 state */
1008c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_CLKSW_EN				BIT(13)
1018c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L0S_EN				BIT(12)
1028c2ecf20Sopenharmony_ci#define ALX_PMCTRL_RXL1_AFTER_L0S			BIT(11)
1038c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_BUFSRX_EN				BIT(7)
1048c2ecf20Sopenharmony_ci/* bit6: power down serdes RX */
1058c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_SRDSRX_PWD			BIT(6)
1068c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_SRDSPLL_EN			BIT(5)
1078c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_SRDS_EN				BIT(4)
1088c2ecf20Sopenharmony_ci#define ALX_PMCTRL_L1_EN				BIT(3)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/*******************************************************/
1118c2ecf20Sopenharmony_ci/* following registers are mapped only to memory space */
1128c2ecf20Sopenharmony_ci/*******************************************************/
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define ALX_MASTER					0x1400
1158c2ecf20Sopenharmony_ci/* bit12: 1:alwys select pclk from serdes, not sw to 25M */
1168c2ecf20Sopenharmony_ci#define ALX_MASTER_PCLKSEL_SRDS				BIT(12)
1178c2ecf20Sopenharmony_ci/* bit11: irq moduration for rx */
1188c2ecf20Sopenharmony_ci#define ALX_MASTER_IRQMOD2_EN				BIT(11)
1198c2ecf20Sopenharmony_ci/* bit10: irq moduration for tx/rx */
1208c2ecf20Sopenharmony_ci#define ALX_MASTER_IRQMOD1_EN				BIT(10)
1218c2ecf20Sopenharmony_ci#define ALX_MASTER_SYSALVTIMER_EN			BIT(7)
1228c2ecf20Sopenharmony_ci#define ALX_MASTER_OOB_DIS				BIT(6)
1238c2ecf20Sopenharmony_ci/* bit5: wakeup without pcie clk */
1248c2ecf20Sopenharmony_ci#define ALX_MASTER_WAKEN_25M				BIT(5)
1258c2ecf20Sopenharmony_ci/* bit0: MAC & DMA reset */
1268c2ecf20Sopenharmony_ci#define ALX_MASTER_DMA_MAC_RST				BIT(0)
1278c2ecf20Sopenharmony_ci#define ALX_DMA_MAC_RST_TO				50
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define ALX_IRQ_MODU_TIMER				0x1408
1308c2ecf20Sopenharmony_ci#define ALX_IRQ_MODU_TIMER1_MASK			0xFFFF
1318c2ecf20Sopenharmony_ci#define ALX_IRQ_MODU_TIMER1_SHIFT			0
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL					0x140C
1348c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_100AB_EN				BIT(17)
1358c2ecf20Sopenharmony_ci/* bit14: affect MAC & PHY, go to low power sts */
1368c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_POWER_DOWN				BIT(14)
1378c2ecf20Sopenharmony_ci/* bit13: 1:pll always ON, 0:can switch in lpw */
1388c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_PLL_ON				BIT(13)
1398c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_RST_ANALOG				BIT(12)
1408c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_HIB_PULSE				BIT(11)
1418c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_HIB_EN				BIT(10)
1428c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_IDDQ				BIT(7)
1438c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_GATE_25M				BIT(5)
1448c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_LED_MODE				BIT(2)
1458c2ecf20Sopenharmony_ci/* bit0: out of dsp RST state */
1468c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_DSPRST_OUT				BIT(0)
1478c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_DSPRST_TO				80
1488c2ecf20Sopenharmony_ci#define ALX_PHY_CTRL_CLS	(ALX_PHY_CTRL_LED_MODE | \
1498c2ecf20Sopenharmony_ci				 ALX_PHY_CTRL_100AB_EN | \
1508c2ecf20Sopenharmony_ci				 ALX_PHY_CTRL_PLL_ON)
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci#define ALX_MAC_STS					0x1410
1538c2ecf20Sopenharmony_ci#define ALX_MAC_STS_TXQ_BUSY				BIT(3)
1548c2ecf20Sopenharmony_ci#define ALX_MAC_STS_RXQ_BUSY				BIT(2)
1558c2ecf20Sopenharmony_ci#define ALX_MAC_STS_TXMAC_BUSY				BIT(1)
1568c2ecf20Sopenharmony_ci#define ALX_MAC_STS_RXMAC_BUSY				BIT(0)
1578c2ecf20Sopenharmony_ci#define ALX_MAC_STS_IDLE	(ALX_MAC_STS_TXQ_BUSY | \
1588c2ecf20Sopenharmony_ci				 ALX_MAC_STS_RXQ_BUSY | \
1598c2ecf20Sopenharmony_ci				 ALX_MAC_STS_TXMAC_BUSY | \
1608c2ecf20Sopenharmony_ci				 ALX_MAC_STS_RXMAC_BUSY)
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define ALX_MDIO					0x1414
1638c2ecf20Sopenharmony_ci#define ALX_MDIO_MODE_EXT				BIT(30)
1648c2ecf20Sopenharmony_ci#define ALX_MDIO_BUSY					BIT(27)
1658c2ecf20Sopenharmony_ci#define ALX_MDIO_CLK_SEL_MASK				0x7
1668c2ecf20Sopenharmony_ci#define ALX_MDIO_CLK_SEL_SHIFT				24
1678c2ecf20Sopenharmony_ci#define ALX_MDIO_CLK_SEL_25MD4				0
1688c2ecf20Sopenharmony_ci#define ALX_MDIO_CLK_SEL_25MD128			7
1698c2ecf20Sopenharmony_ci#define ALX_MDIO_START					BIT(23)
1708c2ecf20Sopenharmony_ci#define ALX_MDIO_SPRES_PRMBL				BIT(22)
1718c2ecf20Sopenharmony_ci/* bit21: 1:read,0:write */
1728c2ecf20Sopenharmony_ci#define ALX_MDIO_OP_READ				BIT(21)
1738c2ecf20Sopenharmony_ci#define ALX_MDIO_REG_MASK				0x1F
1748c2ecf20Sopenharmony_ci#define ALX_MDIO_REG_SHIFT				16
1758c2ecf20Sopenharmony_ci#define ALX_MDIO_DATA_MASK				0xFFFF
1768c2ecf20Sopenharmony_ci#define ALX_MDIO_DATA_SHIFT				0
1778c2ecf20Sopenharmony_ci#define ALX_MDIO_MAX_AC_TO				120
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define ALX_MDIO_EXTN					0x1448
1808c2ecf20Sopenharmony_ci#define ALX_MDIO_EXTN_DEVAD_MASK			0x1F
1818c2ecf20Sopenharmony_ci#define ALX_MDIO_EXTN_DEVAD_SHIFT			16
1828c2ecf20Sopenharmony_ci#define ALX_MDIO_EXTN_REG_MASK				0xFFFF
1838c2ecf20Sopenharmony_ci#define ALX_MDIO_EXTN_REG_SHIFT				0
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#define ALX_SERDES					0x1424
1868c2ecf20Sopenharmony_ci#define ALX_SERDES_PHYCLK_SLWDWN			BIT(18)
1878c2ecf20Sopenharmony_ci#define ALX_SERDES_MACCLK_SLWDWN			BIT(17)
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define ALX_LPI_CTRL					0x1440
1908c2ecf20Sopenharmony_ci#define ALX_LPI_CTRL_EN					BIT(0)
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* for B0+, bit[13..] for C0+ */
1938c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL				0x1AD0
1948c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_MASK		0x3F
1958c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_SHIFT		24
1968c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_SWOI_STARTUP_PKT_EN		BIT(23)
1978c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_FRAGMENTED		BIT(22)
1988c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_FRAGMENTED		BIT(21)
1998c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_KEEPALIVE_EN		BIT(20)
2008c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_HAS_VLAN		BIT(19)
2018c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_8023		BIT(18)
2028c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_IPV6		BIT(17)
2038c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_KEEPALIVE_EN		BIT(16)
2048c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_HAS_VLAN		BIT(15)
2058c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_8023		BIT(14)
2068c2ecf20Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_IPV6		BIT(13)
2078c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_NS_EN			BIT(12)
2088c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_MASK		0xFF
2098c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_SHIFT		4
2108c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_IS_8023			BIT(3)
2118c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_IS_IPV6			BIT(2)
2128c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_WAKEUP_EN			BIT(1)
2138c2ecf20Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_ARP_EN			BIT(0)
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#define ALX_HRTBT_REM_IPV4_ADDR				0x1AD4
2168c2ecf20Sopenharmony_ci#define ALX_HRTBT_HOST_IPV4_ADDR			0x1478
2178c2ecf20Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR3			0x1AD8
2188c2ecf20Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR2			0x1ADC
2198c2ecf20Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR1			0x1AE0
2208c2ecf20Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR0			0x1AE4
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/* 1B8C ~ 1B94 for C0+ */
2238c2ecf20Sopenharmony_ci#define ALX_SWOI_ACER_CTRL				0x1B8C
2248c2ecf20Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_EN			BIT(20)
2258c2ecf20Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_MASK		0XFF
2268c2ecf20Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_SHIFT		12
2278c2ecf20Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_ADDR_MASK			0XFFF
2288c2ecf20Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_ADDR_SHIFT			0
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2				0x1B90
2318c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_MASK	0xFF
2328c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_SHIFT	24
2338c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_MASK	0xFFF
2348c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_SHIFT	12
2358c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_MASK	0xFFF
2368c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_SHIFT	0
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3				0x1B94
2398c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_MASK	0xFF
2408c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_SHIFT	24
2418c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_MASK	0xFFF
2428c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_SHIFT	12
2438c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_MASK	0xFFF
2448c2ecf20Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_SHIFT	0
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci/* for B0 */
2478c2ecf20Sopenharmony_ci#define ALX_IDLE_DECISN_TIMER				0x1474
2488c2ecf20Sopenharmony_ci/* 1ms */
2498c2ecf20Sopenharmony_ci#define ALX_IDLE_DECISN_TIMER_DEF			0x400
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL					0x1480
2528c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_FAST_PAUSE				BIT(31)
2538c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_WOLSPED_SWEN			BIT(30)
2548c2ecf20Sopenharmony_ci/* bit29: 1:legacy(hi5b), 0:marvl(lo5b)*/
2558c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_MHASH_ALG_HI5B			BIT(29)
2568c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_BRD_EN				BIT(26)
2578c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_MULTIALL_EN			BIT(25)
2588c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_MASK				0x3
2598c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_SHIFT			20
2608c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_10_100			1
2618c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_1000				2
2628c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_PROMISC_EN				BIT(15)
2638c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_VLANSTRIP				BIT(14)
2648c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_PRMBLEN_MASK			0xF
2658c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_PRMBLEN_SHIFT			10
2668c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_PCRCE				BIT(7)
2678c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_CRCE				BIT(6)
2688c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_FULLD				BIT(5)
2698c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_RXFC_EN				BIT(3)
2708c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_TXFC_EN				BIT(2)
2718c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_RX_EN				BIT(1)
2728c2ecf20Sopenharmony_ci#define ALX_MAC_CTRL_TX_EN				BIT(0)
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci#define ALX_STAD0					0x1488
2758c2ecf20Sopenharmony_ci#define ALX_STAD1					0x148C
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci#define ALX_HASH_TBL0					0x1490
2788c2ecf20Sopenharmony_ci#define ALX_HASH_TBL1					0x1494
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci#define ALX_MTU						0x149C
2818c2ecf20Sopenharmony_ci#define ALX_MTU_JUMBO_TH				1514
2828c2ecf20Sopenharmony_ci#define ALX_MTU_STD_ALGN				1536
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci#define ALX_SRAM5					0x1524
2858c2ecf20Sopenharmony_ci#define ALX_SRAM_RXF_LEN_MASK				0xFFF
2868c2ecf20Sopenharmony_ci#define ALX_SRAM_RXF_LEN_SHIFT				0
2878c2ecf20Sopenharmony_ci#define ALX_SRAM_RXF_LEN_8K				(8*1024)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci#define ALX_SRAM9					0x1534
2908c2ecf20Sopenharmony_ci#define ALX_SRAM_LOAD_PTR				BIT(0)
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#define ALX_RX_BASE_ADDR_HI				0x1540
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#define ALX_TX_BASE_ADDR_HI				0x1544
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci#define ALX_RFD_ADDR_LO					0x1550
2978c2ecf20Sopenharmony_ci#define ALX_RFD_RING_SZ					0x1560
2988c2ecf20Sopenharmony_ci#define ALX_RFD_BUF_SZ					0x1564
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define ALX_RRD_ADDR_LO					0x1568
3018c2ecf20Sopenharmony_ci#define ALX_RRD_RING_SZ					0x1578
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci/* pri3: highest, pri0: lowest */
3048c2ecf20Sopenharmony_ci#define ALX_TPD_PRI3_ADDR_LO				0x14E4
3058c2ecf20Sopenharmony_ci#define ALX_TPD_PRI2_ADDR_LO				0x14E0
3068c2ecf20Sopenharmony_ci#define ALX_TPD_PRI1_ADDR_LO				0x157C
3078c2ecf20Sopenharmony_ci#define ALX_TPD_PRI0_ADDR_LO				0x1580
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* producer index is 16bit */
3108c2ecf20Sopenharmony_ci#define ALX_TPD_PRI3_PIDX				0x1618
3118c2ecf20Sopenharmony_ci#define ALX_TPD_PRI2_PIDX				0x161A
3128c2ecf20Sopenharmony_ci#define ALX_TPD_PRI1_PIDX				0x15F0
3138c2ecf20Sopenharmony_ci#define ALX_TPD_PRI0_PIDX				0x15F2
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/* consumer index is 16bit */
3168c2ecf20Sopenharmony_ci#define ALX_TPD_PRI3_CIDX				0x161C
3178c2ecf20Sopenharmony_ci#define ALX_TPD_PRI2_CIDX				0x161E
3188c2ecf20Sopenharmony_ci#define ALX_TPD_PRI1_CIDX				0x15F4
3198c2ecf20Sopenharmony_ci#define ALX_TPD_PRI0_CIDX				0x15F6
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci#define ALX_TPD_RING_SZ					0x1584
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci#define ALX_TXQ0					0x1590
3248c2ecf20Sopenharmony_ci#define ALX_TXQ0_TXF_BURST_PREF_MASK			0xFFFF
3258c2ecf20Sopenharmony_ci#define ALX_TXQ0_TXF_BURST_PREF_SHIFT			16
3268c2ecf20Sopenharmony_ci#define ALX_TXQ_TXF_BURST_PREF_DEF			0x200
3278c2ecf20Sopenharmony_ci#define ALX_TXQ0_LSO_8023_EN				BIT(7)
3288c2ecf20Sopenharmony_ci#define ALX_TXQ0_MODE_ENHANCE				BIT(6)
3298c2ecf20Sopenharmony_ci#define ALX_TXQ0_EN					BIT(5)
3308c2ecf20Sopenharmony_ci#define ALX_TXQ0_SUPT_IPOPT				BIT(4)
3318c2ecf20Sopenharmony_ci#define ALX_TXQ0_TPD_BURSTPREF_MASK			0xF
3328c2ecf20Sopenharmony_ci#define ALX_TXQ0_TPD_BURSTPREF_SHIFT			0
3338c2ecf20Sopenharmony_ci#define ALX_TXQ_TPD_BURSTPREF_DEF			5
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci#define ALX_TXQ1					0x1594
3368c2ecf20Sopenharmony_ci/* bit11:  drop large packet, len > (rfd buf) */
3378c2ecf20Sopenharmony_ci#define ALX_TXQ1_ERRLGPKT_DROP_EN			BIT(11)
3388c2ecf20Sopenharmony_ci#define ALX_TXQ1_JUMBO_TSO_TH				(7*1024)
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci#define ALX_RXQ0					0x15A0
3418c2ecf20Sopenharmony_ci#define ALX_RXQ0_EN					BIT(31)
3428c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HASH_EN				BIT(29)
3438c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_MASK				0x3
3448c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_SHIFT				26
3458c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_DIS				0
3468c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_MQMI				3
3478c2ecf20Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_MASK			0x3F
3488c2ecf20Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_SHIFT			20
3498c2ecf20Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_DEF			8
3508c2ecf20Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_MASK			0x1FF
3518c2ecf20Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_SHIFT			8
3528c2ecf20Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_DEF			0x100
3538c2ecf20Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_NORMAL			128
3548c2ecf20Sopenharmony_ci#define ALX_RXQ0_IPV6_PARSE_EN				BIT(7)
3558c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_MASK				0xF
3568c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_SHIFT			2
3578c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN			BIT(5)
3588c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV6_EN			BIT(4)
3598c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN			BIT(3)
3608c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV4_EN			BIT(2)
3618c2ecf20Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_ALL		(ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN | \
3628c2ecf20Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN | \
3638c2ecf20Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV6_EN | \
3648c2ecf20Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV4_EN)
3658c2ecf20Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_MASK			0x3
3668c2ecf20Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_SHIFT			0
3678c2ecf20Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_100M			3
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci#define ALX_RXQ2					0x15A8
3708c2ecf20Sopenharmony_ci#define ALX_RXQ2_RXF_XOFF_THRESH_MASK			0xFFF
3718c2ecf20Sopenharmony_ci#define ALX_RXQ2_RXF_XOFF_THRESH_SHIFT			16
3728c2ecf20Sopenharmony_ci#define ALX_RXQ2_RXF_XON_THRESH_MASK			0xFFF
3738c2ecf20Sopenharmony_ci#define ALX_RXQ2_RXF_XON_THRESH_SHIFT			0
3748c2ecf20Sopenharmony_ci/* Size = tx-packet(1522) + IPG(12) + SOF(8) + 64(Pause) + IPG(12) + SOF(8) +
3758c2ecf20Sopenharmony_ci *        rx-packet(1522) + delay-of-link(64)
3768c2ecf20Sopenharmony_ci *      = 3212.
3778c2ecf20Sopenharmony_ci */
3788c2ecf20Sopenharmony_ci#define ALX_RXQ2_RXF_FLOW_CTRL_RSVD			3212
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define ALX_DMA						0x15C0
3818c2ecf20Sopenharmony_ci#define ALX_DMA_RCHNL_SEL_MASK				0x3
3828c2ecf20Sopenharmony_ci#define ALX_DMA_RCHNL_SEL_SHIFT				26
3838c2ecf20Sopenharmony_ci#define ALX_DMA_WDLY_CNT_MASK				0xF
3848c2ecf20Sopenharmony_ci#define ALX_DMA_WDLY_CNT_SHIFT				16
3858c2ecf20Sopenharmony_ci#define ALX_DMA_WDLY_CNT_DEF				4
3868c2ecf20Sopenharmony_ci#define ALX_DMA_RDLY_CNT_MASK				0x1F
3878c2ecf20Sopenharmony_ci#define ALX_DMA_RDLY_CNT_SHIFT				11
3888c2ecf20Sopenharmony_ci#define ALX_DMA_RDLY_CNT_DEF				15
3898c2ecf20Sopenharmony_ci/* bit10: 0:tpd with pri, 1: data */
3908c2ecf20Sopenharmony_ci#define ALX_DMA_RREQ_PRI_DATA				BIT(10)
3918c2ecf20Sopenharmony_ci#define ALX_DMA_RREQ_BLEN_MASK				0x7
3928c2ecf20Sopenharmony_ci#define ALX_DMA_RREQ_BLEN_SHIFT				4
3938c2ecf20Sopenharmony_ci#define ALX_DMA_RORDER_MODE_MASK			0x7
3948c2ecf20Sopenharmony_ci#define ALX_DMA_RORDER_MODE_SHIFT			0
3958c2ecf20Sopenharmony_ci#define ALX_DMA_RORDER_MODE_OUT				4
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci#define ALX_WOL0					0x14A0
3988c2ecf20Sopenharmony_ci#define ALX_WOL0_PME_LINK				BIT(5)
3998c2ecf20Sopenharmony_ci#define ALX_WOL0_LINK_EN				BIT(4)
4008c2ecf20Sopenharmony_ci#define ALX_WOL0_PME_MAGIC_EN				BIT(3)
4018c2ecf20Sopenharmony_ci#define ALX_WOL0_MAGIC_EN				BIT(2)
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci#define ALX_RFD_PIDX					0x15E0
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci#define ALX_RFD_CIDX					0x15F8
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci/* MIB */
4088c2ecf20Sopenharmony_ci#define ALX_MIB_BASE					0x1700
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci#define ALX_MIB_RX_OK					(ALX_MIB_BASE + 0)
4118c2ecf20Sopenharmony_ci#define ALX_MIB_RX_BCAST				(ALX_MIB_BASE + 4)
4128c2ecf20Sopenharmony_ci#define ALX_MIB_RX_MCAST				(ALX_MIB_BASE + 8)
4138c2ecf20Sopenharmony_ci#define ALX_MIB_RX_PAUSE				(ALX_MIB_BASE + 12)
4148c2ecf20Sopenharmony_ci#define ALX_MIB_RX_CTRL					(ALX_MIB_BASE + 16)
4158c2ecf20Sopenharmony_ci#define ALX_MIB_RX_FCS_ERR				(ALX_MIB_BASE + 20)
4168c2ecf20Sopenharmony_ci#define ALX_MIB_RX_LEN_ERR				(ALX_MIB_BASE + 24)
4178c2ecf20Sopenharmony_ci#define ALX_MIB_RX_BYTE_CNT				(ALX_MIB_BASE + 28)
4188c2ecf20Sopenharmony_ci#define ALX_MIB_RX_RUNT					(ALX_MIB_BASE + 32)
4198c2ecf20Sopenharmony_ci#define ALX_MIB_RX_FRAG					(ALX_MIB_BASE + 36)
4208c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_64B				(ALX_MIB_BASE + 40)
4218c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_127B				(ALX_MIB_BASE + 44)
4228c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_255B				(ALX_MIB_BASE + 48)
4238c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_511B				(ALX_MIB_BASE + 52)
4248c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_1023B				(ALX_MIB_BASE + 56)
4258c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_1518B				(ALX_MIB_BASE + 60)
4268c2ecf20Sopenharmony_ci#define ALX_MIB_RX_SZ_MAX				(ALX_MIB_BASE + 64)
4278c2ecf20Sopenharmony_ci#define ALX_MIB_RX_OV_SZ				(ALX_MIB_BASE + 68)
4288c2ecf20Sopenharmony_ci#define ALX_MIB_RX_OV_RXF				(ALX_MIB_BASE + 72)
4298c2ecf20Sopenharmony_ci#define ALX_MIB_RX_OV_RRD				(ALX_MIB_BASE + 76)
4308c2ecf20Sopenharmony_ci#define ALX_MIB_RX_ALIGN_ERR				(ALX_MIB_BASE + 80)
4318c2ecf20Sopenharmony_ci#define ALX_MIB_RX_BCCNT				(ALX_MIB_BASE + 84)
4328c2ecf20Sopenharmony_ci#define ALX_MIB_RX_MCCNT				(ALX_MIB_BASE + 88)
4338c2ecf20Sopenharmony_ci#define ALX_MIB_RX_ERRADDR				(ALX_MIB_BASE + 92)
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define ALX_MIB_TX_OK					(ALX_MIB_BASE + 96)
4368c2ecf20Sopenharmony_ci#define ALX_MIB_TX_BCAST				(ALX_MIB_BASE + 100)
4378c2ecf20Sopenharmony_ci#define ALX_MIB_TX_MCAST				(ALX_MIB_BASE + 104)
4388c2ecf20Sopenharmony_ci#define ALX_MIB_TX_PAUSE				(ALX_MIB_BASE + 108)
4398c2ecf20Sopenharmony_ci#define ALX_MIB_TX_EXC_DEFER				(ALX_MIB_BASE + 112)
4408c2ecf20Sopenharmony_ci#define ALX_MIB_TX_CTRL					(ALX_MIB_BASE + 116)
4418c2ecf20Sopenharmony_ci#define ALX_MIB_TX_DEFER				(ALX_MIB_BASE + 120)
4428c2ecf20Sopenharmony_ci#define ALX_MIB_TX_BYTE_CNT				(ALX_MIB_BASE + 124)
4438c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_64B				(ALX_MIB_BASE + 128)
4448c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_127B				(ALX_MIB_BASE + 132)
4458c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_255B				(ALX_MIB_BASE + 136)
4468c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_511B				(ALX_MIB_BASE + 140)
4478c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_1023B				(ALX_MIB_BASE + 144)
4488c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_1518B				(ALX_MIB_BASE + 148)
4498c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SZ_MAX				(ALX_MIB_BASE + 152)
4508c2ecf20Sopenharmony_ci#define ALX_MIB_TX_SINGLE_COL				(ALX_MIB_BASE + 156)
4518c2ecf20Sopenharmony_ci#define ALX_MIB_TX_MULTI_COL				(ALX_MIB_BASE + 160)
4528c2ecf20Sopenharmony_ci#define ALX_MIB_TX_LATE_COL				(ALX_MIB_BASE + 164)
4538c2ecf20Sopenharmony_ci#define ALX_MIB_TX_ABORT_COL				(ALX_MIB_BASE + 168)
4548c2ecf20Sopenharmony_ci#define ALX_MIB_TX_UNDERRUN				(ALX_MIB_BASE + 172)
4558c2ecf20Sopenharmony_ci#define ALX_MIB_TX_TRD_EOP				(ALX_MIB_BASE + 176)
4568c2ecf20Sopenharmony_ci#define ALX_MIB_TX_LEN_ERR				(ALX_MIB_BASE + 180)
4578c2ecf20Sopenharmony_ci#define ALX_MIB_TX_TRUNC				(ALX_MIB_BASE + 184)
4588c2ecf20Sopenharmony_ci#define ALX_MIB_TX_BCCNT				(ALX_MIB_BASE + 188)
4598c2ecf20Sopenharmony_ci#define ALX_MIB_TX_MCCNT				(ALX_MIB_BASE + 192)
4608c2ecf20Sopenharmony_ci#define ALX_MIB_UPDATE					(ALX_MIB_BASE + 196)
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci#define ALX_ISR						0x1600
4648c2ecf20Sopenharmony_ci#define ALX_ISR_DIS					BIT(31)
4658c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q7					BIT(30)
4668c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q6					BIT(29)
4678c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q5					BIT(28)
4688c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q4					BIT(27)
4698c2ecf20Sopenharmony_ci#define ALX_ISR_PCIE_LNKDOWN				BIT(26)
4708c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q3					BIT(19)
4718c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q2					BIT(18)
4728c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q1					BIT(17)
4738c2ecf20Sopenharmony_ci#define ALX_ISR_RX_Q0					BIT(16)
4748c2ecf20Sopenharmony_ci#define ALX_ISR_TX_Q0					BIT(15)
4758c2ecf20Sopenharmony_ci#define ALX_ISR_PHY					BIT(12)
4768c2ecf20Sopenharmony_ci#define ALX_ISR_DMAW					BIT(10)
4778c2ecf20Sopenharmony_ci#define ALX_ISR_DMAR					BIT(9)
4788c2ecf20Sopenharmony_ci#define ALX_ISR_TXF_UR					BIT(8)
4798c2ecf20Sopenharmony_ci#define ALX_ISR_TX_Q3					BIT(7)
4808c2ecf20Sopenharmony_ci#define ALX_ISR_TX_Q2					BIT(6)
4818c2ecf20Sopenharmony_ci#define ALX_ISR_TX_Q1					BIT(5)
4828c2ecf20Sopenharmony_ci#define ALX_ISR_RFD_UR					BIT(4)
4838c2ecf20Sopenharmony_ci#define ALX_ISR_RXF_OV					BIT(3)
4848c2ecf20Sopenharmony_ci#define ALX_ISR_MANU					BIT(2)
4858c2ecf20Sopenharmony_ci#define ALX_ISR_TIMER					BIT(1)
4868c2ecf20Sopenharmony_ci#define ALX_ISR_SMB					BIT(0)
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci#define ALX_IMR						0x1604
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci/* re-send assert msg if SW no response */
4918c2ecf20Sopenharmony_ci#define ALX_INT_RETRIG					0x1608
4928c2ecf20Sopenharmony_ci/* 40ms */
4938c2ecf20Sopenharmony_ci#define ALX_INT_RETRIG_TO				20000
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci#define ALX_SMB_TIMER					0x15C4
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci#define ALX_TINT_TPD_THRSHLD				0x15C8
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci#define ALX_TINT_TIMER					0x15CC
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci#define ALX_CLK_GATE					0x1814
5028c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_RXMAC				BIT(5)
5038c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_TXMAC				BIT(4)
5048c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_RXQ				BIT(3)
5058c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_TXQ				BIT(2)
5068c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_DMAR				BIT(1)
5078c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_DMAW				BIT(0)
5088c2ecf20Sopenharmony_ci#define ALX_CLK_GATE_ALL		(ALX_CLK_GATE_RXMAC | \
5098c2ecf20Sopenharmony_ci					 ALX_CLK_GATE_TXMAC | \
5108c2ecf20Sopenharmony_ci					 ALX_CLK_GATE_RXQ | \
5118c2ecf20Sopenharmony_ci					 ALX_CLK_GATE_TXQ | \
5128c2ecf20Sopenharmony_ci					 ALX_CLK_GATE_DMAR | \
5138c2ecf20Sopenharmony_ci					 ALX_CLK_GATE_DMAW)
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_ci/* interop between drivers */
5168c2ecf20Sopenharmony_ci#define ALX_DRV						0x1804
5178c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_AUTO				BIT(28)
5188c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_1000				BIT(27)
5198c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_100					BIT(26)
5208c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_10					BIT(25)
5218c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_DUPLEX				BIT(24)
5228c2ecf20Sopenharmony_ci/* bit23: adv Pause */
5238c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_PAUSE				BIT(23)
5248c2ecf20Sopenharmony_ci/* bit22: adv Asym Pause */
5258c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_MASK				0xFF
5268c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_SHIFT				21
5278c2ecf20Sopenharmony_ci#define ALX_DRV_PHY_UNKNOWN				0
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci/* flag of phy inited */
5308c2ecf20Sopenharmony_ci#define ALX_PHY_INITED					0x003F
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci/* reg 1830 ~ 186C for C0+, 16 bit map patterns and wake packet detection */
5338c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL2					0x1830
5348c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL2_DATA_STORE			BIT(3)
5358c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL2_PTRN_EVT				BIT(2)
5368c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL2_PME_PTRN_EN			BIT(1)
5378c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL2_PTRN_EN				BIT(0)
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL3					0x1834
5408c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL3_PTRN_ADDR_MASK			0xFFFFF
5418c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL3_PTRN_ADDR_SHIFT			0
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4					0x1838
5448c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT15_MATCH			BIT(31)
5458c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT14_MATCH			BIT(30)
5468c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT13_MATCH			BIT(29)
5478c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT12_MATCH			BIT(28)
5488c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT11_MATCH			BIT(27)
5498c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT10_MATCH			BIT(26)
5508c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT9_MATCH				BIT(25)
5518c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT8_MATCH				BIT(24)
5528c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT7_MATCH				BIT(23)
5538c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT6_MATCH				BIT(22)
5548c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT5_MATCH				BIT(21)
5558c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT4_MATCH				BIT(20)
5568c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT3_MATCH				BIT(19)
5578c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT2_MATCH				BIT(18)
5588c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT1_MATCH				BIT(17)
5598c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT0_MATCH				BIT(16)
5608c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT15_EN				BIT(15)
5618c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT14_EN				BIT(14)
5628c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT13_EN				BIT(13)
5638c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT12_EN				BIT(12)
5648c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT11_EN				BIT(11)
5658c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT10_EN				BIT(10)
5668c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT9_EN				BIT(9)
5678c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT8_EN				BIT(8)
5688c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT7_EN				BIT(7)
5698c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT6_EN				BIT(6)
5708c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT5_EN				BIT(5)
5718c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT4_EN				BIT(4)
5728c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT3_EN				BIT(3)
5738c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT2_EN				BIT(2)
5748c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT1_EN				BIT(1)
5758c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL4_PT0_EN				BIT(0)
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5					0x183C
5788c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT3_LEN_MASK			0xFF
5798c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT3_LEN_SHIFT			24
5808c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT2_LEN_MASK			0xFF
5818c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT2_LEN_SHIFT			16
5828c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT1_LEN_MASK			0xFF
5838c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT1_LEN_SHIFT			8
5848c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT0_LEN_MASK			0xFF
5858c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT0_LEN_SHIFT			0
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL6					0x1840
5888c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT7_LEN_MASK			0xFF
5898c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT7_LEN_SHIFT			24
5908c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT6_LEN_MASK			0xFF
5918c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT6_LEN_SHIFT			16
5928c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT5_LEN_MASK			0xFF
5938c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT5_LEN_SHIFT			8
5948c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT4_LEN_MASK			0xFF
5958c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT4_LEN_SHIFT			0
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL7					0x1844
5988c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT11_LEN_MASK			0xFF
5998c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT11_LEN_SHIFT			24
6008c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT10_LEN_MASK			0xFF
6018c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT10_LEN_SHIFT			16
6028c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT9_LEN_MASK			0xFF
6038c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT9_LEN_SHIFT			8
6048c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT8_LEN_MASK			0xFF
6058c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT8_LEN_SHIFT			0
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL8					0x1848
6088c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT15_LEN_MASK			0xFF
6098c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT15_LEN_SHIFT			24
6108c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT14_LEN_MASK			0xFF
6118c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT14_LEN_SHIFT			16
6128c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT13_LEN_MASK			0xFF
6138c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT13_LEN_SHIFT			8
6148c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT12_LEN_MASK			0xFF
6158c2ecf20Sopenharmony_ci#define ALX_WOL_CTRL5_PT12_LEN_SHIFT			0
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN0				0x1850
6188c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN0_MASK			0xFFFFFFFF
6198c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN0_SHIFT			0
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN1				0x1854
6228c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN1_MASK			0xFFFF
6238c2ecf20Sopenharmony_ci#define ALX_ACER_FIXED_PTN1_SHIFT			0
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0				0x1858
6268c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0_MASK			0xFFFFFFFF
6278c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0_SHIFT			0
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1				0x185C
6308c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1_MASK			0xFFFFFFFF
6318c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1_SHIFT			0
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2				0x1860
6348c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2_MASK			0xFFFFFFFF
6358c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2_SHIFT			0
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3				0x1864
6388c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3_MASK			0xFFFFFFFF
6398c2ecf20Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3_SHIFT			0
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC					0x1868
6428c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_EN				BIT(31)
6438c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_PME_EN				BIT(30)
6448c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_MATCH				BIT(29)
6458c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_FF_CHECK				BIT(10)
6468c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_RAN_LEN_MASK			0x1F
6478c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_RAN_LEN_SHIFT			5
6488c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_FIX_LEN_MASK			0x1F
6498c2ecf20Sopenharmony_ci#define ALX_ACER_MAGIC_FIX_LEN_SHIFT			0
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER					0x186C
6528c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_EN				BIT(31)
6538c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_PME_EN				BIT(30)
6548c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_MATCH				BIT(29)
6558c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_THRES_MASK			0x1FFFF
6568c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_THRES_SHIFT			0
6578c2ecf20Sopenharmony_ci#define ALX_ACER_TIMER_THRES_DEF			1
6588c2ecf20Sopenharmony_ci
6598c2ecf20Sopenharmony_ci/* RSS definitions */
6608c2ecf20Sopenharmony_ci#define ALX_RSS_KEY0					0x14B0
6618c2ecf20Sopenharmony_ci#define ALX_RSS_KEY1					0x14B4
6628c2ecf20Sopenharmony_ci#define ALX_RSS_KEY2					0x14B8
6638c2ecf20Sopenharmony_ci#define ALX_RSS_KEY3					0x14BC
6648c2ecf20Sopenharmony_ci#define ALX_RSS_KEY4					0x14C0
6658c2ecf20Sopenharmony_ci#define ALX_RSS_KEY5					0x14C4
6668c2ecf20Sopenharmony_ci#define ALX_RSS_KEY6					0x14C8
6678c2ecf20Sopenharmony_ci#define ALX_RSS_KEY7					0x14CC
6688c2ecf20Sopenharmony_ci#define ALX_RSS_KEY8					0x14D0
6698c2ecf20Sopenharmony_ci#define ALX_RSS_KEY9					0x14D4
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_ci#define ALX_RSS_IDT_TBL0				0x1B00
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1				0x15D0
6748c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_TXQ1_SHIFT			20
6758c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_TXQ0_SHIFT			16
6768c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ3_SHIFT			12
6778c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ2_SHIFT			8
6788c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ1_SHIFT			4
6798c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ0_SHIFT			0
6808c2ecf20Sopenharmony_ci
6818c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2				0x15D8
6828c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_TXQ3_SHIFT			20
6838c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_TXQ2_SHIFT			16
6848c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ7_SHIFT			12
6858c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ6_SHIFT			8
6868c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ5_SHIFT			4
6878c2ecf20Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ4_SHIFT			0
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_ci#define ALX_MSI_ID_MAP					0x15D4
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci#define ALX_MSI_RETRANS_TIMER				0x1920
6928c2ecf20Sopenharmony_ci/* bit16: 1:line,0:standard */
6938c2ecf20Sopenharmony_ci#define ALX_MSI_MASK_SEL_LINE				BIT(16)
6948c2ecf20Sopenharmony_ci#define ALX_MSI_RETRANS_TM_MASK				0xFFFF
6958c2ecf20Sopenharmony_ci#define ALX_MSI_RETRANS_TM_SHIFT			0
6968c2ecf20Sopenharmony_ci
6978c2ecf20Sopenharmony_ci/* CR DMA ctrl */
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_ci/* TX QoS */
7008c2ecf20Sopenharmony_ci#define ALX_WRR						0x1938
7018c2ecf20Sopenharmony_ci#define ALX_WRR_PRI_MASK				0x3
7028c2ecf20Sopenharmony_ci#define ALX_WRR_PRI_SHIFT				29
7038c2ecf20Sopenharmony_ci#define ALX_WRR_PRI_RESTRICT_NONE			3
7048c2ecf20Sopenharmony_ci#define ALX_WRR_PRI3_MASK				0x1F
7058c2ecf20Sopenharmony_ci#define ALX_WRR_PRI3_SHIFT				24
7068c2ecf20Sopenharmony_ci#define ALX_WRR_PRI2_MASK				0x1F
7078c2ecf20Sopenharmony_ci#define ALX_WRR_PRI2_SHIFT				16
7088c2ecf20Sopenharmony_ci#define ALX_WRR_PRI1_MASK				0x1F
7098c2ecf20Sopenharmony_ci#define ALX_WRR_PRI1_SHIFT				8
7108c2ecf20Sopenharmony_ci#define ALX_WRR_PRI0_MASK				0x1F
7118c2ecf20Sopenharmony_ci#define ALX_WRR_PRI0_SHIFT				0
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci#define ALX_HQTPD					0x193C
7148c2ecf20Sopenharmony_ci#define ALX_HQTPD_BURST_EN				BIT(31)
7158c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q3_NUMPREF_MASK			0xF
7168c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q3_NUMPREF_SHIFT			8
7178c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q2_NUMPREF_MASK			0xF
7188c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q2_NUMPREF_SHIFT			4
7198c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q1_NUMPREF_MASK			0xF
7208c2ecf20Sopenharmony_ci#define ALX_HQTPD_Q1_NUMPREF_SHIFT			0
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci#define ALX_MISC					0x19C0
7238c2ecf20Sopenharmony_ci#define ALX_MISC_PSW_OCP_MASK				0x7
7248c2ecf20Sopenharmony_ci#define ALX_MISC_PSW_OCP_SHIFT				21
7258c2ecf20Sopenharmony_ci#define ALX_MISC_PSW_OCP_DEF				0x7
7268c2ecf20Sopenharmony_ci#define ALX_MISC_ISO_EN					BIT(12)
7278c2ecf20Sopenharmony_ci#define ALX_MISC_INTNLOSC_OPEN				BIT(3)
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_ci#define ALX_MSIC2					0x19C8
7308c2ecf20Sopenharmony_ci#define ALX_MSIC2_CALB_START				BIT(0)
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci#define ALX_MISC3					0x19CC
7338c2ecf20Sopenharmony_ci/* bit1: 1:Software control 25M */
7348c2ecf20Sopenharmony_ci#define ALX_MISC3_25M_BY_SW				BIT(1)
7358c2ecf20Sopenharmony_ci/* bit0: 25M switch to intnl OSC */
7368c2ecf20Sopenharmony_ci#define ALX_MISC3_25M_NOTO_INTNL			BIT(0)
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci/* MSIX tbl in memory space */
7398c2ecf20Sopenharmony_ci#define ALX_MSIX_ENTRY_BASE				0x2000
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci/********************* PHY regs definition ***************************/
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci/* PHY Specific Status Register */
7448c2ecf20Sopenharmony_ci#define ALX_MII_GIGA_PSSR				0x11
7458c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_SPD_DPLX_RESOLVED			0x0800
7468c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_DPLX				0x2000
7478c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_SPEED				0xC000
7488c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_10MBS				0x0000
7498c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_100MBS				0x4000
7508c2ecf20Sopenharmony_ci#define ALX_GIGA_PSSR_1000MBS				0x8000
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_ci/* PHY Interrupt Enable Register */
7538c2ecf20Sopenharmony_ci#define ALX_MII_IER					0x12
7548c2ecf20Sopenharmony_ci#define ALX_IER_LINK_UP					0x0400
7558c2ecf20Sopenharmony_ci#define ALX_IER_LINK_DOWN				0x0800
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_ci/* PHY Interrupt Status Register */
7588c2ecf20Sopenharmony_ci#define ALX_MII_ISR					0x13
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci#define ALX_MII_DBG_ADDR				0x1D
7618c2ecf20Sopenharmony_ci#define ALX_MII_DBG_DATA				0x1E
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci/***************************** debug port *************************************/
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci#define ALX_MIIDBG_ANACTRL				0x00
7668c2ecf20Sopenharmony_ci#define ALX_ANACTRL_DEF					0x02EF
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci#define ALX_MIIDBG_SYSMODCTRL				0x04
7698c2ecf20Sopenharmony_ci/* en half bias */
7708c2ecf20Sopenharmony_ci#define ALX_SYSMODCTRL_IECHOADJ_DEF			0xBB8B
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci#define ALX_MIIDBG_SRDSYSMOD				0x05
7738c2ecf20Sopenharmony_ci#define ALX_SRDSYSMOD_DEEMP_EN				0x0040
7748c2ecf20Sopenharmony_ci#define ALX_SRDSYSMOD_DEF				0x2C46
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_ci#define ALX_MIIDBG_HIBNEG				0x0B
7778c2ecf20Sopenharmony_ci#define ALX_HIBNEG_PSHIB_EN				0x8000
7788c2ecf20Sopenharmony_ci#define ALX_HIBNEG_HIB_PSE				0x1000
7798c2ecf20Sopenharmony_ci#define ALX_HIBNEG_DEF					0xBC40
7808c2ecf20Sopenharmony_ci#define ALX_HIBNEG_NOHIB	(ALX_HIBNEG_DEF & \
7818c2ecf20Sopenharmony_ci				 ~(ALX_HIBNEG_PSHIB_EN | ALX_HIBNEG_HIB_PSE))
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci#define ALX_MIIDBG_TST10BTCFG				0x12
7848c2ecf20Sopenharmony_ci#define ALX_TST10BTCFG_DEF				0x4C04
7858c2ecf20Sopenharmony_ci
7868c2ecf20Sopenharmony_ci#define ALX_MIIDBG_AZ_ANADECT				0x15
7878c2ecf20Sopenharmony_ci#define ALX_AZ_ANADECT_DEF				0x3220
7888c2ecf20Sopenharmony_ci#define ALX_AZ_ANADECT_LONG				0x3210
7898c2ecf20Sopenharmony_ci
7908c2ecf20Sopenharmony_ci#define ALX_MIIDBG_MSE16DB				0x18
7918c2ecf20Sopenharmony_ci#define ALX_MSE16DB_UP					0x05EA
7928c2ecf20Sopenharmony_ci#define ALX_MSE16DB_DOWN				0x02EA
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci#define ALX_MIIDBG_MSE20DB				0x1C
7958c2ecf20Sopenharmony_ci#define ALX_MSE20DB_TH_MASK				0x7F
7968c2ecf20Sopenharmony_ci#define ALX_MSE20DB_TH_SHIFT				2
7978c2ecf20Sopenharmony_ci#define ALX_MSE20DB_TH_DEF				0x2E
7988c2ecf20Sopenharmony_ci#define ALX_MSE20DB_TH_HI				0x54
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_ci#define ALX_MIIDBG_AGC					0x23
8018c2ecf20Sopenharmony_ci#define ALX_AGC_2_VGA_MASK				0x3FU
8028c2ecf20Sopenharmony_ci#define ALX_AGC_2_VGA_SHIFT				8
8038c2ecf20Sopenharmony_ci#define ALX_AGC_LONG1G_LIMT				40
8048c2ecf20Sopenharmony_ci#define ALX_AGC_LONG100M_LIMT				44
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_ci#define ALX_MIIDBG_LEGCYPS				0x29
8078c2ecf20Sopenharmony_ci#define ALX_LEGCYPS_EN					0x8000
8088c2ecf20Sopenharmony_ci#define ALX_LEGCYPS_DEF					0x129D
8098c2ecf20Sopenharmony_ci
8108c2ecf20Sopenharmony_ci#define ALX_MIIDBG_TST100BTCFG				0x36
8118c2ecf20Sopenharmony_ci#define ALX_TST100BTCFG_DEF				0xE12C
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci#define ALX_MIIDBG_GREENCFG				0x3B
8148c2ecf20Sopenharmony_ci#define ALX_GREENCFG_DEF				0x7078
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_ci#define ALX_MIIDBG_GREENCFG2				0x3D
8178c2ecf20Sopenharmony_ci#define ALX_GREENCFG2_BP_GREEN				0x8000
8188c2ecf20Sopenharmony_ci#define ALX_GREENCFG2_GATE_DFSE_EN			0x0080
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ci/******* dev 3 *********/
8218c2ecf20Sopenharmony_ci#define ALX_MIIEXT_PCS					3
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL3				0x8003
8248c2ecf20Sopenharmony_ci#define ALX_CLDCTRL3_BP_CABLE1TH_DET_GT			0x8000
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL5				0x8005
8278c2ecf20Sopenharmony_ci#define ALX_CLDCTRL5_BP_VD_HLFBIAS			0x4000
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL6				0x8006
8308c2ecf20Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_MASK			0xFF
8318c2ecf20Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHIFT			0
8328c2ecf20Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHORT1G			116
8338c2ecf20Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHORT100M			152
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci#define ALX_MIIEXT_VDRVBIAS				0x8062
8368c2ecf20Sopenharmony_ci#define ALX_VDRVBIAS_DEF				0x3
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ci/********* dev 7 **********/
8398c2ecf20Sopenharmony_ci#define ALX_MIIEXT_ANEG					7
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci#define ALX_MIIEXT_LOCAL_EEEADV				0x3C
8428c2ecf20Sopenharmony_ci#define ALX_LOCAL_EEEADV_1000BT				0x0004
8438c2ecf20Sopenharmony_ci#define ALX_LOCAL_EEEADV_100BT				0x0002
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci#define ALX_MIIEXT_AFE					0x801A
8468c2ecf20Sopenharmony_ci#define ALX_AFE_10BT_100M_TH				0x0040
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ci#define ALX_MIIEXT_S3DIG10				0x8023
8498c2ecf20Sopenharmony_ci/* bit0: 1:bypass 10BT rx fifo, 0:original 10BT rx */
8508c2ecf20Sopenharmony_ci#define ALX_MIIEXT_S3DIG10_SL				0x0001
8518c2ecf20Sopenharmony_ci#define ALX_MIIEXT_S3DIG10_DEF				0
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci#define ALX_MIIEXT_NLP78				0x8027
8548c2ecf20Sopenharmony_ci#define ALX_MIIEXT_NLP78_120M_DEF			0x8A05
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci#endif
857