提交 23e0f148 编写于 作者: A Akeem G. Abodunrin 提交者: Jeff Kirsher

igb: Acquire, release semaphore for writing each EEPROM page

This patch allows software acquires and releases NVM resource for
writing each EEPROM page, instead of holding semaphore for the whole
data block which is too long and could trigger write fails on
unpredictable addresses.
Signed-off-by: NAkeem G Abodunrin <akeem.g.abodunrin@intel.com>
Tested-by: NJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 1720ee3e
...@@ -438,7 +438,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -438,7 +438,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{ {
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
s32 ret_val; s32 ret_val = -E1000_ERR_NVM;
u16 widx = 0; u16 widx = 0;
/* /*
...@@ -448,22 +448,21 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -448,22 +448,21 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) { (words == 0)) {
hw_dbg("nvm parameter(s) out of bounds\n"); hw_dbg("nvm parameter(s) out of bounds\n");
ret_val = -E1000_ERR_NVM; return ret_val;
goto out;
} }
ret_val = hw->nvm.ops.acquire(hw);
if (ret_val)
goto out;
msleep(10);
while (widx < words) { while (widx < words) {
u8 write_opcode = NVM_WRITE_OPCODE_SPI; u8 write_opcode = NVM_WRITE_OPCODE_SPI;
ret_val = igb_ready_nvm_eeprom(hw); ret_val = nvm->ops.acquire(hw);
if (ret_val) if (ret_val)
goto release; return ret_val;
ret_val = igb_ready_nvm_eeprom(hw);
if (ret_val) {
nvm->ops.release(hw);
return ret_val;
}
igb_standby_nvm(hw); igb_standby_nvm(hw);
...@@ -497,13 +496,10 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -497,13 +496,10 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
break; break;
} }
} }
usleep_range(1000, 2000);
nvm->ops.release(hw);
} }
msleep(10);
release:
hw->nvm.ops.release(hw);
out:
return ret_val; return ret_val;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册