tg3: remove IRQF_SAMPLE_RANDOM flag
[linux.git] / drivers / net / ethernet / broadcom / tg3.c
index cb17885cad47f3350aeafde74b5b924f9a3569cc..27dafd928279042b21cb691260e04a13aedcc66a 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
  * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com)
  * Copyright (C) 2004 Sun Microsystems Inc.
- * Copyright (C) 2005-2011 Broadcom Corporation.
+ * Copyright (C) 2005-2012 Broadcom Corporation.
  *
  * Firmware is:
  *     Derived from proprietary unpublished source code,
@@ -1453,33 +1453,23 @@ static void tg3_wait_for_event_ack(struct tg3 *tp)
 }
 
 /* tp->lock is held. */
-static void tg3_ump_link_report(struct tg3 *tp)
+static void tg3_phy_gather_ump_data(struct tg3 *tp, u32 *data)
 {
-       u32 reg;
-       u32 val;
-
-       if (!tg3_flag(tp, 5780_CLASS) || !tg3_flag(tp, ENABLE_ASF))
-               return;
-
-       tg3_wait_for_event_ack(tp);
-
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_LINK_UPDATE);
-
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 14);
+       u32 reg, val;
 
        val = 0;
        if (!tg3_readphy(tp, MII_BMCR, &reg))
                val = reg << 16;
        if (!tg3_readphy(tp, MII_BMSR, &reg))
                val |= (reg & 0xffff);
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, val);
+       *data++ = val;
 
        val = 0;
        if (!tg3_readphy(tp, MII_ADVERTISE, &reg))
                val = reg << 16;
        if (!tg3_readphy(tp, MII_LPA, &reg))
                val |= (reg & 0xffff);
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 4, val);
+       *data++ = val;
 
        val = 0;
        if (!(tp->phy_flags & TG3_PHYFLG_MII_SERDES)) {
@@ -1488,13 +1478,33 @@ static void tg3_ump_link_report(struct tg3 *tp)
                if (!tg3_readphy(tp, MII_STAT1000, &reg))
                        val |= (reg & 0xffff);
        }
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 8, val);
+       *data++ = val;
 
        if (!tg3_readphy(tp, MII_PHYADDR, &reg))
                val = reg << 16;
        else
                val = 0;
-       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val);
+       *data++ = val;
+}
+
+/* tp->lock is held. */
+static void tg3_ump_link_report(struct tg3 *tp)
+{
+       u32 data[4];
+
+       if (!tg3_flag(tp, 5780_CLASS) || !tg3_flag(tp, ENABLE_ASF))
+               return;
+
+       tg3_phy_gather_ump_data(tp, data);
+
+       tg3_wait_for_event_ack(tp);
+
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_LINK_UPDATE);
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 14);
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x0, data[0]);
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x4, data[1]);
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x8, data[2]);
+       tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0xc, data[3]);
 
        tg3_generate_fw_event(tp);
 }
@@ -1809,8 +1819,8 @@ static void tg3_adjust_link(struct net_device *dev)
                      (6 << TX_LENGTHS_IPG_SHIFT) |
                      (32 << TX_LENGTHS_SLOT_TIME_SHIFT)));
 
-       if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) ||
-           (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) ||
+       if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) ||
+           (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||
            phydev->speed != tp->link_config.active_speed ||
            phydev->duplex != tp->link_config.active_duplex ||
            oldflowctrl != tp->link_config.active_flowctrl)
@@ -1884,10 +1894,10 @@ static void tg3_phy_start(struct tg3 *tp)
 
        if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
                tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
-               phydev->speed = tp->link_config.orig_speed;
-               phydev->duplex = tp->link_config.orig_duplex;
-               phydev->autoneg = tp->link_config.orig_autoneg;
-               phydev->advertising = tp->link_config.orig_advertising;
+               phydev->speed = tp->link_config.speed;
+               phydev->duplex = tp->link_config.duplex;
+               phydev->autoneg = tp->link_config.autoneg;
+               phydev->advertising = tp->link_config.advertising;
        }
 
        phy_start(phydev);
@@ -3140,8 +3150,6 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
 
                phy_addr = tg3_nvram_phys_addr(tp, offset);
 
-               tw32(NVRAM_ADDR, phy_addr);
-
                nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR;
 
                if (page_off == 0 || i == 0)
@@ -3152,6 +3160,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
                if (i == (len - 4))
                        nvram_cmd |= NVRAM_CMD_LAST;
 
+               if ((nvram_cmd & NVRAM_CMD_FIRST) ||
+                   !tg3_flag(tp, FLASH) ||
+                   !tg3_flag(tp, 57765_PLUS))
+                       tw32(NVRAM_ADDR, phy_addr);
+
                if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752 &&
                    !tg3_flag(tp, 5755_PLUS) &&
                    (tp->nvram_jedecnum == JEDEC_ST) &&
@@ -3551,10 +3564,10 @@ static int tg3_power_down_prepare(struct tg3 *tp)
 
                        tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
 
-                       tp->link_config.orig_speed = phydev->speed;
-                       tp->link_config.orig_duplex = phydev->duplex;
-                       tp->link_config.orig_autoneg = phydev->autoneg;
-                       tp->link_config.orig_advertising = phydev->advertising;
+                       tp->link_config.speed = phydev->speed;
+                       tp->link_config.duplex = phydev->duplex;
+                       tp->link_config.autoneg = phydev->autoneg;
+                       tp->link_config.advertising = phydev->advertising;
 
                        advertising = ADVERTISED_TP |
                                      ADVERTISED_Pause |
@@ -3587,19 +3600,11 @@ static int tg3_power_down_prepare(struct tg3 *tp)
        } else {
                do_low_power = true;
 
-               if (!(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
+               if (!(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER))
                        tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
-                       tp->link_config.orig_speed = tp->link_config.speed;
-                       tp->link_config.orig_duplex = tp->link_config.duplex;
-                       tp->link_config.orig_autoneg = tp->link_config.autoneg;
-               }
 
-               if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES)) {
-                       tp->link_config.speed = SPEED_10;
-                       tp->link_config.duplex = DUPLEX_HALF;
-                       tp->link_config.autoneg = AUTONEG_ENABLE;
+               if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
                        tg3_setup_phy(tp, 0);
-               }
        }
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
@@ -3808,8 +3813,8 @@ static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8
                                  DUPLEX_HALF;
                        break;
                }
-               *speed = SPEED_INVALID;
-               *duplex = DUPLEX_INVALID;
+               *speed = SPEED_UNKNOWN;
+               *duplex = DUPLEX_UNKNOWN;
                break;
        }
 }
@@ -3901,7 +3906,7 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
 
                tg3_phy_autoneg_cfg(tp, new_adv,
                                    FLOW_CTRL_TX | FLOW_CTRL_RX);
-       } else if (tp->link_config.speed == SPEED_INVALID) {
+       } else if (tp->link_config.speed == SPEED_UNKNOWN) {
                if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
                        tp->link_config.advertising &=
                                ~(ADVERTISED_1000baseT_Half |
@@ -3933,7 +3938,7 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
        }
 
        if (tp->link_config.autoneg == AUTONEG_DISABLE &&
-           tp->link_config.speed != SPEED_INVALID) {
+           tp->link_config.speed != SPEED_UNKNOWN) {
                u32 bmcr, orig_bmcr;
 
                tp->link_config.active_speed = tp->link_config.speed;
@@ -4167,8 +4172,8 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
        }
 
        current_link_up = 0;
-       current_speed = SPEED_INVALID;
-       current_duplex = DUPLEX_INVALID;
+       current_speed = SPEED_UNKNOWN;
+       current_duplex = DUPLEX_UNKNOWN;
        tp->phy_flags &= ~TG3_PHYFLG_MDIX_STATE;
        tp->link_config.rmt_adv = 0;
 
@@ -5064,8 +5069,8 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
                                    LED_CTRL_LNKLED_OVERRIDE |
                                    LED_CTRL_1000MBPS_ON));
        } else {
-               tp->link_config.active_speed = SPEED_INVALID;
-               tp->link_config.active_duplex = DUPLEX_INVALID;
+               tp->link_config.active_speed = SPEED_UNKNOWN;
+               tp->link_config.active_duplex = DUPLEX_UNKNOWN;
                tw32(MAC_LED_CTRL, (tp->led_ctrl |
                                    LED_CTRL_LNKLED_OVERRIDE |
                                    LED_CTRL_TRAFFIC_OVERRIDE));
@@ -5113,8 +5118,8 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
                tg3_phy_reset(tp);
 
        current_link_up = 0;
-       current_speed = SPEED_INVALID;
-       current_duplex = DUPLEX_INVALID;
+       current_speed = SPEED_UNKNOWN;
+       current_duplex = DUPLEX_UNKNOWN;
        tp->link_config.rmt_adv = 0;
 
        err |= tg3_readphy(tp, MII_BMSR, &bmsr);
@@ -9251,12 +9256,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
        }
 
        if (!tg3_flag(tp, USE_PHYLIB)) {
-               if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
+               if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
                        tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
-                       tp->link_config.speed = tp->link_config.orig_speed;
-                       tp->link_config.duplex = tp->link_config.orig_duplex;
-                       tp->link_config.autoneg = tp->link_config.orig_autoneg;
-               }
 
                err = tg3_setup_phy(tp, 0);
                if (err)
@@ -9681,7 +9682,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
        }
 
        err = request_irq(tnapi->irq_vec, tg3_test_isr,
-                         IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, tnapi);
+                         IRQF_SHARED, dev->name, tnapi);
        if (err)
                return err;
 
@@ -10514,8 +10515,8 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                                cmd->eth_tp_mdix = ETH_TP_MDI;
                }
        } else {
-               ethtool_cmd_speed_set(cmd, SPEED_INVALID);
-               cmd->duplex = DUPLEX_INVALID;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
                cmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
        }
        cmd->phy_address = tp->phy_addr;
@@ -10597,18 +10598,14 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (cmd->autoneg == AUTONEG_ENABLE) {
                tp->link_config.advertising = (cmd->advertising |
                                              ADVERTISED_Autoneg);
-               tp->link_config.speed = SPEED_INVALID;
-               tp->link_config.duplex = DUPLEX_INVALID;
+               tp->link_config.speed = SPEED_UNKNOWN;
+               tp->link_config.duplex = DUPLEX_UNKNOWN;
        } else {
                tp->link_config.advertising = 0;
                tp->link_config.speed = speed;
                tp->link_config.duplex = cmd->duplex;
        }
 
-       tp->link_config.orig_speed = tp->link_config.speed;
-       tp->link_config.orig_duplex = tp->link_config.duplex;
-       tp->link_config.orig_autoneg = tp->link_config.autoneg;
-
        if (netif_running(dev))
                tg3_setup_phy(tp, 1);
 
@@ -10855,10 +10852,10 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
                        if (!epause->autoneg)
                                tg3_setup_flow_control(tp, 0, 0);
                } else {
-                       tp->link_config.orig_advertising &=
+                       tp->link_config.advertising &=
                                        ~(ADVERTISED_Pause |
                                          ADVERTISED_Asym_Pause);
-                       tp->link_config.orig_advertising |= newadv;
+                       tp->link_config.advertising |= newadv;
                }
        } else {
                int irq_sync = 0;
@@ -13350,14 +13347,11 @@ static void __devinit tg3_phy_init_link_config(struct tg3 *tp)
                adv |= ADVERTISED_FIBRE;
 
        tp->link_config.advertising = adv;
-       tp->link_config.speed = SPEED_INVALID;
-       tp->link_config.duplex = DUPLEX_INVALID;
+       tp->link_config.speed = SPEED_UNKNOWN;
+       tp->link_config.duplex = DUPLEX_UNKNOWN;
        tp->link_config.autoneg = AUTONEG_ENABLE;
-       tp->link_config.active_speed = SPEED_INVALID;
-       tp->link_config.active_duplex = DUPLEX_INVALID;
-       tp->link_config.orig_speed = SPEED_INVALID;
-       tp->link_config.orig_duplex = DUPLEX_INVALID;
-       tp->link_config.orig_autoneg = AUTONEG_INVALID;
+       tp->link_config.active_speed = SPEED_UNKNOWN;
+       tp->link_config.active_duplex = DUPLEX_UNKNOWN;
 }
 
 static int __devinit tg3_phy_probe(struct tg3 *tp)
@@ -13899,6 +13893,83 @@ static struct pci_dev * __devinit tg3_find_peer(struct tg3 *tp)
        return peer;
 }
 
+static void __devinit tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg)
+{
+       tp->pci_chip_rev_id = misc_ctrl_reg >> MISC_HOST_CTRL_CHIPREV_SHIFT;
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) {
+               u32 reg;
+
+               /* All devices that use the alternate
+                * ASIC REV location have a CPMU.
+                */
+               tg3_flag_set(tp, CPMU_PRESENT);
+
+               if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720)
+                       reg = TG3PCI_GEN2_PRODID_ASICREV;
+               else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57762 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57766 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57782 ||
+                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57786)
+                       reg = TG3PCI_GEN15_PRODID_ASICREV;
+               else
+                       reg = TG3PCI_PRODID_ASICREV;
+
+               pci_read_config_dword(tp->pdev, reg, &tp->pci_chip_rev_id);
+       }
+
+       /* Wrong chip ID in 5752 A0. This code can be removed later
+        * as A0 is not in production.
+        */
+       if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW)
+               tp->pci_chip_rev_id = CHIPREV_ID_5752_A0;
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+               tg3_flag_set(tp, 5717_PLUS);
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766)
+               tg3_flag_set(tp, 57765_CLASS);
+
+       if (tg3_flag(tp, 57765_CLASS) || tg3_flag(tp, 5717_PLUS))
+               tg3_flag_set(tp, 57765_PLUS);
+
+       /* Intentionally exclude ASIC_REV_5906 */
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
+           tg3_flag(tp, 57765_PLUS))
+               tg3_flag_set(tp, 5755_PLUS);
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)
+               tg3_flag_set(tp, 5780_CLASS);
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
+           tg3_flag(tp, 5755_PLUS) ||
+           tg3_flag(tp, 5780_CLASS))
+               tg3_flag_set(tp, 5750_PLUS);
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+           tg3_flag(tp, 5750_PLUS))
+               tg3_flag_set(tp, 5705_PLUS);
+}
+
 static int __devinit tg3_get_invariants(struct tg3 *tp)
 {
        u32 misc_ctrl_reg;
@@ -13930,43 +14001,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
                               tp->misc_host_ctrl);
 
-       tp->pci_chip_rev_id = (misc_ctrl_reg >>
-                              MISC_HOST_CTRL_CHIPREV_SHIFT);
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) {
-               u32 prod_id_asic_rev;
-
-               if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 ||
-                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
-                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
-                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720)
-                       pci_read_config_dword(tp->pdev,
-                                             TG3PCI_GEN2_PRODID_ASICREV,
-                                             &prod_id_asic_rev);
-               else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57762 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57766 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57782 ||
-                        tp->pdev->device == TG3PCI_DEVICE_TIGON3_57786)
-                       pci_read_config_dword(tp->pdev,
-                                             TG3PCI_GEN15_PRODID_ASICREV,
-                                             &prod_id_asic_rev);
-               else
-                       pci_read_config_dword(tp->pdev, TG3PCI_PRODID_ASICREV,
-                                             &prod_id_asic_rev);
-
-               tp->pci_chip_rev_id = prod_id_asic_rev;
-       }
-
-       /* Wrong chip ID in 5752 A0. This code can be removed later
-        * as A0 is not in production.
-        */
-       if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW)
-               tp->pci_chip_rev_id = CHIPREV_ID_5752_A0;
+       tg3_detect_asic_rev(tp, misc_ctrl_reg);
 
        /* If we have 5702/03 A1 or A2 on certain ICH chipsets,
         * we need to disable memory and use config. cycles
@@ -14064,9 +14099,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
         * Any tg3 device found behind the bridge will also need the 40-bit
         * DMA workaround.
         */
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) {
-               tg3_flag_set(tp, 5780_CLASS);
+       if (tg3_flag(tp, 5780_CLASS)) {
                tg3_flag_set(tp, 40BIT_DMA_BUG);
                tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI);
        } else {
@@ -14092,39 +14125,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)
                tp->pdev_peer = tg3_find_peer(tp);
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
-               tg3_flag_set(tp, 5717_PLUS);
-
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766)
-               tg3_flag_set(tp, 57765_CLASS);
-
-       if (tg3_flag(tp, 57765_CLASS) || tg3_flag(tp, 5717_PLUS))
-               tg3_flag_set(tp, 57765_PLUS);
-
-       /* Intentionally exclude ASIC_REV_5906 */
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
-           tg3_flag(tp, 57765_PLUS))
-               tg3_flag_set(tp, 5755_PLUS);
-
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
-           tg3_flag(tp, 5755_PLUS) ||
-           tg3_flag(tp, 5780_CLASS))
-               tg3_flag_set(tp, 5750_PLUS);
-
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
-           tg3_flag(tp, 5750_PLUS))
-               tg3_flag_set(tp, 5705_PLUS);
-
        /* Determine TSO capabilities */
        if (tp->pci_chip_rev_id == CHIPREV_ID_5719_A0)
                ; /* Do nothing. HW bug. */
@@ -14454,13 +14454,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
                tg3_ape_lock_init(tp);
        }
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
-           tg3_flag(tp, 57765_PLUS))
-               tg3_flag_set(tp, CPMU_PRESENT);
-
        /* Set up tp->grc_local_ctrl before calling
         * tg3_pwrsrc_switch_to_vmain().  GPIO1 driven high
         * will bring 5700's external PHY out of reset.