net/ixgbe/base: support FW commands to control some PHYs
[dpdk.git] / drivers / net / ixgbe / base / ixgbe_type.h
index f1e4274..c7100b0 100644 (file)
@@ -3037,6 +3037,7 @@ enum ixgbe_fdir_pballoc_type {
 #define FW_CEM_UNUSED_VER              0x0
 #define FW_CEM_MAX_RETRIES             3
 #define FW_CEM_RESP_STATUS_SUCCESS     0x1
+#define FW_CEM_DRIVER_VERSION_SIZE     39 /* +9 would send 48 bytes to fw */
 #define FW_READ_SHADOW_RAM_CMD         0x31
 #define FW_READ_SHADOW_RAM_LEN         0x6
 #define FW_WRITE_SHADOW_RAM_CMD                0x33
@@ -3062,6 +3063,59 @@ enum ixgbe_fdir_pballoc_type {
 #define FW_INT_PHY_REQ_LEN             10
 #define FW_INT_PHY_REQ_READ            0
 #define FW_INT_PHY_REQ_WRITE           1
+#define FW_PHY_ACT_REQ_CMD             5
+#define FW_PHY_ACT_DATA_COUNT          4
+#define FW_PHY_ACT_REQ_LEN             (4 + 4 * FW_PHY_ACT_DATA_COUNT)
+#define FW_PHY_ACT_INIT_PHY            1
+#define FW_PHY_ACT_SETUP_LINK          2
+#define FW_PHY_ACT_LINK_SPEED_10       (1u << 0)
+#define FW_PHY_ACT_LINK_SPEED_100      (1u << 1)
+#define FW_PHY_ACT_LINK_SPEED_1G       (1u << 2)
+#define FW_PHY_ACT_LINK_SPEED_2_5G     (1u << 3)
+#define FW_PHY_ACT_LINK_SPEED_5G       (1u << 4)
+#define FW_PHY_ACT_LINK_SPEED_10G      (1u << 5)
+#define FW_PHY_ACT_LINK_SPEED_20G      (1u << 6)
+#define FW_PHY_ACT_LINK_SPEED_25G      (1u << 7)
+#define FW_PHY_ACT_LINK_SPEED_40G      (1u << 8)
+#define FW_PHY_ACT_LINK_SPEED_50G      (1u << 9)
+#define FW_PHY_ACT_LINK_SPEED_100G     (1u << 10)
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_SHIFT 16
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_MASK (3u << \
+                                         FW_PHY_ACT_SETUP_LINK_PAUSE_SHIFT)
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_NONE 0u
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_TX 1u
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_RX 2u
+#define FW_PHY_ACT_SETUP_LINK_PAUSE_RXTX 3u
+#define FW_PHY_ACT_SETUP_LINK_LP       (1u << 18)
+#define FW_PHY_ACT_SETUP_LINK_HP       (1u << 19)
+#define FW_PHY_ACT_SETUP_LINK_EEE      (1u << 20)
+#define FW_PHY_ACT_SETUP_LINK_AN       (1u << 22)
+#define FW_PHY_ACT_SETUP_LINK_RSP_DOWN (1u << 0)
+#define FW_PHY_ACT_GET_LINK_INFO       3
+#define FW_PHY_ACT_GET_LINK_INFO_EEE   (1u << 19)
+#define FW_PHY_ACT_GET_LINK_INFO_FC_TX (1u << 20)
+#define FW_PHY_ACT_GET_LINK_INFO_FC_RX (1u << 21)
+#define FW_PHY_ACT_GET_LINK_INFO_POWER (1u << 22)
+#define FW_PHY_ACT_GET_LINK_INFO_AN_COMPLETE   (1u << 24)
+#define FW_PHY_ACT_GET_LINK_INFO_TEMP  (1u << 25)
+#define FW_PHY_ACT_GET_LINK_INFO_LP_FC_TX      (1u << 28)
+#define FW_PHY_ACT_GET_LINK_INFO_LP_FC_RX      (1u << 29)
+#define FW_PHY_ACT_FORCE_LINK_DOWN     4
+#define FW_PHY_ACT_FORCE_LINK_DOWN_OFF (1u << 0)
+#define FW_PHY_ACT_PHY_SW_RESET                5
+#define FW_PHY_ACT_PHY_HW_RESET                6
+#define FW_PHY_ACT_GET_PHY_INFO                7
+#define FW_PHY_ACT_UD_2                        0x1002
+#define FW_PHY_ACT_UD_2_10G_KR_EEE     (1u << 6)
+#define FW_PHY_ACT_UD_2_10G_KX4_EEE    (1u << 5)
+#define FW_PHY_ACT_UD_2_1G_KX_EEE      (1u << 4)
+#define FW_PHY_ACT_UD_2_10G_T_EEE      (1u << 3)
+#define FW_PHY_ACT_UD_2_1G_T_EEE       (1u << 2)
+#define FW_PHY_ACT_UD_2_100M_TX_EEE    (1u << 1)
+#define FW_PHY_ACT_RETRIES             50
+#define FW_PHY_INFO_SPEED_MASK         0xFFFu
+#define FW_PHY_INFO_ID_HI_MASK         0xFFFF0000u
+#define FW_PHY_INFO_ID_LO_MASK         0x0000FFFFu
 
 /* Host Interface Command Structures */
 
@@ -3111,6 +3165,16 @@ struct ixgbe_hic_drv_info {
        u16 pad2; /* end spacing to ensure length is mult. of dword2 */
 };
 
+struct ixgbe_hic_drv_info2 {
+       struct ixgbe_hic_hdr hdr;
+       u8 port_num;
+       u8 ver_sub;
+       u8 ver_build;
+       u8 ver_min;
+       u8 ver_maj;
+       char driver_string[FW_CEM_DRIVER_VERSION_SIZE];
+};
+
 /* These need to be dword aligned */
 struct ixgbe_hic_read_shadow_ram {
        union ixgbe_hic_hdr2 hdr;
@@ -3159,6 +3223,19 @@ struct ixgbe_hic_internal_phy_resp {
        __be32 read_data;
 };
 
+struct ixgbe_hic_phy_activity_req {
+       struct ixgbe_hic_hdr hdr;
+       u8 port_number;
+       u8 pad;
+       __le16 activity_id;
+       __be32 data[FW_PHY_ACT_DATA_COUNT];
+};
+
+struct ixgbe_hic_phy_activity_resp {
+       struct ixgbe_hic_hdr hdr;
+       __be32 data[FW_PHY_ACT_DATA_COUNT];
+};
+
 #ifdef C99
 #pragma pack(pop)
 #else
@@ -3319,7 +3396,7 @@ typedef u32 ixgbe_autoneg_advertised;
 /* Link speed */
 typedef u32 ixgbe_link_speed;
 #define IXGBE_LINK_SPEED_UNKNOWN       0
-#define IXGBE_LINK_SPEED_10_FULL       0x0004
+#define IXGBE_LINK_SPEED_10_FULL       0x0002
 #define IXGBE_LINK_SPEED_100_FULL      0x0008
 #define IXGBE_LINK_SPEED_1GB_FULL      0x0020
 #define IXGBE_LINK_SPEED_2_5GB_FULL    0x0400
@@ -3854,6 +3931,7 @@ struct ixgbe_mac_operations {
        void (*init_swfw_sync)(struct ixgbe_hw *);
        s32 (*prot_autoc_read)(struct ixgbe_hw *, bool *, u32 *);
        s32 (*prot_autoc_write)(struct ixgbe_hw *, u32, bool);
+       s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api);
 
        /* Link */
        void (*disable_tx_laser)(struct ixgbe_hw *);
@@ -3874,6 +3952,7 @@ struct ixgbe_mac_operations {
        s32 (*led_off)(struct ixgbe_hw *, u32);
        s32 (*blink_led_start)(struct ixgbe_hw *, u32);
        s32 (*blink_led_stop)(struct ixgbe_hw *, u32);
+       s32 (*init_led_link_act)(struct ixgbe_hw *);
 
        /* RAR, Multicast, VLAN */
        s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32);
@@ -3898,6 +3977,7 @@ struct ixgbe_mac_operations {
        void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
        void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
        s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
+       s32 (*set_rlpml)(struct ixgbe_hw *, u16);
 
        /* Flow Control */
        s32 (*fc_enable)(struct ixgbe_hw *);
@@ -3905,7 +3985,8 @@ struct ixgbe_mac_operations {
        void (*fc_autoneg)(struct ixgbe_hw *);
 
        /* Manageability interface */
-       s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
+       s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8, u16,
+                             const char *);
        s32 (*get_thermal_sensor_data)(struct ixgbe_hw *);
        s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw);
        void (*get_rtrup2tc)(struct ixgbe_hw *hw, u8 *map);
@@ -4015,6 +4096,7 @@ struct ixgbe_mac_info {
        struct ixgbe_dmac_config dmac_config;
        bool set_lben;
        u32  max_link_up_time;
+       u8   led_link_act;
 };
 
 struct ixgbe_phy_info {
@@ -4030,8 +4112,8 @@ struct ixgbe_phy_info {
        bool reset_disable;
        ixgbe_autoneg_advertised autoneg_advertised;
        ixgbe_link_speed speeds_supported;
-       enum ixgbe_ms_type ms_type;
-       enum ixgbe_ms_type original_ms_type;
+       ixgbe_link_speed eee_speeds_supported;
+       ixgbe_link_speed eee_speeds_advertised;
        enum ixgbe_smart_speed smart_speed;
        bool smart_speed_active;
        bool multispeed_fiber;
@@ -4162,9 +4244,25 @@ struct ixgbe_hw {
 #define IXGBE_KRM_DSP_TXFFE_STATE_5(P) ((P) ? 0x8638 : 0x4638)
 #define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)        ((P) ? 0x8B00 : 0x4B00)
 #define IXGBE_KRM_PMD_DFX_BURNIN(P)    ((P) ? 0x8E00 : 0x4E00)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20(P) ((P) ? 0x9054 : 0x5054)
 #define IXGBE_KRM_TX_COEFF_CTRL_1(P)   ((P) ? 0x9520 : 0x5520)
 #define IXGBE_KRM_RX_ANA_CTL(P)                ((P) ? 0x9A00 : 0x5A00)
 
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA         ~(0x3 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR         (1u << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_LR         (0x2 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN           (1u << 25)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN            (1u << 26)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN              (1u << 27)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10M          ~(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_100M         (1u << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G           (0x2 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10G          (0x3 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN           (0x4 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_2_5G         (0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK         (0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_FW_AN_RESTART      (1u << 31)
+
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B           (1 << 9)
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS         (1 << 11)
 
@@ -4234,8 +4332,13 @@ struct ixgbe_hw {
 #define IXGBE_NW_MNG_IF_SEL_MDIO_ACT   (1u << 1)
 #define IXGBE_NW_MNG_IF_SEL_MDIO_IF_MODE       (1u << 2)
 #define IXGBE_NW_MNG_IF_SEL_EN_SHARED_MDIO     (1u << 13)
-#define IXGBE_NW_MNG_IF_SEL_ENABLE_10_100M (1 << 23)
-#define IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE (1 << 24)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_10M      (1u << 17)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_100M     (1u << 18)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_1G       (1u << 19)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G     (1u << 20)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_10G      (1u << 21)
+#define IXGBE_NW_MNG_IF_SEL_SGMII_ENABLE       (1u << 25)
+#define IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE (1 << 24) /* X552 reg field only */
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT 3
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD       \
                                (0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)