Skip to contentSkip to conversation

smsc95xx: configure LED outputs

PATCH Applied Steve Glendinning 2 participants 2 messages May 1, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smsc95xx: configure LED outputs

SMSC LAN9500 has dual purpose GPIO/LED pins, and by default at power-on these are configured as GPIOs. This means that if LEDs are fitted they won't ever light.

This patch sets them to be LED outputs for speed, duplex and link/activity.

---
 drivers/net/usb/smsc95xx.c |   10 ++++++++++
 drivers/net/usb/smsc95xx.h |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)
drivers/net/usb/smsc95xx.c +10 -0
index dc16653..0fd68a5 100644
@@ -941,6 +941,16 @@ static int smsc95xx_reset(struct usbnet *dev)
 	if (netif_msg_ifup(dev))
 		devdbg(dev, "ID_REV = 0x%08x", read_buf);
 
+	/* 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);
+	if (ret < 0) {
+		devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d",
+			ret);
+		return ret;
+	}
+
 	/* Init Tx */
 	write_buf = 0;
 	ret = smsc95xx_write_reg(dev, FLOW, write_buf);
drivers/net/usb/smsc95xx.h +3 -0
index 66b5c84..86bc449 100644
@@ -99,6 +99,9 @@
 #define PM_CTL_WUPS_MULTI_		(0x00000003)
 
 #define LED_GPIO_CFG			(0x24)
+#define LED_GPIO_CFG_SPD_LED		(0x01000000)
+#define LED_GPIO_CFG_LNK_LED		(0x00100000)
+#define LED_GPIO_CFG_FDX_LED		(0x00010000)
 
 #define GPIO_CFG			(0x28)
 
Signature · 1 line
1.6.0.6
maintainer Applied
#1 lore raw

From: Steve Glendinning <[email protected]>
Date: Fri, 1 May 2009 16:46:51 +0100

Quoted 8 lines

SMSC LAN9500 has dual purpose GPIO/LED pins, and by default at power-on these are configured as GPIOs. This means that if LEDs are fitted they won't ever light.

This patch sets them to be LED outputs for speed, duplex and link/activity.

Applied.