netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
@ 2024-05-23  8:53 Parthiban Veerasooran
  2024-05-23 14:40 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Parthiban Veerasooran @ 2024-05-23  8:53 UTC (permalink / raw)
  To: steve.glendinning, UNGLinuxDriver, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-usb, linux-kernel, Parthiban Veerasooran

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: f293501c61c5 ("smsc95xx: configure LED outputs")
Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
---
 drivers/net/usb/smsc95xx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index cbea24666479..8e82184be5e7 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -879,7 +879,7 @@ static int smsc95xx_start_rx_path(struct usbnet *dev)
 static int smsc95xx_reset(struct usbnet *dev)
 {
 	struct smsc95xx_priv *pdata = dev->driver_priv;
-	u32 read_buf, write_buf, burst_cap;
+	u32 read_buf, burst_cap;
 	int ret = 0, timeout;
 
 	netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
@@ -1003,10 +1003,13 @@ static int smsc95xx_reset(struct usbnet *dev)
 		return ret;
 	netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
 
+	ret = smsc95xx_read_reg(dev, LED_GPIO_CFG, &read_buf);
+	if (ret < 0)
+		return ret;
 	/* Configure GPIO pins as LED outputs */
-	write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
-		LED_GPIO_CFG_FDX_LED;
-	ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
+	read_buf |= LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
+		    LED_GPIO_CFG_FDX_LED;
+	ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, read_buf);
 	if (ret < 0)
 		return ret;
 

base-commit: 4b377b4868ef17b040065bd468668c707d2477a5
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
  2024-05-23  8:53 [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM Parthiban Veerasooran
@ 2024-05-23 14:40 ` Simon Horman
  2024-05-23 16:17 ` Woojung.Huh
  2024-05-27 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-05-23 14:40 UTC (permalink / raw)
  To: Parthiban Veerasooran
  Cc: steve.glendinning, UNGLinuxDriver, davem, edumazet, kuba, pabeni,
	netdev, linux-usb, linux-kernel

On Thu, May 23, 2024 at 02:23:14PM +0530, Parthiban Veerasooran wrote:
> 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: f293501c61c5 ("smsc95xx: configure LED outputs")
> Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
> ---
>  drivers/net/usb/smsc95xx.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
  2024-05-23  8:53 [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM Parthiban Veerasooran
  2024-05-23 14:40 ` Simon Horman
@ 2024-05-23 16:17 ` Woojung.Huh
  2024-05-27 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Woojung.Huh @ 2024-05-23 16:17 UTC (permalink / raw)
  To: Parthiban.Veerasooran, steve.glendinning, UNGLinuxDriver, davem,
	edumazet, kuba, pabeni
  Cc: netdev, linux-usb, linux-kernel, Parthiban.Veerasooran

> -----Original Message-----
> From: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
> Sent: Thursday, May 23, 2024 4:53 AM
> To: steve.glendinning@shawell.net; UNGLinuxDriver
> <UNGLinuxDriver@microchip.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com
> Cc: netdev@vger.kernel.org; linux-usb@vger.kernel.org; linux-
> kernel@vger.kernel.org; Parthiban Veerasooran - I17164
> <Parthiban.Veerasooran@microchip.com>
> Subject: [PATCH] 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: f293501c61c5 ("smsc95xx: configure LED outputs")
> Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
> ---
>  drivers/net/usb/smsc95xx.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Reviewed-by: Woojung Huh <woojung.huh@microchip.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
  2024-05-23  8:53 [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM Parthiban Veerasooran
  2024-05-23 14:40 ` Simon Horman
  2024-05-23 16:17 ` Woojung.Huh
@ 2024-05-27 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-27 11:00 UTC (permalink / raw)
  To: Parthiban Veerasooran
  Cc: steve.glendinning, UNGLinuxDriver, davem, edumazet, kuba, pabeni,
	netdev, linux-usb, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Thu, 23 May 2024 14:23:14 +0530 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
    https://git.kernel.org/netdev/net/c/52a2f0608366

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-27 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23  8:53 [PATCH] net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM Parthiban Veerasooran
2024-05-23 14:40 ` Simon Horman
2024-05-23 16:17 ` Woojung.Huh
2024-05-27 11:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).