netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Luebbe <jlu@pengutronix.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	Vaibhav Hiremath <hvaibhav@ti.com>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	Jan Luebbe <jlu@pengutronix.de>
Subject: [PATCH 3/3] net: cpsw: implement ioctl for MII
Date: Mon,  3 Dec 2012 14:49:29 +0100	[thread overview]
Message-ID: <1354542569-6165-3-git-send-email-jlu@pengutronix.de> (raw)
In-Reply-To: <1354542569-6165-1-git-send-email-jlu@pengutronix.de>

This allows using tools like mii-diag on CPSW.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 drivers/net/ethernet/ti/cpsw.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 8de3e92..f476c03 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -629,6 +629,20 @@ static void cpsw_ndo_change_rx_flags(struct net_device *ndev, int flags)
 		dev_err(&ndev->dev, "multicast traffic cannot be filtered!\n");
 }
 
+static int cpsw_ndo_do_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
+{
+	struct cpsw_priv *priv = netdev_priv(ndev);
+	struct phy_device *phy = priv->slaves[0].phy;
+
+	if (!netif_running(ndev))
+		return -EINVAL;
+
+	if (!phy)
+		return -ENODEV;
+
+	return phy_mii_ioctl(phy, rq, cmd);
+}
+
 static void cpsw_ndo_tx_timeout(struct net_device *ndev)
 {
 	struct cpsw_priv *priv = netdev_priv(ndev);
@@ -670,6 +684,7 @@ static const struct net_device_ops cpsw_netdev_ops = {
 	.ndo_start_xmit		= cpsw_ndo_start_xmit,
 	.ndo_change_rx_flags	= cpsw_ndo_change_rx_flags,
 	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_do_ioctl		= cpsw_ndo_do_ioctl,
 	.ndo_change_mtu		= eth_change_mtu,
 	.ndo_tx_timeout		= cpsw_ndo_tx_timeout,
 	.ndo_get_stats		= cpsw_ndo_get_stats,
-- 
1.7.10.4

  parent reply	other threads:[~2012-12-03 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 13:49 [PATCH 1/3] net: cpsw: replace pr_xxx with dev_xxx functions Jan Luebbe
2012-12-03 13:49 ` [PATCH 2/3] net: cpsw: verify correct number of slaves in DT Jan Luebbe
2012-12-03 17:00   ` Mugunthan V N
2012-12-03 13:49 ` Jan Luebbe [this message]
2012-12-03 14:16   ` [PATCH 3/3] net: cpsw: implement ioctl for MII Ben Hutchings
2012-12-03 17:04   ` Mugunthan V N
2012-12-04 11:06     ` Jan Lübbe
2012-12-03 16:59 ` [PATCH 1/3] net: cpsw: replace pr_xxx with dev_xxx functions Mugunthan V N

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=1354542569-6165-3-git-send-email-jlu@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=hvaibhav@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).