All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marek Vasut <marex@denx.de>, linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Mark Rutland <mark.rutland@arm.com>,
	Wolfgang Grandegger <wg@grandegger.com>
Subject: Re: [PATCH V4 1/4] net: can: ifi: Fix clock generator configuration
Date: Thu, 3 Mar 2016 21:18:39 +0100	[thread overview]
Message-ID: <56D89C1F.9060504@hartkopp.net> (raw)
In-Reply-To: <1457034358-5515-2-git-send-email-marex@denx.de>

Hi Marek,

On 03/03/2016 08:45 PM, Marek Vasut wrote:

> @@ -545,32 +545,34 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev)
>  	u32 noniso_arg = 0;
>  	u32 time_off;
>  
> -	if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO) {
> +	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) &&
> +	    !(priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)) {
> +		time_off = IFI_CANFD_TIME_SJW_OFF_ISO;
> +	} else {
>  		noniso_arg = IFI_CANFD_TIME_SET_TIMEB_BOSCH |
>  			     IFI_CANFD_TIME_SET_TIMEA_BOSCH |
>  			     IFI_CANFD_TIME_SET_PRESC_BOSCH |
>  			     IFI_CANFD_TIME_SET_SJW_BOSCH;
>  		time_off = IFI_CANFD_TIME_SJW_OFF_BOSCH;
> -	} else {
> -		time_off = IFI_CANFD_TIME_SJW_OFF_ISO;
>  	}
>  

This may set time_off to IFI_CANFD_TIME_SJW_OFF_BOSCH in the case of

	!(priv->can.ctrlmode & CAN_CTRLMODE_FD)

(== CAN2.0) right?

I assume this is not intended.

I would suggest to initialize time_off first:

	u32 noniso_arg = 0;
	u32 time_off = IFI_CANFD_TIME_SJW_OFF_ISO;

	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) &&
	    (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)) {
		noniso_arg = IFI_CANFD_TIME_SET_TIMEB_BOSCH |
			     IFI_CANFD_TIME_SET_TIMEA_BOSCH |
			     IFI_CANFD_TIME_SET_PRESC_BOSCH |
			     IFI_CANFD_TIME_SET_SJW_BOSCH;
		time_off = IFI_CANFD_TIME_SJW_OFF_BOSCH;
	}

Is my assumption correct? Or does the manual require other settings?

Regards,
Oliver

  reply	other threads:[~2016-03-03 20:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 19:45 [PATCH V4 0/4] Synchronise IFI CANFD driver with real world Marek Vasut
2016-03-03 19:45 ` [PATCH V4 1/4] net: can: ifi: Fix clock generator configuration Marek Vasut
2016-03-03 20:18   ` Oliver Hartkopp [this message]
2016-03-03 20:52     ` Marek Vasut
2016-03-03 20:58       ` Oliver Hartkopp
2016-03-03 21:01         ` Marc Kleine-Budde
2016-03-03 21:02           ` Marc Kleine-Budde
2016-03-03 21:04             ` Oliver Hartkopp
2016-03-03 21:05               ` Marc Kleine-Budde
2016-03-03 21:06                 ` Oliver Hartkopp
2016-03-03 21:29                   ` Marek Vasut
2016-03-03 19:45 ` [PATCH V4 2/4] net: can: ifi: Fix TX DLC configuration Marek Vasut
2016-03-03 19:45 ` [PATCH V4 3/4] net: can: ifi: Fix RX and TX ID mask Marek Vasut
2016-03-03 19:45 ` [PATCH V4 4/4] net: can: ifi: Add obscure bit swap for EFF frame IDs Marek Vasut

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=56D89C1F.9060504@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=mkl@pengutronix.de \
    --cc=wg@grandegger.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.