I'm afraid that this patch isn't going to work: normally the mcp251x is kept in sleep mode to reduce power consumption. In a comment to my patch you said that mcp251x_do_set_bittiming is called only from open_candev. This is important to make sure that mcp2515 is in setup mode. For this reason mcp251x_setup is always called after mcp251x_hw_reset and before mcp251x_set_normal_mode. The code is mcp251x_do_set_bittiming can be made more context-free with the patch I'm attaching that explicitly puts the mcp251x in configuration mode for setting bit timings and then restores the old mode.
On Mon, Nov 16, 2009 at 10:50 PM, Wolfgang Grandegger <[email protected]> wrote: > --- > drivers/net/can/mcp251x.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > Index: net-next-2.6/drivers/net/can/mcp251x.c > =================================================================== > --- net-next-2.6.orig/drivers/net/can/mcp251x.c > +++ net-next-2.6/drivers/net/can/mcp251x.c > @@ -596,12 +596,6 @@ static int mcp251x_setup(struct net_devi > { > int ret; > > - ret = open_candev(net); > - if (ret) { > - dev_err(&spi->dev, "unable to set initial baudrate!\n"); > - return ret; > - } > - > /* Enable RX0->RX1 buffer roll over and disable filters */ > mcp251x_write_bits(spi, RXBCTRL(0), > RXBCTRL_BUKT | RXBCTRL_RXM0 | RXBCTRL_RXM1, > @@ -671,6 +665,12 @@ static int mcp251x_open(struct net_devic > struct mcp251x_platform_data *pdata = spi->dev.platform_data; > int ret; > > + ret = open_candev(net); > + if (ret) { > + dev_err(&spi->dev, "unable to set initial baudrate!\n"); > + return ret; > + } > + > if (pdata->transceiver_enable) > pdata->transceiver_enable(1); > > _______________________________________________ > Socketcan-core mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/socketcan-core > -- Christian Pellegrin, see http://www.evolware.org/chri/ "Real Programmers don't play tennis, or any other sport which requires you to change clothes. Mountain climbing is OK, and Real Programmers wear their climbing boots to work in case a mountain should suddenly spring up in the middle of the computer room."
mcp-confmode
Description: Binary data
_______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
