1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
3 * Copyright(c) 2010-2017 Intel Corporation
10 #include "ngbe_phy_rtl.h"
11 #include "ngbe_phy_mvl.h"
12 #include "ngbe_phy_yt.h"
14 /******************************************************************************
16 ******************************************************************************/
17 #define NGBE_MAX_PHY_ADDR 32
20 #define NGBE_MD_DEV_PMA_PMD 0x1
21 #define NGBE_MD_PHY_ID_HIGH 0x2 /* PHY ID High Reg*/
22 #define NGBE_MD_PHY_ID_LOW 0x3 /* PHY ID Low Reg*/
23 #define NGBE_PHY_REVISION_MASK 0xFFFFFFF0
25 #define NGBE_MII_AUTONEG_REG 0x0
27 /* IEEE 802.3 Clause 22 */
33 typedef struct mdi_reg_22 mdi_reg_22_t;
35 /* IEEE 802.3ae Clause 45 */
40 typedef struct mdi_reg mdi_reg_t;
42 #define NGBE_MD22_PHY_ID_HIGH 0x2 /* PHY ID High Reg*/
43 #define NGBE_MD22_PHY_ID_LOW 0x3 /* PHY ID Low Reg*/
45 #define NGBE_TAF_SYM_PAUSE 0x1
46 #define NGBE_TAF_ASM_PAUSE 0x2
48 s32 ngbe_mdi_map_register(mdi_reg_t *reg, mdi_reg_22_t *reg22);
50 bool ngbe_validate_phy_addr(struct ngbe_hw *hw, u32 phy_addr);
51 enum ngbe_phy_type ngbe_get_phy_type_from_id(struct ngbe_hw *hw);
52 s32 ngbe_get_phy_id(struct ngbe_hw *hw);
53 s32 ngbe_identify_phy(struct ngbe_hw *hw);
54 s32 ngbe_reset_phy(struct ngbe_hw *hw);
55 s32 ngbe_read_phy_reg_mdi(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
57 s32 ngbe_write_phy_reg_mdi(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
59 s32 ngbe_read_phy_reg(struct ngbe_hw *hw, u32 reg_addr,
60 u32 device_type, u16 *phy_data);
61 s32 ngbe_write_phy_reg(struct ngbe_hw *hw, u32 reg_addr,
62 u32 device_type, u16 phy_data);
63 s32 ngbe_check_reset_blocked(struct ngbe_hw *hw);
65 #endif /* _NGBE_PHY_H_ */