[PATCH] net: e1000: read EEPROM through EERD register on 8257x adapters

Denis Orlov denorl2009 at gmail.com
Fri Jan 13 06:09:09 PST 2023


For some reason, we would only use EERD if Flash is used as non-volatile
memory. However, looking at e1000e driver sources from Linux this is how
they are reading NVM on those cards for both EEPROM and Flash.

This fixes issues with reading EEPROM in driver on QEMU emulated 82574
PCIe card.

Signed-off-by: Denis Orlov <denorl2009 at gmail.com>
---
 drivers/net/e1000/eeprom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c
index 27143bd6d0..c90faf3a58 100644
--- a/drivers/net/e1000/eeprom.c
+++ b/drivers/net/e1000/eeprom.c
@@ -495,6 +495,7 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw)
 	case e1000_82571:
 	case e1000_82572:
 		e1000_eeprom_uses_spi(eeprom, eecd);
+		eeprom->read = e1000_read_eeprom_eerd;
 		break;
 
 	case e1000_82573:
@@ -502,7 +503,6 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw)
 		if (e1000_is_onboard_nvm_eeprom(hw)) {
 			e1000_eeprom_uses_spi(eeprom, eecd);
 		} else {
-			eeprom->read = e1000_read_eeprom_eerd;
 			eeprom->type = e1000_eeprom_flash;
 			eeprom->word_size = 2048;
 
@@ -513,6 +513,7 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw)
 			eecd &= ~E1000_EECD_AUPDEN;
 			e1000_write_reg(hw, E1000_EECD, eecd);
 		}
+		eeprom->read = e1000_read_eeprom_eerd;
 		break;
 
 	case e1000_80003es2lan:
-- 
2.30.2




More information about the barebox mailing list