]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/gianfar.c
smsc911x: fix smsc911x_reg_read compiler warning
[linux-2.6-omap-h63xx.git] / drivers / net / gianfar.c
index c672ecfc95957f24cc3cb0f358bface91b0a2fbd..efcbeb6c8673f569de72465c5eb327da4b2fd3b9 100644 (file)
@@ -238,8 +238,8 @@ static int gfar_of_init(struct net_device *dev)
                        goto err_out;
                }
 
-               snprintf(priv->phy_bus_id, BUS_ID_SIZE, PHY_ID_FMT, "0",
-                               fixed_link[0]);
+               snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id),
+                               PHY_ID_FMT, "0", fixed_link[0]);
        } else {
                phy = of_find_node_by_phandle(*ph);
 
@@ -256,7 +256,7 @@ static int gfar_of_init(struct net_device *dev)
                of_node_put(mdio);
 
                gfar_mdio_bus_name(bus_name, mdio);
-               snprintf(priv->phy_bus_id, BUS_ID_SIZE, "%s:%02x",
+               snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
                                bus_name, *id);
        }
 
@@ -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 *ofdev,
        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;
@@ -1973,6 +1988,8 @@ static void adjust_link(struct net_device *dev)
                        case 1000:
                                tempval =
                                    ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
+
+                               ecntrl &= ~(ECNTRL_R100);
                                break;
                        case 100:
                        case 10: