net: txgbe: Fix to calculate EEPROM checksum for AML devices
authorJiawen Wu <jiawenwu@trustnetic.com>
Tue, 13 May 2025 02:10:07 +0000 (10:10 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 02:26:55 +0000 (19:26 -0700)
In the new firmware version, the shadow ram reserves some space to store
I2C information, so the checksum calculation needs to skip this section.
Otherwise, the driver will fail to probe because the invalid EEPROM
checksum.

Fixes: 2e5af6b2ae85 ("net: txgbe: Add basic support for new AML devices")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1C6BF7A937237F5A+20250513021009.145708-2-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h

index 4b9921b..a054b25 100644 (file)
@@ -99,9 +99,15 @@ static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum)
        }
        local_buffer = eeprom_ptrs;
 
-       for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++)
+       for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++) {
+               if (wx->mac.type == wx_mac_aml) {
+                       if (i >= TXGBE_EEPROM_I2C_SRART_PTR &&
+                           i < TXGBE_EEPROM_I2C_END_PTR)
+                               local_buffer[i] = 0xffff;
+               }
                if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
                        *checksum += local_buffer[i];
+       }
 
        kvfree(eeprom_ptrs);
 
index 9c1c262..f423012 100644 (file)
 #define TXGBE_EEPROM_VERSION_L                  0x1D
 #define TXGBE_EEPROM_VERSION_H                  0x1E
 #define TXGBE_ISCSI_BOOT_CONFIG                 0x07
+#define TXGBE_EEPROM_I2C_SRART_PTR              0x580
+#define TXGBE_EEPROM_I2C_END_PTR                0x800
 
 #define TXGBE_MAX_MSIX_VECTORS          64
 #define TXGBE_MAX_FDIR_INDICES          63