Skip to content

Commit 6548355

Browse files
shifty91davem330
authored andcommitted
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: Kurt Kanzenbach <kurt@linutronix.de> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 738baea commit 6548355

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/net/ethernet/ti/cpsw_priv.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -710,20 +710,26 @@ int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
710710
struct cpsw_priv *priv = netdev_priv(dev);
711711
struct cpsw_common *cpsw = priv->cpsw;
712712
int slave_no = cpsw_slave_index(cpsw, priv);
713+
struct phy_device *phy;
713714

714715
if (!netif_running(dev))
715716
return -EINVAL;
716717

717-
switch (cmd) {
718-
case SIOCSHWTSTAMP:
719-
return cpsw_hwtstamp_set(dev, req);
720-
case SIOCGHWTSTAMP:
721-
return cpsw_hwtstamp_get(dev, req);
718+
phy = cpsw->slaves[slave_no].phy;
719+
720+
if (!phy_has_hwtstamp(phy)) {
721+
switch (cmd) {
722+
case SIOCSHWTSTAMP:
723+
return cpsw_hwtstamp_set(dev, req);
724+
case SIOCGHWTSTAMP:
725+
return cpsw_hwtstamp_get(dev, req);
726+
}
722727
}
723728

724-
if (!cpsw->slaves[slave_no].phy)
725-
return -EOPNOTSUPP;
726-
return phy_mii_ioctl(cpsw->slaves[slave_no].phy, req, cmd);
729+
if (phy)
730+
return phy_mii_ioctl(phy, req, cmd);
731+
732+
return -EOPNOTSUPP;
727733
}
728734

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

0 commit comments

Comments
 (0)