aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2006-10-31 18:53:05 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-02 00:12:01 -0500
commitbf793295e1090af84972750898bf8470df5e5419 (patch)
tree900158abf33dd5fa98dca6506fb82dd15f59353b /drivers/net/r8169.c
parentde3edab4276c3c789f64dc3d78eea027709fef0e (diff)
r8169: perform a PHY reset before any other operation at boot time
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 <romieu@fr.zoreil.com> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index b977ed85ff3..45d3ca43195 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -571,8 +571,8 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr)
571{ 571{
572 unsigned int val; 572 unsigned int val;
573 573
574 val = (mdio_read(ioaddr, MII_BMCR) | BMCR_RESET) & 0xffff; 574 mdio_write(ioaddr, MII_BMCR, BMCR_RESET);
575 mdio_write(ioaddr, MII_BMCR, val); 575 val = mdio_read(ioaddr, MII_BMCR);
576} 576}
577 577
578static void rtl8169_check_link_status(struct net_device *dev, 578static void rtl8169_check_link_status(struct net_device *dev,
@@ -1406,6 +1406,22 @@ static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
1406 free_netdev(dev); 1406 free_netdev(dev);
1407} 1407}
1408 1408
1409static void rtl8169_phy_reset(struct net_device *dev,
1410 struct rtl8169_private *tp)
1411{
1412 void __iomem *ioaddr = tp->mmio_addr;
1413 int i;
1414
1415 tp->phy_reset_enable(ioaddr);
1416 for (i = 0; i < 100; i++) {
1417 if (!tp->phy_reset_pending(ioaddr))
1418 return;
1419 msleep(1);
1420 }
1421 if (netif_msg_link(tp))
1422 printk(KERN_ERR "%s: PHY reset failed.\n", dev->name);
1423}
1424
1409static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) 1425static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
1410{ 1426{
1411 void __iomem *ioaddr = tp->mmio_addr; 1427 void __iomem *ioaddr = tp->mmio_addr;
@@ -1434,6 +1450,8 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
1434 1450
1435 rtl8169_link_option(board_idx, &autoneg, &speed, &duplex); 1451 rtl8169_link_option(board_idx, &autoneg, &speed, &duplex);
1436 1452
1453 rtl8169_phy_reset(dev, tp);
1454
1437 rtl8169_set_speed(dev, autoneg, speed, duplex); 1455 rtl8169_set_speed(dev, autoneg, speed, duplex);
1438 1456
1439 if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp)) 1457 if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))