aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-23 04:32:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-24 07:27:18 -0400
commit96c45726c7dd5ee11b8773810208c41e40a93ffd (patch)
tree7b777559f18ce6b934fb8b9ee8b435be77edd605 /drivers/net/sfc/falcon.c
parentdc803df8dd68a045bea4753f5300eeecb961ca2d (diff)
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>
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r--drivers/net/sfc/falcon.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index ade27920a96c..d9ce21edfa6a 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2173,37 +2173,6 @@ static int falcon_mdio_read(struct net_device *net_dev,
2173 return rc; 2173 return rc;
2174} 2174}
2175 2175
2176static int falcon_probe_phy(struct efx_nic *efx)
2177{
2178 switch (efx->phy_type) {
2179 case PHY_TYPE_SFX7101:
2180 efx->phy_op = &falcon_sfx7101_phy_ops;
2181 break;
2182 case PHY_TYPE_SFT9001A:
2183 case PHY_TYPE_SFT9001B:
2184 efx->phy_op = &falcon_sft9001_phy_ops;
2185 break;
2186 case PHY_TYPE_QT2022C2:
2187 case PHY_TYPE_QT2025C:
2188 efx->phy_op = &falcon_xfp_phy_ops;
2189 break;
2190 default:
2191 EFX_ERR(efx, "Unknown PHY type %d\n",
2192 efx->phy_type);
2193 return -1;
2194 }
2195
2196 if (efx->phy_op->macs & EFX_XMAC)
2197 efx->loopback_modes |= ((1 << LOOPBACK_XGMII) |
2198 (1 << LOOPBACK_XGXS) |
2199 (1 << LOOPBACK_XAUI));
2200 if (efx->phy_op->macs & EFX_GMAC)
2201 efx->loopback_modes |= (1 << LOOPBACK_GMAC);
2202 efx->loopback_modes |= efx->phy_op->loopbacks;
2203
2204 return 0;
2205}
2206
2207int falcon_switch_mac(struct efx_nic *efx) 2176int falcon_switch_mac(struct efx_nic *efx)
2208{ 2177{
2209 struct efx_mac_operations *old_mac_op = efx->mac_op; 2178 struct efx_mac_operations *old_mac_op = efx->mac_op;
@@ -2260,10 +2229,31 @@ int falcon_probe_port(struct efx_nic *efx)
2260{ 2229{
2261 int rc; 2230 int rc;
2262 2231
2263 /* Hook in PHY operations table */ 2232 switch (efx->phy_type) {
2264 rc = falcon_probe_phy(efx); 2233 case PHY_TYPE_SFX7101:
2265 if (rc) 2234 efx->phy_op = &falcon_sfx7101_phy_ops;
2266 return rc; 2235 break;
2236 case PHY_TYPE_SFT9001A:
2237 case PHY_TYPE_SFT9001B:
2238 efx->phy_op = &falcon_sft9001_phy_ops;
2239 break;
2240 case PHY_TYPE_QT2022C2:
2241 case PHY_TYPE_QT2025C:
2242 efx->phy_op = &falcon_xfp_phy_ops;
2243 break;
2244 default:
2245 EFX_ERR(efx, "Unknown PHY type %d\n",
2246 efx->phy_type);
2247 return -ENODEV;
2248 }
2249
2250 if (efx->phy_op->macs & EFX_XMAC)
2251 efx->loopback_modes |= ((1 << LOOPBACK_XGMII) |
2252 (1 << LOOPBACK_XGXS) |
2253 (1 << LOOPBACK_XAUI));
2254 if (efx->phy_op->macs & EFX_GMAC)
2255 efx->loopback_modes |= (1 << LOOPBACK_GMAC);
2256 efx->loopback_modes |= efx->phy_op->loopbacks;
2267 2257
2268 /* Set up MDIO structure for PHY */ 2258 /* Set up MDIO structure for PHY */
2269 efx->mdio.mmds = efx->phy_op->mmds; 2259 efx->mdio.mmds = efx->phy_op->mmds;