e1000e: use generic IEEE MII definitions
authorBruce Allan <bruce.w.allan@intel.com>
Wed, 16 Jan 2013 08:54:35 +0000 (08:54 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 1 Feb 2013 06:34:59 +0000 (22:34 -0800)
For standard IEEE MII-compatible transceivers, the kernel has generic
register and bit definitions.  Use those instead of redundant local
defines.

Do not replace references of MII_CR_SPEED_10 with BMCR_SPEED10 (0x0000)
when it is not necessary (i.e. when it is bitwise OR'ed with another
value).

Some whitespace issues in the surrounding context of the above changes are
also cleaned up.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/e1000e/80003es2lan.c
drivers/net/ethernet/intel/e1000e/82571.c
drivers/net/ethernet/intel/e1000e/defines.h
drivers/net/ethernet/intel/e1000e/e1000.h
drivers/net/ethernet/intel/e1000e/ethtool.c
drivers/net/ethernet/intel/e1000e/ich8lan.c
drivers/net/ethernet/intel/e1000e/mac.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/e1000e/phy.c

index 765211a289d8905d2e5702aa9bbc4866c1c55aeb..a00457abce69d07ac067d5910b2c3cd8e7b00ea7 100644 (file)
@@ -624,16 +624,16 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
 
        e_dbg("GG82563 PSCR: %X\n", phy_data);
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_data);
        if (ret_val)
                return ret_val;
 
        e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
 
        /* Reset the phy to commit changes. */
-       phy_data |= MII_CR_RESET;
+       phy_data |= BMCR_RESET;
 
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_data);
        if (ret_val)
                return ret_val;
 
index db364b69f87e78e6f058b115b83e9962ae5651b1..cf86090edd3b3c382cbf6e934391906ccb20aa58 100644 (file)
@@ -447,13 +447,13 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
                break;
        case e1000_82574:
        case e1000_82583:
-               ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
+               ret_val = e1e_rphy(hw, MII_PHYSID1, &phy_id);
                if (ret_val)
                        return ret_val;
 
                phy->id = (u32)(phy_id << 16);
                udelay(20);
-               ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
+               ret_val = e1e_rphy(hw, MII_PHYSID2, &phy_id);
                if (ret_val)
                        return ret_val;
 
index 1257f917af340510ef77c6a489f90cdc93dea164..615b900c0152f8d44f08cd9a6c4b32f2e9c5c857 100644 (file)
                           E1000_GCR_TXDSCW_NO_SNOOP      | \
                           E1000_GCR_TXDSCR_NO_SNOOP)
 
-/* PHY Control Register */
-#define MII_CR_FULL_DUPLEX      0x0100  /* FDX =1, half duplex =0 */
-#define MII_CR_RESTART_AUTO_NEG 0x0200  /* Restart auto negotiation */
-#define MII_CR_POWER_DOWN       0x0800  /* Power down */
-#define MII_CR_AUTO_NEG_EN      0x1000  /* Auto Neg Enable */
-#define MII_CR_LOOPBACK         0x4000  /* 0 = normal, 1 = loopback */
-#define MII_CR_RESET            0x8000  /* 0 = normal, 1 = PHY reset */
-#define MII_CR_SPEED_1000       0x0040
-#define MII_CR_SPEED_100        0x2000
-#define MII_CR_SPEED_10         0x0000
-
-/* PHY Status Register */
-#define MII_SR_LINK_STATUS       0x0004 /* Link Status 1 = link */
-#define MII_SR_AUTONEG_COMPLETE  0x0020 /* Auto Neg Complete */
-
-/* Autoneg Advertisement Register */
-#define NWAY_AR_10T_HD_CAPS      0x0020   /* 10T   Half Duplex Capable */
-#define NWAY_AR_10T_FD_CAPS      0x0040   /* 10T   Full Duplex Capable */
-#define NWAY_AR_100TX_HD_CAPS    0x0080   /* 100TX Half Duplex Capable */
-#define NWAY_AR_100TX_FD_CAPS    0x0100   /* 100TX Full Duplex Capable */
-#define NWAY_AR_PAUSE            0x0400   /* Pause operation desired */
-#define NWAY_AR_ASM_DIR          0x0800   /* Asymmetric Pause Direction bit */
-
-/* Link Partner Ability Register (Base Page) */
-#define NWAY_LPAR_100TX_FD_CAPS  0x0100 /* LP 100TX Full Dplx Capable */
-#define NWAY_LPAR_PAUSE          0x0400 /* LP Pause operation desired */
-#define NWAY_LPAR_ASM_DIR        0x0800 /* LP Asymmetric Pause Direction bit */
-
-/* Autoneg Expansion Register */
-#define NWAY_ER_LP_NWAY_CAPS     0x0001 /* LP has Auto Neg Capability */
-
-/* 1000BASE-T Control Register */
-#define CR_1000T_HD_CAPS         0x0100 /* Advertise 1000T HD capability */
-#define CR_1000T_FD_CAPS         0x0200 /* Advertise 1000T FD capability  */
-                                       /* 0=DTE device */
-#define CR_1000T_MS_VALUE        0x0800 /* 1=Configure PHY as Master */
-                                       /* 0=Configure PHY as Slave */
-#define CR_1000T_MS_ENABLE       0x1000 /* 1=Master/Slave manual config value */
-                                       /* 0=Automatic Master/Slave config */
-
-/* 1000BASE-T Status Register */
-#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */
-#define SR_1000T_LOCAL_RX_STATUS  0x2000 /* Local receiver OK */
-
-
-/* PHY 1000 MII Register/Bit Definitions */
-/* PHY Registers defined by IEEE */
-#define PHY_CONTROL      0x00 /* Control Register */
-#define PHY_STATUS       0x01 /* Status Register */
-#define PHY_ID1          0x02 /* Phy Id Reg (word 1) */
-#define PHY_ID2          0x03 /* Phy Id Reg (word 2) */
-#define PHY_AUTONEG_ADV  0x04 /* Autoneg Advertisement */
-#define PHY_LP_ABILITY   0x05 /* Link Partner Ability (Base Page) */
-#define PHY_AUTONEG_EXP  0x06 /* Autoneg Expansion Reg */
-#define PHY_1000T_CTRL   0x09 /* 1000Base-T Control Reg */
-#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
-#define PHY_EXT_STATUS   0x0F /* Extended Status Reg */
-
-#define PHY_CONTROL_LB   0x4000 /* PHY Loopback bit */
-
 /* NVM Control */
 #define E1000_EECD_SK        0x00000001 /* NVM Clock */
 #define E1000_EECD_CS        0x00000002 /* NVM Chip Select */
index c7d5c5b92ee51ebece454d5b974e54800157d374..4b0bd9c225ccb14eb9654d3f9c753c3cd1a7e92f 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/net_tstamp.h>
 #include <linux/ptp_clock_kernel.h>
 #include <linux/ptp_classify.h>
+#include <linux/mii.h>
 #include "hw.h"
 
 struct e1000_info;
index b1447783ff2936ac4b76f9adbe56ad9583bf7cb1..c6c3e921686ddc43099d2a46c243f3db1b48c116 100644 (file)
@@ -472,10 +472,10 @@ static void e1000_get_regs(struct net_device *netdev,
                regs_buff[22] = adapter->phy_stats.receive_errors;
                regs_buff[23] = regs_buff[13]; /* mdix mode */
        }
-       regs_buff[21] = 0; /* was idle_errors */
-       e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
-       regs_buff[24] = (u32)phy_data;  /* phy local receiver status */
-       regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
+       regs_buff[21] = 0;      /* was idle_errors */
+       e1e_rphy(hw, MII_STAT1000, &phy_data);
+       regs_buff[24] = (u32)phy_data;  /* phy local receiver status */
+       regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
 }
 
 static int e1000_get_eeprom_len(struct net_device *netdev)
@@ -1284,7 +1284,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
 
        if (hw->phy.type == e1000_phy_ife) {
                /* force 100, set loopback */
-               e1e_wphy(hw, PHY_CONTROL, 0x6100);
+               e1e_wphy(hw, MII_BMCR, 0x6100);
 
                /* Now set up the MAC to the same speed/duplex as the PHY. */
                ctrl_reg = er32(CTRL);
@@ -1307,9 +1307,9 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
                /* Auto-MDI/MDIX Off */
                e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
                /* reset to update Auto-MDI/MDIX */
-               e1e_wphy(hw, PHY_CONTROL, 0x9140);
+               e1e_wphy(hw, MII_BMCR, 0x9140);
                /* autoneg off */
-               e1e_wphy(hw, PHY_CONTROL, 0x8140);
+               e1e_wphy(hw, MII_BMCR, 0x8140);
                break;
        case e1000_phy_gg82563:
                e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC);
@@ -1363,7 +1363,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
        }
 
        /* force 1000, set loopback */
-       e1e_wphy(hw, PHY_CONTROL, 0x4140);
+       e1e_wphy(hw, MII_BMCR, 0x4140);
        mdelay(250);
 
        /* Now set up the MAC to the same speed/duplex as the PHY. */
@@ -1538,10 +1538,10 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
                hw->mac.autoneg = 1;
                if (hw->phy.type == e1000_phy_gg82563)
                        e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x180);
-               e1e_rphy(hw, PHY_CONTROL, &phy_reg);
-               if (phy_reg & MII_CR_LOOPBACK) {
-                       phy_reg &= ~MII_CR_LOOPBACK;
-                       e1e_wphy(hw, PHY_CONTROL, phy_reg);
+               e1e_rphy(hw, MII_BMCR, &phy_reg);
+               if (phy_reg & BMCR_LOOPBACK) {
+                       phy_reg &= ~BMCR_LOOPBACK;
+                       e1e_wphy(hw, MII_BMCR, phy_reg);
                        if (hw->phy.ops.commit)
                                hw->phy.ops.commit(hw);
                }
index 5ca21f9b33345663cc4726ea9022d9904e5593ee..a019b46f30e22dead7aec7cc857b25175bc12100 100644 (file)
@@ -312,12 +312,12 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw)
        u16 retry_count;
 
        for (retry_count = 0; retry_count < 2; retry_count++) {
-               ret_val = e1e_rphy_locked(hw, PHY_ID1, &phy_reg);
+               ret_val = e1e_rphy_locked(hw, MII_PHYSID1, &phy_reg);
                if (ret_val || (phy_reg == 0xFFFF))
                        continue;
                phy_id = (u32)(phy_reg << 16);
 
-               ret_val = e1e_rphy_locked(hw, PHY_ID2, &phy_reg);
+               ret_val = e1e_rphy_locked(hw, MII_PHYSID2, &phy_reg);
                if (ret_val || (phy_reg == 0xFFFF)) {
                        phy_id = 0;
                        continue;
@@ -882,8 +882,8 @@ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw)
                        lpi_ctrl |= I82579_LPI_CTRL_1000_ENABLE;
 
                if (dev_spec->eee_lp_ability & I82579_EEE_100_SUPPORTED) {
-                       e1e_rphy_locked(hw, PHY_LP_ABILITY, &data);
-                       if (data & NWAY_LPAR_100TX_FD_CAPS)
+                       e1e_rphy_locked(hw, MII_LPA, &data);
+                       if (data & LPA_100FULL)
                                lpi_ctrl |= I82579_LPI_CTRL_100_ENABLE;
                        else
                                /* EEE is not supported in 100Half, so ignore
@@ -1792,7 +1792,7 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
                 */
                if (hw->phy.revision < 2) {
                        e1000e_phy_sw_reset(hw);
-                       ret_val = e1e_wphy(hw, PHY_CONTROL, 0x3140);
+                       ret_val = e1e_wphy(hw, MII_BMCR, 0x3140);
                }
        }
 
index 7365288f20f7d0dd8deba9cf8c728b6ee33d4c85..b78e02174601a5f25a444c964eece95cf50fb6e6 100644 (file)
@@ -1053,14 +1053,14 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
                 * has completed.  We read this twice because this reg has
                 * some "sticky" (latched) bits.
                 */
-               ret_val = e1e_rphy(hw, PHY_STATUS, &mii_status_reg);
+               ret_val = e1e_rphy(hw, MII_BMSR, &mii_status_reg);
                if (ret_val)
                        return ret_val;
-               ret_val = e1e_rphy(hw, PHY_STATUS, &mii_status_reg);
+               ret_val = e1e_rphy(hw, MII_BMSR, &mii_status_reg);
                if (ret_val)
                        return ret_val;
 
-               if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
+               if (!(mii_status_reg & BMSR_ANEGCOMPLETE)) {
                        e_dbg("Copper PHY and Auto Neg has not completed.\n");
                        return ret_val;
                }
@@ -1071,11 +1071,10 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
                 * Page Ability Register (Address 5) to determine how
                 * flow control was negotiated.
                 */
-               ret_val = e1e_rphy(hw, PHY_AUTONEG_ADV, &mii_nway_adv_reg);
+               ret_val = e1e_rphy(hw, MII_ADVERTISE, &mii_nway_adv_reg);
                if (ret_val)
                        return ret_val;
-               ret_val = e1e_rphy(hw, PHY_LP_ABILITY,
-                                  &mii_nway_lp_ability_reg);
+               ret_val = e1e_rphy(hw, MII_LPA, &mii_nway_lp_ability_reg);
                if (ret_val)
                        return ret_val;
 
@@ -1112,8 +1111,8 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
                 *   1   |   DC    |   1   |   DC    | E1000_fc_full
                 *
                 */
-               if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-                   (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
+               if ((mii_nway_adv_reg & ADVERTISE_PAUSE_CAP) &&
+                   (mii_nway_lp_ability_reg & LPA_PAUSE_CAP)) {
                        /* Now we need to check if the user selected Rx ONLY
                         * of pause frames.  In this case, we had to advertise
                         * FULL flow control because we could not advertise Rx
@@ -1135,10 +1134,10 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
                 *-------|---------|-------|---------|--------------------
                 *   0   |    1    |   1   |    1    | e1000_fc_tx_pause
                 */
-               else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-                        (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-                        (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-                        (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
+               else if (!(mii_nway_adv_reg & ADVERTISE_PAUSE_CAP) &&
+                        (mii_nway_adv_reg & ADVERTISE_PAUSE_ASYM) &&
+                        (mii_nway_lp_ability_reg & LPA_PAUSE_CAP) &&
+                        (mii_nway_lp_ability_reg & LPA_PAUSE_ASYM)) {
                        hw->fc.current_mode = e1000_fc_tx_pause;
                        e_dbg("Flow Control = Tx PAUSE frames only.\n");
                }
@@ -1149,10 +1148,10 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
                 *-------|---------|-------|---------|--------------------
                 *   1   |    1    |   0   |    1    | e1000_fc_rx_pause
                 */
-               else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
-                        (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
-                        !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
-                        (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
+               else if ((mii_nway_adv_reg & ADVERTISE_PAUSE_CAP) &&
+                        (mii_nway_adv_reg & ADVERTISE_PAUSE_ASYM) &&
+                        !(mii_nway_lp_ability_reg & LPA_PAUSE_CAP) &&
+                        (mii_nway_lp_ability_reg & LPA_PAUSE_ASYM)) {
                        hw->fc.current_mode = e1000_fc_rx_pause;
                        e_dbg("Flow Control = Rx PAUSE frames only.\n");
                } else {
index eb01a55f60a6390a100d66197c19b682acfeea54..e0eb5dddf3eae5b3f09b7acb0679270c3b0e6840 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/slab.h>
 #include <net/checksum.h>
 #include <net/ip6_checksum.h>
-#include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
 #include <linux/cpu.h>
@@ -1117,9 +1116,9 @@ static void e1000_print_hw_hang(struct work_struct *work)
        adapter->tx_hang_recheck = false;
        netif_stop_queue(netdev);
 
-       e1e_rphy(hw, PHY_STATUS, &phy_status);
-       e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status);
-       e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status);
+       e1e_rphy(hw, MII_BMSR, &phy_status);
+       e1e_rphy(hw, MII_STAT1000, &phy_1000t_status);
+       e1e_rphy(hw, MII_ESTATUS, &phy_ext_status);
 
        pci_read_config_word(adapter->pdev, PCI_STATUS, &pci_status);
 
@@ -4677,14 +4676,14 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
            (adapter->hw.phy.media_type == e1000_media_type_copper)) {
                int ret_val;
 
-               ret_val  = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr);
-               ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr);
-               ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise);
-               ret_val |= e1e_rphy(hw, PHY_LP_ABILITY, &phy->lpa);
-               ret_val |= e1e_rphy(hw, PHY_AUTONEG_EXP, &phy->expansion);
-               ret_val |= e1e_rphy(hw, PHY_1000T_CTRL, &phy->ctrl1000);
-               ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000);
-               ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus);
+               ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr);
+               ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr);
+               ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise);
+               ret_val |= e1e_rphy(hw, MII_LPA, &phy->lpa);
+               ret_val |= e1e_rphy(hw, MII_EXPANSION, &phy->expansion);
+               ret_val |= e1e_rphy(hw, MII_CTRL1000, &phy->ctrl1000);
+               ret_val |= e1e_rphy(hw, MII_STAT1000, &phy->stat1000);
+               ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus);
                if (ret_val)
                        e_warn("Error reading PHY register\n");
        } else {
@@ -4856,9 +4855,9 @@ static void e1000_watchdog_task(struct work_struct *work)
                            (adapter->link_duplex == HALF_DUPLEX)) {
                                u16 autoneg_exp;
 
-                               e1e_rphy(hw, PHY_AUTONEG_EXP, &autoneg_exp);
+                               e1e_rphy(hw, MII_EXPANSION, &autoneg_exp);
 
-                               if (!(autoneg_exp & NWAY_ER_LP_NWAY_CAPS))
+                               if (!(autoneg_exp & EXPANSION_NWAY))
                                        e_info("Autonegotiated half duplex but link partner cannot autoneg.  Try forcing full duplex if link gets many collisions.\n");
                        }
 
index 6f32811dbcf0a1c2fd6adb76b111ea710a39a149..ae656f16c9fd461517415650c336405cd1879907 100644 (file)
@@ -131,13 +131,13 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw)
                return 0;
 
        while (retry_count < 2) {
-               ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
+               ret_val = e1e_rphy(hw, MII_PHYSID1, &phy_id);
                if (ret_val)
                        return ret_val;
 
                phy->id = (u32)(phy_id << 16);
                udelay(20);
-               ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
+               ret_val = e1e_rphy(hw, MII_PHYSID2, &phy_id);
                if (ret_val)
                        return ret_val;
 
@@ -641,31 +641,31 @@ static s32 e1000_set_master_slave_mode(struct e1000_hw *hw)
        u16 phy_data;
 
        /* Resolve Master/Slave mode */
-       ret_val = e1e_rphy(hw, PHY_1000T_CTRL, &phy_data);
+       ret_val = e1e_rphy(hw, MII_CTRL1000, &phy_data);
        if (ret_val)
                return ret_val;
 
        /* load defaults for future use */
-       hw->phy.original_ms_type = (phy_data & CR_1000T_MS_ENABLE) ?
-           ((phy_data & CR_1000T_MS_VALUE) ?
+       hw->phy.original_ms_type = (phy_data & CTL1000_ENABLE_MASTER) ?
+           ((phy_data & CTL1000_AS_MASTER) ?
             e1000_ms_force_master : e1000_ms_force_slave) : e1000_ms_auto;
 
        switch (hw->phy.ms_type) {
        case e1000_ms_force_master:
-               phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE);
+               phy_data |= (CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER);
                break;
        case e1000_ms_force_slave:
-               phy_data |= CR_1000T_MS_ENABLE;
-               phy_data &= ~(CR_1000T_MS_VALUE);
+               phy_data |= CTL1000_ENABLE_MASTER;
+               phy_data &= ~(CTL1000_AS_MASTER);
                break;
        case e1000_ms_auto:
-               phy_data &= ~CR_1000T_MS_ENABLE;
+               phy_data &= ~CTL1000_ENABLE_MASTER;
                /* fall-through */
        default:
                break;
        }
 
-       return e1e_wphy(hw, PHY_1000T_CTRL, phy_data);
+       return e1e_wphy(hw, MII_CTRL1000, phy_data);
 }
 
 /**
@@ -943,12 +943,12 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
                                return ret_val;
 
                        /* Set auto Master/Slave resolution process */
-                       ret_val = e1e_rphy(hw, PHY_1000T_CTRL, &data);
+                       ret_val = e1e_rphy(hw, MII_CTRL1000, &data);
                        if (ret_val)
                                return ret_val;
 
-                       data &= ~CR_1000T_MS_ENABLE;
-                       ret_val = e1e_wphy(hw, PHY_1000T_CTRL, data);
+                       data &= ~CTL1000_ENABLE_MASTER;
+                       ret_val = e1e_wphy(hw, MII_CTRL1000, data);
                        if (ret_val)
                                return ret_val;
                }
@@ -978,13 +978,13 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
        phy->autoneg_advertised &= phy->autoneg_mask;
 
        /* Read the MII Auto-Neg Advertisement Register (Address 4). */
-       ret_val = e1e_rphy(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
+       ret_val = e1e_rphy(hw, MII_ADVERTISE, &mii_autoneg_adv_reg);
        if (ret_val)
                return ret_val;
 
        if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
                /* Read the MII 1000Base-T Control Register (Address 9). */
-               ret_val = e1e_rphy(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
+               ret_val = e1e_rphy(hw, MII_CTRL1000, &mii_1000t_ctrl_reg);
                if (ret_val)
                        return ret_val;
        }
@@ -1000,36 +1000,35 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
         * Advertisement Register (Address 4) and the 1000 mb speed bits in
         * the  1000Base-T Control Register (Address 9).
         */
-       mii_autoneg_adv_reg &= ~(NWAY_AR_100TX_FD_CAPS |
-                                NWAY_AR_100TX_HD_CAPS |
-                                NWAY_AR_10T_FD_CAPS   |
-                                NWAY_AR_10T_HD_CAPS);
-       mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS);
+       mii_autoneg_adv_reg &= ~(ADVERTISE_100FULL |
+                                ADVERTISE_100HALF |
+                                ADVERTISE_10FULL | ADVERTISE_10HALF);
+       mii_1000t_ctrl_reg &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
 
        e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised);
 
        /* Do we want to advertise 10 Mb Half Duplex? */
        if (phy->autoneg_advertised & ADVERTISE_10_HALF) {
                e_dbg("Advertise 10mb Half duplex\n");
-               mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
+               mii_autoneg_adv_reg |= ADVERTISE_10HALF;
        }
 
        /* Do we want to advertise 10 Mb Full Duplex? */
        if (phy->autoneg_advertised & ADVERTISE_10_FULL) {
                e_dbg("Advertise 10mb Full duplex\n");
-               mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
+               mii_autoneg_adv_reg |= ADVERTISE_10FULL;
        }
 
        /* Do we want to advertise 100 Mb Half Duplex? */
        if (phy->autoneg_advertised & ADVERTISE_100_HALF) {
                e_dbg("Advertise 100mb Half duplex\n");
-               mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
+               mii_autoneg_adv_reg |= ADVERTISE_100HALF;
        }
 
        /* Do we want to advertise 100 Mb Full Duplex? */
        if (phy->autoneg_advertised & ADVERTISE_100_FULL) {
                e_dbg("Advertise 100mb Full duplex\n");
-               mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
+               mii_autoneg_adv_reg |= ADVERTISE_100FULL;
        }
 
        /* We do not allow the Phy to advertise 1000 Mb Half Duplex */
@@ -1039,14 +1038,14 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
        /* Do we want to advertise 1000 Mb Full Duplex? */
        if (phy->autoneg_advertised & ADVERTISE_1000_FULL) {
                e_dbg("Advertise 1000mb Full duplex\n");
-               mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
+               mii_1000t_ctrl_reg |= ADVERTISE_1000FULL;
        }
 
        /* Check for a software override of the flow control settings, and
         * setup the PHY advertisement registers accordingly.  If
         * auto-negotiation is enabled, then software will have to set the
         * "PAUSE" bits to the correct value in the Auto-Negotiation
-        * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-
+        * Advertisement Register (MII_ADVERTISE) and re-start auto-
         * negotiation.
         *
         * The possible values of the "fc" parameter are:
@@ -1064,7 +1063,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
                /* Flow control (Rx & Tx) is completely disabled by a
                 * software over-ride.
                 */
-               mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
+               mii_autoneg_adv_reg &=
+                   ~(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
                break;
        case e1000_fc_rx_pause:
                /* Rx Flow control is enabled, and Tx Flow control is
@@ -1076,34 +1076,36 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
                 * (in e1000e_config_fc_after_link_up) we will disable the
                 * hw's ability to send PAUSE frames.
                 */
-               mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
+               mii_autoneg_adv_reg |=
+                   (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
                break;
        case e1000_fc_tx_pause:
                /* Tx Flow control is enabled, and Rx Flow control is
                 * disabled, by a software over-ride.
                 */
-               mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
-               mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
+               mii_autoneg_adv_reg |= ADVERTISE_PAUSE_ASYM;
+               mii_autoneg_adv_reg &= ~ADVERTISE_PAUSE_CAP;
                break;
        case e1000_fc_full:
                /* Flow control (both Rx and Tx) is enabled by a software
                 * over-ride.
                 */
-               mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
+               mii_autoneg_adv_reg |=
+                   (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
                break;
        default:
                e_dbg("Flow control param set incorrectly\n");
                return -E1000_ERR_CONFIG;
        }
 
-       ret_val = e1e_wphy(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg);
+       ret_val = e1e_wphy(hw, MII_ADVERTISE, mii_autoneg_adv_reg);
        if (ret_val)
                return ret_val;
 
        e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
 
        if (phy->autoneg_mask & ADVERTISE_1000_FULL)
-               ret_val = e1e_wphy(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
+               ret_val = e1e_wphy(hw, MII_CTRL1000, mii_1000t_ctrl_reg);
 
        return ret_val;
 }
@@ -1145,12 +1147,12 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
        /* Restart auto-negotiation by setting the Auto Neg Enable bit and
         * the Auto Neg Restart bit in the PHY control register.
         */
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl);
        if (ret_val)
                return ret_val;
 
-       phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_ctrl);
+       phy_ctrl |= (BMCR_ANENABLE | BMCR_ANRESTART);
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl);
        if (ret_val)
                return ret_val;
 
@@ -1237,13 +1239,13 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
        u16 phy_data;
        bool link;
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_data);
        if (ret_val)
                return ret_val;
 
        e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
 
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_data);
        if (ret_val)
                return ret_val;
 
@@ -1315,13 +1317,13 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
 
        e_dbg("M88E1000 PSCR: %X\n", phy_data);
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_data);
        if (ret_val)
                return ret_val;
 
        e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
 
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_data);
        if (ret_val)
                return ret_val;
 
@@ -1408,13 +1410,13 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw)
        u16 data;
        bool link;
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &data);
+       ret_val = e1e_rphy(hw, MII_BMCR, &data);
        if (ret_val)
                return ret_val;
 
        e1000e_phy_force_speed_duplex_setup(hw, &data);
 
-       ret_val = e1e_wphy(hw, PHY_CONTROL, data);
+       ret_val = e1e_wphy(hw, MII_BMCR, data);
        if (ret_val)
                return ret_val;
 
@@ -1458,13 +1460,13 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw)
 /**
  *  e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
  *  @hw: pointer to the HW structure
- *  @phy_ctrl: pointer to current value of PHY_CONTROL
+ *  @phy_ctrl: pointer to current value of MII_BMCR
  *
  *  Forces speed and duplex on the PHY by doing the following: disable flow
  *  control, force speed/duplex on the MAC, disable auto speed detection,
  *  disable auto-negotiation, configure duplex, configure speed, configure
  *  the collision distance, write configuration to CTRL register.  The
- *  caller must write to the PHY_CONTROL register for these settings to
+ *  caller must write to the MII_BMCR register for these settings to
  *  take affect.
  **/
 void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
@@ -1484,29 +1486,28 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
        ctrl &= ~E1000_CTRL_ASDE;
 
        /* Disable autoneg on the phy */
-       *phy_ctrl &= ~MII_CR_AUTO_NEG_EN;
+       *phy_ctrl &= ~BMCR_ANENABLE;
 
        /* Forcing Full or Half Duplex? */
        if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) {
                ctrl &= ~E1000_CTRL_FD;
-               *phy_ctrl &= ~MII_CR_FULL_DUPLEX;
+               *phy_ctrl &= ~BMCR_FULLDPLX;
                e_dbg("Half Duplex\n");
        } else {
                ctrl |= E1000_CTRL_FD;
-               *phy_ctrl |= MII_CR_FULL_DUPLEX;
+               *phy_ctrl |= BMCR_FULLDPLX;
                e_dbg("Full Duplex\n");
        }
 
        /* Forcing 10mb or 100mb? */
        if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) {
                ctrl |= E1000_CTRL_SPD_100;
-               *phy_ctrl |= MII_CR_SPEED_100;
-               *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
+               *phy_ctrl |= BMCR_SPEED100;
+               *phy_ctrl &= ~BMCR_SPEED1000;
                e_dbg("Forcing 100mb\n");
        } else {
                ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
-               *phy_ctrl |= MII_CR_SPEED_10;
-               *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
+               *phy_ctrl &= ~(BMCR_SPEED1000 | BMCR_SPEED100);
                e_dbg("Forcing 10mb\n");
        }
 
@@ -1747,13 +1748,13 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
 
        /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
        for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
-               ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
+               ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
                if (ret_val)
                        break;
-               ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
+               ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
                if (ret_val)
                        break;
-               if (phy_status & MII_SR_AUTONEG_COMPLETE)
+               if (phy_status & BMSR_ANEGCOMPLETE)
                        break;
                msleep(100);
        }
@@ -1780,21 +1781,21 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
        u16 i, phy_status;
 
        for (i = 0; i < iterations; i++) {
-               /* Some PHYs require the PHY_STATUS register to be read
+               /* Some PHYs require the MII_BMSR register to be read
                 * twice due to the link bit being sticky.  No harm doing
                 * it across the board.
                 */
-               ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
+               ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
                if (ret_val)
                        /* If the first read fails, another entity may have
                         * ownership of the resources, wait and try again to
                         * see if they have relinquished the resources yet.
                         */
                        udelay(usec_interval);
-               ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
+               ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
                if (ret_val)
                        break;
-               if (phy_status & MII_SR_LINK_STATUS)
+               if (phy_status & BMSR_LSTATUS)
                        break;
                if (usec_interval >= 1000)
                        mdelay(usec_interval/1000);
@@ -1968,17 +1969,15 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
                if (ret_val)
                        return ret_val;
 
-               ret_val = e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
+               ret_val = e1e_rphy(hw, MII_STAT1000, &phy_data);
                if (ret_val)
                        return ret_val;
 
-               phy->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS)
-                               ? e1000_1000t_rx_status_ok
-                               : e1000_1000t_rx_status_not_ok;
+               phy->local_rx = (phy_data & LPA_1000LOCALRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
 
-               phy->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS)
-                                ? e1000_1000t_rx_status_ok
-                                : e1000_1000t_rx_status_not_ok;
+               phy->remote_rx = (phy_data & LPA_1000REMRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
        } else {
                /* Set values to "undefined" */
                phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
@@ -2032,17 +2031,15 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
                if (ret_val)
                        return ret_val;
 
-               ret_val = e1e_rphy(hw, PHY_1000T_STATUS, &data);
+               ret_val = e1e_rphy(hw, MII_STAT1000, &data);
                if (ret_val)
                        return ret_val;
 
-               phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS)
-                               ? e1000_1000t_rx_status_ok
-                               : e1000_1000t_rx_status_not_ok;
+               phy->local_rx = (data & LPA_1000LOCALRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
 
-               phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS)
-                                ? e1000_1000t_rx_status_ok
-                                : e1000_1000t_rx_status_not_ok;
+               phy->remote_rx = (data & LPA_1000REMRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
        } else {
                phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
                phy->local_rx = e1000_1000t_rx_status_undefined;
@@ -2116,12 +2113,12 @@ s32 e1000e_phy_sw_reset(struct e1000_hw *hw)
        s32 ret_val;
        u16 phy_ctrl;
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_ctrl);
        if (ret_val)
                return ret_val;
 
-       phy_ctrl |= MII_CR_RESET;
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_ctrl);
+       phy_ctrl |= BMCR_RESET;
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_ctrl);
        if (ret_val)
                return ret_val;
 
@@ -2751,9 +2748,9 @@ void e1000_power_up_phy_copper(struct e1000_hw *hw)
        u16 mii_reg = 0;
 
        /* The PHY will retain its settings across a power down/up cycle */
-       e1e_rphy(hw, PHY_CONTROL, &mii_reg);
-       mii_reg &= ~MII_CR_POWER_DOWN;
-       e1e_wphy(hw, PHY_CONTROL, mii_reg);
+       e1e_rphy(hw, MII_BMCR, &mii_reg);
+       mii_reg &= ~BMCR_PDOWN;
+       e1e_wphy(hw, MII_BMCR, mii_reg);
 }
 
 /**
@@ -2769,9 +2766,9 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw)
        u16 mii_reg = 0;
 
        /* The PHY will retain its settings across a power down/up cycle */
-       e1e_rphy(hw, PHY_CONTROL, &mii_reg);
-       mii_reg |= MII_CR_POWER_DOWN;
-       e1e_wphy(hw, PHY_CONTROL, mii_reg);
+       e1e_rphy(hw, MII_BMCR, &mii_reg);
+       mii_reg |= BMCR_PDOWN;
+       e1e_wphy(hw, MII_BMCR, mii_reg);
        usleep_range(1000, 2000);
 }
 
@@ -3087,8 +3084,8 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw)
                return 0;
 
        /* Do not apply workaround if in PHY loopback bit 14 set */
-       e1e_rphy(hw, PHY_CONTROL, &data);
-       if (data & PHY_CONTROL_LB)
+       e1e_rphy(hw, MII_BMCR, &data);
+       if (data & BMCR_LOOPBACK)
                return 0;
 
        /* check if link is up and at 1Gbps */
@@ -3152,13 +3149,13 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw)
        u16 phy_data;
        bool link;
 
-       ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
+       ret_val = e1e_rphy(hw, MII_BMCR, &phy_data);
        if (ret_val)
                return ret_val;
 
        e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
 
-       ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
+       ret_val = e1e_wphy(hw, MII_BMCR, phy_data);
        if (ret_val)
                return ret_val;
 
@@ -3226,17 +3223,15 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw)
                if (ret_val)
                        return ret_val;
 
-               ret_val = e1e_rphy(hw, PHY_1000T_STATUS, &data);
+               ret_val = e1e_rphy(hw, MII_STAT1000, &data);
                if (ret_val)
                        return ret_val;
 
-               phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS)
-                               ? e1000_1000t_rx_status_ok
-                               : e1000_1000t_rx_status_not_ok;
+               phy->local_rx = (data & LPA_1000LOCALRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
 
-               phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS)
-                                ? e1000_1000t_rx_status_ok
-                                : e1000_1000t_rx_status_not_ok;
+               phy->remote_rx = (data & LPA_1000REMRXOK)
+                   ? e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
        } else {
                phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
                phy->local_rx = e1000_1000t_rx_status_undefined;