Skip to contentSkip to conversation

Added MII ioctl handler to gianfar driver

PATCH New Clifford Wolf 1 participant 1 message Dec 23, 2008 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added MII ioctl handler to gianfar driver

Added MII ioctl handler to gianfar driver

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.

net/gianfar.c +15 -0
@@ -159,6 +159,20 @@
 	return (priv->vlan_enable || priv->rx_csum_enable);
 }
 
+/* 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 platform_device *pdev)
@@ -272,6 +286,7 @@
 	dev->set_multicast_list = gfar_set_multi;
 
 	dev->ethtool_ops = &gfar_ethtool_ops;
+	dev->do_ioctl = gfar_ioctl;
 
 	if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
 		priv->rx_csum_enable = 1;