diff options
author | Mugunthan V N <mugunthanvnm@ti.com> | 2013-03-11 19:16:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-13 04:38:20 -0400 |
commit | 11f2c988382b880e602a005c26436043c5d2c274 (patch) | |
tree | 2c18692aae9f239b5748e5e973d0d71815e5286b | |
parent | ff5b8ef2ef3af0fd7e1cf6c8c1ed9ec5afbda422 (diff) |
drivers: net: ethernet: cpsw: implement get phy_id via ioctl
Implement get phy_id via ioctl SIOCGMIIPHY. In switch mode active phy_id
is returned and in dual EMAC mode slave's specific phy_id is returned.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index d6cf6982904e..8ff1d3dde778 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1157,14 +1157,26 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1157 | 1157 | ||
1158 | static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | 1158 | static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd) |
1159 | { | 1159 | { |
1160 | struct cpsw_priv *priv = netdev_priv(dev); | ||
1161 | struct mii_ioctl_data *data = if_mii(req); | ||
1162 | int slave_no = cpsw_slave_index(priv); | ||
1163 | |||
1160 | if (!netif_running(dev)) | 1164 | if (!netif_running(dev)) |
1161 | return -EINVAL; | 1165 | return -EINVAL; |
1162 | 1166 | ||
1167 | switch (cmd) { | ||
1163 | #ifdef CONFIG_TI_CPTS | 1168 | #ifdef CONFIG_TI_CPTS |
1164 | if (cmd == SIOCSHWTSTAMP) | 1169 | case SIOCSHWTSTAMP: |
1165 | return cpsw_hwtstamp_ioctl(dev, req); | 1170 | return cpsw_hwtstamp_ioctl(dev, req); |
1166 | #endif | 1171 | #endif |
1167 | return -ENOTSUPP; | 1172 | case SIOCGMIIPHY: |
1173 | data->phy_id = priv->slaves[slave_no].phy->addr; | ||
1174 | break; | ||
1175 | default: | ||
1176 | return -ENOTSUPP; | ||
1177 | } | ||
1178 | |||
1179 | return 0; | ||
1168 | } | 1180 | } |
1169 | 1181 | ||
1170 | static void cpsw_ndo_tx_timeout(struct net_device *ndev) | 1182 | static void cpsw_ndo_tx_timeout(struct net_device *ndev) |