diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-12-12 23:03:36 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-12-17 10:41:56 +0100 |
commit | 2f4e28be6d15069f2d30b637dd645307c8c0c511 (patch) | |
tree | b7caa2794802efdbb759956d213e29270b4fd992 /drivers/net/e1000 | |
parent | cc0bbff8b076aeb143909dce249a8c5669c05aba (diff) | |
download | barebox-2f4e28be6d15069f2d30b637dd645307c8c0c511.tar.gz barebox-2f4e28be6d15069f2d30b637dd645307c8c0c511.tar.xz |
net/e1000: Only read EEPROM_INIT_CONTROL2_REG if it is needed
E1000_ich8lan, e1000_82573, e1000_82574 and e1000_igb
devices (hw->mac_type) do not use data read from
EEPROM_INIT_CONTROL2_REG in e1000_setup_link(), so there's no reason
for it to bail out when EEPROM read fails. An examlpe use-case would
be a i210 adapter initialized from iNVM with no valid EEPROM attached.
Change the code to only call e1000_read_eeprom() for devices that do
need it.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/main.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/e1000/main.c b/drivers/net/e1000/main.c index 87ee460945..0ef8fd6231 100644 --- a/drivers/net/e1000/main.c +++ b/drivers/net/e1000/main.c @@ -832,21 +832,6 @@ static int e1000_setup_link(struct e1000_hw *hw) if (e1000_check_phy_reset_block(hw)) return E1000_SUCCESS; - /* Read and store word 0x0F of the EEPROM. This word contains bits - * that determine the hardware's default PAUSE (flow control) mode, - * a bit that determines whether the HW defaults to enabling or - * disabling auto-negotiation, and the direction of the - * SW defined pins. If there is no SW over-ride of the flow - * control setting, then the variable hw->fc will - * be initialized based on a value in the EEPROM. - */ - ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, - &eeprom_data); - if (ret_val < 0) { - dev_err(hw->dev, "EEPROM Read Error\n"); - return ret_val; - } - switch (hw->mac_type) { case e1000_ich8lan: case e1000_82573: @@ -855,6 +840,22 @@ static int e1000_setup_link(struct e1000_hw *hw) hw->fc = e1000_fc_full; break; default: + /* Read and store word 0x0F of the EEPROM. This word + * contains bits that determine the hardware's default + * PAUSE (flow control) mode, a bit that determines + * whether the HW defaults to enabling or disabling + * auto-negotiation, and the direction of the SW + * defined pins. If there is no SW over-ride of the + * flow control setting, then the variable hw->fc will + * be initialized based on a value in the EEPROM. + */ + ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, + &eeprom_data); + if (ret_val < 0) { + dev_err(hw->dev, "EEPROM Read Error\n"); + return ret_val; + } + if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) hw->fc = e1000_fc_none; else if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == EEPROM_WORD0F_ASM_DIR) |