aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 535f6cc96c8d..ad35674ba838 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -619,28 +619,35 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
619 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 619 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);
620} 620}
621 621
622static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) 622static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
623static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
624
625static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port)
623{ 626{
624 u32 reg1; 627 u32 reg1;
625 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
626 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
627 628
628 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 629 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
629 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); 630 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
630 /* Turn on/off phy power saving */ 631 reg1 &= ~phy_power[port];
631 if (onoff)
632 reg1 &= ~phy_power[port];
633 else
634 reg1 |= phy_power[port];
635 632
636 if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) 633 if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
637 reg1 |= coma_mode[port]; 634 reg1 |= coma_mode[port];
638 635
639 sky2_pci_write32(hw, PCI_DEV_REG1, reg1); 636 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
640 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 637 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
641 sky2_pci_read32(hw, PCI_DEV_REG1); 638 sky2_pci_read32(hw, PCI_DEV_REG1);
639}
640
641static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
642{
643 u32 reg1;
644
645 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
646 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
647 reg1 |= phy_power[port];
642 648
643 udelay(100); 649 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
650 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
644} 651}
645 652
646/* Force a renegotiation */ 653/* Force a renegotiation */
@@ -675,8 +682,11 @@ static void sky2_wol_init(struct sky2_port *sky2)
675 682
676 sky2->advertising &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full); 683 sky2->advertising &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full);
677 sky2->flow_mode = FC_NONE; 684 sky2->flow_mode = FC_NONE;
678 sky2_phy_power(hw, port, 1); 685
679 sky2_phy_reinit(sky2); 686 spin_lock_bh(&sky2->phy_lock);
687 sky2_phy_power_up(hw, port);
688 sky2_phy_init(hw, port);
689 spin_unlock_bh(&sky2->phy_lock);
680 690
681 sky2->flow_mode = save_mode; 691 sky2->flow_mode = save_mode;
682 sky2->advertising = ctrl; 692 sky2->advertising = ctrl;
@@ -781,6 +791,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
781 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK); 791 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK);
782 792
783 spin_lock_bh(&sky2->phy_lock); 793 spin_lock_bh(&sky2->phy_lock);
794 sky2_phy_power_up(hw, port);
784 sky2_phy_init(hw, port); 795 sky2_phy_init(hw, port);
785 spin_unlock_bh(&sky2->phy_lock); 796 spin_unlock_bh(&sky2->phy_lock);
786 797
@@ -1385,8 +1396,6 @@ static int sky2_up(struct net_device *dev)
1385 if (!sky2->rx_ring) 1396 if (!sky2->rx_ring)
1386 goto err_out; 1397 goto err_out;
1387 1398
1388 sky2_phy_power(hw, port, 1);
1389
1390 sky2_mac_init(hw, port); 1399 sky2_mac_init(hw, port);
1391 1400
1392 /* Register is number of 4K blocks on internal RAM buffer. */ 1401 /* Register is number of 4K blocks on internal RAM buffer. */
@@ -1767,7 +1776,7 @@ static int sky2_down(struct net_device *dev)
1767 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 1776 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
1768 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 1777 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
1769 1778
1770 sky2_phy_power(hw, port, 0); 1779 sky2_phy_power_down(hw, port);
1771 1780
1772 netif_carrier_off(dev); 1781 netif_carrier_off(dev);
1773 1782