There is no reason to handle SIOC[GS]HWTSTAMP and return -EOPNOTSUPP when
CPTS is disabled, so just pass them on to the phy. This will allow PTP
timestamping on a capable phy by disabling CPTS.

Signed-off-by: Stefan Sørensen <stefan.soren...@spectralink.com>
---
 drivers/net/ethernet/ti/cpsw.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index db8a4bcfc6c7..4413a669fd79 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1791,16 +1791,6 @@ static int cpsw_hwtstamp_get(struct net_device *dev, 
struct ifreq *ifr)
 
        return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
 }
-#else
-static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr)
-{
-       return -EOPNOTSUPP;
-}
-
-static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
-{
-       return -EOPNOTSUPP;
-}
 #endif /*CONFIG_TI_CPTS*/
 
 static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
@@ -1813,10 +1803,12 @@ static int cpsw_ndo_ioctl(struct net_device *dev, 
struct ifreq *req, int cmd)
                return -EINVAL;
 
        switch (cmd) {
+#if IS_ENABLED(CONFIG_TI_CPTS)
        case SIOCSHWTSTAMP:
                return cpsw_hwtstamp_set(dev, req);
        case SIOCGHWTSTAMP:
                return cpsw_hwtstamp_get(dev, req);
+#endif
        }
 
        if (!cpsw->slaves[slave_no].phy)
-- 
2.13.5

Reply via email to