LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* fec_mpc5200: reset FEC on error
@ 2008-04-15 15:26 Robert Schwebel
  2008-04-15 15:29 ` Kumar Gala
  2008-04-15 15:44 ` Robert Schwebel
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Schwebel @ 2008-04-15 15:26 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Domen Puncer

From: Sascha Hauer <s.hauer@pengutronix.de>

The error handling for the mpc5200 fec interrupt is broken. The intended
behaviour is like this:

* If one of FEC_IEVENT_RFIFO_ERROR and FEC_IEVENT_XFIFO_ERROR happens,
  the datasheet says (MPC5200B User's Guide R1.2, p. 14-13): "When this
  occurs, software must ensure both the FIFO Controller and BestComm are
  soft-reset".

* On any other error (non-TFINT) interrupt, just issue a debug message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

---
 drivers/net/fec_mpc52xx.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Index: drivers/net/fec_mpc52xx.c
===================================================================
--- drivers/net/fec_mpc52xx.c.orig
+++ drivers/net/fec_mpc52xx.c
@@ -491,20 +491,23 @@
 
 	out_be32(&fec->ievent, ievent);		/* clear pending events */
 
-	if (ievent & ~(FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
-		if (ievent & ~FEC_IEVENT_TFINT)
-			dev_dbg(&dev->dev, "ievent: %08x\n", ievent);
+	/* on fifo error, soft-reset fec */
+	if (ievent & (FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
+
+		if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR))
+			dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n");
+		if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
+			dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");
+
+		mpc52xx_fec_reset(dev);
+
+		netif_wake_queue(dev);
 		return IRQ_HANDLED;
 	}
 
-	if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR))
-		dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n");
-	if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
-		dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");
-
-	mpc52xx_fec_reset(dev);
+	if (ievent & ~FEC_IEVENT_TFINT)
+		dev_dbg(&dev->dev, "ievent: %08x\n", ievent);
 
-	netif_wake_queue(dev);
 	return IRQ_HANDLED;
 }
 

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

* Re: fec_mpc5200: reset FEC on error
  2008-04-15 15:26 fec_mpc5200: reset FEC on error Robert Schwebel
@ 2008-04-15 15:29 ` Kumar Gala
  2008-04-15 15:32   ` Robert Schwebel
  2008-04-15 15:44 ` Robert Schwebel
  1 sibling, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2008-04-15 15:29 UTC (permalink / raw)
  To: Robert Schwebel; +Cc: linuxppc-dev, Domen Puncer


On Apr 15, 2008, at 10:26 AM, Robert Schwebel wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> The error handling for the mpc5200 fec interrupt is broken. The  
> intended
> behaviour is like this:
>
> * If one of FEC_IEVENT_RFIFO_ERROR and FEC_IEVENT_XFIFO_ERROR happens,
>  the datasheet says (MPC5200B User's Guide R1.2, p. 14-13): "When this
>  occurs, software must ensure both the FIFO Controller and BestComm  
> are
>  soft-reset".
>
> * On any other error (non-TFINT) interrupt, just issue a debug  
> message.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>
> ---
> drivers/net/fec_mpc52xx.c |   23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>

You really need to also copy netdev and patches to drivers/net.

- k

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

* Re: fec_mpc5200: reset FEC on error
  2008-04-15 15:29 ` Kumar Gala
@ 2008-04-15 15:32   ` Robert Schwebel
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Schwebel @ 2008-04-15 15:32 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Domen Puncer

On Tue, Apr 15, 2008 at 10:29:26AM -0500, Kumar Gala wrote:
> You really need to also copy netdev and patches to drivers/net.

Hm? Sorry, don't understand what you mean.

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

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

* fec_mpc5200: reset FEC on error
  2008-04-15 15:26 fec_mpc5200: reset FEC on error Robert Schwebel
  2008-04-15 15:29 ` Kumar Gala
@ 2008-04-15 15:44 ` Robert Schwebel
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Schwebel @ 2008-04-15 15:44 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, Domen Puncer

From: Sascha Hauer <s.hauer@pengutronix.de>

The error handling for the mpc5200 fec interrupt is broken. The intended
behaviour is like this:

* If one of FEC_IEVENT_RFIFO_ERROR and FEC_IEVENT_XFIFO_ERROR happens,
  the datasheet says (MPC5200B User's Guide R1.2, p. 14-13): "When this
  occurs, software must ensure both the FIFO Controller and BestComm are
  soft-reset".

* On any other error (non-TFINT) interrupt, just issue a debug message.

v2 changed to -p1 and posted on linuxppc list (2008-04-15).

v1 posted on linuxppc list (2008-04-15).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

---
 drivers/net/fec_mpc52xx.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Index: drivers/net/fec_mpc52xx.c
===================================================================
--- a/drivers/net/fec_mpc52xx.c.orig
+++ b/drivers/net/fec_mpc52xx.c
@@ -491,20 +491,23 @@
 
 	out_be32(&fec->ievent, ievent);		/* clear pending events */
 
-	if (ievent & ~(FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
-		if (ievent & ~FEC_IEVENT_TFINT)
-			dev_dbg(&dev->dev, "ievent: %08x\n", ievent);
+	/* on fifo error, soft-reset fec */
+	if (ievent & (FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
+
+		if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR))
+			dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n");
+		if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
+			dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");
+
+		mpc52xx_fec_reset(dev);
+
+		netif_wake_queue(dev);
 		return IRQ_HANDLED;
 	}
 
-	if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR))
-		dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n");
-	if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
-		dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");
-
-	mpc52xx_fec_reset(dev);
+	if (ievent & ~FEC_IEVENT_TFINT)
+		dev_dbg(&dev->dev, "ievent: %08x\n", ievent);
 
-	netif_wake_queue(dev);
 	return IRQ_HANDLED;
 }
 

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

end of thread, other threads:[~2008-04-15 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 15:26 fec_mpc5200: reset FEC on error Robert Schwebel
2008-04-15 15:29 ` Kumar Gala
2008-04-15 15:32   ` Robert Schwebel
2008-04-15 15:44 ` Robert Schwebel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox