s32 ngbe_init_phy_yt(struct ngbe_hw *hw)
{
- u16 value = 0;
-
- DEBUGFUNC("ngbe_init_phy_yt");
-
/* close sds area register */
ngbe_write_phy_reg_ext_yt(hw, YT_SMI_PHY, 0, 0);
/* enable interrupts */
ngbe_write_phy_reg_mdi(hw, YT_INTR, 0,
YT_INTR_ENA_MASK | YT_SDS_INTR_ENA_MASK);
- /* power down in fiber mode */
- hw->phy.read_reg(hw, YT_BCR, 0, &value);
- value |= YT_BCR_PWDN;
- hw->phy.write_reg(hw, YT_BCR, 0, value);
-
- /* power down in UTP mode */
- ngbe_read_phy_reg_mdi(hw, YT_BCR, 0, &value);
- value |= YT_BCR_PWDN;
- ngbe_write_phy_reg_mdi(hw, YT_BCR, 0, value);
+ hw->phy.set_phy_power(hw, false);
return 0;
}
u16 value_r9 = 0;
u16 value;
- DEBUGFUNC("ngbe_setup_phy_link_yt");
UNREFERENCED_PARAMETER(autoneg_wait_to_complete);
hw->phy.autoneg_advertised = 0;
default:
value = YT_BCR_SPEED_SELECT0 |
YT_BCR_SPEED_SELECT1;
- DEBUGOUT("unknown speed = 0x%x.\n",
+ DEBUGOUT("unknown speed = 0x%x.",
speed);
break;
}
value |= YT_BCR_RESET | YT_BCR_ANE | YT_BCR_RESTART_AN;
hw->phy.write_reg(hw, YT_BCR, 0, value);
skip_an:
- /* power on in UTP mode */
- ngbe_read_phy_reg_mdi(hw, YT_BCR, 0, &value);
- value &= ~YT_BCR_PWDN;
- ngbe_write_phy_reg_mdi(hw, YT_BCR, 0, value);
+ hw->phy.set_phy_power(hw, true);
} else if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(1)) {
/* fiber to rgmii */
hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_1GB_FULL;
/* software reset */
ngbe_write_phy_reg_sds_ext_yt(hw, 0x0, 0, 0x9140);
- /* power on phy */
- hw->phy.read_reg(hw, YT_BCR, 0, &value);
- value &= ~YT_BCR_PWDN;
- hw->phy.write_reg(hw, YT_BCR, 0, value);
+ hw->phy.set_phy_power(hw, true);
} else if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(2)) {
- /* power on in UTP mode */
- ngbe_read_phy_reg_mdi(hw, YT_BCR, 0, &value);
- value &= ~YT_BCR_PWDN;
- ngbe_write_phy_reg_mdi(hw, YT_BCR, 0, value);
- /* power down in fiber mode */
- hw->phy.read_reg(hw, YT_BCR, 0, &value);
- value &= ~YT_BCR_PWDN;
- hw->phy.write_reg(hw, YT_BCR, 0, value);
+ hw->phy.set_phy_power(hw, true);
hw->phy.read_reg(hw, YT_SPST, 0, &value);
if (value & YT_SPST_LINK) {
value &= ~YT_SMI_PHY_SW_RST;
ngbe_write_phy_reg_ext_yt(hw, YT_CHIP, 0, value);
- /* power on phy */
- hw->phy.read_reg(hw, YT_BCR, 0, &value);
- value &= ~YT_BCR_PWDN;
- hw->phy.write_reg(hw, YT_BCR, 0, value);
+ hw->phy.set_phy_power(hw, true);
}
ngbe_write_phy_reg_ext_yt(hw, YT_SMI_PHY, 0, 0);
u16 ctrl = 0;
s32 status = 0;
- DEBUGFUNC("ngbe_reset_phy_yt");
-
if (hw->phy.type != ngbe_phy_yt8521s &&
hw->phy.type != ngbe_phy_yt8521s_sfi)
return NGBE_ERR_PHY_TYPE;
}
if (i == YT_PHY_RST_WAIT_PERIOD) {
- DEBUGOUT("PHY reset polling failed to complete.\n");
+ DEBUGOUT("PHY reset polling failed to complete.");
return NGBE_ERR_RESET_FAILED;
}
u16 value;
s32 status = 0;
- DEBUGFUNC("ngbe_get_phy_advertised_pause_yt");
-
status = hw->phy.read_reg(hw, YT_ANA, 0, &value);
value &= YT_FANA_PAUSE_MASK;
*pause_bit = (u8)(value >> 7);
u16 value;
s32 status = 0;
- DEBUGFUNC("ngbe_get_phy_lp_advertised_pause_yt");
-
status = hw->phy.read_reg(hw, YT_LPAR, 0, &value);
value &= YT_FLPAR_PAUSE_MASK;
*pause_bit = (u8)(value >> 7);
u16 value;
s32 status = 0;
- DEBUGFUNC("ngbe_set_phy_pause_adv_yt");
-
-
status = hw->phy.read_reg(hw, YT_ANA, 0, &value);
value &= ~YT_FANA_PAUSE_MASK;
value |= pause_bit;
u16 phy_data = 0;
u16 insr = 0;
- DEBUGFUNC("ngbe_check_phy_link_yt");
-
/* Initialize speed and link to default case */
*link_up = false;
*speed = NGBE_LINK_SPEED_UNKNOWN;
return status;
}
+s32 ngbe_set_phy_power_yt(struct ngbe_hw *hw, bool on)
+{
+ u16 value = 0;
+
+ /* power down/up in fiber mode */
+ hw->phy.read_reg(hw, YT_BCR, 0, &value);
+ if (on)
+ value &= ~YT_BCR_PWDN;
+ else
+ value |= YT_BCR_PWDN;
+ hw->phy.write_reg(hw, YT_BCR, 0, value);
+
+ value = 0;
+ /* power down/up in UTP mode */
+ ngbe_read_phy_reg_mdi(hw, YT_BCR, 0, &value);
+ if (on)
+ value &= ~YT_BCR_PWDN;
+ else
+ value |= YT_BCR_PWDN;
+ ngbe_write_phy_reg_mdi(hw, YT_BCR, 0, value);
+
+ return 0;
+}