Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170441
b: refs/heads/master
c: 2553bb2
h: refs/heads/master
i:
  170439: 4de7e32
v: v3
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Oct 6, 2009
1 parent 102bae5 commit b427580
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab576389b733b458495529f81839f499b3fece78
refs/heads/master: 2553bb2681645bf932db2845121b8f33954f6f39
39 changes: 25 additions & 14 deletions trunk/drivers/net/igb/e1000_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw);
/* Cable length tables */
static const u16 e1000_m88_cable_length_table[] =
{ 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
#define M88E1000_CABLE_LENGTH_TABLE_SIZE \
(sizeof(e1000_m88_cable_length_table) / \
sizeof(e1000_m88_cable_length_table[0]))

static const u16 e1000_igp_2_cable_length_table[] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
Expand Down Expand Up @@ -109,7 +112,10 @@ s32 igb_get_phy_id(struct e1000_hw *hw)
**/
static s32 igb_phy_reset_dsp(struct e1000_hw *hw)
{
s32 ret_val;
s32 ret_val = 0;

if (!(hw->phy.ops.write_reg))
goto out;

ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1);
if (ret_val)
Expand Down Expand Up @@ -1059,22 +1065,19 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)

igb_phy_force_speed_duplex_setup(hw, &phy_data);

/* Reset the phy to commit changes. */
phy_data |= MII_CR_RESET;

ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
if (ret_val)
goto out;

udelay(1);
/* Reset the phy to commit changes. */
ret_val = igb_phy_sw_reset(hw);
if (ret_val)
goto out;

if (phy->autoneg_wait_to_complete) {
hw_dbg("Waiting for forced speed/duplex link on M88 phy.\n");

ret_val = igb_phy_has_link(hw,
PHY_FORCE_LIMIT,
100000,
&link);
ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
if (ret_val)
goto out;

Expand All @@ -1084,8 +1087,8 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
* Reset the DSP and cross our fingers.
*/
ret_val = phy->ops.write_reg(hw,
M88E1000_PHY_PAGE_SELECT,
0x001d);
M88E1000_PHY_PAGE_SELECT,
0x001d);
if (ret_val)
goto out;
ret_val = igb_phy_reset_dsp(hw);
Expand All @@ -1095,7 +1098,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)

/* Try once more */
ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT,
100000, &link);
100000, &link);
if (ret_val)
goto out;
}
Expand Down Expand Up @@ -1207,9 +1210,12 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
s32 ret_val = 0;
u16 data;

if (!(hw->phy.ops.read_reg))
goto out;

ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
if (ret_val)
goto out;
Expand Down Expand Up @@ -1495,8 +1501,13 @@ s32 igb_get_cable_length_m88(struct e1000_hw *hw)

index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
M88E1000_PSSR_CABLE_LENGTH_SHIFT;
if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) {
ret_val = -E1000_ERR_PHY;
goto out;
}

phy->min_cable_length = e1000_m88_cable_length_table[index];
phy->max_cable_length = e1000_m88_cable_length_table[index+1];
phy->max_cable_length = e1000_m88_cable_length_table[index + 1];

phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;

Expand Down

0 comments on commit b427580

Please sign in to comment.