summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-06-01 21:58:48 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2016-06-03 09:14:14 +0200
commit72f02e6c0bf64d4598e13dfcc73c126311f243b9 (patch)
treee26a465cff3b3229d931e75589e3d4f7faa4c554 /drivers/net
parent741cdaf506f9609998418e54396796a4db4ddb3c (diff)
downloadbarebox-72f02e6c0bf64d4598e13dfcc73c126311f243b9.tar.gz
barebox-72f02e6c0bf64d4598e13dfcc73c126311f243b9.tar.xz
e1000: Add EEPROM access locking for i210
As per datasheet (section 4.6 p. 147) accessing EEPROM on i210 requires software to hold a corresponding lock bit in SW_FW_SYNC register. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000/eeprom.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c
index b051a9bb79..9032c12ab7 100644
--- a/drivers/net/e1000/eeprom.c
+++ b/drivers/net/e1000/eeprom.c
@@ -15,7 +15,8 @@ static int32_t e1000_read_eeprom_eerd(struct e1000_hw *hw, uint16_t offset,
uint16_t words, uint16_t *data);
static int32_t e1000_spi_eeprom_ready(struct e1000_hw *hw);
static void e1000_release_eeprom(struct e1000_hw *hw);
-
+static int32_t e1000_acquire_eeprom_flash(struct e1000_hw *hw);
+static void e1000_release_eeprom_flash(struct e1000_hw *hw);
/******************************************************************************
@@ -289,6 +290,11 @@ static int32_t e1000_acquire_eeprom_microwire(struct e1000_hw *hw)
return E1000_SUCCESS;
}
+static int32_t e1000_acquire_eeprom_flash(struct e1000_hw *hw)
+{
+ return e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM);
+}
+
static int32_t e1000_acquire_eeprom(struct e1000_hw *hw)
{
if (hw->eeprom.acquire)
@@ -402,6 +408,9 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw)
if (eecd & E1000_EECD_I210_FLASH_DETECTED) {
eeprom->type = e1000_eeprom_flash;
eeprom->word_size = 2048;
+
+ eeprom->acquire = e1000_acquire_eeprom_flash;
+ eeprom->release = e1000_release_eeprom_flash;
} else {
eeprom->type = e1000_eeprom_invm;
}
@@ -620,6 +629,14 @@ static void e1000_release_eeprom_spi(struct e1000_hw *hw)
e1000_release_eeprom_spi_microwire_epilogue(hw);
}
+static void e1000_release_eeprom_flash(struct e1000_hw *hw)
+{
+ if (e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM) < 0)
+ dev_warn(hw->dev,
+ "Timeout while releasing SWFW_SYNC bits (0x%08x)\n",
+ E1000_SWFW_EEP_SM);
+}
+
static void e1000_release_eeprom(struct e1000_hw *hw)
{
if (hw->eeprom.release)