From: Mugunthan V N <mugunthanvnm@ti.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <devicetree-discuss@lists.ozlabs.org>,
<linux-omap@vger.kernel.org>, <b-cousson@ti.com>,
<paul@pwsan.com>, Mugunthan V N <mugunthanvnm@ti.com>
Subject: [PATCH v2 5/5] drivers: net: ethernet: cpsw: implement get phy_id via ioctl
Date: Tue, 12 Mar 2013 14:46:38 +0530 [thread overview]
Message-ID: <1363079798-18147-6-git-send-email-mugunthanvnm@ti.com> (raw)
In-Reply-To: <1363079798-18147-1-git-send-email-mugunthanvnm@ti.com>
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>
---
drivers/net/ethernet/ti/cpsw.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index d6cf698..8ff1d3d 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)
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
- return -ENOTSUPP;
+ 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)
--
1.7.9.5
next prev parent reply other threads:[~2013-03-12 9:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 9:16 [PATCH v2 0/5] cpsw interrupt pacing and get/set phy setting implementation Mugunthan V N
2013-03-12 9:16 ` [PATCH v2 1/5] documentation: dt: bindings: cpsw: cleanup documentation Mugunthan V N
2013-03-12 9:16 ` [PATCH v2 2/5] drivers: net: ethernet: cpsw: change cpts_active_slave to active_slave Mugunthan V N
2013-03-12 9:16 ` [PATCH v2 3/5] driver: net: ethernet: cpsw: implement ethtool get/set phy setting Mugunthan V N
2013-03-12 9:16 ` [PATCH v2 4/5] driver: net: ethernet: cpsw: implement interrupt pacing via ethtool Mugunthan V N
2013-03-12 9:16 ` Mugunthan V N [this message]
2013-03-13 8:39 ` [PATCH v2 0/5] cpsw interrupt pacing and get/set phy setting implementation David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363079798-18147-6-git-send-email-mugunthanvnm@ti.com \
--to=mugunthanvnm@ti.com \
--cc=b-cousson@ti.com \
--cc=davem@davemloft.net \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul@pwsan.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox