1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
7 #ifndef _NGBE_PHY_MVL_H_
8 #define _NGBE_PHY_MVL_H_
10 #define NGBE_PHYID_MVL 0x01410DD0U
12 /* Page 0 for Copper, Page 1 for Fiber */
14 #define MVL_CTRL_RESET MS16(15, 0x1)
15 #define MVL_CTRL_SPEED_SELECT0 MS16(13, 0x1)
16 #define MVL_CTRL_ANE MS16(12, 0x1)
17 #define MVL_CTRL_PWDN MS16(11, 0x1)
18 #define MVL_CTRL_RESTART_AN MS16(9, 0x1)
19 #define MVL_CTRL_DUPLEX MS16(8, 0x1)
20 #define MVL_CTRL_SPEED_SELECT1 MS16(6, 0x1)
23 #define MVL_CANA_ASM_PAUSE MS16(11, 0x1)
24 #define MVL_CANA_PAUSE MS16(10, 0x1)
25 #define MVL_PHY_100BASET_FULL MS16(8, 0x1)
26 #define MVL_PHY_100BASET_HALF MS16(7, 0x1)
27 #define MVL_PHY_10BASET_FULL MS16(6, 0x1)
28 #define MVL_PHY_10BASET_HALF MS16(5, 0x1)
30 #define MVL_FANA_PAUSE_MASK MS16(7, 0x3)
31 #define MVL_FANA_SYM_PAUSE LS16(1, 7, 0x3)
32 #define MVL_FANA_ASM_PAUSE LS16(2, 7, 0x3)
33 #define MVL_PHY_1000BASEX_HALF MS16(6, 0x1)
34 #define MVL_PHY_1000BASEX_FULL MS16(5, 0x1)
36 #define MVL_CLPAR_ASM_PAUSE MS(11, 0x1)
37 #define MVL_CLPAR_PAUSE MS(10, 0x1)
38 #define MVL_FLPAR_PAUSE_MASK MS(7, 0x3)
39 #define MVL_PHY_1000BASET 0x9
40 #define MVL_PHY_1000BASET_FULL MS16(9, 0x1)
41 #define MVL_PHY_1000BASET_HALF MS16(8, 0x1)
42 #define MVL_CTRL1 0x10
43 #define MVL_CTRL1_INTR_POL MS16(2, 0x1)
44 #define MVL_PHYSR 0x11
45 #define MVL_PHYSR_SPEED_MASK MS16(14, 0x3)
46 #define MVL_PHYSR_SPEED_1000M LS16(2, 14, 0x3)
47 #define MVL_PHYSR_SPEED_100M LS16(1, 14, 0x3)
48 #define MVL_PHYSR_SPEED_10M LS16(0, 14, 0x3)
49 #define MVL_PHYSR_LINK MS16(10, 0x1)
50 #define MVL_INTR_EN 0x12
51 #define MVL_INTR_EN_ANC MS16(11, 0x1)
52 #define MVL_INTR_EN_LSC MS16(10, 0x1)
54 #define MVL_INTR_ANC MS16(11, 0x1)
55 #define MVL_INTR_LSC MS16(10, 0x1)
58 #define MVL_RGM_CTL2 0x15
59 #define MVL_RGM_CTL2_TTC MS16(4, 0x1)
60 #define MVL_RGM_CTL2_RTC MS16(5, 0x1)
62 #define MVL_LEDFCR 0x10
63 #define MVL_LEDFCR_CTL1 MS16(4, 0xF)
64 #define MVL_LEDFCR_CTL1_CONF LS16(6, 4, 0xF)
65 #define MVL_LEDFCR_CTL0 MS16(0, 0xF)
66 #define MVL_LEDFCR_CTL0_CONF LS16(1, 0, 0xF)
67 #define MVL_LEDPCR 0x11
68 #define MVL_LEDPCR_CTL1 MS16(2, 0x3)
69 #define MVL_LEDPCR_CTL1_CONF LS16(1, 2, 0x3)
70 #define MVL_LEDPCR_CTL0 MS16(0, 0x3)
71 #define MVL_LEDPCR_CTL0_CONF LS16(1, 0, 0x3)
72 #define MVL_LEDTCR 0x12
73 #define MVL_LEDTCR_INTR_POL MS16(11, 0x1)
74 #define MVL_LEDTCR_INTR_EN MS16(7, 0x1)
76 #define MVL_GEN_CTL 0x14
77 #define MVL_GEN_CTL_RESET MS16(15, 0x1)
78 #define MVL_GEN_CTL_MODE(v) LS16(v, 0, 0x7)
79 #define MVL_GEN_CTL_MODE_COPPER LS16(0, 0, 0x7)
80 #define MVL_GEN_CTL_MODE_FIBER LS16(2, 0, 0x7)
83 #define MVL_PAGE_SEL 22
85 /* reg 19_0 INT status*/
86 #define MVL_PHY_ANC 0x0800
87 #define MVL_PHY_LSC 0x0400
89 s32 ngbe_read_phy_reg_mvl(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
91 s32 ngbe_write_phy_reg_mvl(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
93 s32 ngbe_check_phy_mode_mvl(struct ngbe_hw *hw);
94 s32 ngbe_init_phy_mvl(struct ngbe_hw *hw);
96 s32 ngbe_reset_phy_mvl(struct ngbe_hw *hw);
98 s32 ngbe_check_phy_link_mvl(struct ngbe_hw *hw,
99 u32 *speed, bool *link_up);
100 s32 ngbe_setup_phy_link_mvl(struct ngbe_hw *hw,
101 u32 speed, bool autoneg_wait_to_complete);
102 s32 ngbe_get_phy_advertised_pause_mvl(struct ngbe_hw *hw, u8 *pause_bit);
103 s32 ngbe_get_phy_lp_advertised_pause_mvl(struct ngbe_hw *hw, u8 *pause_bit);
104 s32 ngbe_set_phy_pause_adv_mvl(struct ngbe_hw *hw, u16 pause_bit);
106 #endif /* _NGBE_PHY_MVL_H_ */