All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Yoann DI RUZZA <ydiruzza@gmail.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: Driver for CAN in at91
Date: Thu, 06 Feb 2014 15:29:09 +0100	[thread overview]
Message-ID: <52F39C35.8040601@pengutronix.de> (raw)
In-Reply-To: <CACwGGRJ2WX2fJJVfvwAk27mp2JhRfLMT8ZeNwfw0w1kPPCAvoA@mail.gmail.com>

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

On 02/06/2014 03:13 PM, Yoann DI RUZZA wrote:
> I'll send you a patch to add the listen only mode in AT91 CAN driver.
> I don't know if it is the good way to send a patch.

Thanks for your contribution, please add the linux-can mailinglist on
Cc, too.

> I'm working and testing this patch with the 3.6.9 kernel version on a
> at91sam9x35-ek.
> cordially,
> 
> Yoann DI RUZZA

Can you add your Signed-off-by to the next patch. See
http://elinux.org/Developer_Certificate_Of_Origin for more information.

> 
> can_listenonly.patch
> 
> 
> diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
> index 1cf6104..d4c3213 100644
> --- a/drivers/net/can/at91_can.c
> +++ b/drivers/net/can/at91_can.c
> @@ -422,7 +422,11 @@ static void at91_chip_start(struct net_device *dev)
>  	at91_transceiver_switch(priv, 1);
>  
>  	/* enable chip */
> -	at91_write(priv, AT91_MR, AT91_MR_CANEN);
> +	if(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
> +		reg_mr = reg_mr | AT91_MR_CANEN | AT91_MR_ABM;
> +	else
> +		reg_mr = reg_mr | AT91_MR_CANEN;

The documentation says it's "autobaud/liste mode". Is this another name
for listen only?

Your patch does change what's written to the CAN core, the original code
writes only AT91_MR_CANEN, you preserve the original contents. Who will
clear AT91_MR_ABM if you switch from listen only to normal mode?

> +	at91_write(priv, AT91_MR, reg_mr);
>  
>  	priv->can.state = CAN_STATE_ERROR_ACTIVE;
>  
> @@ -1345,7 +1349,7 @@ static int __devinit at91_can_probe(struct platform_device *pdev)
>  	priv->can.bittiming_const = &at91_bittiming_const;
>  	priv->can.do_set_mode = at91_set_mode;
>  	priv->can.do_get_berr_counter = at91_get_berr_counter;
> -	priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
> +	priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY;
>  	priv->dev = dev;
>  	priv->reg_base = addr;
>  	priv->devtype_data = *devtype_data;
> 

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-06 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACwGGRJ2WX2fJJVfvwAk27mp2JhRfLMT8ZeNwfw0w1kPPCAvoA@mail.gmail.com>
2014-02-06 14:29 ` Marc Kleine-Budde [this message]
     [not found]   ` <CACwGGR+nqwjL6M08SYMQDwWM=Eib6Y0OcZDQ7mxZdenGk1x3qg@mail.gmail.com>
2014-02-11  8:53     ` Driver for CAN in at91 Marc Kleine-Budde

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=52F39C35.8040601@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=ydiruzza@gmail.com \
    /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.