aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/arm
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2006-06-20 05:59:05 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 22:56:21 -0400
commitca5585ed248dc01ce918002ee9a9c9c41ae4f7c0 (patch)
tree354844b9b92c9694625b805b7044ded9c9abe1c6 /drivers/net/arm
parent775637df0caccc204628ebacca2b07f35c88b96b (diff)
[PATCH] AT91RM9200 Ethernet #2: MII interface
Adds support for the MII ioctls via generic_mii_ioctl(). Patch from Brian Stafford. Set the mii.phy_id to the detected PHY address, otherwise ethtool cannot access PHYs other than 0. Patch from Roman Kolesnikov. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/arm')
-rw-r--r--drivers/net/arm/at91_ether.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 5b5095629a93..cc773662d9f9 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -660,6 +660,22 @@ static struct ethtool_ops at91ether_ethtool_ops = {
660 .get_link = ethtool_op_get_link, 660 .get_link = ethtool_op_get_link,
661}; 661};
662 662
663static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
664{
665 struct at91_private *lp = (struct at91_private *) dev->priv;
666 int res;
667
668 if (!netif_running(dev))
669 return -EINVAL;
670
671 spin_lock_irq(&lp->lock);
672 enable_mdi();
673 res = generic_mii_ioctl(&lp->mii, if_mii(rq), cmd, NULL);
674 disable_mdi();
675 spin_unlock_irq(&lp->lock);
676
677 return res;
678}
663 679
664/* ................................ MAC ................................ */ 680/* ................................ MAC ................................ */
665 681
@@ -963,6 +979,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
963 dev->set_multicast_list = at91ether_set_rx_mode; 979 dev->set_multicast_list = at91ether_set_rx_mode;
964 dev->set_mac_address = set_mac_address; 980 dev->set_mac_address = set_mac_address;
965 dev->ethtool_ops = &at91ether_ethtool_ops; 981 dev->ethtool_ops = &at91ether_ethtool_ops;
982 dev->do_ioctl = at91ether_ioctl;
966 983
967 SET_NETDEV_DEV(dev, &pdev->dev); 984 SET_NETDEV_DEV(dev, &pdev->dev);
968 985
@@ -993,6 +1010,9 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
993 lp->mii.dev = dev; /* Support for ethtool */ 1010 lp->mii.dev = dev; /* Support for ethtool */
994 lp->mii.mdio_read = mdio_read; 1011 lp->mii.mdio_read = mdio_read;
995 lp->mii.mdio_write = mdio_write; 1012 lp->mii.mdio_write = mdio_write;
1013 lp->mii.phy_id = phy_address;
1014 lp->mii.phy_id_mask = 0x1f;
1015 lp->mii.reg_num_mask = 0x1f;
996 1016
997 lp->phy_type = phy_type; /* Type of PHY connected */ 1017 lp->phy_type = phy_type; /* Type of PHY connected */
998 lp->phy_address = phy_address; /* MDI address of PHY */ 1018 lp->phy_address = phy_address; /* MDI address of PHY */