aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-08-02 07:26:07 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-02 18:46:33 -0400
commitf07e9af31e6e1bf2a499e1f52cbf0982619fa611 (patch)
tree53add5d2a93f239b916b8a69fcd91093c56f8894 /drivers/net/tg3.c
parent80096068bc21420ba4d690341a3c70c49017d167 (diff)
tg3: Migrate tg3_flags to phy_flags
This patch moves most of the phy related flag definitions over to the phyflags member and changes the code accordingly. Reviewed-by: Benjamin Li <benli@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c275
1 files changed, 141 insertions, 134 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e0ff49bb8d01..a9d61ab55198 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -879,7 +879,7 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
879 unsigned int loops; 879 unsigned int loops;
880 int ret; 880 int ret;
881 881
882 if ((tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) && 882 if ((tp->phy_flags & TG3_PHYFLG_IS_FET) &&
883 (reg == MII_TG3_CTRL || reg == MII_TG3_AUX_CTRL)) 883 (reg == MII_TG3_CTRL || reg == MII_TG3_AUX_CTRL))
884 return 0; 884 return 0;
885 885
@@ -1175,7 +1175,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1175 case PHY_ID_BCMAC131: 1175 case PHY_ID_BCMAC131:
1176 phydev->interface = PHY_INTERFACE_MODE_MII; 1176 phydev->interface = PHY_INTERFACE_MODE_MII;
1177 phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE; 1177 phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE;
1178 tp->tg3_flags3 |= TG3_FLG3_PHY_IS_FET; 1178 tp->phy_flags |= TG3_PHYFLG_IS_FET;
1179 break; 1179 break;
1180 } 1180 }
1181 1181
@@ -1268,7 +1268,7 @@ static void tg3_ump_link_report(struct tg3 *tp)
1268 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 4, val); 1268 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 4, val);
1269 1269
1270 val = 0; 1270 val = 0;
1271 if (!(tp->tg3_flags2 & TG3_FLG2_MII_SERDES)) { 1271 if (!(tp->phy_flags & TG3_PHYFLG_MII_SERDES)) {
1272 if (!tg3_readphy(tp, MII_CTRL1000, &reg)) 1272 if (!tg3_readphy(tp, MII_CTRL1000, &reg))
1273 val = reg << 16; 1273 val = reg << 16;
1274 if (!tg3_readphy(tp, MII_STAT1000, &reg)) 1274 if (!tg3_readphy(tp, MII_STAT1000, &reg))
@@ -1376,7 +1376,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv)
1376 1376
1377 if (autoneg == AUTONEG_ENABLE && 1377 if (autoneg == AUTONEG_ENABLE &&
1378 (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG)) { 1378 (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG)) {
1379 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) 1379 if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES)
1380 flowctrl = tg3_resolve_flowctrl_1000X(lcladv, rmtadv); 1380 flowctrl = tg3_resolve_flowctrl_1000X(lcladv, rmtadv);
1381 else 1381 else
1382 flowctrl = mii_resolve_flowctrl_fdx(lcladv, rmtadv); 1382 flowctrl = mii_resolve_flowctrl_fdx(lcladv, rmtadv);
@@ -1490,7 +1490,7 @@ static int tg3_phy_init(struct tg3 *tp)
1490{ 1490{
1491 struct phy_device *phydev; 1491 struct phy_device *phydev;
1492 1492
1493 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) 1493 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)
1494 return 0; 1494 return 0;
1495 1495
1496 /* Bring the PHY back to a known state. */ 1496 /* Bring the PHY back to a known state. */
@@ -1510,7 +1510,7 @@ static int tg3_phy_init(struct tg3 *tp)
1510 switch (phydev->interface) { 1510 switch (phydev->interface) {
1511 case PHY_INTERFACE_MODE_GMII: 1511 case PHY_INTERFACE_MODE_GMII:
1512 case PHY_INTERFACE_MODE_RGMII: 1512 case PHY_INTERFACE_MODE_RGMII:
1513 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { 1513 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
1514 phydev->supported &= (PHY_GBIT_FEATURES | 1514 phydev->supported &= (PHY_GBIT_FEATURES |
1515 SUPPORTED_Pause | 1515 SUPPORTED_Pause |
1516 SUPPORTED_Asym_Pause); 1516 SUPPORTED_Asym_Pause);
@@ -1527,7 +1527,7 @@ static int tg3_phy_init(struct tg3 *tp)
1527 return -EINVAL; 1527 return -EINVAL;
1528 } 1528 }
1529 1529
1530 tp->tg3_flags3 |= TG3_FLG3_PHY_CONNECTED; 1530 tp->phy_flags |= TG3_PHYFLG_IS_CONNECTED;
1531 1531
1532 phydev->advertising = phydev->supported; 1532 phydev->advertising = phydev->supported;
1533 1533
@@ -1538,7 +1538,7 @@ static void tg3_phy_start(struct tg3 *tp)
1538{ 1538{
1539 struct phy_device *phydev; 1539 struct phy_device *phydev;
1540 1540
1541 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 1541 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
1542 return; 1542 return;
1543 1543
1544 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 1544 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
@@ -1558,7 +1558,7 @@ static void tg3_phy_start(struct tg3 *tp)
1558 1558
1559static void tg3_phy_stop(struct tg3 *tp) 1559static void tg3_phy_stop(struct tg3 *tp)
1560{ 1560{
1561 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 1561 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
1562 return; 1562 return;
1563 1563
1564 phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 1564 phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
@@ -1566,9 +1566,9 @@ static void tg3_phy_stop(struct tg3 *tp)
1566 1566
1567static void tg3_phy_fini(struct tg3 *tp) 1567static void tg3_phy_fini(struct tg3 *tp)
1568{ 1568{
1569 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) { 1569 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
1570 phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 1570 phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
1571 tp->tg3_flags3 &= ~TG3_FLG3_PHY_CONNECTED; 1571 tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED;
1572 } 1572 }
1573} 1573}
1574 1574
@@ -1610,10 +1610,10 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable)
1610 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) || 1610 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
1611 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || 1611 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
1612 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) && 1612 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) &&
1613 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) 1613 (tp->phy_flags & TG3_PHYFLG_MII_SERDES)))
1614 return; 1614 return;
1615 1615
1616 if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 1616 if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
1617 tg3_phy_fet_toggle_apd(tp, enable); 1617 tg3_phy_fet_toggle_apd(tp, enable);
1618 return; 1618 return;
1619 } 1619 }
@@ -1644,10 +1644,10 @@ static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable)
1644 u32 phy; 1644 u32 phy;
1645 1645
1646 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) || 1646 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
1647 (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) 1647 (tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
1648 return; 1648 return;
1649 1649
1650 if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 1650 if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
1651 u32 ephy; 1651 u32 ephy;
1652 1652
1653 if (!tg3_readphy(tp, MII_TG3_FET_TEST, &ephy)) { 1653 if (!tg3_readphy(tp, MII_TG3_FET_TEST, &ephy)) {
@@ -1683,7 +1683,7 @@ static void tg3_phy_set_wirespeed(struct tg3 *tp)
1683{ 1683{
1684 u32 val; 1684 u32 val;
1685 1685
1686 if (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) 1686 if (tp->phy_flags & TG3_PHYFLG_NO_ETH_WIRE_SPEED)
1687 return; 1687 return;
1688 1688
1689 if (!tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007) && 1689 if (!tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007) &&
@@ -1984,37 +1984,37 @@ static int tg3_phy_reset(struct tg3 *tp)
1984 1984
1985 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || 1985 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
1986 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) && 1986 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) &&
1987 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)) 1987 (tp->phy_flags & TG3_PHYFLG_MII_SERDES))
1988 return 0; 1988 return 0;
1989 1989
1990 tg3_phy_apply_otp(tp); 1990 tg3_phy_apply_otp(tp);
1991 1991
1992 if (tp->tg3_flags3 & TG3_FLG3_PHY_ENABLE_APD) 1992 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
1993 tg3_phy_toggle_apd(tp, true); 1993 tg3_phy_toggle_apd(tp, true);
1994 else 1994 else
1995 tg3_phy_toggle_apd(tp, false); 1995 tg3_phy_toggle_apd(tp, false);
1996 1996
1997out: 1997out:
1998 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1998 if (tp->phy_flags & TG3_PHYFLG_ADC_BUG) {
1999 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1999 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
2000 tg3_phydsp_write(tp, 0x201f, 0x2aaa); 2000 tg3_phydsp_write(tp, 0x201f, 0x2aaa);
2001 tg3_phydsp_write(tp, 0x000a, 0x0323); 2001 tg3_phydsp_write(tp, 0x000a, 0x0323);
2002 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 2002 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
2003 } 2003 }
2004 if (tp->tg3_flags2 & TG3_FLG2_PHY_5704_A0_BUG) { 2004 if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) {
2005 tg3_writephy(tp, MII_TG3_MISC_SHDW, 0x8d68); 2005 tg3_writephy(tp, MII_TG3_MISC_SHDW, 0x8d68);
2006 tg3_writephy(tp, MII_TG3_MISC_SHDW, 0x8d68); 2006 tg3_writephy(tp, MII_TG3_MISC_SHDW, 0x8d68);
2007 } 2007 }
2008 if (tp->tg3_flags2 & TG3_FLG2_PHY_BER_BUG) { 2008 if (tp->phy_flags & TG3_PHYFLG_BER_BUG) {
2009 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 2009 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
2010 tg3_phydsp_write(tp, 0x000a, 0x310b); 2010 tg3_phydsp_write(tp, 0x000a, 0x310b);
2011 tg3_phydsp_write(tp, 0x201f, 0x9506); 2011 tg3_phydsp_write(tp, 0x201f, 0x9506);
2012 tg3_phydsp_write(tp, 0x401f, 0x14e2); 2012 tg3_phydsp_write(tp, 0x401f, 0x14e2);
2013 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 2013 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
2014 } else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) { 2014 } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) {
2015 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 2015 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
2016 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); 2016 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
2017 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADJUST_TRIM) { 2017 if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) {
2018 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); 2018 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b);
2019 tg3_writephy(tp, MII_TG3_TEST1, 2019 tg3_writephy(tp, MII_TG3_TEST1,
2020 MII_TG3_TEST1_TRIM_EN | 0x4); 2020 MII_TG3_TEST1_TRIM_EN | 0x4);
@@ -2199,7 +2199,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2199{ 2199{
2200 u32 val; 2200 u32 val;
2201 2201
2202 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 2202 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
2203 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 2203 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
2204 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); 2204 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL);
2205 u32 serdes_cfg = tr32(MAC_SERDES_CFG); 2205 u32 serdes_cfg = tr32(MAC_SERDES_CFG);
@@ -2218,7 +2218,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2218 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); 2218 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ);
2219 udelay(40); 2219 udelay(40);
2220 return; 2220 return;
2221 } else if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 2221 } else if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
2222 u32 phytest; 2222 u32 phytest;
2223 if (!tg3_readphy(tp, MII_TG3_FET_TEST, &phytest)) { 2223 if (!tg3_readphy(tp, MII_TG3_FET_TEST, &phytest)) {
2224 u32 phy; 2224 u32 phy;
@@ -2255,7 +2255,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2255 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 2255 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
2256 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || 2256 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
2257 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && 2257 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
2258 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) 2258 (tp->phy_flags & TG3_PHYFLG_MII_SERDES)))
2259 return; 2259 return;
2260 2260
2261 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || 2261 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX ||
@@ -2558,7 +2558,7 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2558 2558
2559 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 2559 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
2560 do_low_power = false; 2560 do_low_power = false;
2561 if ((tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) && 2561 if ((tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) &&
2562 !(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) { 2562 !(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
2563 struct phy_device *phydev; 2563 struct phy_device *phydev;
2564 u32 phyid, advertising; 2564 u32 phyid, advertising;
@@ -2611,7 +2611,7 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2611 tp->link_config.orig_autoneg = tp->link_config.autoneg; 2611 tp->link_config.orig_autoneg = tp->link_config.autoneg;
2612 } 2612 }
2613 2613
2614 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) { 2614 if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES)) {
2615 tp->link_config.speed = SPEED_10; 2615 tp->link_config.speed = SPEED_10;
2616 tp->link_config.duplex = DUPLEX_HALF; 2616 tp->link_config.duplex = DUPLEX_HALF;
2617 tp->link_config.autoneg = AUTONEG_ENABLE; 2617 tp->link_config.autoneg = AUTONEG_ENABLE;
@@ -2644,13 +2644,13 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2644 if (device_should_wake) { 2644 if (device_should_wake) {
2645 u32 mac_mode; 2645 u32 mac_mode;
2646 2646
2647 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 2647 if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) {
2648 if (do_low_power) { 2648 if (do_low_power) {
2649 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a); 2649 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a);
2650 udelay(40); 2650 udelay(40);
2651 } 2651 }
2652 2652
2653 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) 2653 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
2654 mac_mode = MAC_MODE_PORT_MODE_GMII; 2654 mac_mode = MAC_MODE_PORT_MODE_GMII;
2655 else 2655 else
2656 mac_mode = MAC_MODE_PORT_MODE_MII; 2656 mac_mode = MAC_MODE_PORT_MODE_MII;
@@ -2818,7 +2818,7 @@ static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8
2818 break; 2818 break;
2819 2819
2820 default: 2820 default:
2821 if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 2821 if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
2822 *speed = (val & MII_TG3_AUX_STAT_100) ? SPEED_100 : 2822 *speed = (val & MII_TG3_AUX_STAT_100) ? SPEED_100 :
2823 SPEED_10; 2823 SPEED_10;
2824 *duplex = (val & MII_TG3_AUX_STAT_FULL) ? DUPLEX_FULL : 2824 *duplex = (val & MII_TG3_AUX_STAT_FULL) ? DUPLEX_FULL :
@@ -2849,7 +2849,7 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
2849 2849
2850 tg3_writephy(tp, MII_ADVERTISE, new_adv); 2850 tg3_writephy(tp, MII_ADVERTISE, new_adv);
2851 } else if (tp->link_config.speed == SPEED_INVALID) { 2851 } else if (tp->link_config.speed == SPEED_INVALID) {
2852 if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) 2852 if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
2853 tp->link_config.advertising &= 2853 tp->link_config.advertising &=
2854 ~(ADVERTISED_1000baseT_Half | 2854 ~(ADVERTISED_1000baseT_Half |
2855 ADVERTISED_1000baseT_Full); 2855 ADVERTISED_1000baseT_Full);
@@ -2875,7 +2875,7 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
2875 new_adv |= MII_TG3_CTRL_ADV_1000_HALF; 2875 new_adv |= MII_TG3_CTRL_ADV_1000_HALF;
2876 if (tp->link_config.advertising & ADVERTISED_1000baseT_Full) 2876 if (tp->link_config.advertising & ADVERTISED_1000baseT_Full)
2877 new_adv |= MII_TG3_CTRL_ADV_1000_FULL; 2877 new_adv |= MII_TG3_CTRL_ADV_1000_FULL;
2878 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY) && 2878 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY) &&
2879 (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || 2879 (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 ||
2880 tp->pci_chip_rev_id == CHIPREV_ID_5701_B0)) 2880 tp->pci_chip_rev_id == CHIPREV_ID_5701_B0))
2881 new_adv |= (MII_TG3_CTRL_AS_MASTER | 2881 new_adv |= (MII_TG3_CTRL_AS_MASTER |
@@ -3006,7 +3006,7 @@ static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
3006 3006
3007 if ((adv_reg & all_mask) != all_mask) 3007 if ((adv_reg & all_mask) != all_mask)
3008 return 0; 3008 return 0;
3009 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { 3009 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
3010 u32 tg3_ctrl; 3010 u32 tg3_ctrl;
3011 3011
3012 all_mask = 0; 3012 all_mask = 0;
@@ -3143,9 +3143,9 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
3143 tg3_readphy(tp, MII_TG3_ISTAT, &dummy); 3143 tg3_readphy(tp, MII_TG3_ISTAT, &dummy);
3144 tg3_readphy(tp, MII_TG3_ISTAT, &dummy); 3144 tg3_readphy(tp, MII_TG3_ISTAT, &dummy);
3145 3145
3146 if (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) 3146 if (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT)
3147 tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG); 3147 tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG);
3148 else if (!(tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET)) 3148 else if (!(tp->phy_flags & TG3_PHYFLG_IS_FET))
3149 tg3_writephy(tp, MII_TG3_IMASK, ~0); 3149 tg3_writephy(tp, MII_TG3_IMASK, ~0);
3150 3150
3151 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 3151 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -3161,7 +3161,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
3161 current_speed = SPEED_INVALID; 3161 current_speed = SPEED_INVALID;
3162 current_duplex = DUPLEX_INVALID; 3162 current_duplex = DUPLEX_INVALID;
3163 3163
3164 if (tp->tg3_flags2 & TG3_FLG2_CAPACITIVE_COUPLING) { 3164 if (tp->phy_flags & TG3_PHYFLG_CAPACITIVE_COUPLING) {
3165 u32 val; 3165 u32 val;
3166 3166
3167 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4007); 3167 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4007);
@@ -3255,7 +3255,7 @@ relink:
3255 tp->mac_mode |= MAC_MODE_PORT_MODE_MII; 3255 tp->mac_mode |= MAC_MODE_PORT_MODE_MII;
3256 else 3256 else
3257 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; 3257 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
3258 } else if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) 3258 } else if (tp->phy_flags & TG3_PHYFLG_IS_FET)
3259 tp->mac_mode |= MAC_MODE_PORT_MODE_MII; 3259 tp->mac_mode |= MAC_MODE_PORT_MODE_MII;
3260 else 3260 else
3261 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; 3261 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
@@ -3806,7 +3806,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
3806 expected_sg_dig_ctrl |= SG_DIG_ASYM_PAUSE; 3806 expected_sg_dig_ctrl |= SG_DIG_ASYM_PAUSE;
3807 3807
3808 if (sg_dig_ctrl != expected_sg_dig_ctrl) { 3808 if (sg_dig_ctrl != expected_sg_dig_ctrl) {
3809 if ((tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && 3809 if ((tp->phy_flags & TG3_PHYFLG_PARALLEL_DETECT) &&
3810 tp->serdes_counter && 3810 tp->serdes_counter &&
3811 ((mac_status & (MAC_STATUS_PCS_SYNCED | 3811 ((mac_status & (MAC_STATUS_PCS_SYNCED |
3812 MAC_STATUS_RCVD_CFG)) == 3812 MAC_STATUS_RCVD_CFG)) ==
@@ -3823,7 +3823,7 @@ restart_autoneg:
3823 tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); 3823 tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl);
3824 3824
3825 tp->serdes_counter = SERDES_AN_TIMEOUT_5704S; 3825 tp->serdes_counter = SERDES_AN_TIMEOUT_5704S;
3826 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 3826 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
3827 } else if (mac_status & (MAC_STATUS_PCS_SYNCED | 3827 } else if (mac_status & (MAC_STATUS_PCS_SYNCED |
3828 MAC_STATUS_SIGNAL_DET)) { 3828 MAC_STATUS_SIGNAL_DET)) {
3829 sg_dig_status = tr32(SG_DIG_STATUS); 3829 sg_dig_status = tr32(SG_DIG_STATUS);
@@ -3846,7 +3846,7 @@ restart_autoneg:
3846 tg3_setup_flow_control(tp, local_adv, remote_adv); 3846 tg3_setup_flow_control(tp, local_adv, remote_adv);
3847 current_link_up = 1; 3847 current_link_up = 1;
3848 tp->serdes_counter = 0; 3848 tp->serdes_counter = 0;
3849 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 3849 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
3850 } else if (!(sg_dig_status & SG_DIG_AUTONEG_COMPLETE)) { 3850 } else if (!(sg_dig_status & SG_DIG_AUTONEG_COMPLETE)) {
3851 if (tp->serdes_counter) 3851 if (tp->serdes_counter)
3852 tp->serdes_counter--; 3852 tp->serdes_counter--;
@@ -3873,8 +3873,8 @@ restart_autoneg:
3873 !(mac_status & MAC_STATUS_RCVD_CFG)) { 3873 !(mac_status & MAC_STATUS_RCVD_CFG)) {
3874 tg3_setup_flow_control(tp, 0, 0); 3874 tg3_setup_flow_control(tp, 0, 0);
3875 current_link_up = 1; 3875 current_link_up = 1;
3876 tp->tg3_flags2 |= 3876 tp->phy_flags |=
3877 TG3_FLG2_PARALLEL_DETECT; 3877 TG3_PHYFLG_PARALLEL_DETECT;
3878 tp->serdes_counter = 3878 tp->serdes_counter =
3879 SERDES_PARALLEL_DET_TIMEOUT; 3879 SERDES_PARALLEL_DET_TIMEOUT;
3880 } else 3880 } else
@@ -3883,7 +3883,7 @@ restart_autoneg:
3883 } 3883 }
3884 } else { 3884 } else {
3885 tp->serdes_counter = SERDES_AN_TIMEOUT_5704S; 3885 tp->serdes_counter = SERDES_AN_TIMEOUT_5704S;
3886 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 3886 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
3887 } 3887 }
3888 3888
3889out: 3889out:
@@ -4100,7 +4100,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
4100 err |= tg3_readphy(tp, MII_BMCR, &bmcr); 4100 err |= tg3_readphy(tp, MII_BMCR, &bmcr);
4101 4101
4102 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && 4102 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset &&
4103 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) { 4103 (tp->phy_flags & TG3_PHYFLG_PARALLEL_DETECT)) {
4104 /* do nothing, just check for link up at the end */ 4104 /* do nothing, just check for link up at the end */
4105 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { 4105 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) {
4106 u32 adv, new_adv; 4106 u32 adv, new_adv;
@@ -4125,7 +4125,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
4125 4125
4126 tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED); 4126 tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
4127 tp->serdes_counter = SERDES_AN_TIMEOUT_5714S; 4127 tp->serdes_counter = SERDES_AN_TIMEOUT_5714S;
4128 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 4128 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4129 4129
4130 return err; 4130 return err;
4131 } 4131 }
@@ -4170,7 +4170,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
4170 else 4170 else
4171 bmsr &= ~BMSR_LSTATUS; 4171 bmsr &= ~BMSR_LSTATUS;
4172 } 4172 }
4173 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 4173 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4174 } 4174 }
4175 } 4175 }
4176 4176
@@ -4225,7 +4225,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
4225 netif_carrier_on(tp->dev); 4225 netif_carrier_on(tp->dev);
4226 else { 4226 else {
4227 netif_carrier_off(tp->dev); 4227 netif_carrier_off(tp->dev);
4228 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 4228 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4229 } 4229 }
4230 tg3_link_report(tp); 4230 tg3_link_report(tp);
4231 } 4231 }
@@ -4267,12 +4267,12 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp)
4267 bmcr &= ~BMCR_ANENABLE; 4267 bmcr &= ~BMCR_ANENABLE;
4268 bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX; 4268 bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX;
4269 tg3_writephy(tp, MII_BMCR, bmcr); 4269 tg3_writephy(tp, MII_BMCR, bmcr);
4270 tp->tg3_flags2 |= TG3_FLG2_PARALLEL_DETECT; 4270 tp->phy_flags |= TG3_PHYFLG_PARALLEL_DETECT;
4271 } 4271 }
4272 } 4272 }
4273 } else if (netif_carrier_ok(tp->dev) && 4273 } else if (netif_carrier_ok(tp->dev) &&
4274 (tp->link_config.autoneg == AUTONEG_ENABLE) && 4274 (tp->link_config.autoneg == AUTONEG_ENABLE) &&
4275 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) { 4275 (tp->phy_flags & TG3_PHYFLG_PARALLEL_DETECT)) {
4276 u32 phy2; 4276 u32 phy2;
4277 4277
4278 /* Select expansion interrupt status register */ 4278 /* Select expansion interrupt status register */
@@ -4286,7 +4286,7 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp)
4286 tg3_readphy(tp, MII_BMCR, &bmcr); 4286 tg3_readphy(tp, MII_BMCR, &bmcr);
4287 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANENABLE); 4287 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANENABLE);
4288 4288
4289 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 4289 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4290 4290
4291 } 4291 }
4292 } 4292 }
@@ -4296,9 +4296,9 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
4296{ 4296{
4297 int err; 4297 int err;
4298 4298
4299 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 4299 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
4300 err = tg3_setup_fiber_phy(tp, force_reset); 4300 err = tg3_setup_fiber_phy(tp, force_reset);
4301 else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) 4301 else if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
4302 err = tg3_setup_fiber_mii_phy(tp, force_reset); 4302 err = tg3_setup_fiber_mii_phy(tp, force_reset);
4303 else 4303 else
4304 err = tg3_setup_copper_phy(tp, force_reset); 4304 err = tg3_setup_copper_phy(tp, force_reset);
@@ -7066,10 +7066,10 @@ static int tg3_chip_reset(struct tg3 *tp)
7066 tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); 7066 tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
7067 } 7067 }
7068 7068
7069 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 7069 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
7070 tp->mac_mode = MAC_MODE_PORT_MODE_TBI; 7070 tp->mac_mode = MAC_MODE_PORT_MODE_TBI;
7071 tw32_f(MAC_MODE, tp->mac_mode); 7071 tw32_f(MAC_MODE, tp->mac_mode);
7072 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 7072 } else if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) {
7073 tp->mac_mode = MAC_MODE_PORT_MODE_GMII; 7073 tp->mac_mode = MAC_MODE_PORT_MODE_GMII;
7074 tw32_f(MAC_MODE, tp->mac_mode); 7074 tw32_f(MAC_MODE, tp->mac_mode);
7075 } else if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { 7075 } else if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
@@ -8073,8 +8073,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8073 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 8073 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
8074 tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE); 8074 tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE);
8075 8075
8076 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 8076 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) {
8077 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 8077 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
8078 /* reset to prevent losing 1st rx packet intermittently */ 8078 /* reset to prevent losing 1st rx packet intermittently */
8079 tw32_f(MAC_RX_MODE, RX_MODE_RESET); 8079 tw32_f(MAC_RX_MODE, RX_MODE_RESET);
8080 udelay(10); 8080 udelay(10);
@@ -8087,7 +8087,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8087 tp->mac_mode |= MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | 8087 tp->mac_mode |= MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE |
8088 MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; 8088 MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE;
8089 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && 8089 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) &&
8090 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 8090 !(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
8091 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) 8091 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
8092 tp->mac_mode |= MAC_MODE_LINK_POLARITY; 8092 tp->mac_mode |= MAC_MODE_LINK_POLARITY;
8093 tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); 8093 tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR);
@@ -8272,16 +8272,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8272 tw32(MAC_LED_CTRL, tp->led_ctrl); 8272 tw32(MAC_LED_CTRL, tp->led_ctrl);
8273 8273
8274 tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); 8274 tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
8275 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 8275 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
8276 tw32_f(MAC_RX_MODE, RX_MODE_RESET); 8276 tw32_f(MAC_RX_MODE, RX_MODE_RESET);
8277 udelay(10); 8277 udelay(10);
8278 } 8278 }
8279 tw32_f(MAC_RX_MODE, tp->rx_mode); 8279 tw32_f(MAC_RX_MODE, tp->rx_mode);
8280 udelay(10); 8280 udelay(10);
8281 8281
8282 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 8282 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
8283 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) && 8283 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) &&
8284 !(tp->tg3_flags2 & TG3_FLG2_SERDES_PREEMPHASIS)) { 8284 !(tp->phy_flags & TG3_PHYFLG_SERDES_PREEMPHASIS)) {
8285 /* Set drive transmission level to 1.2V */ 8285 /* Set drive transmission level to 1.2V */
8286 /* only if the signal pre-emphasis bit is not set */ 8286 /* only if the signal pre-emphasis bit is not set */
8287 val = tr32(MAC_SERDES_CFG); 8287 val = tr32(MAC_SERDES_CFG);
@@ -8303,12 +8303,12 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8303 tw32_f(MAC_LOW_WMARK_MAX_RX_FRAME, val); 8303 tw32_f(MAC_LOW_WMARK_MAX_RX_FRAME, val);
8304 8304
8305 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && 8305 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
8306 (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 8306 (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) {
8307 /* Use hardware link auto-negotiation */ 8307 /* Use hardware link auto-negotiation */
8308 tp->tg3_flags2 |= TG3_FLG2_HW_AUTONEG; 8308 tp->tg3_flags2 |= TG3_FLG2_HW_AUTONEG;
8309 } 8309 }
8310 8310
8311 if ((tp->tg3_flags2 & TG3_FLG2_MII_SERDES) && 8311 if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
8312 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) { 8312 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) {
8313 u32 tmp; 8313 u32 tmp;
8314 8314
@@ -8331,8 +8331,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
8331 if (err) 8331 if (err)
8332 return err; 8332 return err;
8333 8333
8334 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 8334 if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
8335 !(tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET)) { 8335 !(tp->phy_flags & TG3_PHYFLG_IS_FET)) {
8336 u32 tmp; 8336 u32 tmp;
8337 8337
8338 /* Clear CRC stats. */ 8338 /* Clear CRC stats. */
@@ -8507,7 +8507,7 @@ static void tg3_timer(unsigned long __opaque)
8507 mac_stat = tr32(MAC_STATUS); 8507 mac_stat = tr32(MAC_STATUS);
8508 8508
8509 phy_event = 0; 8509 phy_event = 0;
8510 if (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) { 8510 if (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) {
8511 if (mac_stat & MAC_STATUS_MI_INTERRUPT) 8511 if (mac_stat & MAC_STATUS_MI_INTERRUPT)
8512 phy_event = 1; 8512 phy_event = 1;
8513 } else if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED) 8513 } else if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED)
@@ -8539,7 +8539,7 @@ static void tg3_timer(unsigned long __opaque)
8539 } 8539 }
8540 tg3_setup_phy(tp, 0); 8540 tg3_setup_phy(tp, 0);
8541 } 8541 }
8542 } else if ((tp->tg3_flags2 & TG3_FLG2_MII_SERDES) && 8542 } else if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
8543 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { 8543 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
8544 tg3_serdes_parallel_detect(tp); 8544 tg3_serdes_parallel_detect(tp);
8545 } 8545 }
@@ -9069,7 +9069,7 @@ static u64 calc_crc_errors(struct tg3 *tp)
9069{ 9069{
9070 struct tg3_hw_stats *hw_stats = tp->hw_stats; 9070 struct tg3_hw_stats *hw_stats = tp->hw_stats;
9071 9071
9072 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 9072 if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
9073 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 9073 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
9074 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) { 9074 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) {
9075 u32 val; 9075 u32 val;
@@ -9566,7 +9566,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9566 9566
9567 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 9567 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
9568 struct phy_device *phydev; 9568 struct phy_device *phydev;
9569 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 9569 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
9570 return -EAGAIN; 9570 return -EAGAIN;
9571 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 9571 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
9572 return phy_ethtool_gset(phydev, cmd); 9572 return phy_ethtool_gset(phydev, cmd);
@@ -9574,11 +9574,11 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9574 9574
9575 cmd->supported = (SUPPORTED_Autoneg); 9575 cmd->supported = (SUPPORTED_Autoneg);
9576 9576
9577 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) 9577 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
9578 cmd->supported |= (SUPPORTED_1000baseT_Half | 9578 cmd->supported |= (SUPPORTED_1000baseT_Half |
9579 SUPPORTED_1000baseT_Full); 9579 SUPPORTED_1000baseT_Full);
9580 9580
9581 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) { 9581 if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES)) {
9582 cmd->supported |= (SUPPORTED_100baseT_Half | 9582 cmd->supported |= (SUPPORTED_100baseT_Half |
9583 SUPPORTED_100baseT_Full | 9583 SUPPORTED_100baseT_Full |
9584 SUPPORTED_10baseT_Half | 9584 SUPPORTED_10baseT_Half |
@@ -9609,7 +9609,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9609 9609
9610 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 9610 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
9611 struct phy_device *phydev; 9611 struct phy_device *phydev;
9612 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 9612 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
9613 return -EAGAIN; 9613 return -EAGAIN;
9614 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 9614 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
9615 return phy_ethtool_sset(phydev, cmd); 9615 return phy_ethtool_sset(phydev, cmd);
@@ -9629,11 +9629,11 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9629 ADVERTISED_Pause | 9629 ADVERTISED_Pause |
9630 ADVERTISED_Asym_Pause; 9630 ADVERTISED_Asym_Pause;
9631 9631
9632 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) 9632 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
9633 mask |= ADVERTISED_1000baseT_Half | 9633 mask |= ADVERTISED_1000baseT_Half |
9634 ADVERTISED_1000baseT_Full; 9634 ADVERTISED_1000baseT_Full;
9635 9635
9636 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) 9636 if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
9637 mask |= ADVERTISED_100baseT_Half | 9637 mask |= ADVERTISED_100baseT_Half |
9638 ADVERTISED_100baseT_Full | 9638 ADVERTISED_100baseT_Full |
9639 ADVERTISED_10baseT_Half | 9639 ADVERTISED_10baseT_Half |
@@ -9654,7 +9654,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9654 9654
9655 cmd->advertising &= mask; 9655 cmd->advertising &= mask;
9656 } else { 9656 } else {
9657 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) { 9657 if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES) {
9658 if (cmd->speed != SPEED_1000) 9658 if (cmd->speed != SPEED_1000)
9659 return -EINVAL; 9659 return -EINVAL;
9660 9660
@@ -9790,11 +9790,11 @@ static int tg3_nway_reset(struct net_device *dev)
9790 if (!netif_running(dev)) 9790 if (!netif_running(dev))
9791 return -EAGAIN; 9791 return -EAGAIN;
9792 9792
9793 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 9793 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
9794 return -EINVAL; 9794 return -EINVAL;
9795 9795
9796 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 9796 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
9797 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 9797 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
9798 return -EAGAIN; 9798 return -EAGAIN;
9799 r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 9799 r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]);
9800 } else { 9800 } else {
@@ -9805,7 +9805,7 @@ static int tg3_nway_reset(struct net_device *dev)
9805 tg3_readphy(tp, MII_BMCR, &bmcr); 9805 tg3_readphy(tp, MII_BMCR, &bmcr);
9806 if (!tg3_readphy(tp, MII_BMCR, &bmcr) && 9806 if (!tg3_readphy(tp, MII_BMCR, &bmcr) &&
9807 ((bmcr & BMCR_ANENABLE) || 9807 ((bmcr & BMCR_ANENABLE) ||
9808 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT))) { 9808 (tp->phy_flags & TG3_PHYFLG_PARALLEL_DETECT))) {
9809 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART | 9809 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART |
9810 BMCR_ANENABLE); 9810 BMCR_ANENABLE);
9811 r = 0; 9811 r = 0;
@@ -9940,7 +9940,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
9940 else 9940 else
9941 tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG; 9941 tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG;
9942 9942
9943 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) { 9943 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
9944 u32 oldadv = phydev->advertising & 9944 u32 oldadv = phydev->advertising &
9945 (ADVERTISED_Pause | ADVERTISED_Asym_Pause); 9945 (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
9946 if (oldadv != newadv) { 9946 if (oldadv != newadv) {
@@ -10269,7 +10269,7 @@ static int tg3_test_link(struct tg3 *tp)
10269 if (!netif_running(tp->dev)) 10269 if (!netif_running(tp->dev))
10270 return -ENODEV; 10270 return -ENODEV;
10271 10271
10272 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) 10272 if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES)
10273 max = TG3_SERDES_TIMEOUT_SEC; 10273 max = TG3_SERDES_TIMEOUT_SEC;
10274 else 10274 else
10275 max = TG3_COPPER_TIMEOUT_SEC; 10275 max = TG3_COPPER_TIMEOUT_SEC;
@@ -10631,7 +10631,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10631 MAC_MODE_PORT_INT_LPBACK; 10631 MAC_MODE_PORT_INT_LPBACK;
10632 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 10632 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
10633 mac_mode |= MAC_MODE_LINK_POLARITY; 10633 mac_mode |= MAC_MODE_LINK_POLARITY;
10634 if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) 10634 if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
10635 mac_mode |= MAC_MODE_PORT_MODE_MII; 10635 mac_mode |= MAC_MODE_PORT_MODE_MII;
10636 else 10636 else
10637 mac_mode |= MAC_MODE_PORT_MODE_GMII; 10637 mac_mode |= MAC_MODE_PORT_MODE_GMII;
@@ -10639,7 +10639,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10639 } else if (loopback_mode == TG3_PHY_LOOPBACK) { 10639 } else if (loopback_mode == TG3_PHY_LOOPBACK) {
10640 u32 val; 10640 u32 val;
10641 10641
10642 if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 10642 if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
10643 tg3_phy_fet_toggle_apd(tp, false); 10643 tg3_phy_fet_toggle_apd(tp, false);
10644 val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED100; 10644 val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED100;
10645 } else 10645 } else
@@ -10651,7 +10651,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10651 udelay(40); 10651 udelay(40);
10652 10652
10653 mac_mode = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK; 10653 mac_mode = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK;
10654 if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) { 10654 if (tp->phy_flags & TG3_PHYFLG_IS_FET) {
10655 tg3_writephy(tp, MII_TG3_FET_PTEST, 10655 tg3_writephy(tp, MII_TG3_FET_PTEST,
10656 MII_TG3_FET_PTEST_FRC_TX_LINK | 10656 MII_TG3_FET_PTEST_FRC_TX_LINK |
10657 MII_TG3_FET_PTEST_FRC_TX_LOCK); 10657 MII_TG3_FET_PTEST_FRC_TX_LOCK);
@@ -10663,7 +10663,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10663 mac_mode |= MAC_MODE_PORT_MODE_GMII; 10663 mac_mode |= MAC_MODE_PORT_MODE_GMII;
10664 10664
10665 /* reset to prevent losing 1st rx packet intermittently */ 10665 /* reset to prevent losing 1st rx packet intermittently */
10666 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 10666 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) {
10667 tw32_f(MAC_RX_MODE, RX_MODE_RESET); 10667 tw32_f(MAC_RX_MODE, RX_MODE_RESET);
10668 udelay(10); 10668 udelay(10);
10669 tw32_f(MAC_RX_MODE, tp->rx_mode); 10669 tw32_f(MAC_RX_MODE, tp->rx_mode);
@@ -10794,7 +10794,7 @@ static int tg3_test_loopback(struct tg3 *tp)
10794 return TG3_LOOPBACK_FAILED; 10794 return TG3_LOOPBACK_FAILED;
10795 10795
10796 /* Turn off gphy autopowerdown. */ 10796 /* Turn off gphy autopowerdown. */
10797 if (tp->tg3_flags3 & TG3_FLG3_PHY_ENABLE_APD) 10797 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
10798 tg3_phy_toggle_apd(tp, false); 10798 tg3_phy_toggle_apd(tp, false);
10799 10799
10800 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { 10800 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) {
@@ -10831,14 +10831,14 @@ static int tg3_test_loopback(struct tg3 *tp)
10831 tw32(TG3_CPMU_MUTEX_GNT, CPMU_MUTEX_GNT_DRIVER); 10831 tw32(TG3_CPMU_MUTEX_GNT, CPMU_MUTEX_GNT_DRIVER);
10832 } 10832 }
10833 10833
10834 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 10834 if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
10835 !(tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB)) { 10835 !(tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB)) {
10836 if (tg3_run_loopback(tp, TG3_PHY_LOOPBACK)) 10836 if (tg3_run_loopback(tp, TG3_PHY_LOOPBACK))
10837 err |= TG3_PHY_LOOPBACK_FAILED; 10837 err |= TG3_PHY_LOOPBACK_FAILED;
10838 } 10838 }
10839 10839
10840 /* Re-enable gphy autopowerdown. */ 10840 /* Re-enable gphy autopowerdown. */
10841 if (tp->tg3_flags3 & TG3_FLG3_PHY_ENABLE_APD) 10841 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
10842 tg3_phy_toggle_apd(tp, true); 10842 tg3_phy_toggle_apd(tp, true);
10843 10843
10844 return err; 10844 return err;
@@ -10881,7 +10881,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
10881 if (!err) 10881 if (!err)
10882 tg3_nvram_unlock(tp); 10882 tg3_nvram_unlock(tp);
10883 10883
10884 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) 10884 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
10885 tg3_phy_reset(tp); 10885 tg3_phy_reset(tp);
10886 10886
10887 if (tg3_test_registers(tp) != 0) { 10887 if (tg3_test_registers(tp) != 0) {
@@ -10930,7 +10930,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10930 10930
10931 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 10931 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
10932 struct phy_device *phydev; 10932 struct phy_device *phydev;
10933 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 10933 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
10934 return -EAGAIN; 10934 return -EAGAIN;
10935 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 10935 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
10936 return phy_mii_ioctl(phydev, ifr, cmd); 10936 return phy_mii_ioctl(phydev, ifr, cmd);
@@ -10944,7 +10944,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10944 case SIOCGMIIREG: { 10944 case SIOCGMIIREG: {
10945 u32 mii_regval; 10945 u32 mii_regval;
10946 10946
10947 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 10947 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
10948 break; /* We have no PHY */ 10948 break; /* We have no PHY */
10949 10949
10950 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) 10950 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
@@ -10960,7 +10960,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10960 } 10960 }
10961 10961
10962 case SIOCSMIIREG: 10962 case SIOCSMIIREG:
10963 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 10963 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
10964 break; /* We have no PHY */ 10964 break; /* We have no PHY */
10965 10965
10966 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) 10966 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
@@ -12091,9 +12091,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
12091 tp->phy_id = eeprom_phy_id; 12091 tp->phy_id = eeprom_phy_id;
12092 if (eeprom_phy_serdes) { 12092 if (eeprom_phy_serdes) {
12093 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 12093 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
12094 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 12094 tp->phy_flags |= TG3_PHYFLG_PHY_SERDES;
12095 else 12095 else
12096 tp->tg3_flags2 |= TG3_FLG2_MII_SERDES; 12096 tp->phy_flags |= TG3_PHYFLG_MII_SERDES;
12097 } 12097 }
12098 12098
12099 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 12099 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
@@ -12177,7 +12177,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
12177 (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)) 12177 (tp->tg3_flags2 & TG3_FLG2_5750_PLUS))
12178 tp->tg3_flags3 |= TG3_FLG3_ENABLE_APE; 12178 tp->tg3_flags3 |= TG3_FLG3_ENABLE_APE;
12179 12179
12180 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES && 12180 if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES &&
12181 !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL)) 12181 !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
12182 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; 12182 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
12183 12183
@@ -12186,17 +12186,17 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
12186 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12186 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
12187 12187
12188 if (cfg2 & (1 << 17)) 12188 if (cfg2 & (1 << 17))
12189 tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING; 12189 tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING;
12190 12190
12191 /* serdes signal pre-emphasis in register 0x590 set by */ 12191 /* serdes signal pre-emphasis in register 0x590 set by */
12192 /* bootcode if bit 18 is set */ 12192 /* bootcode if bit 18 is set */
12193 if (cfg2 & (1 << 18)) 12193 if (cfg2 & (1 << 18))
12194 tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; 12194 tp->phy_flags |= TG3_PHYFLG_SERDES_PREEMPHASIS;
12195 12195
12196 if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 12196 if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
12197 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX)) && 12197 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX)) &&
12198 (cfg2 & NIC_SRAM_DATA_CFG_2_APD_EN)) 12198 (cfg2 & NIC_SRAM_DATA_CFG_2_APD_EN))
12199 tp->tg3_flags3 |= TG3_FLG3_PHY_ENABLE_APD; 12199 tp->phy_flags |= TG3_PHYFLG_ENABLE_APD;
12200 12200
12201 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && 12201 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
12202 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 && 12202 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
@@ -12305,9 +12305,9 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
12305 if (!err && TG3_KNOWN_PHY_ID(hw_phy_id_masked)) { 12305 if (!err && TG3_KNOWN_PHY_ID(hw_phy_id_masked)) {
12306 tp->phy_id = hw_phy_id; 12306 tp->phy_id = hw_phy_id;
12307 if (hw_phy_id_masked == TG3_PHY_ID_BCM8002) 12307 if (hw_phy_id_masked == TG3_PHY_ID_BCM8002)
12308 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 12308 tp->phy_flags |= TG3_PHYFLG_PHY_SERDES;
12309 else 12309 else
12310 tp->tg3_flags2 &= ~TG3_FLG2_PHY_SERDES; 12310 tp->phy_flags &= ~TG3_PHYFLG_PHY_SERDES;
12311 } else { 12311 } else {
12312 if (tp->phy_id != TG3_PHY_ID_INVALID) { 12312 if (tp->phy_id != TG3_PHY_ID_INVALID) {
12313 /* Do nothing, phy ID already set up in 12313 /* Do nothing, phy ID already set up in
@@ -12326,11 +12326,11 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
12326 tp->phy_id = p->phy_id; 12326 tp->phy_id = p->phy_id;
12327 if (!tp->phy_id || 12327 if (!tp->phy_id ||
12328 tp->phy_id == TG3_PHY_ID_BCM8002) 12328 tp->phy_id == TG3_PHY_ID_BCM8002)
12329 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 12329 tp->phy_flags |= TG3_PHYFLG_PHY_SERDES;
12330 } 12330 }
12331 } 12331 }
12332 12332
12333 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && 12333 if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) &&
12334 !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) && 12334 !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) &&
12335 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { 12335 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
12336 u32 bmsr, adv_reg, tg3_ctrl, mask; 12336 u32 bmsr, adv_reg, tg3_ctrl, mask;
@@ -12348,7 +12348,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
12348 ADVERTISE_100HALF | ADVERTISE_100FULL | 12348 ADVERTISE_100HALF | ADVERTISE_100FULL |
12349 ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); 12349 ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
12350 tg3_ctrl = 0; 12350 tg3_ctrl = 0;
12351 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { 12351 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
12352 tg3_ctrl = (MII_TG3_CTRL_ADV_1000_HALF | 12352 tg3_ctrl = (MII_TG3_CTRL_ADV_1000_HALF |
12353 MII_TG3_CTRL_ADV_1000_FULL); 12353 MII_TG3_CTRL_ADV_1000_FULL);
12354 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 || 12354 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 ||
@@ -12363,7 +12363,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
12363 if (!tg3_copper_is_advertising_all(tp, mask)) { 12363 if (!tg3_copper_is_advertising_all(tp, mask)) {
12364 tg3_writephy(tp, MII_ADVERTISE, adv_reg); 12364 tg3_writephy(tp, MII_ADVERTISE, adv_reg);
12365 12365
12366 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) 12366 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
12367 tg3_writephy(tp, MII_TG3_CTRL, tg3_ctrl); 12367 tg3_writephy(tp, MII_TG3_CTRL, tg3_ctrl);
12368 12368
12369 tg3_writephy(tp, MII_BMCR, 12369 tg3_writephy(tp, MII_BMCR,
@@ -12372,7 +12372,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
12372 tg3_phy_set_wirespeed(tp); 12372 tg3_phy_set_wirespeed(tp);
12373 12373
12374 tg3_writephy(tp, MII_ADVERTISE, adv_reg); 12374 tg3_writephy(tp, MII_ADVERTISE, adv_reg);
12375 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) 12375 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
12376 tg3_writephy(tp, MII_TG3_CTRL, tg3_ctrl); 12376 tg3_writephy(tp, MII_TG3_CTRL, tg3_ctrl);
12377 } 12377 }
12378 12378
@@ -12385,13 +12385,13 @@ skip_phy_reset:
12385 err = tg3_init_5401phy_dsp(tp); 12385 err = tg3_init_5401phy_dsp(tp);
12386 } 12386 }
12387 12387
12388 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) 12388 if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES)
12389 tp->link_config.advertising = 12389 tp->link_config.advertising =
12390 (ADVERTISED_1000baseT_Half | 12390 (ADVERTISED_1000baseT_Half |
12391 ADVERTISED_1000baseT_Full | 12391 ADVERTISED_1000baseT_Full |
12392 ADVERTISED_Autoneg | 12392 ADVERTISED_Autoneg |
12393 ADVERTISED_FIBRE); 12393 ADVERTISED_FIBRE);
12394 if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) 12394 if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
12395 tp->link_config.advertising &= 12395 tp->link_config.advertising &=
12396 ~(ADVERTISED_1000baseT_Half | 12396 ~(ADVERTISED_1000baseT_Half |
12397 ADVERTISED_1000baseT_Full); 12397 ADVERTISED_1000baseT_Full);
@@ -13350,25 +13350,25 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13350 } 13350 }
13351 13351
13352 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 13352 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
13353 tp->tg3_flags3 |= TG3_FLG3_PHY_IS_FET; 13353 tp->phy_flags |= TG3_PHYFLG_IS_FET;
13354 13354
13355 /* A few boards don't want Ethernet@WireSpeed phy feature */ 13355 /* A few boards don't want Ethernet@WireSpeed phy feature */
13356 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) || 13356 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
13357 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && 13357 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
13358 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && 13358 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
13359 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) || 13359 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) ||
13360 (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) || 13360 (tp->phy_flags & TG3_PHYFLG_IS_FET) ||
13361 (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) 13361 (tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
13362 tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; 13362 tp->phy_flags |= TG3_PHYFLG_NO_ETH_WIRE_SPEED;
13363 13363
13364 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX || 13364 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX ||
13365 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5704_AX) 13365 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5704_AX)
13366 tp->tg3_flags2 |= TG3_FLG2_PHY_ADC_BUG; 13366 tp->phy_flags |= TG3_PHYFLG_ADC_BUG;
13367 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) 13367 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)
13368 tp->tg3_flags2 |= TG3_FLG2_PHY_5704_A0_BUG; 13368 tp->phy_flags |= TG3_PHYFLG_5704_A0_BUG;
13369 13369
13370 if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && 13370 if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) &&
13371 !(tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) && 13371 !(tp->phy_flags & TG3_PHYFLG_IS_FET) &&
13372 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 && 13372 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
13373 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780 && 13373 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780 &&
13374 !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) { 13374 !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) {
@@ -13378,11 +13378,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13378 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) { 13378 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
13379 if (tp->pdev->device != PCI_DEVICE_ID_TIGON3_5756 && 13379 if (tp->pdev->device != PCI_DEVICE_ID_TIGON3_5756 &&
13380 tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722) 13380 tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722)
13381 tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG; 13381 tp->phy_flags |= TG3_PHYFLG_JITTER_BUG;
13382 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M) 13382 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M)
13383 tp->tg3_flags2 |= TG3_FLG2_PHY_ADJUST_TRIM; 13383 tp->phy_flags |= TG3_PHYFLG_ADJUST_TRIM;
13384 } else 13384 } else
13385 tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; 13385 tp->phy_flags |= TG3_PHYFLG_BER_BUG;
13386 } 13386 }
13387 13387
13388 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 13388 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
@@ -13495,8 +13495,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13495 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790 || 13495 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790 ||
13496 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 || 13496 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
13497 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795 || 13497 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795 ||
13498 (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET)) 13498 (tp->phy_flags & TG3_PHYFLG_IS_FET))
13499 tp->tg3_flags |= TG3_FLAG_10_100_ONLY; 13499 tp->phy_flags |= TG3_PHYFLG_10_100_ONLY;
13500 13500
13501 err = tg3_phy_probe(tp); 13501 err = tg3_phy_probe(tp);
13502 if (err) { 13502 if (err) {
@@ -13508,13 +13508,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13508 tg3_read_vpd(tp); 13508 tg3_read_vpd(tp);
13509 tg3_read_fw_ver(tp); 13509 tg3_read_fw_ver(tp);
13510 13510
13511 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 13511 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
13512 tp->tg3_flags &= ~TG3_FLAG_USE_MI_INTERRUPT; 13512 tp->phy_flags &= ~TG3_PHYFLG_USE_MI_INTERRUPT;
13513 } else { 13513 } else {
13514 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) 13514 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700)
13515 tp->tg3_flags |= TG3_FLAG_USE_MI_INTERRUPT; 13515 tp->phy_flags |= TG3_PHYFLG_USE_MI_INTERRUPT;
13516 else 13516 else
13517 tp->tg3_flags &= ~TG3_FLAG_USE_MI_INTERRUPT; 13517 tp->phy_flags &= ~TG3_PHYFLG_USE_MI_INTERRUPT;
13518 } 13518 }
13519 13519
13520 /* 5700 {AX,BX} chips have a broken status block link 13520 /* 5700 {AX,BX} chips have a broken status block link
@@ -13532,13 +13532,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13532 */ 13532 */
13533 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL && 13533 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
13534 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 && 13534 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
13535 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 13535 !(tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) {
13536 tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT | 13536 tp->phy_flags |= TG3_PHYFLG_USE_MI_INTERRUPT;
13537 TG3_FLAG_USE_LINKCHG_REG); 13537 tp->tg3_flags |= TG3_FLAG_USE_LINKCHG_REG;
13538 } 13538 }
13539 13539
13540 /* For all SERDES we poll the MAC status register. */ 13540 /* For all SERDES we poll the MAC status register. */
13541 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 13541 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
13542 tp->tg3_flags |= TG3_FLAG_POLL_SERDES; 13542 tp->tg3_flags |= TG3_FLAG_POLL_SERDES;
13543 else 13543 else
13544 tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; 13544 tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES;
@@ -14641,24 +14641,31 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14641 tg3_bus_string(tp, str), 14641 tg3_bus_string(tp, str),
14642 dev->dev_addr); 14642 dev->dev_addr);
14643 14643
14644 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) { 14644 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
14645 struct phy_device *phydev; 14645 struct phy_device *phydev;
14646 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 14646 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
14647 netdev_info(dev, 14647 netdev_info(dev,
14648 "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", 14648 "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
14649 phydev->drv->name, dev_name(&phydev->dev)); 14649 phydev->drv->name, dev_name(&phydev->dev));
14650 } else 14650 } else {
14651 char *ethtype;
14652
14653 if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
14654 ethtype = "10/100Base-TX";
14655 else if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES)
14656 ethtype = "1000Base-SX";
14657 else
14658 ethtype = "10/100/1000Base-T";
14659
14651 netdev_info(dev, "attached PHY is %s (%s Ethernet) " 14660 netdev_info(dev, "attached PHY is %s (%s Ethernet) "
14652 "(WireSpeed[%d])\n", tg3_phy_string(tp), 14661 "(WireSpeed[%d])\n", tg3_phy_string(tp), ethtype,
14653 ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" : 14662 (tp->phy_flags & TG3_PHYFLG_NO_ETH_WIRE_SPEED) == 0);
14654 ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" : 14663 }
14655 "10/100/1000Base-T")),
14656 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0);
14657 14664
14658 netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n", 14665 netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n",
14659 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, 14666 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
14660 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, 14667 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
14661 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, 14668 (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) != 0,
14662 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, 14669 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
14663 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); 14670 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
14664 netdev_info(dev, "dma_rwctrl[%08x] dma_mask[%d-bit]\n", 14671 netdev_info(dev, "dma_rwctrl[%08x] dma_mask[%d-bit]\n",