Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11f2c988 authored by Mugunthan V N's avatar Mugunthan V N Committed by David S. Miller
Browse files

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: default avatarMugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff5b8ef2
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1157,16 +1157,28 @@ static int cpsw_hwtstamp_ioctl(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))
		return -EINVAL;

	switch (cmd) {
#ifdef CONFIG_TI_CPTS
	if (cmd == SIOCSHWTSTAMP)
	case SIOCSHWTSTAMP:
		return cpsw_hwtstamp_ioctl(dev, req);
#endif
	case SIOCGMIIPHY:
		data->phy_id = priv->slaves[slave_no].phy->addr;
		break;
	default:
		return -ENOTSUPP;
	}

	return 0;
}

static void cpsw_ndo_tx_timeout(struct net_device *ndev)
{
	struct cpsw_priv *priv = netdev_priv(ndev);