diff options
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 0025b8367ece..ace895b2e221 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1475,6 +1475,32 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) | |||
1475 | printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name); | 1475 | printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name); |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
1479 | { | ||
1480 | struct rtl8169_private *tp = netdev_priv(dev); | ||
1481 | struct mii_ioctl_data *data = if_mii(ifr); | ||
1482 | |||
1483 | if (!netif_running(dev)) | ||
1484 | return -ENODEV; | ||
1485 | |||
1486 | switch (cmd) { | ||
1487 | case SIOCGMIIPHY: | ||
1488 | data->phy_id = 32; /* Internal PHY */ | ||
1489 | return 0; | ||
1490 | |||
1491 | case SIOCGMIIREG: | ||
1492 | data->val_out = mdio_read(tp->mmio_addr, data->reg_num & 0x1f); | ||
1493 | return 0; | ||
1494 | |||
1495 | case SIOCSMIIREG: | ||
1496 | if (!capable(CAP_NET_ADMIN)) | ||
1497 | return -EPERM; | ||
1498 | mdio_write(tp->mmio_addr, data->reg_num & 0x1f, data->val_in); | ||
1499 | return 0; | ||
1500 | } | ||
1501 | return -EOPNOTSUPP; | ||
1502 | } | ||
1503 | |||
1478 | static int __devinit | 1504 | static int __devinit |
1479 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1505 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1480 | { | 1506 | { |
@@ -1639,6 +1665,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1639 | tp->phy_reset_enable = rtl8169_xmii_reset_enable; | 1665 | tp->phy_reset_enable = rtl8169_xmii_reset_enable; |
1640 | tp->phy_reset_pending = rtl8169_xmii_reset_pending; | 1666 | tp->phy_reset_pending = rtl8169_xmii_reset_pending; |
1641 | tp->link_ok = rtl8169_xmii_link_ok; | 1667 | tp->link_ok = rtl8169_xmii_link_ok; |
1668 | |||
1669 | dev->do_ioctl = rtl8169_ioctl; | ||
1642 | } | 1670 | } |
1643 | 1671 | ||
1644 | /* Get MAC address. FIXME: read EEPROM */ | 1672 | /* Get MAC address. FIXME: read EEPROM */ |