diff options
Diffstat (limited to 'target/linux/ipq40xx/files-5.4')
-rw-r--r-- | target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c index 8f6e3833b6..1270e20a90 100644 --- a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c +++ b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c @@ -180,9 +180,8 @@ static uint32_t edma_get_msglevel(struct net_device *netdev) /* edma_get_settings() * Get edma settings */ -#if 0 static int edma_get_settings(struct net_device *netdev, - struct ethtool_cmd *ecmd) + struct ethtool_link_ksettings *cmd) { struct edma_adapter *adapter = netdev_priv(netdev); @@ -196,38 +195,46 @@ static int edma_get_settings(struct net_device *netdev, phydev = adapter->phydev; - ecmd->advertising = phydev->advertising; - ecmd->autoneg = phydev->autoneg; + linkmode_copy(cmd->link_modes.advertising, phydev->advertising); + linkmode_copy(cmd->link_modes.supported, phydev->supported); + + cmd->base.autoneg = phydev->autoneg; if (adapter->link_state == __EDMA_LINKDOWN) { - ecmd->speed = SPEED_UNKNOWN; - ecmd->duplex = DUPLEX_UNKNOWN; + cmd->base.speed = SPEED_UNKNOWN; + cmd->base.duplex = DUPLEX_UNKNOWN; } else { - ecmd->speed = phydev->speed; - ecmd->duplex = phydev->duplex; + cmd->base.speed = phydev->speed; + cmd->base.duplex = phydev->duplex; } - ecmd->phy_address = adapter->phy_mdio_addr; + cmd->base.phy_address = adapter->phy_mdio_addr; phyreg = (uint16_t)phy_read(adapter->phydev, MII_LPA); if (phyreg & LPA_10HALF) - ecmd->lp_advertising |= ADVERTISED_10baseT_Half; + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, + cmd->link_modes.lp_advertising); if (phyreg & LPA_10FULL) - ecmd->lp_advertising |= ADVERTISED_10baseT_Full; + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, + cmd->link_modes.lp_advertising); if (phyreg & LPA_100HALF) - ecmd->lp_advertising |= ADVERTISED_100baseT_Half; + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, + cmd->link_modes.lp_advertising); if (phyreg & LPA_100FULL) - ecmd->lp_advertising |= ADVERTISED_100baseT_Full; + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + cmd->link_modes.lp_advertising); phyreg = (uint16_t)phy_read(adapter->phydev, MII_STAT1000); if (phyreg & LPA_1000HALF) - ecmd->lp_advertising |= ADVERTISED_1000baseT_Half; + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, + cmd->link_modes.lp_advertising); if (phyreg & LPA_1000FULL) - ecmd->lp_advertising |= ADVERTISED_1000baseT_Full; + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + cmd->link_modes.lp_advertising); } else { /* If the speed/duplex for this GMAC is forced and we * are not polling for link state changes, return the @@ -238,14 +245,14 @@ static int edma_get_settings(struct net_device *netdev, if (!(adapter->poll_required)) { if (adapter->forced_speed != SPEED_UNKNOWN) { /* set speed and duplex */ - ethtool_cmd_speed_set(ecmd, SPEED_1000); - ecmd->duplex = DUPLEX_FULL; + cmd->base.speed = SPEED_1000; + cmd->base.duplex = DUPLEX_FULL; /* Populate capabilities advertised by self */ - ecmd->advertising = 0; - ecmd->autoneg = 0; - ecmd->port = PORT_TP; - ecmd->transceiver = XCVR_EXTERNAL; + linkmode_zero(cmd->link_modes.advertising); + cmd->base.autoneg = 0; + cmd->base.port = PORT_TP; + cmd->base.transceiver = XCVR_EXTERNAL; } else { /* non link polled and non * forced speed/duplex interface @@ -262,7 +269,7 @@ static int edma_get_settings(struct net_device *netdev, * Set EDMA settings */ static int edma_set_settings(struct net_device *netdev, - struct ethtool_cmd *ecmd) + const struct ethtool_link_ksettings *cmd) { struct edma_adapter *adapter = netdev_priv(netdev); struct phy_device *phydev = NULL; @@ -272,16 +279,16 @@ static int edma_set_settings(struct net_device *netdev, return -EPERM; phydev = adapter->phydev; - phydev->advertising = ecmd->advertising; - phydev->autoneg = ecmd->autoneg; - phydev->speed = ethtool_cmd_speed(ecmd); - phydev->duplex = ecmd->duplex; + linkmode_copy(phydev->advertising, cmd->link_modes.advertising); + linkmode_copy(phydev->supported, cmd->link_modes.supported); + phydev->autoneg = cmd->base.autoneg; + phydev->speed = cmd->base.speed; + phydev->duplex = cmd->base.duplex; genphy_config_aneg(phydev); return 0; } -#endif /* edma_get_coalesce * get interrupt mitigation @@ -356,8 +363,8 @@ static const struct ethtool_ops edma_ethtool_ops = { .get_msglevel = &edma_get_msglevel, .nway_reset = &edma_nway_reset, .get_wol = &edma_get_wol, -// .get_settings = &edma_get_settings, -// .set_settings = &edma_set_settings, + .get_link_ksettings = &edma_get_settings, + .set_link_ksettings = &edma_set_settings, .get_strings = &edma_get_strings, .get_sset_count = &edma_get_strset_count, .get_ethtool_stats = &edma_get_ethtool_stats, |