Changeset View
Changeset View
Standalone View
Standalone View
stable/10/sys/dev/ixgbe/ixgbe_phy.c
Show First 20 Lines • Show All 502 Lines • ▼ Show 20 Lines | enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id) | ||||
enum ixgbe_phy_type phy_type; | enum ixgbe_phy_type phy_type; | ||||
DEBUGFUNC("ixgbe_get_phy_type_from_id"); | DEBUGFUNC("ixgbe_get_phy_type_from_id"); | ||||
switch (phy_id) { | switch (phy_id) { | ||||
case TN1010_PHY_ID: | case TN1010_PHY_ID: | ||||
phy_type = ixgbe_phy_tn; | phy_type = ixgbe_phy_tn; | ||||
break; | break; | ||||
case X550_PHY_ID: | case X550_PHY_ID1: | ||||
case X550_PHY_ID2: | |||||
case X550_PHY_ID3: | |||||
case X540_PHY_ID: | case X540_PHY_ID: | ||||
phy_type = ixgbe_phy_aq; | phy_type = ixgbe_phy_aq; | ||||
break; | break; | ||||
case QT2022_PHY_ID: | case QT2022_PHY_ID: | ||||
phy_type = ixgbe_phy_qt; | phy_type = ixgbe_phy_qt; | ||||
break; | break; | ||||
case ATH_PHY_ID: | case ATH_PHY_ID: | ||||
phy_type = ixgbe_phy_nl; | phy_type = ixgbe_phy_nl; | ||||
▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | if (speed & IXGBE_LINK_SPEED_10GB_FULL) { | ||||
hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, | hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, | ||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | ||||
autoneg_reg); | autoneg_reg); | ||||
} | } | ||||
if (hw->mac.type == ixgbe_mac_X550) { | if (hw->mac.type == ixgbe_mac_X550) { | ||||
if (speed & IXGBE_LINK_SPEED_5GB_FULL) { | if (speed & IXGBE_LINK_SPEED_5GB_FULL) { | ||||
/* Set or unset auto-negotiation 1G advertisement */ | /* Set or unset auto-negotiation 5G advertisement */ | ||||
hw->phy.ops.read_reg(hw, | hw->phy.ops.read_reg(hw, | ||||
IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | ||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | ||||
&autoneg_reg); | &autoneg_reg); | ||||
autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE; | autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE; | ||||
if (hw->phy.autoneg_advertised & | if (hw->phy.autoneg_advertised & | ||||
IXGBE_LINK_SPEED_5GB_FULL) | IXGBE_LINK_SPEED_5GB_FULL) | ||||
autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE; | autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE; | ||||
hw->phy.ops.write_reg(hw, | hw->phy.ops.write_reg(hw, | ||||
IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | ||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | ||||
autoneg_reg); | autoneg_reg); | ||||
} | } | ||||
if (speed & IXGBE_LINK_SPEED_2_5GB_FULL) { | if (speed & IXGBE_LINK_SPEED_2_5GB_FULL) { | ||||
/* Set or unset auto-negotiation 1G advertisement */ | /* Set or unset auto-negotiation 2.5G advertisement */ | ||||
hw->phy.ops.read_reg(hw, | hw->phy.ops.read_reg(hw, | ||||
IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, | ||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | IXGBE_MDIO_AUTO_NEG_DEV_TYPE, | ||||
&autoneg_reg); | &autoneg_reg); | ||||
autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE; | autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE; | ||||
if (hw->phy.autoneg_advertised & | if (hw->phy.autoneg_advertised & | ||||
IXGBE_LINK_SPEED_2_5GB_FULL) | IXGBE_LINK_SPEED_2_5GB_FULL) | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, | ||||
if (speed & IXGBE_LINK_SPEED_1GB_FULL) | if (speed & IXGBE_LINK_SPEED_1GB_FULL) | ||||
hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; | ||||
if (speed & IXGBE_LINK_SPEED_100_FULL) | if (speed & IXGBE_LINK_SPEED_100_FULL) | ||||
hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; | ||||
/* Setup link based on the new speed settings */ | /* Setup link based on the new speed settings */ | ||||
hw->phy.ops.setup_link(hw); | ixgbe_setup_phy_link(hw); | ||||
return IXGBE_SUCCESS; | return IXGBE_SUCCESS; | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_get_copper_link_capabilities_generic - Determines link capabilities | * ixgbe_get_copper_speeds_supported - Get copper link speeds from phy | ||||
* @hw: pointer to hardware structure | * @hw: pointer to hardware structure | ||||
* @speed: pointer to link speed | |||||
* @autoneg: boolean auto-negotiation value | |||||
* | * | ||||
* Determines the supported link capabilities by reading the PHY auto | * Determines the supported link capabilities by reading the PHY auto | ||||
* negotiation register. | * negotiation register. | ||||
**/ | **/ | ||||
s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, | static s32 ixgbe_get_copper_speeds_supported(struct ixgbe_hw *hw) | ||||
ixgbe_link_speed *speed, | |||||
bool *autoneg) | |||||
{ | { | ||||
s32 status; | s32 status; | ||||
u16 speed_ability; | u16 speed_ability; | ||||
DEBUGFUNC("ixgbe_get_copper_link_capabilities_generic"); | |||||
*speed = 0; | |||||
*autoneg = TRUE; | |||||
status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_SPEED_ABILITY, | status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_SPEED_ABILITY, | ||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, | IXGBE_MDIO_PMA_PMD_DEV_TYPE, | ||||
&speed_ability); | &speed_ability); | ||||
if (status) | |||||
return status; | |||||
if (status == IXGBE_SUCCESS) { | |||||
if (speed_ability & IXGBE_MDIO_PHY_SPEED_10G) | if (speed_ability & IXGBE_MDIO_PHY_SPEED_10G) | ||||
*speed |= IXGBE_LINK_SPEED_10GB_FULL; | hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10GB_FULL; | ||||
if (speed_ability & IXGBE_MDIO_PHY_SPEED_1G) | if (speed_ability & IXGBE_MDIO_PHY_SPEED_1G) | ||||
*speed |= IXGBE_LINK_SPEED_1GB_FULL; | hw->phy.speeds_supported |= IXGBE_LINK_SPEED_1GB_FULL; | ||||
if (speed_ability & IXGBE_MDIO_PHY_SPEED_100M) | if (speed_ability & IXGBE_MDIO_PHY_SPEED_100M) | ||||
*speed |= IXGBE_LINK_SPEED_100_FULL; | hw->phy.speeds_supported |= IXGBE_LINK_SPEED_100_FULL; | ||||
switch (hw->mac.type) { | |||||
case ixgbe_mac_X550: | |||||
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL; | |||||
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL; | |||||
break; | |||||
case ixgbe_mac_X550EM_x: | |||||
hw->phy.speeds_supported &= ~IXGBE_LINK_SPEED_100_FULL; | |||||
break; | |||||
default: | |||||
break; | |||||
} | } | ||||
/* Internal PHY does not support 100 Mbps */ | return status; | ||||
if (hw->mac.type == ixgbe_mac_X550EM_x) | |||||
*speed &= ~IXGBE_LINK_SPEED_100_FULL; | |||||
if (hw->mac.type == ixgbe_mac_X550) { | |||||
*speed |= IXGBE_LINK_SPEED_2_5GB_FULL; | |||||
*speed |= IXGBE_LINK_SPEED_5GB_FULL; | |||||
} | } | ||||
/** | |||||
* ixgbe_get_copper_link_capabilities_generic - Determines link capabilities | |||||
* @hw: pointer to hardware structure | |||||
* @speed: pointer to link speed | |||||
* @autoneg: boolean auto-negotiation value | |||||
**/ | |||||
s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, | |||||
ixgbe_link_speed *speed, | |||||
bool *autoneg) | |||||
{ | |||||
s32 status = IXGBE_SUCCESS; | |||||
DEBUGFUNC("ixgbe_get_copper_link_capabilities_generic"); | |||||
*autoneg = TRUE; | |||||
if (!hw->phy.speeds_supported) | |||||
status = ixgbe_get_copper_speeds_supported(hw); | |||||
*speed = hw->phy.speeds_supported; | |||||
return status; | return status; | ||||
} | } | ||||
/** | /** | ||||
* ixgbe_check_phy_link_tnx - Determine link and speed status | * ixgbe_check_phy_link_tnx - Determine link and speed status | ||||
* @hw: pointer to hardware structure | * @hw: pointer to hardware structure | ||||
* | * | ||||
* Reads the VS1 register to determine if link is up and the current speed for | * Reads the VS1 register to determine if link is up and the current speed for | ||||
▲ Show 20 Lines • Show All 1,729 Lines • Show Last 20 Lines |