netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: c_can: Do basic c_can configuration _before_ enabling the interrupts
@ 2011-03-21 13:47 Jan Altenberg
  2011-03-21 14:49 ` Kurt Van Dijck
  2011-03-21 16:35 ` Wolfgang Grandegger
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Altenberg @ 2011-03-21 13:47 UTC (permalink / raw)
  To: bhupesh.sharma; +Cc: davem, b.spranger, jan, netdev

Hi all,

I ran into some trouble while testing the SocketCAN driver for the BOSCH
C_CAN controller. The interface is not correctly initialized, if I put
some CAN traffic on the line, _while_ the interface is being started
(which means: the interface doesn't come up correcty, if there's some RX
traffic while doing 'ifconfig can0 up').

The current implementation enables the controller interrupts _before_
doing the basic c_can configuration. I think, this should be done the
other way round.

The patch below fixes things for me.

Signed-off-by: Jan Altenberg <jan@linutronix.de>
---
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 1405078..110eda0 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -633,9 +633,6 @@ static void c_can_start(struct net_device *dev)
 {
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	/* enable status change, error and module interrupts */
-	c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);
-
 	/* basic c_can configuration */
 	c_can_chip_config(dev);
 
@@ -643,6 +640,9 @@ static void c_can_start(struct net_device *dev)
 
 	/* reset tx helper pointers */
 	priv->tx_next = priv->tx_echo = 0;
+
+	/* enable status change, error and module interrupts */
+	c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);
 }
 
 static void c_can_stop(struct net_device *dev)




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

end of thread, other threads:[~2011-03-22  1:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-21 13:47 [PATCH] can: c_can: Do basic c_can configuration _before_ enabling the interrupts Jan Altenberg
2011-03-21 14:49 ` Kurt Van Dijck
2011-03-21 16:35 ` Wolfgang Grandegger
2011-03-22  1:19   ` 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).