Lines Matching +full:eeprom +full:- +full:data
6 /*-----------------------------------------------------------------------
15 * input data overwrites the output data (since both are buffered by
18 * This may be interrupted with Ctrl-C if "intr" is true, otherwise it will
31 /* Pre-read the control register */ in e1000_spi_xfer()
38 return -1; in e1000_spi_xfer()
69 din[i >> 3] &= ~((mask << 1) - 1); in e1000_spi_xfer()
91 if (hw->eeprom.type != e1000_eeprom_spi) { in spi_setup_slave()
92 E1000_ERR(hw, "No attached SPI EEPROM found!\n"); in spi_setup_slave()
102 E1000_ERR(hw, "Only SPI MODE-0 is supported!\n"); in spi_setup_slave()
107 E1000_DBG(hw->nic, "EEPROM SPI access requested\n"); in spi_setup_slave()
108 return &hw->spi; in spi_setup_slave()
114 E1000_DBG(hw->nic, "EEPROM SPI access released\n"); in spi_free_slave()
122 E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n"); in spi_claim_bus()
123 return -1; in spi_claim_bus()
157 /* The EEPROM opcodes */
165 /* The EEPROM status bits */
178 * of the EEPROM commands at this time.
201 return -1; in e1000_spi_eeprom_read_status()
206 const void *data, u16 off, u16 len, bool intr) in e1000_spi_eeprom_write_page() argument
210 (off >> (hw->eeprom.address_bits - 8)) & 0xff, off & 0xff in e1000_spi_eeprom_write_page()
215 if (e1000_spi_xfer(hw, 8 + hw->eeprom.address_bits, op, NULL, intr)) in e1000_spi_eeprom_write_page()
216 return -1; in e1000_spi_eeprom_write_page()
217 if (e1000_spi_xfer(hw, len << 3, data, NULL, intr)) in e1000_spi_eeprom_write_page()
218 return -1; in e1000_spi_eeprom_write_page()
224 void *data, u16 off, u16 len, bool intr) in e1000_spi_eeprom_read_page() argument
228 (off >> (hw->eeprom.address_bits - 8)) & 0xff, off & 0xff in e1000_spi_eeprom_read_page()
233 if (e1000_spi_xfer(hw, 8 + hw->eeprom.address_bits, op, NULL, intr)) in e1000_spi_eeprom_read_page()
234 return -1; in e1000_spi_eeprom_read_page()
235 if (e1000_spi_xfer(hw, len << 3, NULL, data, intr)) in e1000_spi_eeprom_read_page()
236 return -1; in e1000_spi_eeprom_read_page()
248 return -1; in e1000_spi_eeprom_poll_ready()
252 void *data, u16 off, unsigned int len, bool intr) in e1000_spi_eeprom_dump() argument
254 /* Interruptibly wait for the EEPROM to be ready */ in e1000_spi_eeprom_dump()
256 return -1; in e1000_spi_eeprom_dump()
260 /* Calculate the data bytes on this page */ in e1000_spi_eeprom_dump()
261 u16 pg_off = off & (hw->eeprom.page_size - 1); in e1000_spi_eeprom_dump()
262 u16 pg_len = hw->eeprom.page_size - pg_off; in e1000_spi_eeprom_dump()
267 if (e1000_spi_eeprom_read_page(hw, data, off, pg_len, intr)) in e1000_spi_eeprom_dump()
268 return -1; in e1000_spi_eeprom_dump()
271 len -= pg_len; in e1000_spi_eeprom_dump()
273 data += pg_len; in e1000_spi_eeprom_dump()
281 const void *data, u16 off, u16 len, bool intr) in e1000_spi_eeprom_program() argument
285 /* Calculate the data bytes on this page */ in e1000_spi_eeprom_program()
286 u16 pg_off = off & (hw->eeprom.page_size - 1); in e1000_spi_eeprom_program()
287 u16 pg_len = hw->eeprom.page_size - pg_off; in e1000_spi_eeprom_program()
291 /* Interruptibly wait for the EEPROM to be ready */ in e1000_spi_eeprom_program()
293 return -1; in e1000_spi_eeprom_program()
297 return -1; in e1000_spi_eeprom_program()
300 if (e1000_spi_eeprom_write_page(hw, data, off, pg_len, intr)) in e1000_spi_eeprom_program()
301 return -1; in e1000_spi_eeprom_program()
304 len -= pg_len; in e1000_spi_eeprom_program()
306 data += pg_len; in e1000_spi_eeprom_program()
311 return -1; in e1000_spi_eeprom_program()
335 else if (offset < (hw->eeprom.word_size << 1)) in do_e1000_spi_show()
336 length = (hw->eeprom.word_size << 1) - offset; in do_e1000_spi_show()
340 E1000_ERR(hw, "Requested zero-sized dump!\n"); in do_e1000_spi_show()
343 if ((0x10000 < length) || (0x10000 - length < offset)) { in do_e1000_spi_show()
355 /* Acquire the EEPROM and perform the dump */ in do_e1000_spi_show()
357 E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n"); in do_e1000_spi_show()
370 printf("%s: ===== Intel e1000 EEPROM (0x%04hX - 0x%04hX) =====", in do_e1000_spi_show()
371 hw->name, offset, offset + length - 1); in do_e1000_spi_show()
374 printf("\n%s: %04hX: ", hw->name, offset + i); in do_e1000_spi_show()
405 E1000_ERR(hw, "Requested zero-sized dump!\n"); in do_e1000_spi_dump()
408 if ((0x10000 < length) || (0x10000 - length < offset)) { in do_e1000_spi_dump()
413 /* Acquire the EEPROM */ in do_e1000_spi_dump()
415 E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n"); in do_e1000_spi_dump()
427 printf("%s: ===== EEPROM DUMP COMPLETE =====\n", hw->name); in do_e1000_spi_dump()
448 /* Acquire the EEPROM */ in do_e1000_spi_program()
450 E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n"); in do_e1000_spi_program()
462 printf("%s: ===== EEPROM PROGRAMMED =====\n", hw->name); in do_e1000_spi_program()
486 E1000_ERR(hw, "Unable to allocate EEPROM buffer!\n"); in do_e1000_spi_checksum()
490 /* Acquire the EEPROM */ in do_e1000_spi_checksum()
492 E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n"); in do_e1000_spi_checksum()
496 /* Read the EEPROM */ in do_e1000_spi_checksum()
506 checksum = ((uint16_t)EEPROM_SUM) - checksum; in do_e1000_spi_checksum()
511 printf("%s: INFO: EEPROM checksum is correct! (0x%04hx)\n", in do_e1000_spi_checksum()
512 hw->name, checksum); in do_e1000_spi_checksum()
518 E1000_ERR(hw, "EEPROM checksum is incorrect!\n"); in do_e1000_spi_checksum()
529 printf("%s: Reprogramming the EEPROM checksum...\n", hw->name); in do_e1000_spi_checksum()
551 if (hw->eeprom.type != e1000_eeprom_spi) { in do_e1000_spi()
552 E1000_ERR(hw, "No attached SPI EEPROM found (%d)!\n", in do_e1000_spi()
553 hw->eeprom.type); in do_e1000_spi()
557 /* Check the eeprom sub-sub-command arguments */ in do_e1000_spi()
559 return do_e1000_spi_show(cmdtp, hw, argc - 1, argv + 1); in do_e1000_spi()
562 return do_e1000_spi_dump(cmdtp, hw, argc - 1, argv + 1); in do_e1000_spi()
565 return do_e1000_spi_program(cmdtp, hw, argc - 1, argv + 1); in do_e1000_spi()
568 return do_e1000_spi_checksum(cmdtp, hw, argc - 1, argv + 1); in do_e1000_spi()