]> err.no Git - linux-2.6/blobdiff - drivers/net/sky2.c
[PATCH] sky2: use standard pci register capabilties for error register
[linux-2.6] / drivers / net / sky2.c
index c4c51f1418f541fb5069757662a922a854676e72..d3174ed8e454640c1d133cd156c87535d46111fe 100644 (file)
@@ -1184,7 +1184,7 @@ static unsigned tx_le_req(const struct sk_buff *skb)
        if (skb_is_gso(skb))
                ++count;
 
-       if (skb->ip_summed == CHECKSUM_HW)
+       if (skb->ip_summed == CHECKSUM_PARTIAL)
                ++count;
 
        return count;
@@ -1284,7 +1284,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 #endif
 
        /* Handle TCP checksum offload */
-       if (skb->ip_summed == CHECKSUM_HW) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
                unsigned offset = skb->h.raw - skb->data;
                u32 tcpsum;
 
@@ -1624,22 +1624,33 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
                return -1;
        }
 
-       if (hw->chip_id != CHIP_ID_YUKON_FE &&
-           gm_phy_read(hw, port, PHY_MARV_1000T_STAT) & PHY_B_1000S_MSF) {
-               printk(KERN_ERR PFX "%s: master/slave fault",
-                      sky2->netdev->name);
-               return -1;
-       }
-
        if (!(aux & PHY_M_PS_SPDUP_RES)) {
                printk(KERN_ERR PFX "%s: speed/duplex mismatch",
                       sky2->netdev->name);
                return -1;
        }
 
-       sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
-
        sky2->speed = sky2_phy_speed(hw, aux);
+       if (sky2->speed == SPEED_1000) {
+               u16 ctl2 = gm_phy_read(hw, port, PHY_MARV_1000T_CTRL);
+               u16 lpa2 = gm_phy_read(hw, port, PHY_MARV_1000T_STAT);
+               if (lpa2  & PHY_B_1000S_MSF) {
+                       printk(KERN_ERR PFX "%s: master/slave fault",
+                              sky2->netdev->name);
+                       return -1;
+               }
+
+               if ((ctl2 & PHY_M_1000C_AFD) && (lpa2 & PHY_B_1000S_LP_FD))
+                       sky2->duplex = DUPLEX_FULL;
+               else
+                       sky2->duplex = DUPLEX_HALF;
+       } else {
+               u16 adv = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
+               if ((aux & adv) & PHY_AN_FULL)
+                       sky2->duplex = DUPLEX_FULL;
+               else
+                       sky2->duplex = DUPLEX_HALF;
+       }
 
        /* Pause bits are offset (9..8) */
        if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)
@@ -1982,7 +1993,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
 #endif
                case OP_RXCHKS:
                        skb = sky2->rx_ring[sky2->rx_next].skb;
-                       skb->ip_summed = CHECKSUM_HW;
+                       skb->ip_summed = CHECKSUM_COMPLETE;
                        skb->csum = status & 0xffff;
                        break;
 
@@ -2082,7 +2093,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
 
                sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
                sky2_pci_write16(hw, PCI_STATUS,
-                                     pci_err | PCI_STATUS_ERROR_BITS);
+                                pci_err | PCI_STATUS_ERROR_BITS);
                sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
        }
 
@@ -2090,7 +2101,8 @@ static void sky2_hw_intr(struct sky2_hw *hw)
                /* PCI-Express uncorrectable Error occurred */
                u32 pex_err;
 
-               pex_err = sky2_pci_read32(hw, PEX_UNC_ERR_STAT);
+               pex_err = sky2_pci_read32(hw,
+                                         hw->err_cap + PCI_ERR_UNCOR_STATUS);
 
                if (net_ratelimit())
                        printk(KERN_ERR PFX "%s: pci express error (0x%x)\n",
@@ -2098,15 +2110,20 @@ static void sky2_hw_intr(struct sky2_hw *hw)
 
                /* clear the interrupt */
                sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-               sky2_pci_write32(hw, PEX_UNC_ERR_STAT,
-                                      0xffffffffUL);
+               sky2_pci_write32(hw,
+                                hw->err_cap + PCI_ERR_UNCOR_STATUS,
+                                0xffffffffUL);
                sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 
-               if (pex_err & PEX_FATAL_ERRORS) {
+
+               /* In case of fatal error mask off to keep from getting stuck */
+               if (pex_err & (PCI_ERR_UNC_POISON_TLP | PCI_ERR_UNC_FCP
+                              | PCI_ERR_UNC_DLP)) {
                        u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK);
                        hwmsk &= ~Y2_IS_PCI_EXP;
                        sky2_write32(hw, B0_HWE_IMSK, hwmsk);
                }
+
        }
 
        if (status & Y2_HWE_L1_MASK)
@@ -2287,6 +2304,7 @@ static int sky2_reset(struct sky2_hw *hw)
        u16 status;
        u8 t8;
        int i;
+       u32 msk;
 
        sky2_write8(hw, B0_CTST, CS_RST_CLR);
 
@@ -2327,9 +2345,13 @@ static int sky2_reset(struct sky2_hw *hw)
        sky2_write8(hw, B0_CTST, CS_MRST_CLR);
 
        /* clear any PEX errors */
-       if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP))
-               sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xffffffffUL);
-
+       if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) {
+               hw->err_cap = pci_find_ext_capability(hw->pdev, PCI_EXT_CAP_ID_ERR);
+               if (hw->err_cap)
+                       sky2_pci_write32(hw,
+                                        hw->err_cap + PCI_ERR_UNCOR_STATUS,
+                                        0xffffffffUL);
+       }
 
        hw->pmd_type = sky2_read8(hw, B2_PMD_TYP);
        hw->ports = 1;
@@ -2386,7 +2408,10 @@ static int sky2_reset(struct sky2_hw *hw)
                sky2_write8(hw, RAM_BUFFER(i, B3_RI_RTO_XS2), SK_RI_TO_53);
        }
 
-       sky2_write32(hw, B0_HWE_IMSK, Y2_HWE_ALL_MASK);
+       msk = Y2_HWE_ALL_MASK;
+       if (!hw->err_cap)
+               msk &= ~Y2_IS_PCI_EXP;
+       sky2_write32(hw, B0_HWE_IMSK, msk);
 
        for (i = 0; i < hw->ports; i++)
                sky2_gmac_reset(hw, i);