aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ethernet/sfc/ef100_nic.c
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2020-07-27 13:05:08 +0100
committerDavid S. Miller <davem@davemloft.net>2020-07-27 12:26:56 -0700
commit99a23c1168b7a6b8d1d1b228788b32749b06cbfe (patch)
tree589e15937696ad866a966b7c6a1509ca7416ce8f /drivers/net/ethernet/sfc/ef100_nic.c
parentsfc_ef100: actually perform resets (diff)
downloadwireguard-linux-99a23c1168b7a6b8d1d1b228788b32749b06cbfe.tar.xz
wireguard-linux-99a23c1168b7a6b8d1d1b228788b32749b06cbfe.zip
sfc_ef100: probe the PHY and configure the MAC
Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/sfc/ef100_nic.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 5e6a8337a336..dc7d4aaa2b04 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -288,16 +288,54 @@ static irqreturn_t ef100_msi_interrupt(int irq, void *dev_id)
static int ef100_phy_probe(struct efx_nic *efx)
{
- /* stub: allocate the phy_data */
+ struct efx_mcdi_phy_data *phy_data;
+ int rc;
+
+ /* Probe for the PHY */
efx->phy_data = kzalloc(sizeof(struct efx_mcdi_phy_data), GFP_KERNEL);
if (!efx->phy_data)
return -ENOMEM;
+ rc = efx_mcdi_get_phy_cfg(efx, efx->phy_data);
+ if (rc)
+ return rc;
+
+ /* Populate driver and ethtool settings */
+ phy_data = efx->phy_data;
+ mcdi_to_ethtool_linkset(phy_data->media, phy_data->supported_cap,
+ efx->link_advertising);
+ efx->fec_config = mcdi_fec_caps_to_ethtool(phy_data->supported_cap,
+ false);
+
+ /* Default to Autonegotiated flow control if the PHY supports it */
+ efx->wanted_fc = EFX_FC_RX | EFX_FC_TX;
+ if (phy_data->supported_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
+ efx->wanted_fc |= EFX_FC_AUTO;
+ efx_link_set_wanted_fc(efx, efx->wanted_fc);
+
+ /* Push settings to the PHY. Failure is not fatal, the user can try to
+ * fix it using ethtool.
+ */
+ rc = efx_mcdi_port_reconfigure(efx);
+ if (rc && rc != -EPERM)
+ netif_warn(efx, drv, efx->net_dev,
+ "could not initialise PHY settings\n");
+
return 0;
}
/* Other
*/
+static int ef100_reconfigure_mac(struct efx_nic *efx, bool mtu_only)
+{
+ WARN_ON(!mutex_is_locked(&efx->mac_lock));
+
+ efx_mcdi_filter_sync_rx_mode(efx);
+
+ if (mtu_only && efx_has_cap(efx, SET_MAC_ENHANCED))
+ return efx_mcdi_set_mtu(efx);
+ return efx_mcdi_set_mac(efx);
+}
static enum reset_type ef100_map_reset_reason(enum reset_type reason)
{
@@ -401,6 +439,8 @@ const struct efx_nic_type ef100_pf_nic_type = {
.rx_write = ef100_rx_write,
.rx_packet = __ef100_rx_packet,
+ .reconfigure_mac = ef100_reconfigure_mac,
+
/* Per-type bar/size configuration not used on ef100. Location of
* registers is defined by extended capabilities.
*/