summaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-01-26 14:32:30 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-01-30 07:53:49 +0100
commit127837acde71b471888fe7d9ddd9125d39feb65b (patch)
tree794ed8ac39087c2351c953b827e542fcacdfe60e /drivers/net/e1000
parentb82e7ef10b533ba39b799dd0214736565d7d81c3 (diff)
downloadbarebox-127837acde71b471888fe7d9ddd9125d39feb65b.tar.gz
barebox-127837acde71b471888fe7d9ddd9125d39feb65b.tar.xz
net/e1000: EEPROM isn't valid if only iNVM is available
There is no point in registering the emulated EEPROM device if only the iNVM is available with no external flash attached to the i210, as in practice it's only shadowing the iNVM. When the EEPROM is populated from iNVM, the signature is not valid, which causes other parts of the driver to fall over. To fix this just ignore the EEPROM in that case. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/eeprom.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c
index ddac7de8a0..0a28dfdd88 100644
--- a/drivers/net/e1000/eeprom.c
+++ b/drivers/net/e1000/eeprom.c
@@ -1525,20 +1525,18 @@ int e1000_register_invm(struct e1000_hw *hw)
int e1000_eeprom_valid(struct e1000_hw *hw)
{
- uint32_t eecd;
+ uint32_t valid_mask = E1000_EECD_FLASH_IN_USE |
+ E1000_EECD_AUTO_RD | E1000_EECD_EE_PRES;
if (hw->mac_type != e1000_igb)
return 1;
/*
- * if AUTO_RD or EE_PRES are not set in EECD, the shadow RAM is invalid
- * (and in practise seems to contain the contents of iNVM).
+ * If there is no flash in use or AUTO_RD or EE_PRES are not set in
+ * EECD, the shadow RAM is invalid (and in practise seems to contain
+ * the contents of iNVM).
*/
- eecd = e1000_read_reg(hw, E1000_EECD);
- if (!(eecd & E1000_EECD_AUTO_RD))
- return 0;
-
- if (!(eecd & E1000_EECD_EE_PRES))
+ if ((e1000_read_reg(hw, E1000_EECD) & valid_mask) != valid_mask)
return 0;
return 1;