aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-eeprom.c
diff options
context:
space:
mode:
authorZhu, Yi <yi.zhu@intel.com>2008-12-11 13:33:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-12 14:45:33 -0500
commit3d5717ade01ce22511f2992f150bf6644b21c377 (patch)
tree03d223be4bdd43cad502b59e8d8dc5ddf5873754 /drivers/net/wireless/iwlwifi/iwl-eeprom.c
parent9c5f89b3f6580cca21dca4ede940900c5b3c3a81 (diff)
iwlwifi: use iwl_poll_direct_bit in EEPROM reading
The patch replaces the current reading EEPROM loop iterations with iwl_poll_direct_bit(). It also fixes some comment error. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-eeprom.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index a47fa38e52f0..ce2f47306cea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -209,10 +209,8 @@ int iwl_eeprom_init(struct iwl_priv *priv)
209{ 209{
210 u16 *e; 210 u16 *e;
211 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 211 u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
212 u32 r;
213 int sz = priv->cfg->eeprom_size; 212 int sz = priv->cfg->eeprom_size;
214 int ret; 213 int ret;
215 int i;
216 u16 addr; 214 u16 addr;
217 215
218 /* allocate eeprom */ 216 /* allocate eeprom */
@@ -240,22 +238,19 @@ int iwl_eeprom_init(struct iwl_priv *priv)
240 238
241 /* eeprom is an array of 16bit values */ 239 /* eeprom is an array of 16bit values */
242 for (addr = 0; addr < sz; addr += sizeof(u16)) { 240 for (addr = 0; addr < sz; addr += sizeof(u16)) {
243 _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); 241 u32 r;
244 _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); 242
245 243 _iwl_write32(priv, CSR_EEPROM_REG,
246 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; 244 CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
247 i += IWL_EEPROM_ACCESS_DELAY) {
248 r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
249 if (r & CSR_EEPROM_REG_READ_VALID_MSK)
250 break;
251 udelay(IWL_EEPROM_ACCESS_DELAY);
252 }
253 245
254 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { 246 ret = iwl_poll_direct_bit(priv, CSR_EEPROM_REG,
247 CSR_EEPROM_REG_READ_VALID_MSK,
248 IWL_EEPROM_ACCESS_TIMEOUT);
249 if (ret < 0) {
255 IWL_ERROR("Time out reading EEPROM[%d]\n", addr); 250 IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
256 ret = -ETIMEDOUT;
257 goto done; 251 goto done;
258 } 252 }
253 r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
259 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); 254 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
260 } 255 }
261 ret = 0; 256 ret = 0;