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.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 1c01b96c9611..d760650c5c04 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -644,6 +644,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port)
644{ 644{
645 u32 reg1; 645 u32 reg1;
646 646
647 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
647 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); 648 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
648 reg1 &= ~phy_power[port]; 649 reg1 &= ~phy_power[port];
649 650
@@ -651,6 +652,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port)
651 reg1 |= coma_mode[port]; 652 reg1 |= coma_mode[port];
652 653
653 sky2_pci_write32(hw, PCI_DEV_REG1, reg1); 654 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
655 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
654 sky2_pci_read32(hw, PCI_DEV_REG1); 656 sky2_pci_read32(hw, PCI_DEV_REG1);
655 657
656 if (hw->chip_id == CHIP_ID_YUKON_FE) 658 if (hw->chip_id == CHIP_ID_YUKON_FE)
@@ -707,9 +709,11 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
707 gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN); 709 gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN);
708 } 710 }
709 711
712 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
710 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); 713 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
711 reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */ 714 reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */
712 sky2_pci_write32(hw, PCI_DEV_REG1, reg1); 715 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
716 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
713} 717}
714 718
715/* Force a renegotiation */ 719/* Force a renegotiation */
@@ -1844,7 +1848,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1844 sky2->tx_cons = idx; 1848 sky2->tx_cons = idx;
1845 smp_mb(); 1849 smp_mb();
1846 1850
1847 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 1851 /* Wake unless it's detached, and called e.g. from sky2_down() */
1852 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev))
1848 netif_wake_queue(dev); 1853 netif_wake_queue(dev);
1849} 1854}
1850 1855
@@ -2148,7 +2153,9 @@ static void sky2_qlink_intr(struct sky2_hw *hw)
2148 2153
2149 /* reset PHY Link Detect */ 2154 /* reset PHY Link Detect */
2150 phy = sky2_pci_read16(hw, PSM_CONFIG_REG4); 2155 phy = sky2_pci_read16(hw, PSM_CONFIG_REG4);
2156 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2151 sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1); 2157 sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1);
2158 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2152 2159
2153 sky2_link_up(sky2); 2160 sky2_link_up(sky2);
2154} 2161}
@@ -2639,6 +2646,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2639 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { 2646 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
2640 u16 pci_err; 2647 u16 pci_err;
2641 2648
2649 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2642 pci_err = sky2_pci_read16(hw, PCI_STATUS); 2650 pci_err = sky2_pci_read16(hw, PCI_STATUS);
2643 if (net_ratelimit()) 2651 if (net_ratelimit())
2644 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", 2652 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
@@ -2646,12 +2654,14 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2646 2654
2647 sky2_pci_write16(hw, PCI_STATUS, 2655 sky2_pci_write16(hw, PCI_STATUS,
2648 pci_err | PCI_STATUS_ERROR_BITS); 2656 pci_err | PCI_STATUS_ERROR_BITS);
2657 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2649 } 2658 }
2650 2659
2651 if (status & Y2_IS_PCI_EXP) { 2660 if (status & Y2_IS_PCI_EXP) {
2652 /* PCI-Express uncorrectable Error occurred */ 2661 /* PCI-Express uncorrectable Error occurred */
2653 u32 err; 2662 u32 err;
2654 2663
2664 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2655 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); 2665 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2656 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, 2666 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2657 0xfffffffful); 2667 0xfffffffful);
@@ -2659,6 +2669,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2659 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); 2669 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
2660 2670
2661 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); 2671 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2672 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2662 } 2673 }
2663 2674
2664 if (status & Y2_HWE_L1_MASK) 2675 if (status & Y2_HWE_L1_MASK)
@@ -3037,6 +3048,7 @@ static void sky2_reset(struct sky2_hw *hw)
3037 } 3048 }
3038 3049
3039 sky2_power_on(hw); 3050 sky2_power_on(hw);
3051 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
3040 3052
3041 for (i = 0; i < hw->ports; i++) { 3053 for (i = 0; i < hw->ports; i++) {
3042 sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); 3054 sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
@@ -3073,6 +3085,7 @@ static void sky2_reset(struct sky2_hw *hw)
3073 reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE; 3085 reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE;
3074 3086
3075 /* reset PHY Link Detect */ 3087 /* reset PHY Link Detect */
3088 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
3076 sky2_pci_write16(hw, PSM_CONFIG_REG4, 3089 sky2_pci_write16(hw, PSM_CONFIG_REG4,
3077 reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT); 3090 reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT);
3078 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); 3091 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg);
@@ -3090,6 +3103,7 @@ static void sky2_reset(struct sky2_hw *hw)
3090 /* restore the PCIe Link Control register */ 3103 /* restore the PCIe Link Control register */
3091 sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg); 3104 sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg);
3092 } 3105 }
3106 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
3093 3107
3094 /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */ 3108 /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */
3095 sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16)); 3109 sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16));
@@ -3227,6 +3241,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw)
3227 return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; 3241 return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0;
3228} 3242}
3229 3243
3244static void sky2_hw_set_wol(struct sky2_hw *hw)
3245{
3246 int wol = 0;
3247 int i;
3248
3249 for (i = 0; i < hw->ports; i++) {
3250 struct net_device *dev = hw->dev[i];
3251 struct sky2_port *sky2 = netdev_priv(dev);
3252
3253 if (sky2->wol)
3254 wol = 1;
3255 }
3256
3257 if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
3258 hw->chip_id == CHIP_ID_YUKON_EX ||
3259 hw->chip_id == CHIP_ID_YUKON_FE_P)
3260 sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
3261
3262 device_set_wakeup_enable(&hw->pdev->dev, wol);
3263}
3264
3230static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 3265static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
3231{ 3266{
3232 const struct sky2_port *sky2 = netdev_priv(dev); 3267 const struct sky2_port *sky2 = netdev_priv(dev);
@@ -3246,13 +3281,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
3246 3281
3247 sky2->wol = wol->wolopts; 3282 sky2->wol = wol->wolopts;
3248 3283
3249 if (hw->chip_id == CHIP_ID_YUKON_EC_U || 3284 sky2_hw_set_wol(hw);
3250 hw->chip_id == CHIP_ID_YUKON_EX ||
3251 hw->chip_id == CHIP_ID_YUKON_FE_P)
3252 sky2_write32(hw, B0_CTST, sky2->wol
3253 ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
3254
3255 device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);
3256 3285
3257 if (!netif_running(dev)) 3286 if (!netif_running(dev))
3258 sky2_wol_init(sky2); 3287 sky2_wol_init(sky2);
@@ -4684,6 +4713,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4684 INIT_WORK(&hw->restart_work, sky2_restart); 4713 INIT_WORK(&hw->restart_work, sky2_restart);
4685 4714
4686 pci_set_drvdata(pdev, hw); 4715 pci_set_drvdata(pdev, hw);
4716 pdev->d3_delay = 150;
4687 4717
4688 return 0; 4718 return 0;
4689 4719