#include "igb.h"Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_ONLY) | |
| static void | igb_stop_nvm (struct e1000_hw *hw) |
| igb_stop_nvm - Terminate EEPROM command : pointer to the HW structure | |
| static void | igb_reload_nvm_generic (struct e1000_hw *hw) |
| igb_reload_nvm_generic - Reloads EEPROM : pointer to the HW structure | |
| void | igb_init_nvm_ops_generic (struct e1000_hw *hw) |
| igb_init_nvm_ops_generic - Initialize NVM function pointers : pointer to the HW structure | |
| static void | igb_raise_eec_clk (struct e1000_hw *hw, u32 *eecd) |
| igb_raise_eec_clk - Raise EEPROM clock : pointer to the HW structure : pointer to the EEPROM | |
| static void | igb_lower_eec_clk (struct e1000_hw *hw, u32 *eecd) |
| igb_lower_eec_clk - Lower EEPROM clock : pointer to the HW structure : pointer to the EEPROM | |
| static void | igb_shift_out_eec_bits (struct e1000_hw *hw, u16 data, u16 count) |
| igb_shift_out_eec_bits - Shift data bits our to the EEPROM : pointer to the HW structure : data to send to the EEPROM : number of bits to shift out | |
| static u16 | igb_shift_in_eec_bits (struct e1000_hw *hw, u16 count) |
| igb_shift_in_eec_bits - Shift data bits in from the EEPROM : pointer to the HW structure : number of bits to shift in | |
| s32 | igb_poll_eerd_eewr_done (struct e1000_hw *hw, int ee_reg) |
| igb_poll_eerd_eewr_done - Poll for EEPROM read/write completion : pointer to the HW structure : EEPROM flag for polling | |
| s32 | igb_acquire_nvm_generic (struct e1000_hw *hw) |
| igb_acquire_nvm_generic - Generic request for access to EEPROM : pointer to the HW structure | |
| static void | igb_standby_nvm (struct e1000_hw *hw) |
| igb_standby_nvm - Return EEPROM to standby state : pointer to the HW structure | |
| void | igb_release_nvm_generic (struct e1000_hw *hw) |
| igb_release_nvm_generic - Release exclusive access to EEPROM : pointer to the HW structure | |
| static s32 | igb_ready_nvm_eeprom (struct e1000_hw *hw) |
| igb_ready_nvm_eeprom - Prepares EEPROM for read/write : pointer to the HW structure | |
| s32 | igb_read_nvm_eerd (struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
| igb_read_nvm_eerd - Reads EEPROM using EERD register : pointer to the HW structure : offset of word in the EEPROM to read : number of words to read : word read from the EEPROM | |
| s32 | igb_write_nvm_spi (struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
| igb_write_nvm_spi - Write to EEPROM using SPI : pointer to the HW structure : offset within the EEPROM to be written to : number of words to write : 16 bit word(s) to be written to the EEPROM | |
| s32 | igb_read_pba_num_generic (struct e1000_hw *hw, u32 *pba_num) |
| igb_read_pba_num_generic - Read device part number : pointer to the HW structure : pointer to device part number | |
| s32 | igb_read_mac_addr_generic (struct e1000_hw *hw) |
| igb_read_mac_addr_generic - Read device MAC address : pointer to the HW structure | |
| s32 | igb_validate_nvm_checksum_generic (struct e1000_hw *hw) |
| igb_validate_nvm_checksum_generic - Validate EEPROM checksum : pointer to the HW structure | |
| s32 | igb_update_nvm_checksum_generic (struct e1000_hw *hw) |
| igb_update_nvm_checksum_generic - Update EEPROM checksum : pointer to the HW structure | |
| FILE_LICENCE | ( | GPL2_ONLY | ) |
| static void igb_stop_nvm | ( | struct e1000_hw * | hw | ) | [static] |
igb_stop_nvm - Terminate EEPROM command : pointer to the HW structure
Terminates the current command by inverting the EEPROM's chip select pin.
Definition at line 265 of file igb_nvm.c.
References DEBUGFUNC, E1000_EECD, E1000_EECD_CS, e1000_nvm_eeprom_spi, E1000_READ_REG, igb_lower_eec_clk(), e1000_hw::nvm, e1000_nvm_info::type, and u32.
Referenced by igb_release_nvm_generic().
00266 { 00267 u32 eecd; 00268 00269 DEBUGFUNC("igb_stop_nvm"); 00270 00271 eecd = E1000_READ_REG(hw, E1000_EECD); 00272 if (hw->nvm.type == e1000_nvm_eeprom_spi) { 00273 /* Pull CS high */ 00274 eecd |= E1000_EECD_CS; 00275 igb_lower_eec_clk(hw, &eecd); 00276 } 00277 }
| static void igb_reload_nvm_generic | ( | struct e1000_hw * | hw | ) | [static] |
igb_reload_nvm_generic - Reloads EEPROM : pointer to the HW structure
Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the extended control register.
Definition at line 615 of file igb_nvm.c.
References DEBUGFUNC, E1000_CTRL_EXT, E1000_CTRL_EXT_EE_RST, E1000_READ_REG, E1000_WRITE_FLUSH, E1000_WRITE_REG, u32, and usec_delay.
Referenced by igb_init_nvm_ops_generic().
00616 { 00617 u32 ctrl_ext; 00618 00619 DEBUGFUNC("igb_reload_nvm_generic"); 00620 00621 usec_delay(10); 00622 ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); 00623 ctrl_ext |= E1000_CTRL_EXT_EE_RST; 00624 E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); 00625 E1000_WRITE_FLUSH(hw); 00626 }
| void igb_init_nvm_ops_generic | ( | struct e1000_hw * | hw | ) |
igb_init_nvm_ops_generic - Initialize NVM function pointers : pointer to the HW structure
Setups up the function pointers to no-op functions
Definition at line 41 of file igb_nvm.c.
References DEBUGFUNC, igb_reload_nvm_generic(), e1000_hw::nvm, e1000_nvm_info::ops, and e1000_nvm_operations::reload.
Referenced by igb_setup_init_funcs().
00042 { 00043 struct e1000_nvm_info *nvm = &hw->nvm; 00044 DEBUGFUNC("igb_init_nvm_ops_generic"); 00045 00046 /* Initialize function pointers */ 00047 nvm->ops.reload = igb_reload_nvm_generic; 00048 }
igb_raise_eec_clk - Raise EEPROM clock : pointer to the HW structure : pointer to the EEPROM
Enable/Raise the EEPROM clock bit.
Definition at line 57 of file igb_nvm.c.
References e1000_nvm_info::delay_usec, E1000_EECD, E1000_EECD_SK, E1000_WRITE_FLUSH, E1000_WRITE_REG, e1000_hw::nvm, and usec_delay.
Referenced by igb_shift_in_eec_bits(), and igb_shift_out_eec_bits().
00058 { 00059 *eecd = *eecd | E1000_EECD_SK; 00060 E1000_WRITE_REG(hw, E1000_EECD, *eecd); 00061 E1000_WRITE_FLUSH(hw); 00062 usec_delay(hw->nvm.delay_usec); 00063 }
igb_lower_eec_clk - Lower EEPROM clock : pointer to the HW structure : pointer to the EEPROM
Clear/Lower the EEPROM clock bit.
Definition at line 72 of file igb_nvm.c.
References e1000_nvm_info::delay_usec, E1000_EECD, E1000_EECD_SK, E1000_WRITE_FLUSH, E1000_WRITE_REG, e1000_hw::nvm, and usec_delay.
Referenced by igb_shift_in_eec_bits(), igb_shift_out_eec_bits(), and igb_stop_nvm().
00073 { 00074 *eecd = *eecd & ~E1000_EECD_SK; 00075 E1000_WRITE_REG(hw, E1000_EECD, *eecd); 00076 E1000_WRITE_FLUSH(hw); 00077 usec_delay(hw->nvm.delay_usec); 00078 }
igb_shift_out_eec_bits - Shift data bits our to the EEPROM : pointer to the HW structure : data to send to the EEPROM : number of bits to shift out
We need to shift 'count' bits out to the EEPROM. So, the value in the "data" parameter will be shifted out to the EEPROM one bit at a time. In order to do this, "data" must be broken down into bits.
Definition at line 90 of file igb_nvm.c.
References DEBUGFUNC, e1000_nvm_info::delay_usec, E1000_EECD, E1000_EECD_DI, E1000_EECD_DO, e1000_nvm_eeprom_spi, E1000_READ_REG, E1000_WRITE_FLUSH, E1000_WRITE_REG, igb_lower_eec_clk(), igb_raise_eec_clk(), e1000_hw::nvm, e1000_nvm_info::type, u32, and usec_delay.
Referenced by igb_ready_nvm_eeprom(), and igb_write_nvm_spi().
00091 { 00092 struct e1000_nvm_info *nvm = &hw->nvm; 00093 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 00094 u32 mask; 00095 00096 DEBUGFUNC("igb_shift_out_eec_bits"); 00097 00098 mask = 0x01 << (count - 1); 00099 if (nvm->type == e1000_nvm_eeprom_spi) 00100 eecd |= E1000_EECD_DO; 00101 00102 do { 00103 eecd &= ~E1000_EECD_DI; 00104 00105 if (data & mask) 00106 eecd |= E1000_EECD_DI; 00107 00108 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00109 E1000_WRITE_FLUSH(hw); 00110 00111 usec_delay(nvm->delay_usec); 00112 00113 igb_raise_eec_clk(hw, &eecd); 00114 igb_lower_eec_clk(hw, &eecd); 00115 00116 mask >>= 1; 00117 } while (mask); 00118 00119 eecd &= ~E1000_EECD_DI; 00120 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00121 }
igb_shift_in_eec_bits - Shift data bits in from the EEPROM : pointer to the HW structure : number of bits to shift in
In order to read a register from the EEPROM, we need to shift 'count' bits in from the EEPROM. Bits are "shifted in" by raising the clock input to the EEPROM (setting the SK bit), and then reading the value of the data out "DO" bit. During this "shifting in" process the data in "DI" bit should always be clear.
Definition at line 134 of file igb_nvm.c.
References DEBUGFUNC, E1000_EECD, E1000_EECD_DI, E1000_EECD_DO, E1000_READ_REG, igb_lower_eec_clk(), igb_raise_eec_clk(), u16, and u32.
Referenced by igb_ready_nvm_eeprom().
00135 { 00136 u32 eecd; 00137 u32 i; 00138 u16 data; 00139 00140 DEBUGFUNC("igb_shift_in_eec_bits"); 00141 00142 eecd = E1000_READ_REG(hw, E1000_EECD); 00143 00144 eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); 00145 data = 0; 00146 00147 for (i = 0; i < count; i++) { 00148 data <<= 1; 00149 igb_raise_eec_clk(hw, &eecd); 00150 00151 eecd = E1000_READ_REG(hw, E1000_EECD); 00152 00153 eecd &= ~E1000_EECD_DI; 00154 if (eecd & E1000_EECD_DO) 00155 data |= 1; 00156 00157 igb_lower_eec_clk(hw, &eecd); 00158 } 00159 00160 return data; 00161 }
igb_poll_eerd_eewr_done - Poll for EEPROM read/write completion : pointer to the HW structure : EEPROM flag for polling
Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'.
Definition at line 171 of file igb_nvm.c.
References DEBUGFUNC, E1000_EERD, E1000_EEWR, E1000_ERR_NVM, E1000_NVM_POLL_READ, E1000_NVM_RW_REG_DONE, E1000_READ_REG, E1000_SUCCESS, u32, and usec_delay.
Referenced by igb_read_nvm_eerd().
00172 { 00173 u32 attempts = 100000; 00174 u32 i, reg = 0; 00175 s32 ret_val = -E1000_ERR_NVM; 00176 00177 DEBUGFUNC("igb_poll_eerd_eewr_done"); 00178 00179 for (i = 0; i < attempts; i++) { 00180 if (ee_reg == E1000_NVM_POLL_READ) 00181 reg = E1000_READ_REG(hw, E1000_EERD); 00182 else 00183 reg = E1000_READ_REG(hw, E1000_EEWR); 00184 00185 if (reg & E1000_NVM_RW_REG_DONE) { 00186 ret_val = E1000_SUCCESS; 00187 break; 00188 } 00189 00190 usec_delay(5); 00191 } 00192 00193 return ret_val; 00194 }
igb_acquire_nvm_generic - Generic request for access to EEPROM : pointer to the HW structure
Set the EEPROM access request bit and wait for EEPROM access grant bit. Return successful if access grant bit set, else clear the request for EEPROM access and return -E1000_ERR_NVM (-1).
Definition at line 204 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, E1000_EECD, E1000_EECD_GNT, E1000_EECD_REQ, E1000_ERR_NVM, E1000_NVM_GRANT_ATTEMPTS, E1000_READ_REG, E1000_SUCCESS, E1000_WRITE_REG, timeout(), u32, and usec_delay.
Referenced by igb_acquire_nvm_82575().
00205 { 00206 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 00207 s32 timeout = E1000_NVM_GRANT_ATTEMPTS; 00208 s32 ret_val = E1000_SUCCESS; 00209 00210 DEBUGFUNC("igb_acquire_nvm_generic"); 00211 00212 E1000_WRITE_REG(hw, E1000_EECD, eecd | E1000_EECD_REQ); 00213 eecd = E1000_READ_REG(hw, E1000_EECD); 00214 00215 while (timeout) { 00216 if (eecd & E1000_EECD_GNT) 00217 break; 00218 usec_delay(5); 00219 eecd = E1000_READ_REG(hw, E1000_EECD); 00220 timeout--; 00221 } 00222 00223 if (!timeout) { 00224 eecd &= ~E1000_EECD_REQ; 00225 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00226 DEBUGOUT("Could not acquire NVM grant\n"); 00227 ret_val = -E1000_ERR_NVM; 00228 } 00229 00230 return ret_val; 00231 }
| static void igb_standby_nvm | ( | struct e1000_hw * | hw | ) | [static] |
igb_standby_nvm - Return EEPROM to standby state : pointer to the HW structure
Return the EEPROM to a standby state.
Definition at line 239 of file igb_nvm.c.
References DEBUGFUNC, e1000_nvm_info::delay_usec, E1000_EECD, E1000_EECD_CS, e1000_nvm_eeprom_spi, E1000_READ_REG, E1000_WRITE_FLUSH, E1000_WRITE_REG, e1000_hw::nvm, e1000_nvm_info::type, u32, and usec_delay.
Referenced by igb_ready_nvm_eeprom(), and igb_write_nvm_spi().
00240 { 00241 struct e1000_nvm_info *nvm = &hw->nvm; 00242 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 00243 00244 DEBUGFUNC("igb_standby_nvm"); 00245 00246 if (nvm->type == e1000_nvm_eeprom_spi) { 00247 /* Toggle CS to flush commands */ 00248 eecd |= E1000_EECD_CS; 00249 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00250 E1000_WRITE_FLUSH(hw); 00251 usec_delay(nvm->delay_usec); 00252 eecd &= ~E1000_EECD_CS; 00253 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00254 E1000_WRITE_FLUSH(hw); 00255 usec_delay(nvm->delay_usec); 00256 } 00257 }
| void igb_release_nvm_generic | ( | struct e1000_hw * | hw | ) |
igb_release_nvm_generic - Release exclusive access to EEPROM : pointer to the HW structure
Stop any current commands to the EEPROM and clear the EEPROM request bit.
Definition at line 285 of file igb_nvm.c.
References DEBUGFUNC, E1000_EECD, E1000_EECD_REQ, E1000_READ_REG, E1000_WRITE_REG, igb_stop_nvm(), and u32.
Referenced by igb_release_nvm_82575().
00286 { 00287 u32 eecd; 00288 00289 DEBUGFUNC("igb_release_nvm_generic"); 00290 00291 igb_stop_nvm(hw); 00292 00293 eecd = E1000_READ_REG(hw, E1000_EECD); 00294 eecd &= ~E1000_EECD_REQ; 00295 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00296 }
igb_ready_nvm_eeprom - Prepares EEPROM for read/write : pointer to the HW structure
Setups the EEPROM for reading and writing.
Definition at line 304 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, E1000_EECD, E1000_EECD_CS, E1000_EECD_SK, E1000_ERR_NVM, e1000_nvm_eeprom_spi, E1000_READ_REG, E1000_SUCCESS, E1000_WRITE_REG, igb_shift_in_eec_bits(), igb_shift_out_eec_bits(), igb_standby_nvm(), e1000_hw::nvm, NVM_MAX_RETRY_SPI, NVM_RDSR_OPCODE_SPI, NVM_STATUS_RDY_SPI, e1000_nvm_info::opcode_bits, timeout(), e1000_nvm_info::type, u16, u32, u8, and usec_delay.
Referenced by igb_write_nvm_spi().
00305 { 00306 struct e1000_nvm_info *nvm = &hw->nvm; 00307 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 00308 s32 ret_val = E1000_SUCCESS; 00309 u16 timeout = 0; 00310 u8 spi_stat_reg; 00311 00312 DEBUGFUNC("igb_ready_nvm_eeprom"); 00313 00314 if (nvm->type == e1000_nvm_eeprom_spi) { 00315 /* Clear SK and CS */ 00316 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 00317 E1000_WRITE_REG(hw, E1000_EECD, eecd); 00318 usec_delay(1); 00319 timeout = NVM_MAX_RETRY_SPI; 00320 00321 /* 00322 * Read "Status Register" repeatedly until the LSB is cleared. 00323 * The EEPROM will signal that the command has been completed 00324 * by clearing bit 0 of the internal status register. If it's 00325 * not cleared within 'timeout', then error out. 00326 */ 00327 while (timeout) { 00328 igb_shift_out_eec_bits(hw, NVM_RDSR_OPCODE_SPI, 00329 hw->nvm.opcode_bits); 00330 spi_stat_reg = (u8)igb_shift_in_eec_bits(hw, 8); 00331 if (!(spi_stat_reg & NVM_STATUS_RDY_SPI)) 00332 break; 00333 00334 usec_delay(5); 00335 igb_standby_nvm(hw); 00336 timeout--; 00337 } 00338 00339 if (!timeout) { 00340 DEBUGOUT("SPI NVM Status error\n"); 00341 ret_val = -E1000_ERR_NVM; 00342 goto out; 00343 } 00344 } 00345 00346 out: 00347 return ret_val; 00348 }
igb_read_nvm_eerd - Reads EEPROM using EERD register : pointer to the HW structure : offset of word in the EEPROM to read : number of words to read : word read from the EEPROM
Reads a 16 bit word from the EEPROM using the EERD register.
Definition at line 359 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, E1000_EERD, E1000_ERR_NVM, E1000_NVM_POLL_READ, E1000_NVM_RW_ADDR_SHIFT, E1000_NVM_RW_REG_DATA, E1000_NVM_RW_REG_START, E1000_READ_REG, E1000_SUCCESS, E1000_WRITE_REG, igb_poll_eerd_eewr_done(), e1000_hw::nvm, u32, and e1000_nvm_info::word_size.
Referenced by igb_init_nvm_params_82575().
00360 { 00361 struct e1000_nvm_info *nvm = &hw->nvm; 00362 u32 i, eerd = 0; 00363 s32 ret_val = E1000_SUCCESS; 00364 00365 DEBUGFUNC("igb_read_nvm_eerd"); 00366 00367 /* 00368 * A check for invalid values: offset too large, too many words, 00369 * too many words for the offset, and not enough words. 00370 */ 00371 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || 00372 (words == 0)) { 00373 DEBUGOUT("nvm parameter(s) out of bounds\n"); 00374 ret_val = -E1000_ERR_NVM; 00375 goto out; 00376 } 00377 00378 for (i = 0; i < words; i++) { 00379 eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) + 00380 E1000_NVM_RW_REG_START; 00381 00382 E1000_WRITE_REG(hw, E1000_EERD, eerd); 00383 ret_val = igb_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ); 00384 if (ret_val) 00385 break; 00386 00387 data[i] = (E1000_READ_REG(hw, E1000_EERD) >> 00388 E1000_NVM_RW_REG_DATA); 00389 } 00390 00391 out: 00392 return ret_val; 00393 }
igb_write_nvm_spi - Write to EEPROM using SPI : pointer to the HW structure : offset within the EEPROM to be written to : number of words to write : 16 bit word(s) to be written to the EEPROM
Writes data to EEPROM at offset using SPI interface.
If e1000_update_nvm_checksum is not called after this function , the EEPROM will most likely contain an invalid checksum.
Definition at line 407 of file igb_nvm.c.
References e1000_nvm_operations::acquire, e1000_nvm_info::address_bits, DEBUGFUNC, DEBUGOUT, E1000_ERR_NVM, igb_ready_nvm_eeprom(), igb_shift_out_eec_bits(), igb_standby_nvm(), msec_delay, e1000_hw::nvm, NVM_A8_OPCODE_SPI, NVM_WREN_OPCODE_SPI, NVM_WRITE_OPCODE_SPI, e1000_nvm_info::opcode_bits, e1000_nvm_info::ops, e1000_nvm_info::page_size, e1000_nvm_operations::release, u16, u8, and e1000_nvm_info::word_size.
Referenced by igb_init_nvm_params_82575().
00408 { 00409 struct e1000_nvm_info *nvm = &hw->nvm; 00410 s32 ret_val; 00411 u16 widx = 0; 00412 00413 DEBUGFUNC("igb_write_nvm_spi"); 00414 00415 /* 00416 * A check for invalid values: offset too large, too many words, 00417 * and not enough words. 00418 */ 00419 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || 00420 (words == 0)) { 00421 DEBUGOUT("nvm parameter(s) out of bounds\n"); 00422 ret_val = -E1000_ERR_NVM; 00423 goto out; 00424 } 00425 00426 ret_val = nvm->ops.acquire(hw); 00427 if (ret_val) 00428 goto out; 00429 00430 while (widx < words) { 00431 u8 write_opcode = NVM_WRITE_OPCODE_SPI; 00432 00433 ret_val = igb_ready_nvm_eeprom(hw); 00434 if (ret_val) 00435 goto release; 00436 00437 igb_standby_nvm(hw); 00438 00439 /* Send the WRITE ENABLE command (8 bit opcode) */ 00440 igb_shift_out_eec_bits(hw, NVM_WREN_OPCODE_SPI, 00441 nvm->opcode_bits); 00442 00443 igb_standby_nvm(hw); 00444 00445 /* 00446 * Some SPI eeproms use the 8th address bit embedded in the 00447 * opcode 00448 */ 00449 if ((nvm->address_bits == 8) && (offset >= 128)) 00450 write_opcode |= NVM_A8_OPCODE_SPI; 00451 00452 /* Send the Write command (8-bit opcode + addr) */ 00453 igb_shift_out_eec_bits(hw, write_opcode, nvm->opcode_bits); 00454 igb_shift_out_eec_bits(hw, (u16)((offset + widx) * 2), 00455 nvm->address_bits); 00456 00457 /* Loop to allow for up to whole page write of eeprom */ 00458 while (widx < words) { 00459 u16 word_out = data[widx]; 00460 word_out = (word_out >> 8) | (word_out << 8); 00461 igb_shift_out_eec_bits(hw, word_out, 16); 00462 widx++; 00463 00464 if ((((offset + widx) * 2) % nvm->page_size) == 0) { 00465 igb_standby_nvm(hw); 00466 break; 00467 } 00468 } 00469 } 00470 00471 msec_delay(10); 00472 release: 00473 nvm->ops.release(hw); 00474 00475 out: 00476 return ret_val; 00477 }
igb_read_pba_num_generic - Read device part number : pointer to the HW structure : pointer to device part number
Reads the product board assembly (PBA) number from the EEPROM and stores the value in pba_num.
Definition at line 487 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, e1000_hw::nvm, NVM_PBA_OFFSET_0, NVM_PBA_OFFSET_1, e1000_nvm_info::ops, e1000_nvm_operations::read, u16, and u32.
Referenced by igb_read_pba_num().
00488 { 00489 s32 ret_val; 00490 u16 nvm_data; 00491 00492 DEBUGFUNC("igb_read_pba_num_generic"); 00493 00494 ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); 00495 if (ret_val) { 00496 DEBUGOUT("NVM Read Error\n"); 00497 goto out; 00498 } 00499 *pba_num = (u32)(nvm_data << 16); 00500 00501 ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); 00502 if (ret_val) { 00503 DEBUGOUT("NVM Read Error\n"); 00504 goto out; 00505 } 00506 *pba_num |= nvm_data; 00507 00508 out: 00509 return ret_val; 00510 }
igb_read_mac_addr_generic - Read device MAC address : pointer to the HW structure
Reads the device MAC address from the EEPROM and stores the value. Since devices with two ports use the same EEPROM, we increment the last bit in the MAC address for the second port.
Definition at line 520 of file igb_nvm.c.
References e1000_mac_info::addr, E1000_RAH, E1000_RAH_MAC_ADDR_LEN, E1000_RAL, E1000_RAL_MAC_ADDR_LEN, E1000_READ_REG, E1000_SUCCESS, ETH_ADDR_LEN, e1000_hw::mac, e1000_mac_info::perm_addr, u16, u32, and u8.
Referenced by igb_init_mac_ops_generic(), igb_read_mac_addr(), and igb_read_mac_addr_82575().
00521 { 00522 u32 rar_high; 00523 u32 rar_low; 00524 u16 i; 00525 00526 rar_high = E1000_READ_REG(hw, E1000_RAH(0)); 00527 rar_low = E1000_READ_REG(hw, E1000_RAL(0)); 00528 00529 for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++) 00530 hw->mac.perm_addr[i] = (u8)(rar_low >> (i*8)); 00531 00532 for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++) 00533 hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8)); 00534 00535 for (i = 0; i < ETH_ADDR_LEN; i++) 00536 hw->mac.addr[i] = hw->mac.perm_addr[i]; 00537 00538 return E1000_SUCCESS; 00539 }
igb_validate_nvm_checksum_generic - Validate EEPROM checksum : pointer to the HW structure
Calculates the EEPROM checksum by reading/adding each word of the EEPROM and then verifies that the sum of the EEPROM is equal to 0xBABA.
Definition at line 548 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, E1000_ERR_NVM, E1000_SUCCESS, e1000_hw::nvm, NVM_CHECKSUM_REG, NVM_SUM, e1000_nvm_info::ops, e1000_nvm_operations::read, and u16.
Referenced by igb_init_nvm_params_82575().
00549 { 00550 s32 ret_val = E1000_SUCCESS; 00551 u16 checksum = 0; 00552 u16 i, nvm_data; 00553 00554 DEBUGFUNC("igb_validate_nvm_checksum_generic"); 00555 00556 for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { 00557 ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); 00558 if (ret_val) { 00559 DEBUGOUT("NVM Read Error\n"); 00560 goto out; 00561 } 00562 checksum += nvm_data; 00563 } 00564 00565 if (checksum != (u16) NVM_SUM) { 00566 DEBUGOUT("NVM Checksum Invalid\n"); 00567 ret_val = -E1000_ERR_NVM; 00568 goto out; 00569 } 00570 00571 out: 00572 return ret_val; 00573 }
igb_update_nvm_checksum_generic - Update EEPROM checksum : pointer to the HW structure
Updates the EEPROM checksum by reading/adding each word of the EEPROM up to the checksum. Then calculates the EEPROM checksum and writes the value to the EEPROM.
Definition at line 583 of file igb_nvm.c.
References DEBUGFUNC, DEBUGOUT, e1000_hw::nvm, NVM_CHECKSUM_REG, NVM_SUM, e1000_nvm_info::ops, e1000_nvm_operations::read, u16, and e1000_nvm_operations::write.
Referenced by igb_init_nvm_params_82575().
00584 { 00585 s32 ret_val; 00586 u16 checksum = 0; 00587 u16 i, nvm_data; 00588 00589 DEBUGFUNC("igb_update_nvm_checksum"); 00590 00591 for (i = 0; i < NVM_CHECKSUM_REG; i++) { 00592 ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); 00593 if (ret_val) { 00594 DEBUGOUT("NVM Read Error while updating checksum.\n"); 00595 goto out; 00596 } 00597 checksum += nvm_data; 00598 } 00599 checksum = (u16) NVM_SUM - checksum; 00600 ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum); 00601 if (ret_val) { 00602 DEBUGOUT("NVM Write Error while updating checksum.\n"); 00603 } 00604 out: 00605 return ret_val; 00606 }
1.5.7.1