From 70df7678f805ffffd63444c68ea913a4a5549258 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Tue, 24 Sep 2019 09:42:27 +0200 Subject: [PATCH] Wait a little longer for the erase to complete Sometimes the erase operation would timeout, but the new MAC address was still written: $ /usr/sbin/rtl8168-eeprom -s 2:0 -m 00:0d:b9:4f:0f:7d failed: 1 initializing pci access building filter starting bus iteration found matching device (02:00.0), base_addr=0xf7c00000 (len=0) Existing/Old MAC address: 00:0d:b9:4f:0f:7d Saving EEPROM backup to 000DB94F0F7D.backup Writing new MAC address 00:0d:b9:4f:0f:7d... timeout during ERASE Error during EEPROM WRITE, MAC address is corrupt! --- rtl8168-eeprom.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rtl8168-eeprom.c b/rtl8168-eeprom.c index 19cae0d..c97e675 100644 --- a/rtl8168-eeprom.c +++ b/rtl8168-eeprom.c @@ -294,13 +294,13 @@ int at93c46_op_write(struct pci_dev *d, uint8_t addr, uint16_t data) return 0; } -/* endable write access */ +/* enable write access */ int at93c46_op_ewen(struct pci_dev *d) { return at93c46_op(d, AT93_OP_MISC, 0x30, 0); } -/* endable write access */ +/* erase a word */ int at93c46_op_erase(struct pci_dev *d, uint8_t addr) { int i, rc; @@ -317,6 +317,7 @@ int at93c46_op_erase(struct pci_dev *d, uint8_t addr) //rc = rtlspi_xceive_bit(d, 0); if (rc == 1) break; + rtlspi_delay(); } rtlspi_pin_set(d, RTLSPI_CS, 0);