sfc: Remove unused code for non-autoneg speed/duplex switching

The only multi-speed PHY driver using this is 10Xpress, and it does
not support non-autoneg operation.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ben Hutchings
2009-10-23 08:33:27 +00:00
committed by David S. Miller
parent 18ea024fd6
commit fc2b5e673f

View File

@@ -248,7 +248,7 @@ void efx_mdio_set_mmds_lpower(struct efx_nic *efx,
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
{ {
struct ethtool_cmd prev; struct ethtool_cmd prev;
u32 required; bool xnp;
int reg; int reg;
efx->phy_op->get_settings(efx, &prev); efx->phy_op->get_settings(efx, &prev);
@@ -265,76 +265,46 @@ int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
return -EINVAL; return -EINVAL;
/* Check that PHY supports these settings */ /* Check that PHY supports these settings */
if (ecmd->autoneg) { if (!ecmd->autoneg ||
required = SUPPORTED_Autoneg; (ecmd->advertising | SUPPORTED_Autoneg) & ~prev.supported)
} else if (ecmd->duplex) {
switch (ecmd->speed) {
case SPEED_10: required = SUPPORTED_10baseT_Full; break;
case SPEED_100: required = SUPPORTED_100baseT_Full; break;
default: return -EINVAL;
}
} else {
switch (ecmd->speed) {
case SPEED_10: required = SUPPORTED_10baseT_Half; break;
case SPEED_100: required = SUPPORTED_100baseT_Half; break;
default: return -EINVAL;
}
}
required |= ecmd->advertising;
if (required & ~prev.supported)
return -EINVAL; return -EINVAL;
if (ecmd->autoneg) { xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full
bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full || EFX_WORKAROUND_13204(efx));
|| EFX_WORKAROUND_13204(efx));
/* Set up the base page */ /* Set up the base page */
reg = ADVERTISE_CSMA; reg = ADVERTISE_CSMA;
if (ecmd->advertising & ADVERTISED_10baseT_Half) if (ecmd->advertising & ADVERTISED_10baseT_Half)
reg |= ADVERTISE_10HALF; reg |= ADVERTISE_10HALF;
if (ecmd->advertising & ADVERTISED_10baseT_Full) if (ecmd->advertising & ADVERTISED_10baseT_Full)
reg |= ADVERTISE_10FULL; reg |= ADVERTISE_10FULL;
if (ecmd->advertising & ADVERTISED_100baseT_Half) if (ecmd->advertising & ADVERTISED_100baseT_Half)
reg |= ADVERTISE_100HALF; reg |= ADVERTISE_100HALF;
if (ecmd->advertising & ADVERTISED_100baseT_Full) if (ecmd->advertising & ADVERTISED_100baseT_Full)
reg |= ADVERTISE_100FULL; reg |= ADVERTISE_100FULL;
if (xnp) if (xnp)
reg |= ADVERTISE_RESV; reg |= ADVERTISE_RESV;
else if (ecmd->advertising & (ADVERTISED_1000baseT_Half | else if (ecmd->advertising & (ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full)) ADVERTISED_1000baseT_Full))
reg |= ADVERTISE_NPAGE; reg |= ADVERTISE_NPAGE;
reg |= mii_advertise_flowctrl(efx->wanted_fc); reg |= mii_advertise_flowctrl(efx->wanted_fc);
efx_mdio_write(efx, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg); efx_mdio_write(efx, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
/* Set up the (extended) next page if necessary */ /* Set up the (extended) next page if necessary */
if (efx->phy_op->set_npage_adv) if (efx->phy_op->set_npage_adv)
efx->phy_op->set_npage_adv(efx, ecmd->advertising); efx->phy_op->set_npage_adv(efx, ecmd->advertising);
/* Enable and restart AN */ /* Enable and restart AN */
reg = efx_mdio_read(efx, MDIO_MMD_AN, MDIO_CTRL1); reg = efx_mdio_read(efx, MDIO_MMD_AN, MDIO_CTRL1);
reg |= MDIO_AN_CTRL1_ENABLE; reg |= MDIO_AN_CTRL1_ENABLE;
if (!(EFX_WORKAROUND_15195(efx) && if (!(EFX_WORKAROUND_15195(efx) &&
LOOPBACK_MASK(efx) & efx->phy_op->loopbacks)) LOOPBACK_MASK(efx) & efx->phy_op->loopbacks))
reg |= MDIO_AN_CTRL1_RESTART; reg |= MDIO_AN_CTRL1_RESTART;
if (xnp) if (xnp)
reg |= MDIO_AN_CTRL1_XNP; reg |= MDIO_AN_CTRL1_XNP;
else else
reg &= ~MDIO_AN_CTRL1_XNP; reg &= ~MDIO_AN_CTRL1_XNP;
efx_mdio_write(efx, MDIO_MMD_AN, MDIO_CTRL1, reg); efx_mdio_write(efx, MDIO_MMD_AN, MDIO_CTRL1, reg);
} else {
/* Disable AN */
efx_mdio_set_flag(efx, MDIO_MMD_AN, MDIO_CTRL1,
MDIO_AN_CTRL1_ENABLE, false);
/* Set the basic control bits */
reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1);
reg &= ~(MDIO_CTRL1_SPEEDSEL | MDIO_CTRL1_FULLDPLX);
if (ecmd->speed == SPEED_100)
reg |= MDIO_PMA_CTRL1_SPEED100;
if (ecmd->duplex)
reg |= MDIO_CTRL1_FULLDPLX;
efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, reg);
}
return 0; return 0;
} }