Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

smsc911x: add second read of EEPROM mac when possible corruption seen

When the EEPROM MAC is read by way of ADDRH, it can return all 0s the
first time. Subsequent reads succeed.

This is fully reproduceable on the Phytec PCM049 SOM.

Re-read the ADDRH when this behaviour is observed, in an attempt to
correctly apply the EEPROM MAC address.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Link: https://patch.msgid.link/20250903132610.966787-1-colin.foster@in-advantage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Colin Foster and committed by
Jakub Kicinski
69777753 3132f0e8

+12 -2
+12 -2
drivers/net/ethernet/smsc/smsc911x.c
··· 2162 2162 static void smsc911x_read_mac_address(struct net_device *dev) 2163 2163 { 2164 2164 struct smsc911x_data *pdata = netdev_priv(dev); 2165 - u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); 2166 - u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL); 2165 + u32 mac_high16, mac_low32; 2167 2166 u8 addr[ETH_ALEN]; 2167 + 2168 + mac_high16 = smsc911x_mac_read(pdata, ADDRH); 2169 + mac_low32 = smsc911x_mac_read(pdata, ADDRL); 2170 + 2171 + /* The first mac_read in some setups can incorrectly read 0. Re-read it 2172 + * to get the full MAC if this is observed. 2173 + */ 2174 + if (mac_high16 == 0) { 2175 + SMSC_TRACE(pdata, probe, "Re-read MAC ADDRH\n"); 2176 + mac_high16 = smsc911x_mac_read(pdata, ADDRH); 2177 + } 2168 2178 2169 2179 addr[0] = (u8)(mac_low32); 2170 2180 addr[1] = (u8)(mac_low32 >> 8);