1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
7 #ifndef _NGBE_PHY_YT_H_
8 #define _NGBE_PHY_YT_H_
10 #define NGBE_PHYID_YT 0x00000110U
13 #define YT_SMI_PHY 0xA000
14 #define YT_SMI_PHY_SDS MS16(1, 0x1) /* 0 for UTP */
15 #define YT_CHIP 0xA001
16 #define YT_CHIP_SW_RST MS16(15, 0x1)
17 #define YT_CHIP_SW_LDO_EN MS16(6, 0x1)
18 #define YT_CHIP_MODE_SEL(v) LS16(v, 0, 0x7)
19 #define YT_RGMII_CONF1 0xA003
20 #define YT_RGMII_CONF1_RXDELAY MS16(10, 0xF)
21 #define YT_RGMII_CONF1_TXDELAY_FE MS16(4, 0xF)
22 #define YT_RGMII_CONF1_TXDELAY MS16(0, 0x1)
23 #define YT_MISC 0xA006
24 #define YT_MISC_FIBER_PRIO MS16(8, 0x1) /* 0 for UTP */
26 /* MII common registers in UTP and SDS */
28 #define YT_BCR_RESET MS16(15, 0x1)
29 #define YT_BCR_PWDN MS16(11, 0x1)
32 #define YT_ANA_100BASET_FULL MS16(8, 0x1)
33 #define YT_ANA_10BASET_FULL MS16(6, 0x1)
35 #define YT_FANA_PAUSE_MASK MS16(7, 0x3)
38 #define YT_CLPAR_ASM_PAUSE MS(11, 0x1)
39 #define YT_CLPAR_PAUSE MS(10, 0x1)
40 #define YT_FLPAR_PAUSE_MASK MS(7, 0x3)
42 #define YT_MS_CTRL 0x9
43 #define YT_MS_1000BASET_FULL MS16(9, 0x1)
45 #define YT_SPST_SPEED_MASK MS16(14, 0x3)
46 #define YT_SPST_SPEED_1000M LS16(2, 14, 0x3)
47 #define YT_SPST_SPEED_100M LS16(1, 14, 0x3)
48 #define YT_SPST_SPEED_10M LS16(0, 14, 0x3)
49 #define YT_SPST_LINK MS16(10, 0x1)
53 #define YT_INTR_ENA_MASK MS16(2, 0x3)
54 #define YT_INTR_STATUS 0x13
56 s32 ngbe_read_phy_reg_yt(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
58 s32 ngbe_write_phy_reg_yt(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
60 s32 ngbe_read_phy_reg_ext_yt(struct ngbe_hw *hw,
61 u32 reg_addr, u32 device_type, u16 *phy_data);
62 s32 ngbe_write_phy_reg_ext_yt(struct ngbe_hw *hw,
63 u32 reg_addr, u32 device_type, u16 phy_data);
64 s32 ngbe_read_phy_reg_sds_ext_yt(struct ngbe_hw *hw,
65 u32 reg_addr, u32 device_type, u16 *phy_data);
66 s32 ngbe_write_phy_reg_sds_ext_yt(struct ngbe_hw *hw,
67 u32 reg_addr, u32 device_type, u16 phy_data);
68 s32 ngbe_init_phy_yt(struct ngbe_hw *hw);
70 s32 ngbe_reset_phy_yt(struct ngbe_hw *hw);
72 s32 ngbe_check_phy_link_yt(struct ngbe_hw *hw,
73 u32 *speed, bool *link_up);
74 s32 ngbe_setup_phy_link_yt(struct ngbe_hw *hw,
75 u32 speed, bool autoneg_wait_to_complete);
76 #endif /* _NGBE_PHY_YT_H_ */