Commit 5eb6f3c7 authored by Bruce Allan's avatar Bruce Allan Committed by David S. Miller

e1000e: refactor PHY ID detection workaround

The workaround that detects the correct PHY ID when an initial read of the
PHY ID registers returns an invalid one should retry up to ten times with
a small delay between attempts using a single PHY address and then repeat
using the remaining possible PHY addresses.  Do this instead of trying each
possible PHY address repeating that up to 100 times.
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94e5b651
...@@ -219,7 +219,7 @@ enum e1e_registers { ...@@ -219,7 +219,7 @@ enum e1e_registers {
E1000_HICR = 0x08F00, /* Host Interface Control */ E1000_HICR = 0x08F00, /* Host Interface Control */
}; };
/* RSS registers */ #define E1000_MAX_PHY_ADDR 4
/* IGP01E1000 Specific Registers */ /* IGP01E1000 Specific Registers */
#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */ #define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */
......
...@@ -2197,13 +2197,17 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id) ...@@ -2197,13 +2197,17 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id)
s32 e1000e_determine_phy_address(struct e1000_hw *hw) s32 e1000e_determine_phy_address(struct e1000_hw *hw)
{ {
s32 ret_val = -E1000_ERR_PHY_TYPE; s32 ret_val = -E1000_ERR_PHY_TYPE;
u32 phy_addr= 0; u32 phy_addr = 0;
u32 i = 0; u32 i;
enum e1000_phy_type phy_type = e1000_phy_unknown; enum e1000_phy_type phy_type = e1000_phy_unknown;
do { hw->phy.id = phy_type;
for (phy_addr = 0; phy_addr < 4; phy_addr++) {
for (phy_addr = 0; phy_addr < E1000_MAX_PHY_ADDR; phy_addr++) {
hw->phy.addr = phy_addr; hw->phy.addr = phy_addr;
i = 0;
do {
e1000e_get_phy_id(hw); e1000e_get_phy_id(hw);
phy_type = e1000e_get_phy_type_from_id(hw->phy.id); phy_type = e1000e_get_phy_type_from_id(hw->phy.id);
...@@ -2213,12 +2217,14 @@ s32 e1000e_determine_phy_address(struct e1000_hw *hw) ...@@ -2213,12 +2217,14 @@ s32 e1000e_determine_phy_address(struct e1000_hw *hw)
*/ */
if (phy_type != e1000_phy_unknown) { if (phy_type != e1000_phy_unknown) {
ret_val = 0; ret_val = 0;
break; goto out;
}
} }
msleep(1);
i++; i++;
} while ((ret_val != 0) && (i < 100)); } while (i < 10);
}
out:
return ret_val; return ret_val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment