netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] smsc75xx: more minor fixes
@ 2012-05-04 10:57 Steve Glendinning
  2012-05-04 10:57 ` [PATCH 1/3] smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL Steve Glendinning
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Steve Glendinning @ 2012-05-04 10:57 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Steve Glendinning

3 more minor patches for smsc75xx

Steve Glendinning (3):
  smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL
  smsc75xx: eliminate unnecessary phy register read
  smsc75xx: let EEPROM determine GPIO/LED settings

 drivers/net/usb/smsc75xx.c |   26 +++++++++++++++-----------
 drivers/net/usb/smsc75xx.h |    1 +
 2 files changed, 16 insertions(+), 11 deletions(-)

-- 
1.7.9.5

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

* [PATCH 1/3] smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL
  2012-05-04 10:57 [PATCH 0/3] smsc75xx: more minor fixes Steve Glendinning
@ 2012-05-04 10:57 ` Steve Glendinning
  2012-05-04 10:57 ` [PATCH 2/3] smsc75xx: eliminate unnecessary phy register read Steve Glendinning
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Glendinning @ 2012-05-04 10:57 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Steve Glendinning

This patch defines PHY_INT_SRC_CLEAR_ALL to replace the value 0xffff
in order to be more self-documenting.

This patch should make no functional change, it is purely cosmetic.

Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
---
 drivers/net/usb/smsc75xx.c |    3 ++-
 drivers/net/usb/smsc75xx.h |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 00103a8..ecab87b 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -511,7 +511,8 @@ static int smsc75xx_link_reset(struct usbnet *dev)
 	/* read and write to clear phy interrupt status */
 	ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
 	check_warn_return(ret, "Error reading PHY_INT_SRC");
-	smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff);
+	smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC,
+		PHY_INT_SRC_CLEAR_ALL);
 
 	ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL);
 	check_warn_return(ret, "Error writing INT_STS");
diff --git a/drivers/net/usb/smsc75xx.h b/drivers/net/usb/smsc75xx.h
index 16e98c7..67eba39 100644
--- a/drivers/net/usb/smsc75xx.h
+++ b/drivers/net/usb/smsc75xx.h
@@ -388,6 +388,7 @@
 #define PHY_INT_SRC_ANEG_COMP		((u16)0x0040)
 #define PHY_INT_SRC_REMOTE_FAULT	((u16)0x0020)
 #define PHY_INT_SRC_LINK_DOWN		((u16)0x0010)
+#define PHY_INT_SRC_CLEAR_ALL		((u16)0xffff)
 
 #define PHY_INT_MASK			(30)
 #define PHY_INT_MASK_ENERGY_ON		((u16)0x0080)
-- 
1.7.9.5

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

* [PATCH 2/3] smsc75xx: eliminate unnecessary phy register read
  2012-05-04 10:57 [PATCH 0/3] smsc75xx: more minor fixes Steve Glendinning
  2012-05-04 10:57 ` [PATCH 1/3] smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL Steve Glendinning
@ 2012-05-04 10:57 ` Steve Glendinning
  2012-05-04 10:57 ` [PATCH 3/3] smsc75xx: let EEPROM determine GPIO/LED settings Steve Glendinning
  2012-05-08  3:44 ` [PATCH 0/3] smsc75xx: more minor fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Glendinning @ 2012-05-04 10:57 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Steve Glendinning

Only a write is necessary to clear the interrupt status, and we
don't use the value from the preceding read operation.  This
patch eliminates the unnecessary read.

Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
---
 drivers/net/usb/smsc75xx.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index ecab87b..72b62b5 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -508,9 +508,7 @@ static int smsc75xx_link_reset(struct usbnet *dev)
 	u16 lcladv, rmtadv;
 	int ret;
 
-	/* read and write to clear phy interrupt status */
-	ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
-	check_warn_return(ret, "Error reading PHY_INT_SRC");
+	/* write to clear phy interrupt status */
 	smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC,
 		PHY_INT_SRC_CLEAR_ALL);
 
-- 
1.7.9.5

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

* [PATCH 3/3] smsc75xx: let EEPROM determine GPIO/LED settings
  2012-05-04 10:57 [PATCH 0/3] smsc75xx: more minor fixes Steve Glendinning
  2012-05-04 10:57 ` [PATCH 1/3] smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL Steve Glendinning
  2012-05-04 10:57 ` [PATCH 2/3] smsc75xx: eliminate unnecessary phy register read Steve Glendinning
@ 2012-05-04 10:57 ` Steve Glendinning
  2012-05-08  3:44 ` [PATCH 0/3] smsc75xx: more minor fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Glendinning @ 2012-05-04 10:57 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Steve Glendinning

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>
---
 drivers/net/usb/smsc75xx.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 72b62b5..fb1a087 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -903,15 +903,20 @@ static int smsc75xx_reset(struct usbnet *dev)
 
 	netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x", buf);
 
-	/* Configure GPIO pins as LED outputs */
-	ret = smsc75xx_read_reg(dev, LED_GPIO_CFG, &buf);
-	check_warn_return(ret, "Failed to read LED_GPIO_CFG: %d", ret);
+	ret = smsc75xx_read_reg(dev, E2P_CMD, &buf);
+	check_warn_return(ret, "Failed to read E2P_CMD: %d", ret);
 
-	buf &= ~(LED_GPIO_CFG_LED2_FUN_SEL | LED_GPIO_CFG_LED10_FUN_SEL);
-	buf |= LED_GPIO_CFG_LEDGPIO_EN | LED_GPIO_CFG_LED2_FUN_SEL;
+	/* only set default GPIO/LED settings if no EEPROM is detected */
+	if (!(buf & E2P_CMD_LOADED)) {
+		ret = smsc75xx_read_reg(dev, LED_GPIO_CFG, &buf);
+		check_warn_return(ret, "Failed to read LED_GPIO_CFG: %d", ret);
 
-	ret = smsc75xx_write_reg(dev, LED_GPIO_CFG, buf);
-	check_warn_return(ret, "Failed to write LED_GPIO_CFG: %d", ret);
+		buf &= ~(LED_GPIO_CFG_LED2_FUN_SEL | LED_GPIO_CFG_LED10_FUN_SEL);
+		buf |= LED_GPIO_CFG_LEDGPIO_EN | LED_GPIO_CFG_LED2_FUN_SEL;
+
+		ret = smsc75xx_write_reg(dev, LED_GPIO_CFG, buf);
+		check_warn_return(ret, "Failed to write LED_GPIO_CFG: %d", ret);
+	}
 
 	ret = smsc75xx_write_reg(dev, FLOW, 0);
 	check_warn_return(ret, "Failed to write FLOW: %d", ret);
-- 
1.7.9.5

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

* Re: [PATCH 0/3] smsc75xx: more minor fixes
  2012-05-04 10:57 [PATCH 0/3] smsc75xx: more minor fixes Steve Glendinning
                   ` (2 preceding siblings ...)
  2012-05-04 10:57 ` [PATCH 3/3] smsc75xx: let EEPROM determine GPIO/LED settings Steve Glendinning
@ 2012-05-08  3:44 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-05-08  3:44 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev

From: Steve Glendinning <steve.glendinning@shawell.net>
Date: Fri,  4 May 2012 11:57:10 +0100

> 3 more minor patches for smsc75xx
> 
> Steve Glendinning (3):
>   smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL
>   smsc75xx: eliminate unnecessary phy register read
>   smsc75xx: let EEPROM determine GPIO/LED settings

All applied to net-next.  Please be specific in the future about where
you want patches applied, these wouldn't apply cleanly until I merged
'net' into 'net-next' to propagate recent bug fixes first.

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

end of thread, other threads:[~2012-05-08  3:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04 10:57 [PATCH 0/3] smsc75xx: more minor fixes Steve Glendinning
2012-05-04 10:57 ` [PATCH 1/3] smsc75xx: replace 0xffff with PHY_INT_SRC_CLEAR_ALL Steve Glendinning
2012-05-04 10:57 ` [PATCH 2/3] smsc75xx: eliminate unnecessary phy register read Steve Glendinning
2012-05-04 10:57 ` [PATCH 3/3] smsc75xx: let EEPROM determine GPIO/LED settings Steve Glendinning
2012-05-08  3:44 ` [PATCH 0/3] smsc75xx: more minor fixes David Miller

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).