Skip to content

Commit

Permalink
can: c_can: Do basic c_can configuration _before_ enabling the interr…
Browse files Browse the repository at this point in the history
…upts

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>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jan Altenberg authored and David S. Miller committed Mar 22, 2011
1 parent b20e7bb commit 4f2d56c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,16 +633,16 @@ 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);

priv->can.state = CAN_STATE_ERROR_ACTIVE;

/* 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)
Expand Down

0 comments on commit 4f2d56c

Please sign in to comment.