Skip to content

Commit 52a2f06

Browse files
ParthibanI17164Paolo Abeni
authored andcommitted
net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
LED Select (LED_SEL) bit in the LED General Purpose IO Configuration register is used to determine the functionality of external LED pins (Speed Indicator, Link and Activity Indicator, Full Duplex Link Indicator). The default value for this bit is 0 when no EEPROM is present. If a EEPROM is present, the default value is the value of the LED Select bit in the Configuration Flags of the EEPROM. A USB Reset or Lite Reset (LRST) will cause this bit to be restored to the image value last loaded from EEPROM, or to be set to 0 if no EEPROM is present. While configuring the dual purpose GPIO/LED pins to LED outputs in the LED General Purpose IO Configuration register, the LED_SEL bit is changed as 0 and resulting the configured value from the EEPROM is cleared. The issue is fixed by using read-modify-write approach. Fixes: f293501 ("smsc95xx: configure LED outputs") Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Woojung Huh <woojung.huh@microchip.com> Link: https://lore.kernel.org/r/20240523085314.167650-1-Parthiban.Veerasooran@microchip.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 1684842 commit 52a2f06

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/usb/smsc95xx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ static int smsc95xx_start_rx_path(struct usbnet *dev)
879879
static int smsc95xx_reset(struct usbnet *dev)
880880
{
881881
struct smsc95xx_priv *pdata = dev->driver_priv;
882-
u32 read_buf, write_buf, burst_cap;
882+
u32 read_buf, burst_cap;
883883
int ret = 0, timeout;
884884

885885
netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
@@ -1003,10 +1003,13 @@ static int smsc95xx_reset(struct usbnet *dev)
10031003
return ret;
10041004
netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
10051005

1006+
ret = smsc95xx_read_reg(dev, LED_GPIO_CFG, &read_buf);
1007+
if (ret < 0)
1008+
return ret;
10061009
/* Configure GPIO pins as LED outputs */
1007-
write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
1008-
LED_GPIO_CFG_FDX_LED;
1009-
ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
1010+
read_buf |= LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
1011+
LED_GPIO_CFG_FDX_LED;
1012+
ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, read_buf);
10101013
if (ret < 0)
10111014
return ret;
10121015

0 commit comments

Comments
 (0)