netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 4/4] netdev: gianfar: add MII ioctl handler
@ 2009-01-09 20:23 akpm
  2009-01-10  7:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2009-01-09 20:23 UTC (permalink / raw)
  To: davem; +Cc: netdev, akpm, clifford

From: Clifford Wolf <clifford@clifford.at>

This is the same kind of wrapper that can also be found in many
other network device drivers.

Tested with a freescale MPC8349E host CPU:
Toggled the interface LEDs on a DP83865 PHY.

Signed-off-by: Clifford Wolf <clifford@clifford.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/net/gianfar.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff -puN drivers/net/gianfar.c~netdev-gianfar-add-mii-ioctl-handler drivers/net/gianfar.c
--- a/drivers/net/gianfar.c~netdev-gianfar-add-mii-ioctl-handler
+++ a/drivers/net/gianfar.c
@@ -296,6 +296,20 @@ err_out:
 	return err;
 }
 
+/* Ioctl MII Interface */
+static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	struct gfar_private *priv = netdev_priv(dev);
+
+	if (!netif_running(dev))
+		return -EINVAL;
+
+	if (!priv->phydev)
+		return -ENODEV;
+
+	return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
+}
+
 /* Set up the ethernet device structure, private data,
  * and anything else we need before we start */
 static int gfar_probe(struct of_device *ofdev,
@@ -366,6 +380,7 @@ static int gfar_probe(struct of_device *
 	dev->set_multicast_list = gfar_set_multi;
 
 	dev->ethtool_ops = &gfar_ethtool_ops;
+	dev->do_ioctl = gfar_ioctl;
 
 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
 		priv->rx_csum_enable = 1;
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-10  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 20:23 [patch 4/4] netdev: gianfar: add MII ioctl handler akpm
2009-01-10  7:10 ` David Miller

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).