]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: e1000: do not attempt to set hwaddr for i210 without FLASH
authorTim Harvey <tharvey@gateworks.com>
Fri, 16 Apr 2021 20:25:09 +0000 (13:25 -0700)
committerRamon Fried <rfried.dev@gmail.com>
Fri, 18 Jun 2021 08:29:17 +0000 (11:29 +0300)
commit f1bcad22dd19 ("net: e1000: add support for writing to EEPROM")
adds support for storing hwaddr in EEPROM however i210 devices do not
support this and thus results in errors such as:
Warning: e1000#0 failed to set MAC address'

Check if a flash device is present and if not return -ENOSYS indicating
this is not supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/e1000.c
drivers/net/e1000.h

index 694114eca79c4ff91e9e9e3993f0ccd3f7f8e5e9..60613b7df073a97d2e028f68be1857d1700f43e6 100644 (file)
@@ -5673,6 +5673,10 @@ static int e1000_write_hwaddr(struct eth_device *dev)
 
        DEBUGOUT("%s: mac=%pM\n", __func__, mac);
 
+       if ((hw->eeprom.type == e1000_eeprom_invm) &&
+           !(E1000_READ_REG(hw, EECD) & E1000_EECD_FLASH_DETECTED_I210))
+               return -ENOSYS;
+
        memset(current_mac, 0, 6);
 
        /* Read from EEPROM, not from registers, to make sure
index 072851ba31c6642a9c0d58ed08e01b25f17f1764..082154a997e60ca70300feea8c04450413f3d19c 100644 (file)
@@ -1245,6 +1245,7 @@ struct e1000_hw {
 #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
 #define E1000_EECD_FLUPD_I210       0x00800000 /* Update FLASH */
 #define E1000_EECD_FLUDONE_I210     0x04000000 /* Update FLASH done*/
+#define E1000_EECD_FLASH_DETECTED_I210 0x00080000 /* FLASH detected */
 #define E1000_FLUDONE_ATTEMPTS      20000
 #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
 #define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */