162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2013 Johannes Berg <johannes@sipsolutions.net>
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  This file is free software: you may copy, redistribute and/or modify it
562306a36Sopenharmony_ci *  under the terms of the GNU General Public License as published by the
662306a36Sopenharmony_ci *  Free Software Foundation, either version 2 of the License, or (at your
762306a36Sopenharmony_ci *  option) any later version.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *  This file is distributed in the hope that it will be useful, but
1062306a36Sopenharmony_ci *  WITHOUT ANY WARRANTY; without even the implied warranty of
1162306a36Sopenharmony_ci *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1262306a36Sopenharmony_ci *  General Public License for more details.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *  You should have received a copy of the GNU General Public License
1562306a36Sopenharmony_ci *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * This file incorporates work covered by the following copyright and
1862306a36Sopenharmony_ci * permission notice:
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * Copyright (c) 2012 Qualcomm Atheros, Inc.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
2362306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
2462306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
2762306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
2862306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
2962306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3062306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3162306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3262306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef ALX_REG_H
3662306a36Sopenharmony_ci#define ALX_REG_H
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define ALX_DEV_ID_AR8161				0x1091
3962306a36Sopenharmony_ci#define ALX_DEV_ID_E2200				0xe091
4062306a36Sopenharmony_ci#define ALX_DEV_ID_E2400				0xe0a1
4162306a36Sopenharmony_ci#define ALX_DEV_ID_E2500				0xe0b1
4262306a36Sopenharmony_ci#define ALX_DEV_ID_AR8162				0x1090
4362306a36Sopenharmony_ci#define ALX_DEV_ID_AR8171				0x10A1
4462306a36Sopenharmony_ci#define ALX_DEV_ID_AR8172				0x10A0
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/* rev definition,
4762306a36Sopenharmony_ci * bit(0): with xD support
4862306a36Sopenharmony_ci * bit(1): with Card Reader function
4962306a36Sopenharmony_ci * bit(7:2): real revision
5062306a36Sopenharmony_ci */
5162306a36Sopenharmony_ci#define ALX_PCI_REVID_SHIFT				3
5262306a36Sopenharmony_ci#define ALX_REV_A0					0
5362306a36Sopenharmony_ci#define ALX_REV_A1					1
5462306a36Sopenharmony_ci#define ALX_REV_B0					2
5562306a36Sopenharmony_ci#define ALX_REV_C0					3
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define ALX_DEV_CTRL					0x0060
5862306a36Sopenharmony_ci#define ALX_DEV_CTRL_MAXRRS_MIN				2
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define ALX_MSIX_MASK					0x0090
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define ALX_UE_SVRT					0x010C
6362306a36Sopenharmony_ci#define ALX_UE_SVRT_FCPROTERR				BIT(13)
6462306a36Sopenharmony_ci#define ALX_UE_SVRT_DLPROTERR				BIT(4)
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/* eeprom & flash load register */
6762306a36Sopenharmony_ci#define ALX_EFLD					0x0204
6862306a36Sopenharmony_ci#define ALX_EFLD_F_EXIST				BIT(10)
6962306a36Sopenharmony_ci#define ALX_EFLD_E_EXIST				BIT(9)
7062306a36Sopenharmony_ci#define ALX_EFLD_STAT					BIT(5)
7162306a36Sopenharmony_ci#define ALX_EFLD_START					BIT(0)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* eFuse load register */
7462306a36Sopenharmony_ci#define ALX_SLD						0x0218
7562306a36Sopenharmony_ci#define ALX_SLD_STAT					BIT(12)
7662306a36Sopenharmony_ci#define ALX_SLD_START					BIT(11)
7762306a36Sopenharmony_ci#define ALX_SLD_MAX_TO					100
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#define ALX_PDLL_TRNS1					0x1104
8062306a36Sopenharmony_ci#define ALX_PDLL_TRNS1_D3PLLOFF_EN			BIT(11)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define ALX_PMCTRL					0x12F8
8362306a36Sopenharmony_ci#define ALX_PMCTRL_HOTRST_WTEN				BIT(31)
8462306a36Sopenharmony_ci/* bit30: L0s/L1 controlled by MAC based on throughput(setting in 15A0) */
8562306a36Sopenharmony_ci#define ALX_PMCTRL_ASPM_FCEN				BIT(30)
8662306a36Sopenharmony_ci#define ALX_PMCTRL_SADLY_EN				BIT(29)
8762306a36Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_MASK			0xF
8862306a36Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_SHIFT			24
8962306a36Sopenharmony_ci#define ALX_PMCTRL_LCKDET_TIMER_DEF			0xC
9062306a36Sopenharmony_ci/* bit[23:20] if pm_request_l1 time > @, then enter L0s not L1 */
9162306a36Sopenharmony_ci#define ALX_PMCTRL_L1REQ_TO_MASK			0xF
9262306a36Sopenharmony_ci#define ALX_PMCTRL_L1REQ_TO_SHIFT			20
9362306a36Sopenharmony_ci#define ALX_PMCTRL_L1REG_TO_DEF				0xF
9462306a36Sopenharmony_ci#define ALX_PMCTRL_TXL1_AFTER_L0S			BIT(19)
9562306a36Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_MASK			0x7
9662306a36Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_SHIFT			16
9762306a36Sopenharmony_ci#define ALX_PMCTRL_L1_TIMER_16US			4
9862306a36Sopenharmony_ci#define ALX_PMCTRL_RCVR_WT_1US				BIT(15)
9962306a36Sopenharmony_ci/* bit13: enable pcie clk switch in L1 state */
10062306a36Sopenharmony_ci#define ALX_PMCTRL_L1_CLKSW_EN				BIT(13)
10162306a36Sopenharmony_ci#define ALX_PMCTRL_L0S_EN				BIT(12)
10262306a36Sopenharmony_ci#define ALX_PMCTRL_RXL1_AFTER_L0S			BIT(11)
10362306a36Sopenharmony_ci#define ALX_PMCTRL_L1_BUFSRX_EN				BIT(7)
10462306a36Sopenharmony_ci/* bit6: power down serdes RX */
10562306a36Sopenharmony_ci#define ALX_PMCTRL_L1_SRDSRX_PWD			BIT(6)
10662306a36Sopenharmony_ci#define ALX_PMCTRL_L1_SRDSPLL_EN			BIT(5)
10762306a36Sopenharmony_ci#define ALX_PMCTRL_L1_SRDS_EN				BIT(4)
10862306a36Sopenharmony_ci#define ALX_PMCTRL_L1_EN				BIT(3)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/*******************************************************/
11162306a36Sopenharmony_ci/* following registers are mapped only to memory space */
11262306a36Sopenharmony_ci/*******************************************************/
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#define ALX_MASTER					0x1400
11562306a36Sopenharmony_ci/* bit12: 1:alwys select pclk from serdes, not sw to 25M */
11662306a36Sopenharmony_ci#define ALX_MASTER_PCLKSEL_SRDS				BIT(12)
11762306a36Sopenharmony_ci/* bit11: irq moduration for rx */
11862306a36Sopenharmony_ci#define ALX_MASTER_IRQMOD2_EN				BIT(11)
11962306a36Sopenharmony_ci/* bit10: irq moduration for tx/rx */
12062306a36Sopenharmony_ci#define ALX_MASTER_IRQMOD1_EN				BIT(10)
12162306a36Sopenharmony_ci#define ALX_MASTER_SYSALVTIMER_EN			BIT(7)
12262306a36Sopenharmony_ci#define ALX_MASTER_OOB_DIS				BIT(6)
12362306a36Sopenharmony_ci/* bit5: wakeup without pcie clk */
12462306a36Sopenharmony_ci#define ALX_MASTER_WAKEN_25M				BIT(5)
12562306a36Sopenharmony_ci/* bit0: MAC & DMA reset */
12662306a36Sopenharmony_ci#define ALX_MASTER_DMA_MAC_RST				BIT(0)
12762306a36Sopenharmony_ci#define ALX_DMA_MAC_RST_TO				50
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define ALX_IRQ_MODU_TIMER				0x1408
13062306a36Sopenharmony_ci#define ALX_IRQ_MODU_TIMER1_MASK			0xFFFF
13162306a36Sopenharmony_ci#define ALX_IRQ_MODU_TIMER1_SHIFT			0
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci#define ALX_PHY_CTRL					0x140C
13462306a36Sopenharmony_ci#define ALX_PHY_CTRL_100AB_EN				BIT(17)
13562306a36Sopenharmony_ci/* bit14: affect MAC & PHY, go to low power sts */
13662306a36Sopenharmony_ci#define ALX_PHY_CTRL_POWER_DOWN				BIT(14)
13762306a36Sopenharmony_ci/* bit13: 1:pll always ON, 0:can switch in lpw */
13862306a36Sopenharmony_ci#define ALX_PHY_CTRL_PLL_ON				BIT(13)
13962306a36Sopenharmony_ci#define ALX_PHY_CTRL_RST_ANALOG				BIT(12)
14062306a36Sopenharmony_ci#define ALX_PHY_CTRL_HIB_PULSE				BIT(11)
14162306a36Sopenharmony_ci#define ALX_PHY_CTRL_HIB_EN				BIT(10)
14262306a36Sopenharmony_ci#define ALX_PHY_CTRL_IDDQ				BIT(7)
14362306a36Sopenharmony_ci#define ALX_PHY_CTRL_GATE_25M				BIT(5)
14462306a36Sopenharmony_ci#define ALX_PHY_CTRL_LED_MODE				BIT(2)
14562306a36Sopenharmony_ci/* bit0: out of dsp RST state */
14662306a36Sopenharmony_ci#define ALX_PHY_CTRL_DSPRST_OUT				BIT(0)
14762306a36Sopenharmony_ci#define ALX_PHY_CTRL_DSPRST_TO				80
14862306a36Sopenharmony_ci#define ALX_PHY_CTRL_CLS	(ALX_PHY_CTRL_LED_MODE | \
14962306a36Sopenharmony_ci				 ALX_PHY_CTRL_100AB_EN | \
15062306a36Sopenharmony_ci				 ALX_PHY_CTRL_PLL_ON)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define ALX_MAC_STS					0x1410
15362306a36Sopenharmony_ci#define ALX_MAC_STS_TXQ_BUSY				BIT(3)
15462306a36Sopenharmony_ci#define ALX_MAC_STS_RXQ_BUSY				BIT(2)
15562306a36Sopenharmony_ci#define ALX_MAC_STS_TXMAC_BUSY				BIT(1)
15662306a36Sopenharmony_ci#define ALX_MAC_STS_RXMAC_BUSY				BIT(0)
15762306a36Sopenharmony_ci#define ALX_MAC_STS_IDLE	(ALX_MAC_STS_TXQ_BUSY | \
15862306a36Sopenharmony_ci				 ALX_MAC_STS_RXQ_BUSY | \
15962306a36Sopenharmony_ci				 ALX_MAC_STS_TXMAC_BUSY | \
16062306a36Sopenharmony_ci				 ALX_MAC_STS_RXMAC_BUSY)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define ALX_MDIO					0x1414
16362306a36Sopenharmony_ci#define ALX_MDIO_MODE_EXT				BIT(30)
16462306a36Sopenharmony_ci#define ALX_MDIO_BUSY					BIT(27)
16562306a36Sopenharmony_ci#define ALX_MDIO_CLK_SEL_MASK				0x7
16662306a36Sopenharmony_ci#define ALX_MDIO_CLK_SEL_SHIFT				24
16762306a36Sopenharmony_ci#define ALX_MDIO_CLK_SEL_25MD4				0
16862306a36Sopenharmony_ci#define ALX_MDIO_CLK_SEL_25MD128			7
16962306a36Sopenharmony_ci#define ALX_MDIO_START					BIT(23)
17062306a36Sopenharmony_ci#define ALX_MDIO_SPRES_PRMBL				BIT(22)
17162306a36Sopenharmony_ci/* bit21: 1:read,0:write */
17262306a36Sopenharmony_ci#define ALX_MDIO_OP_READ				BIT(21)
17362306a36Sopenharmony_ci#define ALX_MDIO_REG_MASK				0x1F
17462306a36Sopenharmony_ci#define ALX_MDIO_REG_SHIFT				16
17562306a36Sopenharmony_ci#define ALX_MDIO_DATA_MASK				0xFFFF
17662306a36Sopenharmony_ci#define ALX_MDIO_DATA_SHIFT				0
17762306a36Sopenharmony_ci#define ALX_MDIO_MAX_AC_TO				120
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci#define ALX_MDIO_EXTN					0x1448
18062306a36Sopenharmony_ci#define ALX_MDIO_EXTN_DEVAD_MASK			0x1F
18162306a36Sopenharmony_ci#define ALX_MDIO_EXTN_DEVAD_SHIFT			16
18262306a36Sopenharmony_ci#define ALX_MDIO_EXTN_REG_MASK				0xFFFF
18362306a36Sopenharmony_ci#define ALX_MDIO_EXTN_REG_SHIFT				0
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci#define ALX_SERDES					0x1424
18662306a36Sopenharmony_ci#define ALX_SERDES_PHYCLK_SLWDWN			BIT(18)
18762306a36Sopenharmony_ci#define ALX_SERDES_MACCLK_SLWDWN			BIT(17)
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define ALX_LPI_CTRL					0x1440
19062306a36Sopenharmony_ci#define ALX_LPI_CTRL_EN					BIT(0)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* for B0+, bit[13..] for C0+ */
19362306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL				0x1AD0
19462306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_MASK		0x3F
19562306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_PERIOD_HIGH_SHIFT		24
19662306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_SWOI_STARTUP_PKT_EN		BIT(23)
19762306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_FRAGMENTED		BIT(22)
19862306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_FRAGMENTED		BIT(21)
19962306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_KEEPALIVE_EN		BIT(20)
20062306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_HAS_VLAN		BIT(19)
20162306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_8023		BIT(18)
20262306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_1_IS_IPV6		BIT(17)
20362306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_KEEPALIVE_EN		BIT(16)
20462306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_HAS_VLAN		BIT(15)
20562306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_8023		BIT(14)
20662306a36Sopenharmony_ci#define L1F_HRTBT_EXT_CTRL_IOAC_2_IS_IPV6		BIT(13)
20762306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_NS_EN			BIT(12)
20862306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_MASK		0xFF
20962306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_FRAG_LEN_SHIFT		4
21062306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_IS_8023			BIT(3)
21162306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_IS_IPV6			BIT(2)
21262306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_WAKEUP_EN			BIT(1)
21362306a36Sopenharmony_ci#define ALX_HRTBT_EXT_CTRL_ARP_EN			BIT(0)
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci#define ALX_HRTBT_REM_IPV4_ADDR				0x1AD4
21662306a36Sopenharmony_ci#define ALX_HRTBT_HOST_IPV4_ADDR			0x1478
21762306a36Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR3			0x1AD8
21862306a36Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR2			0x1ADC
21962306a36Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR1			0x1AE0
22062306a36Sopenharmony_ci#define ALX_HRTBT_REM_IPV6_ADDR0			0x1AE4
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci/* 1B8C ~ 1B94 for C0+ */
22362306a36Sopenharmony_ci#define ALX_SWOI_ACER_CTRL				0x1B8C
22462306a36Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_EN			BIT(20)
22562306a36Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_MASK		0XFF
22662306a36Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_NAK_PKT_LEN_SHIFT		12
22762306a36Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_ADDR_MASK			0XFFF
22862306a36Sopenharmony_ci#define ALX_SWOI_ORIG_ACK_ADDR_SHIFT			0
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2				0x1B90
23162306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_MASK	0xFF
23262306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_FRAG_LEN_SHIFT	24
23362306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_MASK	0xFFF
23462306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_PKT_LEN_SHIFT	12
23562306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_MASK	0xFFF
23662306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_2_SWOI_1_HDR_ADDR_SHIFT	0
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3				0x1B94
23962306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_MASK	0xFF
24062306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_FRAG_LEN_SHIFT	24
24162306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_MASK	0xFFF
24262306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_PKT_LEN_SHIFT	12
24362306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_MASK	0xFFF
24462306a36Sopenharmony_ci#define ALX_SWOI_IOAC_CTRL_3_SWOI_2_HDR_ADDR_SHIFT	0
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/* for B0 */
24762306a36Sopenharmony_ci#define ALX_IDLE_DECISN_TIMER				0x1474
24862306a36Sopenharmony_ci/* 1ms */
24962306a36Sopenharmony_ci#define ALX_IDLE_DECISN_TIMER_DEF			0x400
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci#define ALX_MAC_CTRL					0x1480
25262306a36Sopenharmony_ci#define ALX_MAC_CTRL_FAST_PAUSE				BIT(31)
25362306a36Sopenharmony_ci#define ALX_MAC_CTRL_WOLSPED_SWEN			BIT(30)
25462306a36Sopenharmony_ci/* bit29: 1:legacy(hi5b), 0:marvl(lo5b)*/
25562306a36Sopenharmony_ci#define ALX_MAC_CTRL_MHASH_ALG_HI5B			BIT(29)
25662306a36Sopenharmony_ci#define ALX_MAC_CTRL_BRD_EN				BIT(26)
25762306a36Sopenharmony_ci#define ALX_MAC_CTRL_MULTIALL_EN			BIT(25)
25862306a36Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_MASK				0x3
25962306a36Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_SHIFT			20
26062306a36Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_10_100			1
26162306a36Sopenharmony_ci#define ALX_MAC_CTRL_SPEED_1000				2
26262306a36Sopenharmony_ci#define ALX_MAC_CTRL_PROMISC_EN				BIT(15)
26362306a36Sopenharmony_ci#define ALX_MAC_CTRL_VLANSTRIP				BIT(14)
26462306a36Sopenharmony_ci#define ALX_MAC_CTRL_PRMBLEN_MASK			0xF
26562306a36Sopenharmony_ci#define ALX_MAC_CTRL_PRMBLEN_SHIFT			10
26662306a36Sopenharmony_ci#define ALX_MAC_CTRL_PCRCE				BIT(7)
26762306a36Sopenharmony_ci#define ALX_MAC_CTRL_CRCE				BIT(6)
26862306a36Sopenharmony_ci#define ALX_MAC_CTRL_FULLD				BIT(5)
26962306a36Sopenharmony_ci#define ALX_MAC_CTRL_RXFC_EN				BIT(3)
27062306a36Sopenharmony_ci#define ALX_MAC_CTRL_TXFC_EN				BIT(2)
27162306a36Sopenharmony_ci#define ALX_MAC_CTRL_RX_EN				BIT(1)
27262306a36Sopenharmony_ci#define ALX_MAC_CTRL_TX_EN				BIT(0)
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci#define ALX_STAD0					0x1488
27562306a36Sopenharmony_ci#define ALX_STAD1					0x148C
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define ALX_HASH_TBL0					0x1490
27862306a36Sopenharmony_ci#define ALX_HASH_TBL1					0x1494
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define ALX_MTU						0x149C
28162306a36Sopenharmony_ci#define ALX_MTU_JUMBO_TH				1514
28262306a36Sopenharmony_ci#define ALX_MTU_STD_ALGN				1536
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci#define ALX_SRAM5					0x1524
28562306a36Sopenharmony_ci#define ALX_SRAM_RXF_LEN_MASK				0xFFF
28662306a36Sopenharmony_ci#define ALX_SRAM_RXF_LEN_SHIFT				0
28762306a36Sopenharmony_ci#define ALX_SRAM_RXF_LEN_8K				(8*1024)
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci#define ALX_SRAM9					0x1534
29062306a36Sopenharmony_ci#define ALX_SRAM_LOAD_PTR				BIT(0)
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define ALX_RX_BASE_ADDR_HI				0x1540
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci#define ALX_TX_BASE_ADDR_HI				0x1544
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci#define ALX_RFD_ADDR_LO					0x1550
29762306a36Sopenharmony_ci#define ALX_RFD_RING_SZ					0x1560
29862306a36Sopenharmony_ci#define ALX_RFD_BUF_SZ					0x1564
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define ALX_RRD_ADDR_LO					0x1568
30162306a36Sopenharmony_ci#define ALX_RRD_RING_SZ					0x1578
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci/* pri3: highest, pri0: lowest */
30462306a36Sopenharmony_ci#define ALX_TPD_PRI3_ADDR_LO				0x14E4
30562306a36Sopenharmony_ci#define ALX_TPD_PRI2_ADDR_LO				0x14E0
30662306a36Sopenharmony_ci#define ALX_TPD_PRI1_ADDR_LO				0x157C
30762306a36Sopenharmony_ci#define ALX_TPD_PRI0_ADDR_LO				0x1580
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci/* producer index is 16bit */
31062306a36Sopenharmony_ci#define ALX_TPD_PRI3_PIDX				0x1618
31162306a36Sopenharmony_ci#define ALX_TPD_PRI2_PIDX				0x161A
31262306a36Sopenharmony_ci#define ALX_TPD_PRI1_PIDX				0x15F0
31362306a36Sopenharmony_ci#define ALX_TPD_PRI0_PIDX				0x15F2
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci/* consumer index is 16bit */
31662306a36Sopenharmony_ci#define ALX_TPD_PRI3_CIDX				0x161C
31762306a36Sopenharmony_ci#define ALX_TPD_PRI2_CIDX				0x161E
31862306a36Sopenharmony_ci#define ALX_TPD_PRI1_CIDX				0x15F4
31962306a36Sopenharmony_ci#define ALX_TPD_PRI0_CIDX				0x15F6
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci#define ALX_TPD_RING_SZ					0x1584
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci#define ALX_TXQ0					0x1590
32462306a36Sopenharmony_ci#define ALX_TXQ0_TXF_BURST_PREF_MASK			0xFFFF
32562306a36Sopenharmony_ci#define ALX_TXQ0_TXF_BURST_PREF_SHIFT			16
32662306a36Sopenharmony_ci#define ALX_TXQ_TXF_BURST_PREF_DEF			0x200
32762306a36Sopenharmony_ci#define ALX_TXQ0_LSO_8023_EN				BIT(7)
32862306a36Sopenharmony_ci#define ALX_TXQ0_MODE_ENHANCE				BIT(6)
32962306a36Sopenharmony_ci#define ALX_TXQ0_EN					BIT(5)
33062306a36Sopenharmony_ci#define ALX_TXQ0_SUPT_IPOPT				BIT(4)
33162306a36Sopenharmony_ci#define ALX_TXQ0_TPD_BURSTPREF_MASK			0xF
33262306a36Sopenharmony_ci#define ALX_TXQ0_TPD_BURSTPREF_SHIFT			0
33362306a36Sopenharmony_ci#define ALX_TXQ_TPD_BURSTPREF_DEF			5
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci#define ALX_TXQ1					0x1594
33662306a36Sopenharmony_ci/* bit11:  drop large packet, len > (rfd buf) */
33762306a36Sopenharmony_ci#define ALX_TXQ1_ERRLGPKT_DROP_EN			BIT(11)
33862306a36Sopenharmony_ci#define ALX_TXQ1_JUMBO_TSO_TH				(7*1024)
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci#define ALX_RXQ0					0x15A0
34162306a36Sopenharmony_ci#define ALX_RXQ0_EN					BIT(31)
34262306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HASH_EN				BIT(29)
34362306a36Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_MASK				0x3
34462306a36Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_SHIFT				26
34562306a36Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_DIS				0
34662306a36Sopenharmony_ci#define ALX_RXQ0_RSS_MODE_MQMI				3
34762306a36Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_MASK			0x3F
34862306a36Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_SHIFT			20
34962306a36Sopenharmony_ci#define ALX_RXQ0_NUM_RFD_PREF_DEF			8
35062306a36Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_MASK			0x1FF
35162306a36Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_SHIFT			8
35262306a36Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_DEF			0x100
35362306a36Sopenharmony_ci#define ALX_RXQ0_IDT_TBL_SIZE_NORMAL			128
35462306a36Sopenharmony_ci#define ALX_RXQ0_IPV6_PARSE_EN				BIT(7)
35562306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_MASK				0xF
35662306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_SHIFT			2
35762306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN			BIT(5)
35862306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV6_EN			BIT(4)
35962306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN			BIT(3)
36062306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_IPV4_EN			BIT(2)
36162306a36Sopenharmony_ci#define ALX_RXQ0_RSS_HSTYP_ALL		(ALX_RXQ0_RSS_HSTYP_IPV6_TCP_EN | \
36262306a36Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV4_TCP_EN | \
36362306a36Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV6_EN | \
36462306a36Sopenharmony_ci					 ALX_RXQ0_RSS_HSTYP_IPV4_EN)
36562306a36Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_MASK			0x3
36662306a36Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_SHIFT			0
36762306a36Sopenharmony_ci#define ALX_RXQ0_ASPM_THRESH_100M			3
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci#define ALX_RXQ2					0x15A8
37062306a36Sopenharmony_ci#define ALX_RXQ2_RXF_XOFF_THRESH_MASK			0xFFF
37162306a36Sopenharmony_ci#define ALX_RXQ2_RXF_XOFF_THRESH_SHIFT			16
37262306a36Sopenharmony_ci#define ALX_RXQ2_RXF_XON_THRESH_MASK			0xFFF
37362306a36Sopenharmony_ci#define ALX_RXQ2_RXF_XON_THRESH_SHIFT			0
37462306a36Sopenharmony_ci/* Size = tx-packet(1522) + IPG(12) + SOF(8) + 64(Pause) + IPG(12) + SOF(8) +
37562306a36Sopenharmony_ci *        rx-packet(1522) + delay-of-link(64)
37662306a36Sopenharmony_ci *      = 3212.
37762306a36Sopenharmony_ci */
37862306a36Sopenharmony_ci#define ALX_RXQ2_RXF_FLOW_CTRL_RSVD			3212
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci#define ALX_DMA						0x15C0
38162306a36Sopenharmony_ci#define ALX_DMA_RCHNL_SEL_MASK				0x3
38262306a36Sopenharmony_ci#define ALX_DMA_RCHNL_SEL_SHIFT				26
38362306a36Sopenharmony_ci#define ALX_DMA_WDLY_CNT_MASK				0xF
38462306a36Sopenharmony_ci#define ALX_DMA_WDLY_CNT_SHIFT				16
38562306a36Sopenharmony_ci#define ALX_DMA_WDLY_CNT_DEF				4
38662306a36Sopenharmony_ci#define ALX_DMA_RDLY_CNT_MASK				0x1F
38762306a36Sopenharmony_ci#define ALX_DMA_RDLY_CNT_SHIFT				11
38862306a36Sopenharmony_ci#define ALX_DMA_RDLY_CNT_DEF				15
38962306a36Sopenharmony_ci/* bit10: 0:tpd with pri, 1: data */
39062306a36Sopenharmony_ci#define ALX_DMA_RREQ_PRI_DATA				BIT(10)
39162306a36Sopenharmony_ci#define ALX_DMA_RREQ_BLEN_MASK				0x7
39262306a36Sopenharmony_ci#define ALX_DMA_RREQ_BLEN_SHIFT				4
39362306a36Sopenharmony_ci#define ALX_DMA_RORDER_MODE_MASK			0x7
39462306a36Sopenharmony_ci#define ALX_DMA_RORDER_MODE_SHIFT			0
39562306a36Sopenharmony_ci#define ALX_DMA_RORDER_MODE_OUT				4
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci#define ALX_WOL0					0x14A0
39862306a36Sopenharmony_ci#define ALX_WOL0_PME_LINK				BIT(5)
39962306a36Sopenharmony_ci#define ALX_WOL0_LINK_EN				BIT(4)
40062306a36Sopenharmony_ci#define ALX_WOL0_PME_MAGIC_EN				BIT(3)
40162306a36Sopenharmony_ci#define ALX_WOL0_MAGIC_EN				BIT(2)
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci#define ALX_RFD_PIDX					0x15E0
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ci#define ALX_RFD_CIDX					0x15F8
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ci/* MIB */
40862306a36Sopenharmony_ci#define ALX_MIB_BASE					0x1700
40962306a36Sopenharmony_ci
41062306a36Sopenharmony_ci#define ALX_MIB_RX_OK					(ALX_MIB_BASE + 0)
41162306a36Sopenharmony_ci#define ALX_MIB_RX_BCAST				(ALX_MIB_BASE + 4)
41262306a36Sopenharmony_ci#define ALX_MIB_RX_MCAST				(ALX_MIB_BASE + 8)
41362306a36Sopenharmony_ci#define ALX_MIB_RX_PAUSE				(ALX_MIB_BASE + 12)
41462306a36Sopenharmony_ci#define ALX_MIB_RX_CTRL					(ALX_MIB_BASE + 16)
41562306a36Sopenharmony_ci#define ALX_MIB_RX_FCS_ERR				(ALX_MIB_BASE + 20)
41662306a36Sopenharmony_ci#define ALX_MIB_RX_LEN_ERR				(ALX_MIB_BASE + 24)
41762306a36Sopenharmony_ci#define ALX_MIB_RX_BYTE_CNT				(ALX_MIB_BASE + 28)
41862306a36Sopenharmony_ci#define ALX_MIB_RX_RUNT					(ALX_MIB_BASE + 32)
41962306a36Sopenharmony_ci#define ALX_MIB_RX_FRAG					(ALX_MIB_BASE + 36)
42062306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_64B				(ALX_MIB_BASE + 40)
42162306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_127B				(ALX_MIB_BASE + 44)
42262306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_255B				(ALX_MIB_BASE + 48)
42362306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_511B				(ALX_MIB_BASE + 52)
42462306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_1023B				(ALX_MIB_BASE + 56)
42562306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_1518B				(ALX_MIB_BASE + 60)
42662306a36Sopenharmony_ci#define ALX_MIB_RX_SZ_MAX				(ALX_MIB_BASE + 64)
42762306a36Sopenharmony_ci#define ALX_MIB_RX_OV_SZ				(ALX_MIB_BASE + 68)
42862306a36Sopenharmony_ci#define ALX_MIB_RX_OV_RXF				(ALX_MIB_BASE + 72)
42962306a36Sopenharmony_ci#define ALX_MIB_RX_OV_RRD				(ALX_MIB_BASE + 76)
43062306a36Sopenharmony_ci#define ALX_MIB_RX_ALIGN_ERR				(ALX_MIB_BASE + 80)
43162306a36Sopenharmony_ci#define ALX_MIB_RX_BCCNT				(ALX_MIB_BASE + 84)
43262306a36Sopenharmony_ci#define ALX_MIB_RX_MCCNT				(ALX_MIB_BASE + 88)
43362306a36Sopenharmony_ci#define ALX_MIB_RX_ERRADDR				(ALX_MIB_BASE + 92)
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci#define ALX_MIB_TX_OK					(ALX_MIB_BASE + 96)
43662306a36Sopenharmony_ci#define ALX_MIB_TX_BCAST				(ALX_MIB_BASE + 100)
43762306a36Sopenharmony_ci#define ALX_MIB_TX_MCAST				(ALX_MIB_BASE + 104)
43862306a36Sopenharmony_ci#define ALX_MIB_TX_PAUSE				(ALX_MIB_BASE + 108)
43962306a36Sopenharmony_ci#define ALX_MIB_TX_EXC_DEFER				(ALX_MIB_BASE + 112)
44062306a36Sopenharmony_ci#define ALX_MIB_TX_CTRL					(ALX_MIB_BASE + 116)
44162306a36Sopenharmony_ci#define ALX_MIB_TX_DEFER				(ALX_MIB_BASE + 120)
44262306a36Sopenharmony_ci#define ALX_MIB_TX_BYTE_CNT				(ALX_MIB_BASE + 124)
44362306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_64B				(ALX_MIB_BASE + 128)
44462306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_127B				(ALX_MIB_BASE + 132)
44562306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_255B				(ALX_MIB_BASE + 136)
44662306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_511B				(ALX_MIB_BASE + 140)
44762306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_1023B				(ALX_MIB_BASE + 144)
44862306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_1518B				(ALX_MIB_BASE + 148)
44962306a36Sopenharmony_ci#define ALX_MIB_TX_SZ_MAX				(ALX_MIB_BASE + 152)
45062306a36Sopenharmony_ci#define ALX_MIB_TX_SINGLE_COL				(ALX_MIB_BASE + 156)
45162306a36Sopenharmony_ci#define ALX_MIB_TX_MULTI_COL				(ALX_MIB_BASE + 160)
45262306a36Sopenharmony_ci#define ALX_MIB_TX_LATE_COL				(ALX_MIB_BASE + 164)
45362306a36Sopenharmony_ci#define ALX_MIB_TX_ABORT_COL				(ALX_MIB_BASE + 168)
45462306a36Sopenharmony_ci#define ALX_MIB_TX_UNDERRUN				(ALX_MIB_BASE + 172)
45562306a36Sopenharmony_ci#define ALX_MIB_TX_TRD_EOP				(ALX_MIB_BASE + 176)
45662306a36Sopenharmony_ci#define ALX_MIB_TX_LEN_ERR				(ALX_MIB_BASE + 180)
45762306a36Sopenharmony_ci#define ALX_MIB_TX_TRUNC				(ALX_MIB_BASE + 184)
45862306a36Sopenharmony_ci#define ALX_MIB_TX_BCCNT				(ALX_MIB_BASE + 188)
45962306a36Sopenharmony_ci#define ALX_MIB_TX_MCCNT				(ALX_MIB_BASE + 192)
46062306a36Sopenharmony_ci#define ALX_MIB_UPDATE					(ALX_MIB_BASE + 196)
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci#define ALX_ISR						0x1600
46462306a36Sopenharmony_ci#define ALX_ISR_DIS					BIT(31)
46562306a36Sopenharmony_ci#define ALX_ISR_RX_Q7					BIT(30)
46662306a36Sopenharmony_ci#define ALX_ISR_RX_Q6					BIT(29)
46762306a36Sopenharmony_ci#define ALX_ISR_RX_Q5					BIT(28)
46862306a36Sopenharmony_ci#define ALX_ISR_RX_Q4					BIT(27)
46962306a36Sopenharmony_ci#define ALX_ISR_PCIE_LNKDOWN				BIT(26)
47062306a36Sopenharmony_ci#define ALX_ISR_RX_Q3					BIT(19)
47162306a36Sopenharmony_ci#define ALX_ISR_RX_Q2					BIT(18)
47262306a36Sopenharmony_ci#define ALX_ISR_RX_Q1					BIT(17)
47362306a36Sopenharmony_ci#define ALX_ISR_RX_Q0					BIT(16)
47462306a36Sopenharmony_ci#define ALX_ISR_TX_Q0					BIT(15)
47562306a36Sopenharmony_ci#define ALX_ISR_PHY					BIT(12)
47662306a36Sopenharmony_ci#define ALX_ISR_DMAW					BIT(10)
47762306a36Sopenharmony_ci#define ALX_ISR_DMAR					BIT(9)
47862306a36Sopenharmony_ci#define ALX_ISR_TXF_UR					BIT(8)
47962306a36Sopenharmony_ci#define ALX_ISR_TX_Q3					BIT(7)
48062306a36Sopenharmony_ci#define ALX_ISR_TX_Q2					BIT(6)
48162306a36Sopenharmony_ci#define ALX_ISR_TX_Q1					BIT(5)
48262306a36Sopenharmony_ci#define ALX_ISR_RFD_UR					BIT(4)
48362306a36Sopenharmony_ci#define ALX_ISR_RXF_OV					BIT(3)
48462306a36Sopenharmony_ci#define ALX_ISR_MANU					BIT(2)
48562306a36Sopenharmony_ci#define ALX_ISR_TIMER					BIT(1)
48662306a36Sopenharmony_ci#define ALX_ISR_SMB					BIT(0)
48762306a36Sopenharmony_ci
48862306a36Sopenharmony_ci#define ALX_IMR						0x1604
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci/* re-send assert msg if SW no response */
49162306a36Sopenharmony_ci#define ALX_INT_RETRIG					0x1608
49262306a36Sopenharmony_ci/* 40ms */
49362306a36Sopenharmony_ci#define ALX_INT_RETRIG_TO				20000
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci#define ALX_SMB_TIMER					0x15C4
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci#define ALX_TINT_TPD_THRSHLD				0x15C8
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci#define ALX_TINT_TIMER					0x15CC
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_ci#define ALX_CLK_GATE					0x1814
50262306a36Sopenharmony_ci#define ALX_CLK_GATE_RXMAC				BIT(5)
50362306a36Sopenharmony_ci#define ALX_CLK_GATE_TXMAC				BIT(4)
50462306a36Sopenharmony_ci#define ALX_CLK_GATE_RXQ				BIT(3)
50562306a36Sopenharmony_ci#define ALX_CLK_GATE_TXQ				BIT(2)
50662306a36Sopenharmony_ci#define ALX_CLK_GATE_DMAR				BIT(1)
50762306a36Sopenharmony_ci#define ALX_CLK_GATE_DMAW				BIT(0)
50862306a36Sopenharmony_ci#define ALX_CLK_GATE_ALL		(ALX_CLK_GATE_RXMAC | \
50962306a36Sopenharmony_ci					 ALX_CLK_GATE_TXMAC | \
51062306a36Sopenharmony_ci					 ALX_CLK_GATE_RXQ | \
51162306a36Sopenharmony_ci					 ALX_CLK_GATE_TXQ | \
51262306a36Sopenharmony_ci					 ALX_CLK_GATE_DMAR | \
51362306a36Sopenharmony_ci					 ALX_CLK_GATE_DMAW)
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci/* interop between drivers */
51662306a36Sopenharmony_ci#define ALX_DRV						0x1804
51762306a36Sopenharmony_ci#define ALX_DRV_PHY_AUTO				BIT(28)
51862306a36Sopenharmony_ci#define ALX_DRV_PHY_1000				BIT(27)
51962306a36Sopenharmony_ci#define ALX_DRV_PHY_100					BIT(26)
52062306a36Sopenharmony_ci#define ALX_DRV_PHY_10					BIT(25)
52162306a36Sopenharmony_ci#define ALX_DRV_PHY_DUPLEX				BIT(24)
52262306a36Sopenharmony_ci/* bit23: adv Pause */
52362306a36Sopenharmony_ci#define ALX_DRV_PHY_PAUSE				BIT(23)
52462306a36Sopenharmony_ci/* bit22: adv Asym Pause */
52562306a36Sopenharmony_ci#define ALX_DRV_PHY_MASK				0xFF
52662306a36Sopenharmony_ci#define ALX_DRV_PHY_SHIFT				21
52762306a36Sopenharmony_ci#define ALX_DRV_PHY_UNKNOWN				0
52862306a36Sopenharmony_ci
52962306a36Sopenharmony_ci/* flag of phy inited */
53062306a36Sopenharmony_ci#define ALX_PHY_INITED					0x003F
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci/* reg 1830 ~ 186C for C0+, 16 bit map patterns and wake packet detection */
53362306a36Sopenharmony_ci#define ALX_WOL_CTRL2					0x1830
53462306a36Sopenharmony_ci#define ALX_WOL_CTRL2_DATA_STORE			BIT(3)
53562306a36Sopenharmony_ci#define ALX_WOL_CTRL2_PTRN_EVT				BIT(2)
53662306a36Sopenharmony_ci#define ALX_WOL_CTRL2_PME_PTRN_EN			BIT(1)
53762306a36Sopenharmony_ci#define ALX_WOL_CTRL2_PTRN_EN				BIT(0)
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci#define ALX_WOL_CTRL3					0x1834
54062306a36Sopenharmony_ci#define ALX_WOL_CTRL3_PTRN_ADDR_MASK			0xFFFFF
54162306a36Sopenharmony_ci#define ALX_WOL_CTRL3_PTRN_ADDR_SHIFT			0
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci#define ALX_WOL_CTRL4					0x1838
54462306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT15_MATCH			BIT(31)
54562306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT14_MATCH			BIT(30)
54662306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT13_MATCH			BIT(29)
54762306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT12_MATCH			BIT(28)
54862306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT11_MATCH			BIT(27)
54962306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT10_MATCH			BIT(26)
55062306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT9_MATCH				BIT(25)
55162306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT8_MATCH				BIT(24)
55262306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT7_MATCH				BIT(23)
55362306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT6_MATCH				BIT(22)
55462306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT5_MATCH				BIT(21)
55562306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT4_MATCH				BIT(20)
55662306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT3_MATCH				BIT(19)
55762306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT2_MATCH				BIT(18)
55862306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT1_MATCH				BIT(17)
55962306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT0_MATCH				BIT(16)
56062306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT15_EN				BIT(15)
56162306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT14_EN				BIT(14)
56262306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT13_EN				BIT(13)
56362306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT12_EN				BIT(12)
56462306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT11_EN				BIT(11)
56562306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT10_EN				BIT(10)
56662306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT9_EN				BIT(9)
56762306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT8_EN				BIT(8)
56862306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT7_EN				BIT(7)
56962306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT6_EN				BIT(6)
57062306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT5_EN				BIT(5)
57162306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT4_EN				BIT(4)
57262306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT3_EN				BIT(3)
57362306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT2_EN				BIT(2)
57462306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT1_EN				BIT(1)
57562306a36Sopenharmony_ci#define ALX_WOL_CTRL4_PT0_EN				BIT(0)
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_ci#define ALX_WOL_CTRL5					0x183C
57862306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT3_LEN_MASK			0xFF
57962306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT3_LEN_SHIFT			24
58062306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT2_LEN_MASK			0xFF
58162306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT2_LEN_SHIFT			16
58262306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT1_LEN_MASK			0xFF
58362306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT1_LEN_SHIFT			8
58462306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT0_LEN_MASK			0xFF
58562306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT0_LEN_SHIFT			0
58662306a36Sopenharmony_ci
58762306a36Sopenharmony_ci#define ALX_WOL_CTRL6					0x1840
58862306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT7_LEN_MASK			0xFF
58962306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT7_LEN_SHIFT			24
59062306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT6_LEN_MASK			0xFF
59162306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT6_LEN_SHIFT			16
59262306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT5_LEN_MASK			0xFF
59362306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT5_LEN_SHIFT			8
59462306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT4_LEN_MASK			0xFF
59562306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT4_LEN_SHIFT			0
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ci#define ALX_WOL_CTRL7					0x1844
59862306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT11_LEN_MASK			0xFF
59962306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT11_LEN_SHIFT			24
60062306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT10_LEN_MASK			0xFF
60162306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT10_LEN_SHIFT			16
60262306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT9_LEN_MASK			0xFF
60362306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT9_LEN_SHIFT			8
60462306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT8_LEN_MASK			0xFF
60562306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT8_LEN_SHIFT			0
60662306a36Sopenharmony_ci
60762306a36Sopenharmony_ci#define ALX_WOL_CTRL8					0x1848
60862306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT15_LEN_MASK			0xFF
60962306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT15_LEN_SHIFT			24
61062306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT14_LEN_MASK			0xFF
61162306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT14_LEN_SHIFT			16
61262306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT13_LEN_MASK			0xFF
61362306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT13_LEN_SHIFT			8
61462306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT12_LEN_MASK			0xFF
61562306a36Sopenharmony_ci#define ALX_WOL_CTRL5_PT12_LEN_SHIFT			0
61662306a36Sopenharmony_ci
61762306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN0				0x1850
61862306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN0_MASK			0xFFFFFFFF
61962306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN0_SHIFT			0
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN1				0x1854
62262306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN1_MASK			0xFFFF
62362306a36Sopenharmony_ci#define ALX_ACER_FIXED_PTN1_SHIFT			0
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0				0x1858
62662306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0_MASK			0xFFFFFFFF
62762306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM0_SHIFT			0
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1				0x185C
63062306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1_MASK			0xFFFFFFFF
63162306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM1_SHIFT			0
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2				0x1860
63462306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2_MASK			0xFFFFFFFF
63562306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM2_SHIFT			0
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3				0x1864
63862306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3_MASK			0xFFFFFFFF
63962306a36Sopenharmony_ci#define ALX_ACER_RANDOM_NUM3_SHIFT			0
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_ci#define ALX_ACER_MAGIC					0x1868
64262306a36Sopenharmony_ci#define ALX_ACER_MAGIC_EN				BIT(31)
64362306a36Sopenharmony_ci#define ALX_ACER_MAGIC_PME_EN				BIT(30)
64462306a36Sopenharmony_ci#define ALX_ACER_MAGIC_MATCH				BIT(29)
64562306a36Sopenharmony_ci#define ALX_ACER_MAGIC_FF_CHECK				BIT(10)
64662306a36Sopenharmony_ci#define ALX_ACER_MAGIC_RAN_LEN_MASK			0x1F
64762306a36Sopenharmony_ci#define ALX_ACER_MAGIC_RAN_LEN_SHIFT			5
64862306a36Sopenharmony_ci#define ALX_ACER_MAGIC_FIX_LEN_MASK			0x1F
64962306a36Sopenharmony_ci#define ALX_ACER_MAGIC_FIX_LEN_SHIFT			0
65062306a36Sopenharmony_ci
65162306a36Sopenharmony_ci#define ALX_ACER_TIMER					0x186C
65262306a36Sopenharmony_ci#define ALX_ACER_TIMER_EN				BIT(31)
65362306a36Sopenharmony_ci#define ALX_ACER_TIMER_PME_EN				BIT(30)
65462306a36Sopenharmony_ci#define ALX_ACER_TIMER_MATCH				BIT(29)
65562306a36Sopenharmony_ci#define ALX_ACER_TIMER_THRES_MASK			0x1FFFF
65662306a36Sopenharmony_ci#define ALX_ACER_TIMER_THRES_SHIFT			0
65762306a36Sopenharmony_ci#define ALX_ACER_TIMER_THRES_DEF			1
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci/* RSS definitions */
66062306a36Sopenharmony_ci#define ALX_RSS_KEY0					0x14B0
66162306a36Sopenharmony_ci#define ALX_RSS_KEY1					0x14B4
66262306a36Sopenharmony_ci#define ALX_RSS_KEY2					0x14B8
66362306a36Sopenharmony_ci#define ALX_RSS_KEY3					0x14BC
66462306a36Sopenharmony_ci#define ALX_RSS_KEY4					0x14C0
66562306a36Sopenharmony_ci#define ALX_RSS_KEY5					0x14C4
66662306a36Sopenharmony_ci#define ALX_RSS_KEY6					0x14C8
66762306a36Sopenharmony_ci#define ALX_RSS_KEY7					0x14CC
66862306a36Sopenharmony_ci#define ALX_RSS_KEY8					0x14D0
66962306a36Sopenharmony_ci#define ALX_RSS_KEY9					0x14D4
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci#define ALX_RSS_IDT_TBL0				0x1B00
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1				0x15D0
67462306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_TXQ1_SHIFT			20
67562306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_TXQ0_SHIFT			16
67662306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ3_SHIFT			12
67762306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ2_SHIFT			8
67862306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ1_SHIFT			4
67962306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL1_RXQ0_SHIFT			0
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2				0x15D8
68262306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_TXQ3_SHIFT			20
68362306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_TXQ2_SHIFT			16
68462306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ7_SHIFT			12
68562306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ6_SHIFT			8
68662306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ5_SHIFT			4
68762306a36Sopenharmony_ci#define ALX_MSI_MAP_TBL2_RXQ4_SHIFT			0
68862306a36Sopenharmony_ci
68962306a36Sopenharmony_ci#define ALX_MSI_ID_MAP					0x15D4
69062306a36Sopenharmony_ci
69162306a36Sopenharmony_ci#define ALX_MSI_RETRANS_TIMER				0x1920
69262306a36Sopenharmony_ci/* bit16: 1:line,0:standard */
69362306a36Sopenharmony_ci#define ALX_MSI_MASK_SEL_LINE				BIT(16)
69462306a36Sopenharmony_ci#define ALX_MSI_RETRANS_TM_MASK				0xFFFF
69562306a36Sopenharmony_ci#define ALX_MSI_RETRANS_TM_SHIFT			0
69662306a36Sopenharmony_ci
69762306a36Sopenharmony_ci/* CR DMA ctrl */
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci/* TX QoS */
70062306a36Sopenharmony_ci#define ALX_WRR						0x1938
70162306a36Sopenharmony_ci#define ALX_WRR_PRI_MASK				0x3
70262306a36Sopenharmony_ci#define ALX_WRR_PRI_SHIFT				29
70362306a36Sopenharmony_ci#define ALX_WRR_PRI_RESTRICT_NONE			3
70462306a36Sopenharmony_ci#define ALX_WRR_PRI3_MASK				0x1F
70562306a36Sopenharmony_ci#define ALX_WRR_PRI3_SHIFT				24
70662306a36Sopenharmony_ci#define ALX_WRR_PRI2_MASK				0x1F
70762306a36Sopenharmony_ci#define ALX_WRR_PRI2_SHIFT				16
70862306a36Sopenharmony_ci#define ALX_WRR_PRI1_MASK				0x1F
70962306a36Sopenharmony_ci#define ALX_WRR_PRI1_SHIFT				8
71062306a36Sopenharmony_ci#define ALX_WRR_PRI0_MASK				0x1F
71162306a36Sopenharmony_ci#define ALX_WRR_PRI0_SHIFT				0
71262306a36Sopenharmony_ci
71362306a36Sopenharmony_ci#define ALX_HQTPD					0x193C
71462306a36Sopenharmony_ci#define ALX_HQTPD_BURST_EN				BIT(31)
71562306a36Sopenharmony_ci#define ALX_HQTPD_Q3_NUMPREF_MASK			0xF
71662306a36Sopenharmony_ci#define ALX_HQTPD_Q3_NUMPREF_SHIFT			8
71762306a36Sopenharmony_ci#define ALX_HQTPD_Q2_NUMPREF_MASK			0xF
71862306a36Sopenharmony_ci#define ALX_HQTPD_Q2_NUMPREF_SHIFT			4
71962306a36Sopenharmony_ci#define ALX_HQTPD_Q1_NUMPREF_MASK			0xF
72062306a36Sopenharmony_ci#define ALX_HQTPD_Q1_NUMPREF_SHIFT			0
72162306a36Sopenharmony_ci
72262306a36Sopenharmony_ci#define ALX_MISC					0x19C0
72362306a36Sopenharmony_ci#define ALX_MISC_PSW_OCP_MASK				0x7
72462306a36Sopenharmony_ci#define ALX_MISC_PSW_OCP_SHIFT				21
72562306a36Sopenharmony_ci#define ALX_MISC_PSW_OCP_DEF				0x7
72662306a36Sopenharmony_ci#define ALX_MISC_ISO_EN					BIT(12)
72762306a36Sopenharmony_ci#define ALX_MISC_INTNLOSC_OPEN				BIT(3)
72862306a36Sopenharmony_ci
72962306a36Sopenharmony_ci#define ALX_MSIC2					0x19C8
73062306a36Sopenharmony_ci#define ALX_MSIC2_CALB_START				BIT(0)
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci#define ALX_MISC3					0x19CC
73362306a36Sopenharmony_ci/* bit1: 1:Software control 25M */
73462306a36Sopenharmony_ci#define ALX_MISC3_25M_BY_SW				BIT(1)
73562306a36Sopenharmony_ci/* bit0: 25M switch to intnl OSC */
73662306a36Sopenharmony_ci#define ALX_MISC3_25M_NOTO_INTNL			BIT(0)
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci/* MSIX tbl in memory space */
73962306a36Sopenharmony_ci#define ALX_MSIX_ENTRY_BASE				0x2000
74062306a36Sopenharmony_ci
74162306a36Sopenharmony_ci/********************* PHY regs definition ***************************/
74262306a36Sopenharmony_ci
74362306a36Sopenharmony_ci/* PHY Specific Status Register */
74462306a36Sopenharmony_ci#define ALX_MII_GIGA_PSSR				0x11
74562306a36Sopenharmony_ci#define ALX_GIGA_PSSR_SPD_DPLX_RESOLVED			0x0800
74662306a36Sopenharmony_ci#define ALX_GIGA_PSSR_DPLX				0x2000
74762306a36Sopenharmony_ci#define ALX_GIGA_PSSR_SPEED				0xC000
74862306a36Sopenharmony_ci#define ALX_GIGA_PSSR_10MBS				0x0000
74962306a36Sopenharmony_ci#define ALX_GIGA_PSSR_100MBS				0x4000
75062306a36Sopenharmony_ci#define ALX_GIGA_PSSR_1000MBS				0x8000
75162306a36Sopenharmony_ci
75262306a36Sopenharmony_ci/* PHY Interrupt Enable Register */
75362306a36Sopenharmony_ci#define ALX_MII_IER					0x12
75462306a36Sopenharmony_ci#define ALX_IER_LINK_UP					0x0400
75562306a36Sopenharmony_ci#define ALX_IER_LINK_DOWN				0x0800
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci/* PHY Interrupt Status Register */
75862306a36Sopenharmony_ci#define ALX_MII_ISR					0x13
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci#define ALX_MII_DBG_ADDR				0x1D
76162306a36Sopenharmony_ci#define ALX_MII_DBG_DATA				0x1E
76262306a36Sopenharmony_ci
76362306a36Sopenharmony_ci/***************************** debug port *************************************/
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_ci#define ALX_MIIDBG_ANACTRL				0x00
76662306a36Sopenharmony_ci#define ALX_ANACTRL_DEF					0x02EF
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ci#define ALX_MIIDBG_SYSMODCTRL				0x04
76962306a36Sopenharmony_ci/* en half bias */
77062306a36Sopenharmony_ci#define ALX_SYSMODCTRL_IECHOADJ_DEF			0xBB8B
77162306a36Sopenharmony_ci
77262306a36Sopenharmony_ci#define ALX_MIIDBG_SRDSYSMOD				0x05
77362306a36Sopenharmony_ci#define ALX_SRDSYSMOD_DEEMP_EN				0x0040
77462306a36Sopenharmony_ci#define ALX_SRDSYSMOD_DEF				0x2C46
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci#define ALX_MIIDBG_HIBNEG				0x0B
77762306a36Sopenharmony_ci#define ALX_HIBNEG_PSHIB_EN				0x8000
77862306a36Sopenharmony_ci#define ALX_HIBNEG_HIB_PSE				0x1000
77962306a36Sopenharmony_ci#define ALX_HIBNEG_DEF					0xBC40
78062306a36Sopenharmony_ci#define ALX_HIBNEG_NOHIB	(ALX_HIBNEG_DEF & \
78162306a36Sopenharmony_ci				 ~(ALX_HIBNEG_PSHIB_EN | ALX_HIBNEG_HIB_PSE))
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci#define ALX_MIIDBG_TST10BTCFG				0x12
78462306a36Sopenharmony_ci#define ALX_TST10BTCFG_DEF				0x4C04
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci#define ALX_MIIDBG_AZ_ANADECT				0x15
78762306a36Sopenharmony_ci#define ALX_AZ_ANADECT_DEF				0x3220
78862306a36Sopenharmony_ci#define ALX_AZ_ANADECT_LONG				0x3210
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci#define ALX_MIIDBG_MSE16DB				0x18
79162306a36Sopenharmony_ci#define ALX_MSE16DB_UP					0x05EA
79262306a36Sopenharmony_ci#define ALX_MSE16DB_DOWN				0x02EA
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci#define ALX_MIIDBG_MSE20DB				0x1C
79562306a36Sopenharmony_ci#define ALX_MSE20DB_TH_MASK				0x7F
79662306a36Sopenharmony_ci#define ALX_MSE20DB_TH_SHIFT				2
79762306a36Sopenharmony_ci#define ALX_MSE20DB_TH_DEF				0x2E
79862306a36Sopenharmony_ci#define ALX_MSE20DB_TH_HI				0x54
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci#define ALX_MIIDBG_AGC					0x23
80162306a36Sopenharmony_ci#define ALX_AGC_2_VGA_MASK				0x3FU
80262306a36Sopenharmony_ci#define ALX_AGC_2_VGA_SHIFT				8
80362306a36Sopenharmony_ci#define ALX_AGC_LONG1G_LIMT				40
80462306a36Sopenharmony_ci#define ALX_AGC_LONG100M_LIMT				44
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ci#define ALX_MIIDBG_LEGCYPS				0x29
80762306a36Sopenharmony_ci#define ALX_LEGCYPS_EN					0x8000
80862306a36Sopenharmony_ci#define ALX_LEGCYPS_DEF					0x129D
80962306a36Sopenharmony_ci
81062306a36Sopenharmony_ci#define ALX_MIIDBG_TST100BTCFG				0x36
81162306a36Sopenharmony_ci#define ALX_TST100BTCFG_DEF				0xE12C
81262306a36Sopenharmony_ci
81362306a36Sopenharmony_ci#define ALX_MIIDBG_GREENCFG				0x3B
81462306a36Sopenharmony_ci#define ALX_GREENCFG_DEF				0x7078
81562306a36Sopenharmony_ci
81662306a36Sopenharmony_ci#define ALX_MIIDBG_GREENCFG2				0x3D
81762306a36Sopenharmony_ci#define ALX_GREENCFG2_BP_GREEN				0x8000
81862306a36Sopenharmony_ci#define ALX_GREENCFG2_GATE_DFSE_EN			0x0080
81962306a36Sopenharmony_ci
82062306a36Sopenharmony_ci/******* dev 3 *********/
82162306a36Sopenharmony_ci#define ALX_MIIEXT_PCS					3
82262306a36Sopenharmony_ci
82362306a36Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL3				0x8003
82462306a36Sopenharmony_ci#define ALX_CLDCTRL3_BP_CABLE1TH_DET_GT			0x8000
82562306a36Sopenharmony_ci
82662306a36Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL5				0x8005
82762306a36Sopenharmony_ci#define ALX_CLDCTRL5_BP_VD_HLFBIAS			0x4000
82862306a36Sopenharmony_ci
82962306a36Sopenharmony_ci#define ALX_MIIEXT_CLDCTRL6				0x8006
83062306a36Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_MASK			0xFF
83162306a36Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHIFT			0
83262306a36Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHORT1G			116
83362306a36Sopenharmony_ci#define ALX_CLDCTRL6_CAB_LEN_SHORT100M			152
83462306a36Sopenharmony_ci
83562306a36Sopenharmony_ci#define ALX_MIIEXT_VDRVBIAS				0x8062
83662306a36Sopenharmony_ci#define ALX_VDRVBIAS_DEF				0x3
83762306a36Sopenharmony_ci
83862306a36Sopenharmony_ci/********* dev 7 **********/
83962306a36Sopenharmony_ci#define ALX_MIIEXT_ANEG					7
84062306a36Sopenharmony_ci
84162306a36Sopenharmony_ci#define ALX_MIIEXT_LOCAL_EEEADV				0x3C
84262306a36Sopenharmony_ci#define ALX_LOCAL_EEEADV_1000BT				0x0004
84362306a36Sopenharmony_ci#define ALX_LOCAL_EEEADV_100BT				0x0002
84462306a36Sopenharmony_ci
84562306a36Sopenharmony_ci#define ALX_MIIEXT_AFE					0x801A
84662306a36Sopenharmony_ci#define ALX_AFE_10BT_100M_TH				0x0040
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci#define ALX_MIIEXT_S3DIG10				0x8023
84962306a36Sopenharmony_ci/* bit0: 1:bypass 10BT rx fifo, 0:original 10BT rx */
85062306a36Sopenharmony_ci#define ALX_MIIEXT_S3DIG10_SL				0x0001
85162306a36Sopenharmony_ci#define ALX_MIIEXT_S3DIG10_DEF				0
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ci#define ALX_MIIEXT_NLP78				0x8027
85462306a36Sopenharmony_ci#define ALX_MIIEXT_NLP78_120M_DEF			0x8A05
85562306a36Sopenharmony_ci
85662306a36Sopenharmony_ci#endif
857