All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: John Whitmore <arigead@gmail.com>, linux-can@vger.kernel.org
Subject: Re: mcp251x can't drop the can0 Interface
Date: Sat, 08 Feb 2014 18:10:29 +0100	[thread overview]
Message-ID: <52F66505.6090303@pengutronix.de> (raw)
In-Reply-To: <20140207201236.GB28637@griso.site>

[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]

On 02/07/2014 09:12 PM, John Whitmore wrote:
> I guess you might say that I'm playing with an MCP2515 connected to a
> RaspberryPi. I've got a problem which I've asked about on the RaspberryPi
> forum but have never received an answer, so as a last resort I thought I'd try
> here.
> 
> Basically I bring up the MCP2515 in listen mode at a certain baud rate. I
> wanted to work on auto detetection of baud rate. So after listening for a
> period of time at a certain baud rate I try to change the baud rate but I
> can't do that with the linux mcp251x driver (I don't think it's the driver's
> fault but have no idea whose it is). I've put in some debug statements
> to see what happens when I execute "ifconfig can0 down" and basically the
> interface goes down momentarily and then gets brough straight back up
> again. So when I try to use the "ip" command to set the new baud rate I get an
> error that the device is busy. 

Please add this patch to the driver:

-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index cdb9808..b1ea15c 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -697,6 +697,8 @@ static int mcp251x_stop(struct net_device *net)
        struct mcp251x_priv *priv = netdev_priv(net);
        struct spi_device *spi = priv->spi;

+       dump_stack();
+
        close_candev(net);

        priv->force_quit = 1;
@@ -941,6 +943,8 @@ static int mcp251x_open(struct net_device *net)
        unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_FALLING;
        int ret;

+       dump_stack();
+
        ret = open_candev(net);
        if (ret) {
                dev_err(&spi->dev, "unable to set initial baudrate!\n");

-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------

Then reproduce your problem, then send dmesg output.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

  reply	other threads:[~2014-02-08 17:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 20:12 mcp251x can't drop the can0 Interface John Whitmore
2014-02-08 17:10 ` Marc Kleine-Budde [this message]
2014-02-10 22:28   ` John Whitmore
2014-02-10 22:34     ` Marc Kleine-Budde
2014-02-10 22:43       ` John Whitmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F66505.6090303@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=arigead@gmail.com \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.