netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] smsc95xx: bugfix for net-2.6
@ 2010-03-16 19:03 Steve Glendinning
  2010-03-16 19:03 ` [PATCH] smsc95xx: wait for PHY to complete reset during init Steve Glendinning
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Glendinning @ 2010-03-16 19:03 UTC (permalink / raw)
  To: netdev

Please consider this single bugfix for net-2.6.  I'll re-send the
other enhancement patches for net-next-2.6 when it opens.

Steve Glendinning (1):
  smsc95xx: wait for PHY to complete reset during init

 drivers/net/usb/smsc95xx.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)


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

* [PATCH] smsc95xx: wait for PHY to complete reset during init
  2010-03-16 19:03 [PATCH] smsc95xx: bugfix for net-2.6 Steve Glendinning
@ 2010-03-16 19:03 ` Steve Glendinning
  2010-03-16 21:28   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Glendinning @ 2010-03-16 19:03 UTC (permalink / raw)
  To: netdev

This patch ensures the PHY correctly completes its reset before
setting register values.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
---
 drivers/net/usb/smsc95xx.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index df9179a..d222d7e 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -709,6 +709,8 @@ static void smsc95xx_start_rx_path(struct usbnet *dev)
 
 static int smsc95xx_phy_initialize(struct usbnet *dev)
 {
+	int bmcr, timeout = 0;
+
 	/* Initialize MII structure */
 	dev->mii.dev = dev->net;
 	dev->mii.mdio_read = smsc95xx_mdio_read;
@@ -717,7 +719,20 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
 	dev->mii.reg_num_mask = 0x1f;
 	dev->mii.phy_id = SMSC95XX_INTERNAL_PHY_ID;
 
+	/* reset phy and wait for reset to complete */
 	smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
+
+	do {
+		msleep(10);
+		bmcr = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR);
+		timeout++;
+	} while ((bmcr & MII_BMCR) && (timeout < 100));
+
+	if (timeout >= 100) {
+		netdev_warn(dev->net, "timeout on PHY Reset");
+		return -EIO;
+	}
+
 	smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
 		ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
 		ADVERTISE_PAUSE_ASYM);
-- 
1.6.6.1


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

* Re: [PATCH] smsc95xx: wait for PHY to complete reset during init
  2010-03-16 19:03 ` [PATCH] smsc95xx: wait for PHY to complete reset during init Steve Glendinning
@ 2010-03-16 21:28   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-03-16 21:28 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev

From: Steve Glendinning <steve.glendinning@smsc.com>
Date: Tue, 16 Mar 2010 19:03:06 +0000

> This patch ensures the PHY correctly completes its reset before
> setting register values.
> 
> Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>

Applied.

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

end of thread, other threads:[~2010-03-16 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-16 19:03 [PATCH] smsc95xx: bugfix for net-2.6 Steve Glendinning
2010-03-16 19:03 ` [PATCH] smsc95xx: wait for PHY to complete reset during init Steve Glendinning
2010-03-16 21:28   ` 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).