net/ngbe: support basic statistics
[dpdk.git] / drivers / net / ngbe / base / ngbe_phy_yt.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
3  */
4
5 #include "ngbe_phy.h"
6
7 #ifndef _NGBE_PHY_YT_H_
8 #define _NGBE_PHY_YT_H_
9
10 #define NGBE_PHYID_YT                   0x00000110U
11
12 /* Common EXT */
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 */
25
26 /* MII common registers in UTP and SDS */
27 #define YT_BCR                          0x0
28 #define   YT_BCR_RESET                  MS16(15, 0x1)
29 #define   YT_BCR_PWDN                   MS16(11, 0x1)
30 #define YT_ANA                          0x4
31 /* copper */
32 #define   YT_ANA_100BASET_FULL          MS16(8, 0x1)
33 #define   YT_ANA_10BASET_FULL           MS16(6, 0x1)
34 /* fiber */
35 #define   YT_FANA_PAUSE_MASK            MS16(7, 0x3)
36
37 #define YT_LPAR                         0x5
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)
41
42 #define YT_MS_CTRL                      0x9
43 #define   YT_MS_1000BASET_FULL          MS16(9, 0x1)
44 #define YT_SPST                         0x11
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)
50
51 /* UTP only */
52 #define YT_INTR                         0x12
53 #define   YT_INTR_ENA_MASK              MS16(2, 0x3)
54 #define YT_INTR_STATUS                  0x13
55
56 s32 ngbe_read_phy_reg_yt(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
57                         u16 *phy_data);
58 s32 ngbe_write_phy_reg_yt(struct ngbe_hw *hw, u32 reg_addr, u32 device_type,
59                         u16 phy_data);
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);
69
70 s32 ngbe_reset_phy_yt(struct ngbe_hw *hw);
71
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_ */