net:cpsw: Pass unhandled ioctl's on to generic phy ioctl
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Sun, 16 Feb 2014 13:54:25 +0000 (14:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Feb 2014 05:30:29 +0000 (00:30 -0500)
This patch allows the use of a generic timestamping phy connected
to the cpsw if CPTS support is not enabled. This also adds support
of the SIOCGMIIREG and SIOCSMIIREG, and moves handling of SIOCGMIIPHY
to the generic driver.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 1d860ce914edefabba03f681a1d44a48c5c4911e..39d12535c3c61d196b55c1cd14643961d6bec064 100644 (file)
@@ -1471,7 +1471,6 @@ static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr)
 static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
 {
        struct cpsw_priv *priv = netdev_priv(dev);
-       struct mii_ioctl_data *data = if_mii(req);
        int slave_no = cpsw_slave_index(priv);
 
        if (!netif_running(dev))
@@ -1484,14 +1483,11 @@ static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
        case SIOCGHWTSTAMP:
                return cpsw_hwtstamp_get(dev, req);
 #endif
-       case SIOCGMIIPHY:
-               data->phy_id = priv->slaves[slave_no].phy->addr;
-               break;
-       default:
-               return -ENOTSUPP;
        }
 
-       return 0;
+       if (!priv->slaves[slave_no].phy)
+               return -EOPNOTSUPP;
+       return phy_mii_ioctl(priv->slaves[slave_no].phy, req, cmd);
 }
 
 static void cpsw_ndo_tx_timeout(struct net_device *ndev)