Commit 65483559 authored by Kurt Kanzenbach's avatar Kurt Kanzenbach Committed by David S. Miller
Browse files

net: ethernet: ti: cpsw: Enable PHY timestamping



If the used PHYs also support hardware timestamping, all configuration requests
should be forwared to the PHYs instead of being processed by the MAC driver
itself.

This enables PHY timestamping in combination with the cpsw driver.

Tested with an am335x based board with two DP83640 PHYs connected to the cpsw
switch.

Signed-off-by: default avatarKurt Kanzenbach <kurt@linutronix.de>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 738baea4
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -710,20 +710,26 @@ int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
	struct cpsw_priv *priv = netdev_priv(dev);
	struct cpsw_common *cpsw = priv->cpsw;
	int slave_no = cpsw_slave_index(cpsw, priv);
	struct phy_device *phy;

	if (!netif_running(dev))
		return -EINVAL;

	phy = cpsw->slaves[slave_no].phy;

	if (!phy_has_hwtstamp(phy)) {
		switch (cmd) {
		case SIOCSHWTSTAMP:
			return cpsw_hwtstamp_set(dev, req);
		case SIOCGHWTSTAMP:
			return cpsw_hwtstamp_get(dev, req);
		}
	}

	if (phy)
		return phy_mii_ioctl(phy, req, cmd);

	if (!cpsw->slaves[slave_no].phy)
	return -EOPNOTSUPP;
	return phy_mii_ioctl(cpsw->slaves[slave_no].phy, req, cmd);
}

int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)