diff options
Diffstat (limited to 'drivers/net/e1000e/lib.c')
-rw-r--r-- | drivers/net/e1000e/lib.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 95f75a43c9f9..073934c7f73a 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -1852,62 +1852,6 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) | |||
1852 | } | 1852 | } |
1853 | 1853 | ||
1854 | /** | 1854 | /** |
1855 | * e1000e_read_nvm_spi - Reads EEPROM using SPI | ||
1856 | * @hw: pointer to the HW structure | ||
1857 | * @offset: offset of word in the EEPROM to read | ||
1858 | * @words: number of words to read | ||
1859 | * @data: word read from the EEPROM | ||
1860 | * | ||
1861 | * Reads a 16 bit word from the EEPROM. | ||
1862 | **/ | ||
1863 | s32 e1000e_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | ||
1864 | { | ||
1865 | struct e1000_nvm_info *nvm = &hw->nvm; | ||
1866 | u32 i = 0; | ||
1867 | s32 ret_val; | ||
1868 | u16 word_in; | ||
1869 | u8 read_opcode = NVM_READ_OPCODE_SPI; | ||
1870 | |||
1871 | /* A check for invalid values: offset too large, too many words, | ||
1872 | * and not enough words. */ | ||
1873 | if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || | ||
1874 | (words == 0)) { | ||
1875 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); | ||
1876 | return -E1000_ERR_NVM; | ||
1877 | } | ||
1878 | |||
1879 | ret_val = nvm->ops.acquire_nvm(hw); | ||
1880 | if (ret_val) | ||
1881 | return ret_val; | ||
1882 | |||
1883 | ret_val = e1000_ready_nvm_eeprom(hw); | ||
1884 | if (ret_val) { | ||
1885 | nvm->ops.release_nvm(hw); | ||
1886 | return ret_val; | ||
1887 | } | ||
1888 | |||
1889 | e1000_standby_nvm(hw); | ||
1890 | |||
1891 | if ((nvm->address_bits == 8) && (offset >= 128)) | ||
1892 | read_opcode |= NVM_A8_OPCODE_SPI; | ||
1893 | |||
1894 | /* Send the READ command (opcode + addr) */ | ||
1895 | e1000_shift_out_eec_bits(hw, read_opcode, nvm->opcode_bits); | ||
1896 | e1000_shift_out_eec_bits(hw, (u16)(offset*2), nvm->address_bits); | ||
1897 | |||
1898 | /* Read the data. SPI NVMs increment the address with each byte | ||
1899 | * read and will roll over if reading beyond the end. This allows | ||
1900 | * us to read the whole NVM from any offset */ | ||
1901 | for (i = 0; i < words; i++) { | ||
1902 | word_in = e1000_shift_in_eec_bits(hw, 16); | ||
1903 | data[i] = (word_in >> 8) | (word_in << 8); | ||
1904 | } | ||
1905 | |||
1906 | nvm->ops.release_nvm(hw); | ||
1907 | return 0; | ||
1908 | } | ||
1909 | |||
1910 | /** | ||
1911 | * e1000e_read_nvm_eerd - Reads EEPROM using EERD register | 1855 | * e1000e_read_nvm_eerd - Reads EEPROM using EERD register |
1912 | * @hw: pointer to the HW structure | 1856 | * @hw: pointer to the HW structure |
1913 | * @offset: offset of word in the EEPROM to read | 1857 | * @offset: offset of word in the EEPROM to read |