Realtek's 8139/810x (0x8136) PCI-E comes with a touchy PHY.
A big heavy reset seems to calm it down.

Fix for http://bugzilla.kernel.org/show_bug.cgi?id=7378.

Signed-off-by: Francois Romieu <[EMAIL PROTECTED]>
Signed-off-by: Darren Salt <[EMAIL PROTECTED]>
---
 drivers/net/r8169.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c2c9a86..03c0dc5 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1442,6 +1442,22 @@ static void rtl8169_release_board(struct
        free_netdev(dev);
 }
 
+static void rtl8169_phy_reset(struct net_device *dev,
+                             struct rtl8169_private *tp)
+{
+       void __iomem *ioaddr = tp->mmio_addr;
+       int i;
+
+       tp->phy_reset_enable(ioaddr);
+       for (i = 0; i < 100; i++) {
+               if (!tp->phy_reset_pending(ioaddr))
+                       return;
+               msleep(1);
+       }
+       if (netif_msg_link(tp))
+               printk(KERN_ERR "%s: PHY reset failed.\n", dev->name);
+}
+
 static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private 
*tp)
 {
        void __iomem *ioaddr = tp->mmio_addr;
@@ -1470,6 +1486,8 @@ static void rtl8169_init_phy(struct net_
 
        rtl8169_link_option(board_idx, &autoneg, &speed, &duplex);
 
+       rtl8169_phy_reset(dev, tp);
+
        rtl8169_set_speed(dev, autoneg, speed, duplex);
 
        if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
-- 
1.4.2.3

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to