diff options
author | Steve Glendinning <steve.glendinning@shawell.net> | 2012-05-03 20:57:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-07 23:43:57 -0400 |
commit | 97138a1ca7917c11431293e668457f916a610ca5 (patch) | |
tree | 569c875e500efe5c172b17e694c208f67a95a682 /drivers/net/usb | |
parent | 4f94a929e4adb0d0ed78d448ff68fe870163c575 (diff) |
smsc75xx: let EEPROM determine GPIO/LED settings
This patch allows the GPIO/LED settings to be configured by the
EEPROM if present, and only sets the default values (LED outputs
for link/activity) when an EEPROM is not detected.
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/smsc75xx.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 72b62b51c46f..fb1a087b101d 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -903,15 +903,20 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
903 | 903 | ||
904 | netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x", buf); | 904 | netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x", buf); |
905 | 905 | ||
906 | /* Configure GPIO pins as LED outputs */ | 906 | ret = smsc75xx_read_reg(dev, E2P_CMD, &buf); |
907 | ret = smsc75xx_read_reg(dev, LED_GPIO_CFG, &buf); | 907 | check_warn_return(ret, "Failed to read E2P_CMD: %d", ret); |
908 | check_warn_return(ret, "Failed to read LED_GPIO_CFG: %d", ret); | ||
909 | 908 | ||
910 | buf &= ~(LED_GPIO_CFG_LED2_FUN_SEL | LED_GPIO_CFG_LED10_FUN_SEL); | 909 | /* only set default GPIO/LED settings if no EEPROM is detected */ |
911 | buf |= LED_GPIO_CFG_LEDGPIO_EN | LED_GPIO_CFG_LED2_FUN_SEL; | 910 | if (!(buf & E2P_CMD_LOADED)) { |
911 | ret = smsc75xx_read_reg(dev, LED_GPIO_CFG, &buf); | ||
912 | check_warn_return(ret, "Failed to read LED_GPIO_CFG: %d", ret); | ||
912 | 913 | ||
913 | ret = smsc75xx_write_reg(dev, LED_GPIO_CFG, buf); | 914 | buf &= ~(LED_GPIO_CFG_LED2_FUN_SEL | LED_GPIO_CFG_LED10_FUN_SEL); |
914 | check_warn_return(ret, "Failed to write LED_GPIO_CFG: %d", ret); | 915 | buf |= LED_GPIO_CFG_LEDGPIO_EN | LED_GPIO_CFG_LED2_FUN_SEL; |
916 | |||
917 | ret = smsc75xx_write_reg(dev, LED_GPIO_CFG, buf); | ||
918 | check_warn_return(ret, "Failed to write LED_GPIO_CFG: %d", ret); | ||
919 | } | ||
915 | 920 | ||
916 | ret = smsc75xx_write_reg(dev, FLOW, 0); | 921 | ret = smsc75xx_write_reg(dev, FLOW, 0); |
917 | check_warn_return(ret, "Failed to write FLOW: %d", ret); | 922 | check_warn_return(ret, "Failed to write FLOW: %d", ret); |