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_ANE MS16(12, 0x1)
16 #define MVL_CTRL_RESTART_AN MS16(9, 0x1)
19 #define MVL_CANA_ASM_PAUSE MS16(11, 0x1)
20 #define MVL_CANA_PAUSE MS16(10, 0x1)
21 #define MVL_PHY_100BASET_FULL MS16(8, 0x1)
22 #define MVL_PHY_100BASET_HALF MS16(7, 0x1)
23 #define MVL_PHY_10BASET_FULL MS16(6, 0x1)
24 #define MVL_PHY_10BASET_HALF MS16(5, 0x1)
26 #define MVL_FANA_PAUSE_MASK MS16(7, 0x3)
27 #define MVL_FANA_SYM_PAUSE LS16(1, 7, 0x3)
28 #define MVL_FANA_ASM_PAUSE LS16(2, 7, 0x3)
29 #define MVL_PHY_1000BASEX_HALF MS16(6, 0x1)
30 #define MVL_PHY_1000BASEX_FULL MS16(5, 0x1)
32 #define MVL_CLPAR_ASM_PAUSE MS(11, 0x1)
33 #define MVL_CLPAR_PAUSE MS(10, 0x1)
34 #define MVL_FLPAR_PAUSE_MASK MS(7, 0x3)
35 #define MVL_PHY_1000BASET 0x9
36 #define MVL_PHY_1000BASET_FULL MS16(9, 0x1)
37 #define MVL_PHY_1000BASET_HALF MS16(8, 0x1)
38 #define MVL_CTRL1 0x10
39 #define MVL_CTRL1_INTR_POL MS16(2, 0x1)
40 #define MVL_PHYSR 0x11
41 #define MVL_PHYSR_SPEED_MASK MS16(14, 0x3)
42 #define MVL_PHYSR_SPEED_1000M LS16(2, 14, 0x3)
43 #define MVL_PHYSR_SPEED_100M LS16(1, 14, 0x3)
44 #define MVL_PHYSR_SPEED_10M LS16(0, 14, 0x3)
45 #define MVL_PHYSR_LINK MS16(10, 0x1)
46 #define MVL_INTR_EN 0x12
47 #define MVL_INTR_EN_ANC MS16(11, 0x1)
48 #define MVL_INTR_EN_LSC MS16(10, 0x1)
50 #define MVL_INTR_ANC MS16(11, 0x1)
51 #define MVL_INTR_LSC MS16(10, 0x1)
54 #define MVL_RGM_CTL2 0x15
55 #define MVL_RGM_CTL2_TTC MS16(4, 0x1)
56 #define MVL_RGM_CTL2_RTC MS16(5, 0x1)
58 #define MVL_LEDFCR 0x10
59 #define MVL_LEDFCR_CTL1 MS16(4, 0xF)
60 #define MVL_LEDFCR_CTL1_CONF LS16(6, 4, 0xF)
61 #define MVL_LEDFCR_CTL0 MS16(0, 0xF)
62 #define MVL_LEDFCR_CTL0_CONF LS16(1, 0, 0xF)
63 #define MVL_LEDPCR 0x11
64 #define MVL_LEDPCR_CTL1 MS16(2, 0x3)
65 #define MVL_LEDPCR_CTL1_CONF LS16(1, 2, 0x3)
66 #define MVL_LEDPCR_CTL0 MS16(0, 0x3)
67 #define MVL_LEDPCR_CTL0_CONF LS16(1, 0, 0x3)
68 #define MVL_LEDTCR 0x12
69 #define MVL_LEDTCR_INTR_POL MS16(11, 0x1)
70 #define MVL_LEDTCR_INTR_EN MS16(7, 0x1)
72 #define MVL_GEN_CTL 0x14
73 #define MVL_GEN_CTL_RESET MS16(15, 0x1)
74 #define MVL_GEN_CTL_MODE(v) LS16(v, 0, 0x7)
75 #define MVL_GEN_CTL_MODE_COPPER LS16(0, 0, 0x7)
76 #define MVL_GEN_CTL_MODE_FIBER LS16(2, 0, 0x7)
79 #define MVL_PAGE_SEL 22
81 /* reg 19_0 INT status*/
82 #define MVL_PHY_ANC 0x0800
83 #define MVL_PHY_LSC 0x0400
85 s32 ngbe_read_phy_reg_mvl(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
87 s32 ngbe_write_phy_reg_mvl(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
89 s32 ngbe_init_phy_mvl(struct ngbe_hw *hw);
91 s32 ngbe_reset_phy_mvl(struct ngbe_hw *hw);
93 s32 ngbe_check_phy_link_mvl(struct ngbe_hw *hw,
94 u32 *speed, bool *link_up);
95 s32 ngbe_setup_phy_link_mvl(struct ngbe_hw *hw,
96 u32 speed, bool autoneg_wait_to_complete);
97 s32 ngbe_get_phy_advertised_pause_mvl(struct ngbe_hw *hw, u8 *pause_bit);
98 s32 ngbe_get_phy_lp_advertised_pause_mvl(struct ngbe_hw *hw, u8 *pause_bit);
99 s32 ngbe_set_phy_pause_adv_mvl(struct ngbe_hw *hw, u16 pause_bit);
101 #endif /* _NGBE_PHY_MVL_H_ */