Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / drivers / net / ethernet / intel / ixgbe / ixgbe_x550.c
index 4716ca4..e092a89 100644 (file)
@@ -295,6 +295,12 @@ static s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
        case IXGBE_DEV_ID_X550EM_A_KR_L:
                hw->phy.type = ixgbe_phy_x550em_kr;
                break;
+       case IXGBE_DEV_ID_X550EM_A_10G_T:
+               if (hw->bus.lan_id)
+                       hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM;
+               else
+                       hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM;
+               /* Fallthrough */
        case IXGBE_DEV_ID_X550EM_X_1G_T:
        case IXGBE_DEV_ID_X550EM_X_10G_T:
                return ixgbe_identify_phy_generic(hw);
@@ -2114,6 +2120,50 @@ static s32 ixgbe_reset_phy_t_X550em(struct ixgbe_hw *hw)
        return ixgbe_enable_lasi_ext_t_x550em(hw);
 }
 
+/**
+ *  ixgbe_led_on_t_x550em - Turns on the software controllable LEDs.
+ *  @hw: pointer to hardware structure
+ *  @led_idx: led number to turn on
+ **/
+s32 ixgbe_led_on_t_x550em(struct ixgbe_hw *hw, u32 led_idx)
+{
+       u16 phy_data;
+
+       if (led_idx >= IXGBE_X557_MAX_LED_INDEX)
+               return IXGBE_ERR_PARAM;
+
+       /* To turn on the LED, set mode to ON. */
+       hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx,
+                            IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, &phy_data);
+       phy_data |= IXGBE_X557_LED_MANUAL_SET_MASK;
+       hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx,
+                             IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, phy_data);
+
+       return 0;
+}
+
+/**
+ *  ixgbe_led_off_t_x550em - Turns off the software controllable LEDs.
+ *  @hw: pointer to hardware structure
+ *  @led_idx: led number to turn off
+ **/
+s32 ixgbe_led_off_t_x550em(struct ixgbe_hw *hw, u32 led_idx)
+{
+       u16 phy_data;
+
+       if (led_idx >= IXGBE_X557_MAX_LED_INDEX)
+               return IXGBE_ERR_PARAM;
+
+       /* To turn on the LED, set mode to ON. */
+       hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx,
+                            IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, &phy_data);
+       phy_data &= ~IXGBE_X557_LED_MANUAL_SET_MASK;
+       hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx,
+                             IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, phy_data);
+
+       return 0;
+}
+
 /** ixgbe_get_lcd_x550em - Determine lowest common denominator
  *  @hw: pointer to hardware structure
  *  @lcd_speed: pointer to lowest common link speed
@@ -2344,18 +2394,12 @@ static void ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw)
        /* If X552 (X550EM_a) and MDIO is connected to external PHY, then set
         * PHY address. This register field was has only been used for X552.
         */
-       if (!hw->phy.nw_mng_if_sel) {
-               if (hw->mac.type == ixgbe_mac_x550em_a) {
-                       struct ixgbe_adapter *adapter = hw->back;
-
-                       e_warn(drv, "nw_mng_if_sel not set\n");
-               }
-               return;
+       if (hw->mac.type == ixgbe_mac_x550em_a &&
+           hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_MDIO_ACT) {
+               hw->phy.mdio.prtad = (hw->phy.nw_mng_if_sel &
+                                     IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
+                                    IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
        }
-
-       hw->phy.mdio.prtad = (hw->phy.nw_mng_if_sel &
-                             IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
-                            IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
 }
 
 /** ixgbe_init_phy_ops_X550em - PHY/SFP specific init
@@ -2456,6 +2500,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw)
                break;
        case IXGBE_DEV_ID_X550EM_X_1G_T:
        case IXGBE_DEV_ID_X550EM_X_10G_T:
+       case IXGBE_DEV_ID_X550EM_A_10G_T:
                media_type = ixgbe_media_type_copper;
                break;
        default:
@@ -2514,6 +2559,9 @@ static void ixgbe_set_mdio_speed(struct ixgbe_hw *hw)
 
        switch (hw->device_id) {
        case IXGBE_DEV_ID_X550EM_X_10G_T:
+       case IXGBE_DEV_ID_X550EM_A_SGMII:
+       case IXGBE_DEV_ID_X550EM_A_SGMII_L:
+       case IXGBE_DEV_ID_X550EM_A_10G_T:
        case IXGBE_DEV_ID_X550EM_A_SFP:
                /* Config MDIO clock speed before the first MDIO PHY access */
                hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
@@ -2853,8 +2901,6 @@ static s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
        .write_analog_reg8              = NULL, \
        .set_rxpba                      = &ixgbe_set_rxpba_generic, \
        .check_link                     = &ixgbe_check_mac_link_generic, \
-       .led_on                         = &ixgbe_led_on_generic, \
-       .led_off                        = &ixgbe_led_off_generic, \
        .blink_led_start                = &ixgbe_blink_led_start_X540, \
        .blink_led_stop                 = &ixgbe_blink_led_stop_X540, \
        .set_rar                        = &ixgbe_set_rar_generic, \
@@ -2886,6 +2932,8 @@ static s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 
 static const struct ixgbe_mac_operations mac_ops_X550 = {
        X550_COMMON_MAC
+       .led_on                 = ixgbe_led_on_generic,
+       .led_off                = ixgbe_led_off_generic,
        .reset_hw               = &ixgbe_reset_hw_X540,
        .get_media_type         = &ixgbe_get_media_type_X540,
        .get_san_mac_addr       = &ixgbe_get_san_mac_addr_generic,
@@ -2904,6 +2952,8 @@ static const struct ixgbe_mac_operations mac_ops_X550 = {
 
 static const struct ixgbe_mac_operations mac_ops_X550EM_x = {
        X550_COMMON_MAC
+       .led_on                 = ixgbe_led_on_t_x550em,
+       .led_off                = ixgbe_led_off_t_x550em,
        .reset_hw               = &ixgbe_reset_hw_X550em,
        .get_media_type         = &ixgbe_get_media_type_X550em,
        .get_san_mac_addr       = NULL,
@@ -2922,6 +2972,8 @@ static const struct ixgbe_mac_operations mac_ops_X550EM_x = {
 
 static struct ixgbe_mac_operations mac_ops_x550em_a = {
        X550_COMMON_MAC
+       .led_on                 = ixgbe_led_on_t_x550em,
+       .led_off                = ixgbe_led_off_t_x550em,
        .reset_hw               = ixgbe_reset_hw_X550em,
        .get_media_type         = ixgbe_get_media_type_X550em,
        .get_san_mac_addr       = NULL,