Commit ddb2d2a8 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-eee-network-driver-cleanups'

Russell King says:

====================
net: eee network driver cleanups

Since commit d1420bb9 ("net: phy: improve generic EEE ethtool
functions") changed phylib to set eee->eee_active and eee->eee_enabled,
overriding anything that drivers have set these to prior to calling
phy_ethtool_get_eee().

Therefore, drivers setting these members becomes redundant, since
phylib overwrites the values they set. This series finishes off
Heiner's work in the referenced commit by removing these redundant
writes in various drivers and any associated code or structure members
that become unnecessary.
====================

Link: https://lore.kernel.org/r/Zb9/O81fVAZw4ANr@shell.armlinux.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 1e8f1477 3465df55
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -2227,16 +2227,10 @@ EXPORT_SYMBOL(b53_eee_init);
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
{
	struct b53_device *dev = ds->priv;
	struct ethtool_keee *p = &dev->ports[port].eee;
	u16 reg;

	if (is5325(dev) || is5365(dev))
		return -EOPNOTSUPP;

	b53_read16(dev, B53_EEE_PAGE, B53_EEE_LPI_INDICATE, &reg);
	e->eee_enabled = p->eee_enabled;
	e->eee_active = !!(reg & BIT(port));

	return 0;
}
EXPORT_SYMBOL(b53_get_mac_eee);
+0 −4
Original line number Diff line number Diff line
@@ -360,7 +360,6 @@ void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
	umac_wl(intf, reg, UMC_EEE_CTRL);

	intf->eee.eee_enabled = enable;
	intf->eee.eee_active = enable;
}

static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
@@ -371,8 +370,6 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
	if (!dev->phydev)
		return -ENODEV;

	e->eee_enabled = p->eee_enabled;
	e->eee_active = p->eee_active;
	e->tx_lpi_enabled = p->tx_lpi_enabled;
	e->tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);

@@ -399,7 +396,6 @@ static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
		}

		umac_wl(intf, e->tx_lpi_timer, UMC_EEE_LPI_TIMER);
		intf->eee.eee_active = ret >= 0;
		intf->eee.tx_lpi_enabled = e->tx_lpi_enabled;
		bcmasp_eee_enable_set(intf, true);
	}
+3 −2
Original line number Diff line number Diff line
@@ -607,6 +607,7 @@ static void bcmasp_adj_link(struct net_device *dev)
	struct phy_device *phydev = dev->phydev;
	u32 cmd_bits = 0, reg;
	int changed = 0;
	bool active;

	if (intf->old_link != phydev->link) {
		changed = 1;
@@ -658,8 +659,8 @@ static void bcmasp_adj_link(struct net_device *dev)
		reg |= cmd_bits;
		umac_wl(intf, reg, UMC_CMD);

		intf->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
		bcmasp_eee_enable_set(intf, intf->eee.eee_active);
		active = phy_init_eee(phydev, 0) >= 0;
		bcmasp_eee_enable_set(intf, active);
	}

	reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
+3 −5
Original line number Diff line number Diff line
@@ -1313,7 +1313,6 @@ void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
	}

	priv->eee.eee_enabled = enable;
	priv->eee.eee_active = enable;
	priv->eee.tx_lpi_enabled = tx_lpi_enabled;
}

@@ -1328,8 +1327,6 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_keee *e)
	if (!dev->phydev)
		return -ENODEV;

	e->eee_enabled = p->eee_enabled;
	e->eee_active = p->eee_active;
	e->tx_lpi_enabled = p->tx_lpi_enabled;
	e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);

@@ -1340,6 +1337,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
{
	struct bcmgenet_priv *priv = netdev_priv(dev);
	struct ethtool_keee *p = &priv->eee;
	bool active;

	if (GENET_IS_V1(priv))
		return -EOPNOTSUPP;
@@ -1352,9 +1350,9 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
	if (!p->eee_enabled) {
		bcmgenet_eee_enable_set(dev, false, false);
	} else {
		p->eee_active = phy_init_eee(dev->phydev, false) >= 0;
		active = phy_init_eee(dev->phydev, false) >= 0;
		bcmgenet_umac_writel(priv, e->tx_lpi_timer, UMAC_EEE_LPI_TIMER);
		bcmgenet_eee_enable_set(dev, p->eee_active, e->tx_lpi_enabled);
		bcmgenet_eee_enable_set(dev, active, e->tx_lpi_enabled);
	}

	return phy_ethtool_set_eee(dev->phydev, e);
+3 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ static void bcmgenet_mac_config(struct net_device *dev)
	struct bcmgenet_priv *priv = netdev_priv(dev);
	struct phy_device *phydev = dev->phydev;
	u32 reg, cmd_bits = 0;
	bool active;

	/* speed */
	if (phydev->speed == SPEED_1000)
@@ -88,9 +89,9 @@ static void bcmgenet_mac_config(struct net_device *dev)
	}
	bcmgenet_umac_writel(priv, reg, UMAC_CMD);

	priv->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
	active = phy_init_eee(phydev, 0) >= 0;
	bcmgenet_eee_enable_set(dev,
				priv->eee.eee_enabled && priv->eee.eee_active,
				priv->eee.eee_enabled && active,
				priv->eee.tx_lpi_enabled);
}

Loading