All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>, 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, 03 Mar 2016 21:52:43 +0100	[thread overview]
Message-ID: <56D8A41B.80508@denx.de> (raw)
In-Reply-To: <56D89C1F.9060504@hartkopp.net>

On 03/03/2016 09:18 PM, Oliver Hartkopp wrote:
> Hi Marek,

Hi Oliver,

> 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.

My understanding (and tests) indicate that this is correct. For CAN2.0
and CANFD-BOSCH (non-ISO), we use the later part of the condition. Only
for CANFD-ISO we use the former part.

> 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?

See above, I think the code is correct as is.

btw can you pick the remaining patches (2,3,4) if they're fine with you,
so I don't have to repost the whole series ?

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-03-03 20:52 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
2016-03-03 20:52     ` Marek Vasut [this message]
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=56D8A41B.80508@denx.de \
    --to=marex@denx.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    --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.