igb: M88E1543 PHY downshift implementation
authorAkeem G Abodunrin <akeem.g.abodunrin@intel.com>
Wed, 28 Aug 2013 02:22:48 +0000 (02:22 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 4 Sep 2013 12:04:31 +0000 (05:04 -0700)
This patch implements downshift mechanism for M88E1543 PHY, so that
downshift is disabled first during link setup process, and later enabled
if we are master and downshift link is negotiated. Also cleaned up
return code implementation.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@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/igb/e1000_phy.c

index 5adccbc90740d7b2654355ad86866ff611514e22..e7266759a10bb116c1da8d8b7c4c9e5aa399c65c 100644 (file)
@@ -731,15 +731,13 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
        s32 ret_val;
        u16 phy_data;
 
-       if (phy->reset_disable) {
-               ret_val = 0;
-               goto out;
-       }
+       if (phy->reset_disable)
+               return 0;
 
        /* Enable CRS on Tx. This must be set for half-duplex operation. */
        ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
-               goto out;
+               return ret_val;
 
        /* Options:
         *   MDI/MDI-X = 0 (default)
@@ -780,23 +778,36 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
                phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
 
        /* Enable downshift and setting it to X6 */
+       if (phy->id == M88E1543_E_PHY_ID) {
+               phy_data &= ~I347AT4_PSCR_DOWNSHIFT_ENABLE;
+               ret_val =
+                   phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
+               if (ret_val)
+                       return ret_val;
+
+               ret_val = igb_phy_sw_reset(hw);
+               if (ret_val) {
+                       hw_dbg("Error committing the PHY changes\n");
+                       return ret_val;
+               }
+       }
+
        phy_data &= ~I347AT4_PSCR_DOWNSHIFT_MASK;
        phy_data |= I347AT4_PSCR_DOWNSHIFT_6X;
        phy_data |= I347AT4_PSCR_DOWNSHIFT_ENABLE;
 
        ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
        if (ret_val)
-               goto out;
+               return ret_val;
 
        /* Commit the changes. */
        ret_val = igb_phy_sw_reset(hw);
        if (ret_val) {
                hw_dbg("Error committing the PHY changes\n");
-               goto out;
+               return ret_val;
        }
 
-out:
-       return ret_val;
+       return 0;
 }
 
 /**
This page took 0.026092 seconds and 5 git commands to generate.