linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ibm_emac: Correctly detect old link speed
@ 2007-05-16 11:00 Stefan Roese
  2007-05-16 17:30 ` Eugene Surovegin
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2007-05-16 11:00 UTC (permalink / raw)
  To: netdev, linuxppc-dev

This patch fixes a bug where the link speed change was not
detected correctly. This occured on a 440SPe (EMAC4) system
where the old link speed was 100Mbps and the new link speed
is 1000Mbps.

Signed-off-by: Stefan Roese <sr@denx.de>

---
commit 1e2a6085bbb6bd384e0812b6e9c62d18d14e1c0f
tree f441a914c9d66fb00fcde1e4bd7e02effba20dc7
parent 7b104bcb8e460e45a1aebe3da9b86aacdb4cab12
author Stefan Roese <sr@denx.de> Wed, 16 May 2007 12:54:40 +0200
committer Stefan Roese <sr@denx.de> Wed, 16 May 2007 12:54:40 +0200

 drivers/net/ibm_emac/ibm_emac_core.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 50035eb..ab38727 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -926,12 +926,18 @@ static int emac_link_differs(struct ocp_enet_private *dev)
 	int duplex = r & EMAC_MR1_FDE ? DUPLEX_FULL : DUPLEX_HALF;
 	int speed, pause, asym_pause;
 
-	if (r & (EMAC_MR1_MF_1000 | EMAC_MR1_MF_1000GPCS))
-		speed = SPEED_1000;
-	else if (r & EMAC_MR1_MF_100)
-		speed = SPEED_100;
-	else
-		speed = SPEED_10;
+	switch (r & EMAC_MR1_MF_MASK) {
+	case EMAC_MR1_MF_1000:
+	case EMAC_MR1_MF_1000GPCS:
+		speed = 1000;
+		break;
+	case EMAC_MR1_MF_10:
+		speed = 10;
+		break;
+	case EMAC_MR1_MF_100:
+	default:
+		speed = 100;
+	}
 
 	switch (r & (EMAC_MR1_EIFC | EMAC_MR1_APP)) {
 	case (EMAC_MR1_EIFC | EMAC_MR1_APP):

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

* Re: [PATCH] ibm_emac: Correctly detect old link speed
  2007-05-16 11:00 [PATCH] ibm_emac: Correctly detect old link speed Stefan Roese
@ 2007-05-16 17:30 ` Eugene Surovegin
  2007-05-16 18:44   ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Eugene Surovegin @ 2007-05-16 17:30 UTC (permalink / raw)
  To: Stefan Roese; +Cc: netdev, linuxppc-dev

On Wed, May 16, 2007 at 01:00:08PM +0200, Stefan Roese wrote:
> This patch fixes a bug where the link speed change was not
> detected correctly. This occured on a 440SPe (EMAC4) system
> where the old link speed was 100Mbps and the new link speed
> is 1000Mbps.

Good catch, Stefan. Unfortunately, I have to NACK your patch - you 
broke non EMAC4 builds.

Correct fix is just to remove EMAC_MR1_MF_1000GPCS from the first 
if condition.

I'll send correct fix shortly along with other queued patches.

-- 
Eugene

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

* Re: [PATCH] ibm_emac: Correctly detect old link speed
  2007-05-16 17:30 ` Eugene Surovegin
@ 2007-05-16 18:44   ` Stefan Roese
  2007-05-21  5:13     ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2007-05-16 18:44 UTC (permalink / raw)
  To: Eugene Surovegin; +Cc: netdev, linuxppc-dev

On Wednesday 16 May 2007, Eugene Surovegin wrote:
> On Wed, May 16, 2007 at 01:00:08PM +0200, Stefan Roese wrote:
> > This patch fixes a bug where the link speed change was not
> > detected correctly. This occured on a 440SPe (EMAC4) system
> > where the old link speed was 100Mbps and the new link speed
> > is 1000Mbps.
>
> Good catch, Stefan. Unfortunately, I have to NACK your patch - you
> broke non EMAC4 builds.

Yes, you're right of course.

> Correct fix is just to remove EMAC_MR1_MF_1000GPCS from the first
> if condition.

Yep.

> I'll send correct fix shortly along with other queued patches.

Thanks.

Best regards,
Stefan

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

* Re: [PATCH] ibm_emac: Correctly detect old link speed
  2007-05-16 18:44   ` Stefan Roese
@ 2007-05-21  5:13     ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2007-05-21  5:13 UTC (permalink / raw)
  To: Stefan Roese; +Cc: netdev, linuxppc-dev

On Wed, May 16, 2007 at 08:44:47PM +0200, Stefan Roese wrote:
> On Wednesday 16 May 2007, Eugene Surovegin wrote:
> > On Wed, May 16, 2007 at 01:00:08PM +0200, Stefan Roese wrote:
> > > This patch fixes a bug where the link speed change was not
> > > detected correctly. This occured on a 440SPe (EMAC4) system
> > > where the old link speed was 100Mbps and the new link speed
> > > is 1000Mbps.
> >
> > Good catch, Stefan. Unfortunately, I have to NACK your patch - you
> > broke non EMAC4 builds.
> 
> Yes, you're right of course.
> 
> > Correct fix is just to remove EMAC_MR1_MF_1000GPCS from the first
> > if condition.
> 
> Yep.
> 
> > I'll send correct fix shortly along with other queued patches.
> 
> Thanks.

I've merged essentially the same fix into the device tree aware
"new_emac" driver.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

end of thread, other threads:[~2007-05-21  5:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-16 11:00 [PATCH] ibm_emac: Correctly detect old link speed Stefan Roese
2007-05-16 17:30 ` Eugene Surovegin
2007-05-16 18:44   ` Stefan Roese
2007-05-21  5:13     ` David Gibson

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