Loading drivers/net/sfc/mdio_10g.c +39 −69 Original line number Diff line number Diff line Loading @@ -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) { struct ethtool_cmd prev; u32 required; bool xnp; int reg; efx->phy_op->get_settings(efx, &prev); Loading @@ -265,27 +265,11 @@ int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) return -EINVAL; /* Check that PHY supports these settings */ if (ecmd->autoneg) { required = SUPPORTED_Autoneg; } 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) if (!ecmd->autoneg || (ecmd->advertising | SUPPORTED_Autoneg) & ~prev.supported) return -EINVAL; if (ecmd->autoneg) { bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full || EFX_WORKAROUND_13204(efx)); /* Set up the base page */ Loading Loading @@ -321,20 +305,6 @@ int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) else reg &= ~MDIO_AN_CTRL1_XNP; 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; } Loading Loading
drivers/net/sfc/mdio_10g.c +39 −69 Original line number Diff line number Diff line Loading @@ -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) { struct ethtool_cmd prev; u32 required; bool xnp; int reg; efx->phy_op->get_settings(efx, &prev); Loading @@ -265,27 +265,11 @@ int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) return -EINVAL; /* Check that PHY supports these settings */ if (ecmd->autoneg) { required = SUPPORTED_Autoneg; } 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) if (!ecmd->autoneg || (ecmd->advertising | SUPPORTED_Autoneg) & ~prev.supported) return -EINVAL; if (ecmd->autoneg) { bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full || EFX_WORKAROUND_13204(efx)); /* Set up the base page */ Loading Loading @@ -321,20 +305,6 @@ int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) else reg &= ~MDIO_AN_CTRL1_XNP; 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; } Loading