mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 02:04:19 +08:00
sfc: Merge falcon_probe_phy() into falcon_probe_port()
MAC and PHY probing are bound up together, as evidenced by the initialisation of efx_nic::loopback_modes. Remove the current arbitrary separation. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
dc803df8dd
commit
96c45726c7
@ -2173,37 +2173,6 @@ static int falcon_mdio_read(struct net_device *net_dev,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int falcon_probe_phy(struct efx_nic *efx)
|
||||
{
|
||||
switch (efx->phy_type) {
|
||||
case PHY_TYPE_SFX7101:
|
||||
efx->phy_op = &falcon_sfx7101_phy_ops;
|
||||
break;
|
||||
case PHY_TYPE_SFT9001A:
|
||||
case PHY_TYPE_SFT9001B:
|
||||
efx->phy_op = &falcon_sft9001_phy_ops;
|
||||
break;
|
||||
case PHY_TYPE_QT2022C2:
|
||||
case PHY_TYPE_QT2025C:
|
||||
efx->phy_op = &falcon_xfp_phy_ops;
|
||||
break;
|
||||
default:
|
||||
EFX_ERR(efx, "Unknown PHY type %d\n",
|
||||
efx->phy_type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (efx->phy_op->macs & EFX_XMAC)
|
||||
efx->loopback_modes |= ((1 << LOOPBACK_XGMII) |
|
||||
(1 << LOOPBACK_XGXS) |
|
||||
(1 << LOOPBACK_XAUI));
|
||||
if (efx->phy_op->macs & EFX_GMAC)
|
||||
efx->loopback_modes |= (1 << LOOPBACK_GMAC);
|
||||
efx->loopback_modes |= efx->phy_op->loopbacks;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int falcon_switch_mac(struct efx_nic *efx)
|
||||
{
|
||||
struct efx_mac_operations *old_mac_op = efx->mac_op;
|
||||
@ -2260,10 +2229,31 @@ int falcon_probe_port(struct efx_nic *efx)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* Hook in PHY operations table */
|
||||
rc = falcon_probe_phy(efx);
|
||||
if (rc)
|
||||
return rc;
|
||||
switch (efx->phy_type) {
|
||||
case PHY_TYPE_SFX7101:
|
||||
efx->phy_op = &falcon_sfx7101_phy_ops;
|
||||
break;
|
||||
case PHY_TYPE_SFT9001A:
|
||||
case PHY_TYPE_SFT9001B:
|
||||
efx->phy_op = &falcon_sft9001_phy_ops;
|
||||
break;
|
||||
case PHY_TYPE_QT2022C2:
|
||||
case PHY_TYPE_QT2025C:
|
||||
efx->phy_op = &falcon_xfp_phy_ops;
|
||||
break;
|
||||
default:
|
||||
EFX_ERR(efx, "Unknown PHY type %d\n",
|
||||
efx->phy_type);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (efx->phy_op->macs & EFX_XMAC)
|
||||
efx->loopback_modes |= ((1 << LOOPBACK_XGMII) |
|
||||
(1 << LOOPBACK_XGXS) |
|
||||
(1 << LOOPBACK_XAUI));
|
||||
if (efx->phy_op->macs & EFX_GMAC)
|
||||
efx->loopback_modes |= (1 << LOOPBACK_GMAC);
|
||||
efx->loopback_modes |= efx->phy_op->loopbacks;
|
||||
|
||||
/* Set up MDIO structure for PHY */
|
||||
efx->mdio.mmds = efx->phy_op->mmds;
|
||||
|
Loading…
Reference in New Issue
Block a user