aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/r8169.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 182c79474434..b3cf1d20ba2c 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -616,7 +616,6 @@ struct rtl8169_private {
616 u16 intr_event; 616 u16 intr_event;
617 u16 napi_event; 617 u16 napi_event;
618 u16 intr_mask; 618 u16 intr_mask;
619 int phy_1000_ctrl_reg;
620 619
621 struct mdio_ops { 620 struct mdio_ops {
622 void (*write)(void __iomem *, int, int); 621 void (*write)(void __iomem *, int, int);
@@ -1288,8 +1287,6 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
1288 bmcr |= BMCR_FULLDPLX; 1287 bmcr |= BMCR_FULLDPLX;
1289 } 1288 }
1290 1289
1291 tp->phy_1000_ctrl_reg = giga_ctrl;
1292
1293 rtl_writephy(tp, MII_BMCR, bmcr); 1290 rtl_writephy(tp, MII_BMCR, bmcr);
1294 1291
1295 if (tp->mac_version == RTL_GIGA_MAC_VER_02 || 1292 if (tp->mac_version == RTL_GIGA_MAC_VER_02 ||
@@ -1315,10 +1312,14 @@ static int rtl8169_set_speed(struct net_device *dev,
1315 int ret; 1312 int ret;
1316 1313
1317 ret = tp->set_speed(dev, autoneg, speed, duplex, advertising); 1314 ret = tp->set_speed(dev, autoneg, speed, duplex, advertising);
1315 if (ret < 0)
1316 goto out;
1318 1317
1319 if (netif_running(dev) && (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) 1318 if (netif_running(dev) && (autoneg == AUTONEG_ENABLE) &&
1319 (advertising & ADVERTISED_1000baseT_Full)) {
1320 mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT); 1320 mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT);
1321 1321 }
1322out:
1322 return ret; 1323 return ret;
1323} 1324}
1324 1325
@@ -1328,6 +1329,8 @@ static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1328 unsigned long flags; 1329 unsigned long flags;
1329 int ret; 1330 int ret;
1330 1331
1332 del_timer_sync(&tp->timer);
1333
1331 spin_lock_irqsave(&tp->lock, flags); 1334 spin_lock_irqsave(&tp->lock, flags);
1332 ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd), 1335 ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd),
1333 cmd->duplex, cmd->advertising); 1336 cmd->duplex, cmd->advertising);
@@ -2691,9 +2694,6 @@ static void rtl8169_phy_timer(unsigned long __opaque)
2691 2694
2692 assert(tp->mac_version > RTL_GIGA_MAC_VER_01); 2695 assert(tp->mac_version > RTL_GIGA_MAC_VER_01);
2693 2696
2694 if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL))
2695 return;
2696
2697 spin_lock_irq(&tp->lock); 2697 spin_lock_irq(&tp->lock);
2698 2698
2699 if (tp->phy_reset_pending(tp)) { 2699 if (tp->phy_reset_pending(tp)) {
@@ -2718,28 +2718,6 @@ out_unlock:
2718 spin_unlock_irq(&tp->lock); 2718 spin_unlock_irq(&tp->lock);
2719} 2719}
2720 2720
2721static inline void rtl8169_delete_timer(struct net_device *dev)
2722{
2723 struct rtl8169_private *tp = netdev_priv(dev);
2724 struct timer_list *timer = &tp->timer;
2725
2726 if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
2727 return;
2728
2729 del_timer_sync(timer);
2730}
2731
2732static inline void rtl8169_request_timer(struct net_device *dev)
2733{
2734 struct rtl8169_private *tp = netdev_priv(dev);
2735 struct timer_list *timer = &tp->timer;
2736
2737 if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
2738 return;
2739
2740 mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
2741}
2742
2743#ifdef CONFIG_NET_POLL_CONTROLLER 2721#ifdef CONFIG_NET_POLL_CONTROLLER
2744/* 2722/*
2745 * Polling 'interrupt' - used by things like netconsole to send skbs 2723 * Polling 'interrupt' - used by things like netconsole to send skbs
@@ -3396,8 +3374,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3396 tp->phy_reset_pending = rtl8169_tbi_reset_pending; 3374 tp->phy_reset_pending = rtl8169_tbi_reset_pending;
3397 tp->link_ok = rtl8169_tbi_link_ok; 3375 tp->link_ok = rtl8169_tbi_link_ok;
3398 tp->do_ioctl = rtl_tbi_ioctl; 3376 tp->do_ioctl = rtl_tbi_ioctl;
3399
3400 tp->phy_1000_ctrl_reg = ADVERTISE_1000FULL; /* Implied by TBI */
3401 } else { 3377 } else {
3402 tp->set_speed = rtl8169_set_speed_xmii; 3378 tp->set_speed = rtl8169_set_speed_xmii;
3403 tp->get_settings = rtl8169_gset_xmii; 3379 tp->get_settings = rtl8169_gset_xmii;
@@ -3593,8 +3569,6 @@ static int rtl8169_open(struct net_device *dev)
3593 3569
3594 rtl_hw_start(dev); 3570 rtl_hw_start(dev);
3595 3571
3596 rtl8169_request_timer(dev);
3597
3598 tp->saved_wolopts = 0; 3572 tp->saved_wolopts = 0;
3599 pm_runtime_put_noidle(&pdev->dev); 3573 pm_runtime_put_noidle(&pdev->dev);
3600 3574
@@ -5147,7 +5121,7 @@ static void rtl8169_down(struct net_device *dev)
5147 struct rtl8169_private *tp = netdev_priv(dev); 5121 struct rtl8169_private *tp = netdev_priv(dev);
5148 void __iomem *ioaddr = tp->mmio_addr; 5122 void __iomem *ioaddr = tp->mmio_addr;
5149 5123
5150 rtl8169_delete_timer(dev); 5124 del_timer_sync(&tp->timer);
5151 5125
5152 netif_stop_queue(dev); 5126 netif_stop_queue(dev);
5153 5127